Slime fixes
This commit is contained in:
parent
a396b3c9d1
commit
c8c8c5fa9e
2 changed files with 16 additions and 12 deletions
|
@ -77,10 +77,10 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag);
|
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag);
|
||||||
EndBiome biome = EndBiomes.getFromBiome(world.getBiome(getBlockPos()));
|
EndBiome biome = EndBiomes.getFromBiome(world.getBiome(getBlockPos()));
|
||||||
if (biome == EndBiomes.FOGGY_MUSHROOMLAND) {
|
if (biome == EndBiomes.FOGGY_MUSHROOMLAND) {
|
||||||
this.setMossy(true);
|
this.setMossy();
|
||||||
}
|
}
|
||||||
else if (biome == EndBiomes.MEGALAKE || biome == EndBiomes.MEGALAKE_GROVE) {
|
else if (biome == EndBiomes.MEGALAKE || biome == EndBiomes.MEGALAKE_GROVE) {
|
||||||
this.setLake(true);
|
this.setLake();
|
||||||
}
|
}
|
||||||
else if (biome == EndBiomes.AMBER_LAND) {
|
else if (biome == EndBiomes.AMBER_LAND) {
|
||||||
this.setAmber(true);
|
this.setAmber(true);
|
||||||
|
@ -123,7 +123,7 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
float f = (float) i / 4.0F;
|
float f = (float) i / 4.0F;
|
||||||
int j = i / 2;
|
int j = i / 2;
|
||||||
int k = 2 + this.random.nextInt(3);
|
int k = 2 + this.random.nextInt(3);
|
||||||
boolean mossy = this.isMossy();
|
int type = this.getSlimeType();
|
||||||
|
|
||||||
for (int l = 0; l < k; ++l) {
|
for (int l = 0; l < k; ++l) {
|
||||||
float g = ((float) (l % 2) - 0.5F) * f;
|
float g = ((float) (l % 2) - 0.5F) * f;
|
||||||
|
@ -133,7 +133,7 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
slimeEntity.setPersistent();
|
slimeEntity.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
slimeEntity.setMossy(mossy);
|
slimeEntity.setSlimeType(type);
|
||||||
slimeEntity.setCustomName(text);
|
slimeEntity.setCustomName(text);
|
||||||
slimeEntity.setAiDisabled(bl);
|
slimeEntity.setAiDisabled(bl);
|
||||||
slimeEntity.setInvulnerable(this.isInvulnerable());
|
slimeEntity.setInvulnerable(this.isInvulnerable());
|
||||||
|
@ -166,20 +166,24 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
return this.dataTracker.get(VARIANT).intValue();
|
return this.dataTracker.get(VARIANT).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setMossy(boolean mossy) {
|
public void setSlimeType(int value) {
|
||||||
this.dataTracker.set(VARIANT, (byte) 1);
|
this.dataTracker.set(VARIANT, (byte) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setMossy() {
|
||||||
|
setSlimeType(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMossy() {
|
public boolean isMossy() {
|
||||||
return this.dataTracker.get(VARIANT) == 1;
|
return getSlimeType() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setLake(boolean mossy) {
|
protected void setLake() {
|
||||||
this.dataTracker.set(VARIANT, (byte) 2);
|
setSlimeType(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLake() {
|
public boolean isLake() {
|
||||||
return this.dataTracker.get(VARIANT) == 2;
|
return getSlimeType() == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setAmber(boolean mossy) {
|
protected void setAmber(boolean mossy) {
|
||||||
|
@ -195,7 +199,7 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSpawn(EntityType<EntityEndSlime> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
|
public static boolean canSpawn(EntityType<EntityEndSlime> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
|
||||||
return random.nextInt(64) == 0 || isPermanentBiome(world, pos) || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
|
return random.nextInt(16) == 0 || isPermanentBiome(world, pos) || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPermanentBiome(ServerWorldAccess world, BlockPos pos) {
|
private static boolean isPermanentBiome(ServerWorldAccess world, BlockPos pos) {
|
||||||
|
|
|
@ -30,6 +30,6 @@ public class BiomeAmberLand extends EndBiome {
|
||||||
.addFeature(EndFeatures.CHARNIA_RED)
|
.addFeature(EndFeatures.CHARNIA_RED)
|
||||||
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
|
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
|
||||||
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4)
|
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4)
|
||||||
.addMobSpawn(EndEntities.END_SLIME, 10, 1, 2));
|
.addMobSpawn(EndEntities.END_SLIME, 30, 1, 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue