This commit is contained in:
paulevsGitch 2021-04-19 21:38:14 +03:00
parent 3ec2edd6d5
commit 3f8da599ec
5 changed files with 56 additions and 67 deletions

View file

@ -11,7 +11,6 @@ public class Configs {
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
public static final PathConfig RECIPE_CONFIG = new PathConfig("recipes");
public static final PortalsConfig PORTALS_CONFIG = new PortalsConfig("portals");
@Environment(value = EnvType.CLIENT)
public static final PathConfig CLENT_CONFIG = new PathConfig("client");

View file

@ -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();
}
}

View file

@ -49,15 +49,20 @@ public class CubozoaEntity extends AbstractSchoolingFish {
@Override
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
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"));
}
else if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
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();
return data;
}
@ -91,8 +96,8 @@ public class CubozoaEntity extends AbstractSchoolingFish {
protected ItemStack getBucketItemStack() {
ItemStack bucket = EndItems.BUCKET_CUBOZOA.getDefaultInstance();
CompoundTag tag = bucket.getOrCreateTag();
tag.putByte("variant", entityData.get(VARIANT));
tag.putByte("scale", entityData.get(SCALE));
tag.putByte("Variant", entityData.get(VARIANT));
tag.putByte("Scale", entityData.get(SCALE));
return bucket;
}

View file

@ -43,15 +43,20 @@ public class EndFishEntity extends AbstractSchoolingFish {
@Override
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
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"));
}
else if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
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();
return data;
}

View file

@ -45,7 +45,6 @@ public class ServerLevelMixin {
lastWorld = session.getLevelId();
@SuppressWarnings("resource")
ServerLevel world = ServerLevel.class.cast(this);
File dir = session.getDimensionPath(world.dimension());
if (!new File(dir, "level.dat").exists()) {