mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 03:23:04 +00:00
Merge branch 'dev' into syntax-highlighter-unified
This commit is contained in:
commit
5cf69f90fb
72 files changed
+4861
-538
No files matched your search
@@ -24,6 +24,7 @@ public class AuctionListing implements IAuctionListing {
|
||||
public long createdTime;
|
||||
public long endTime;
|
||||
public EnumAuctionStatus status;
|
||||
public boolean isGlobalListing;
|
||||
|
||||
public AuctionListing() {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
@@ -31,6 +32,7 @@ public class AuctionListing implements IAuctionListing {
|
||||
this.bidCount = 0;
|
||||
this.currentBid = 0;
|
||||
this.createdTime = System.currentTimeMillis();
|
||||
this.isGlobalListing = false;
|
||||
}
|
||||
|
||||
public AuctionListing(UUID sellerUUID, String sellerName, ItemStack item, long startingPrice, long buyoutPrice, long durationMs) {
|
||||
@@ -228,6 +230,7 @@ public class AuctionListing implements IAuctionListing {
|
||||
compound.setLong("CreatedTime", createdTime);
|
||||
compound.setLong("EndTime", endTime);
|
||||
compound.setInteger("Status", status.ordinal());
|
||||
compound.setBoolean("IsGlobalListing", isGlobalListing);
|
||||
|
||||
return compound;
|
||||
}
|
||||
@@ -255,6 +258,7 @@ public class AuctionListing implements IAuctionListing {
|
||||
createdTime = compound.getLong("CreatedTime");
|
||||
endTime = compound.getLong("EndTime");
|
||||
status = EnumAuctionStatus.fromOrdinal(compound.getInteger("Status"));
|
||||
isGlobalListing = compound.getBoolean("IsGlobalListing");
|
||||
}
|
||||
|
||||
public static AuctionListing fromNBT(NBTTagCompound compound) {
|
||||
|
||||
@@ -21,6 +21,10 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SpawnData extends WeightedRandom.Item implements INaturalSpawn {
|
||||
public static final int DESPAWN_FORCE_NATURAL = INaturalSpawn.DESPAWN_FORCE_NATURAL;
|
||||
public static final int DESPAWN_PRESERVE_TEMPLATE = INaturalSpawn.DESPAWN_PRESERVE_TEMPLATE;
|
||||
public static final int DESPAWN_FORCE_PERSISTENT = INaturalSpawn.DESPAWN_FORCE_PERSISTENT;
|
||||
|
||||
public List<String> biomes = new ArrayList<>();
|
||||
public HashSet<Integer> dimensions = new HashSet<>();
|
||||
public int id = -1;
|
||||
@@ -35,6 +39,11 @@ public class SpawnData extends WeightedRandom.Item implements INaturalSpawn {
|
||||
|
||||
public int spawnHeightMin;
|
||||
public int spawnHeightMax = 100;
|
||||
public int maxAlive = 0;
|
||||
public int cooldownTicks = 0;
|
||||
public int attemptsPerCycle = 1;
|
||||
public int playerMinDistance = 24;
|
||||
public int despawnMode = DESPAWN_FORCE_NATURAL;
|
||||
|
||||
public SpawnData() {
|
||||
super(10);
|
||||
@@ -74,6 +83,19 @@ public class SpawnData extends WeightedRandom.Item implements INaturalSpawn {
|
||||
} else {
|
||||
spawnHeightMax = compound.getInteger("HeightMax");
|
||||
}
|
||||
|
||||
maxAlive = compound.hasKey("MaxAlive") ? Math.max(0, compound.getInteger("MaxAlive")) : 0;
|
||||
cooldownTicks = compound.hasKey("CooldownTicks") ? Math.max(0, compound.getInteger("CooldownTicks")) : 0;
|
||||
attemptsPerCycle = compound.hasKey("AttemptsPerCycle") ? Math.max(1, compound.getInteger("AttemptsPerCycle")) : 1;
|
||||
playerMinDistance = compound.hasKey("PlayerMinDistance") ? Math.max(0, compound.getInteger("PlayerMinDistance")) : 24;
|
||||
if (compound.hasKey("DespawnMode")) {
|
||||
despawnMode = compound.getInteger("DespawnMode");
|
||||
} else {
|
||||
despawnMode = DESPAWN_FORCE_NATURAL;
|
||||
}
|
||||
if (despawnMode < DESPAWN_FORCE_NATURAL || despawnMode > DESPAWN_FORCE_PERSISTENT) {
|
||||
despawnMode = DESPAWN_FORCE_NATURAL;
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNBT(NBTTagCompound compound) {
|
||||
@@ -98,6 +120,11 @@ public class SpawnData extends WeightedRandom.Item implements INaturalSpawn {
|
||||
|
||||
compound.setInteger("HeightMin", spawnHeightMin);
|
||||
compound.setInteger("HeightMax", spawnHeightMax);
|
||||
compound.setInteger("MaxAlive", maxAlive);
|
||||
compound.setInteger("CooldownTicks", cooldownTicks);
|
||||
compound.setInteger("AttemptsPerCycle", attemptsPerCycle);
|
||||
compound.setInteger("PlayerMinDistance", playerMinDistance);
|
||||
compound.setInteger("DespawnMode", despawnMode);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -204,4 +231,46 @@ public class SpawnData extends WeightedRandom.Item implements INaturalSpawn {
|
||||
public void setBiomes(String[] biomes) {
|
||||
this.biomes = new ArrayList<>(Arrays.asList(biomes));
|
||||
}
|
||||
|
||||
public void setMaxAlive(int maxAlive) {
|
||||
this.maxAlive = Math.max(0, maxAlive);
|
||||
}
|
||||
|
||||
public int getMaxAlive() {
|
||||
return this.maxAlive;
|
||||
}
|
||||
|
||||
public void setCooldownTicks(int ticks) {
|
||||
this.cooldownTicks = Math.max(0, ticks);
|
||||
}
|
||||
|
||||
public int getCooldownTicks() {
|
||||
return this.cooldownTicks;
|
||||
}
|
||||
|
||||
public void setAttemptsPerCycle(int attempts) {
|
||||
this.attemptsPerCycle = Math.max(1, attempts);
|
||||
}
|
||||
|
||||
public int getAttemptsPerCycle() {
|
||||
return this.attemptsPerCycle;
|
||||
}
|
||||
|
||||
public void setPlayerMinDistance(int distance) {
|
||||
this.playerMinDistance = Math.max(0, distance);
|
||||
}
|
||||
|
||||
public int getPlayerMinDistance() {
|
||||
return this.playerMinDistance;
|
||||
}
|
||||
|
||||
public void setDespawnMode(int mode) {
|
||||
if (mode < DESPAWN_FORCE_NATURAL || mode > DESPAWN_FORCE_PERSISTENT)
|
||||
mode = DESPAWN_FORCE_NATURAL;
|
||||
this.despawnMode = mode;
|
||||
}
|
||||
|
||||
public int getDespawnMode() {
|
||||
return this.despawnMode;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user