Fixes
This commit is contained in:
parent
3ec2edd6d5
commit
3f8da599ec
5 changed files with 56 additions and 67 deletions
|
@ -11,7 +11,6 @@ public class Configs {
|
||||||
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
|
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
|
||||||
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
|
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
|
||||||
public static final PathConfig RECIPE_CONFIG = new PathConfig("recipes");
|
public static final PathConfig RECIPE_CONFIG = new PathConfig("recipes");
|
||||||
public static final PortalsConfig PORTALS_CONFIG = new PortalsConfig("portals");
|
|
||||||
|
|
||||||
@Environment(value = EnvType.CLIENT)
|
@Environment(value = EnvType.CLIENT)
|
||||||
public static final PathConfig CLENT_CONFIG = new PathConfig("client");
|
public static final PathConfig CLENT_CONFIG = new PathConfig("client");
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package ru.betterend.config;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
public class PortalsConfig {
|
|
||||||
|
|
||||||
|
|
||||||
private final ConfigWriter writer;
|
|
||||||
private final JsonObject configObject;
|
|
||||||
|
|
||||||
public PortalsConfig(String path) {
|
|
||||||
this.writer = new ConfigWriter(path);
|
|
||||||
this.configObject = writer.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveChanges() {
|
|
||||||
writer.save();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -49,15 +49,20 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
||||||
@Override
|
@Override
|
||||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
||||||
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||||
if (entityTag != null) {
|
|
||||||
if (entityTag.contains("variant"))
|
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
||||||
this.entityData.set(VARIANT, entityTag.getByte("variant"));
|
|
||||||
if (entityTag.contains("scale"))
|
|
||||||
this.entityData.set(SCALE, entityTag.getByte("scale"));
|
|
||||||
}
|
|
||||||
else if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
|
||||||
this.entityData.set(VARIANT, (byte) 1);
|
this.entityData.set(VARIANT, (byte) 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entityTag != null) {
|
||||||
|
if (entityTag.contains("Variant")) {
|
||||||
|
this.entityData.set(VARIANT, entityTag.getByte("Variant"));
|
||||||
|
}
|
||||||
|
if (entityTag.contains("Scale")) {
|
||||||
|
this.entityData.set(SCALE, entityTag.getByte("Scale"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -91,8 +96,8 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
||||||
protected ItemStack getBucketItemStack() {
|
protected ItemStack getBucketItemStack() {
|
||||||
ItemStack bucket = EndItems.BUCKET_CUBOZOA.getDefaultInstance();
|
ItemStack bucket = EndItems.BUCKET_CUBOZOA.getDefaultInstance();
|
||||||
CompoundTag tag = bucket.getOrCreateTag();
|
CompoundTag tag = bucket.getOrCreateTag();
|
||||||
tag.putByte("variant", entityData.get(VARIANT));
|
tag.putByte("Variant", entityData.get(VARIANT));
|
||||||
tag.putByte("scale", entityData.get(SCALE));
|
tag.putByte("Scale", entityData.get(SCALE));
|
||||||
return bucket;
|
return bucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,15 +43,20 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
||||||
@Override
|
@Override
|
||||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
||||||
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||||
if (entityTag != null) {
|
|
||||||
if (entityTag.contains("variant"))
|
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
||||||
this.entityData.set(VARIANT, entityTag.getByte("variant"));
|
|
||||||
if (entityTag.contains("scale"))
|
|
||||||
this.entityData.set(SCALE, entityTag.getByte("scale"));
|
|
||||||
}
|
|
||||||
else if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
|
||||||
this.entityData.set(VARIANT, (byte) (random.nextInt(VARIANTS_SULPHUR) + VARIANTS_NORMAL));
|
this.entityData.set(VARIANT, (byte) (random.nextInt(VARIANTS_SULPHUR) + VARIANTS_NORMAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entityTag != null) {
|
||||||
|
if (entityTag.contains("Variant")) {
|
||||||
|
this.entityData.set(VARIANT, entityTag.getByte("variant"));
|
||||||
|
}
|
||||||
|
if (entityTag.contains("Scale")) {
|
||||||
|
this.entityData.set(SCALE, entityTag.getByte("scale"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class ServerLevelMixin {
|
||||||
|
|
||||||
lastWorld = session.getLevelId();
|
lastWorld = session.getLevelId();
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
|
||||||
ServerLevel world = ServerLevel.class.cast(this);
|
ServerLevel world = ServerLevel.class.cast(this);
|
||||||
File dir = session.getDimensionPath(world.dimension());
|
File dir = session.getDimensionPath(world.dimension());
|
||||||
if (!new File(dir, "level.dat").exists()) {
|
if (!new File(dir, "level.dat").exists()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue