From 53b34857be1fc4fa039ef05c2c3615f6145e86c3 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Mon, 11 Jan 2021 09:43:31 +0300 Subject: [PATCH] Fixes --- src/main/java/ru/betterend/BetterEnd.java | 5 ++-- src/main/java/ru/betterend/config/Config.java | 12 +++++----- .../mixin/common/ChorusPlantBlockMixin.java | 14 +++++++++-- .../betterend/patterns/block/wall_post.json | 24 +++++++++++++++---- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/main/java/ru/betterend/BetterEnd.java b/src/main/java/ru/betterend/BetterEnd.java index 5df06e7d..2b43e135 100644 --- a/src/main/java/ru/betterend/BetterEnd.java +++ b/src/main/java/ru/betterend/BetterEnd.java @@ -39,6 +39,9 @@ public class BetterEnd implements ModInitializer { public static final Logger LOGGER = Logger.get(); @Override public void onInitialize() { + TerrainGenerator.init(); + GeneratorOptions.init(); + EndSounds.register(); EndItems.register(); EndBlocks.register(); @@ -60,8 +63,6 @@ public class BetterEnd implements ModInitializer { EndStructures.register(); Integrations.register(); BonemealUtil.init(); - TerrainGenerator.init(); - GeneratorOptions.init(); if (hasGuideBook()) { GuideBookItem.register(); diff --git a/src/main/java/ru/betterend/config/Config.java b/src/main/java/ru/betterend/config/Config.java index 89fb3147..edcec1b9 100644 --- a/src/main/java/ru/betterend/config/Config.java +++ b/src/main/java/ru/betterend/config/Config.java @@ -103,10 +103,10 @@ public abstract class Config { protected float getFloat(ConfigKey key, float defaultValue) { Float val = keeper.getValue(key, FloatEntry.class); if (val == null) { - FloatEntry entry = keeper.registerEntry(key, new FloatEntry(defaultValue)); - return entry.getValue(); + keeper.registerEntry(key, new FloatEntry(defaultValue)); + return defaultValue; } - return val != null ? val : defaultValue; + return val; } protected float getFloat(ConfigKey key) { @@ -129,10 +129,10 @@ public abstract class Config { protected boolean getBoolean(ConfigKey key, boolean defaultValue) { Boolean val = keeper.getValue(key, BooleanEntry.class); if (val == null) { - BooleanEntry entry = keeper.registerEntry(key, new BooleanEntry(defaultValue)); - return entry.getValue(); + keeper.registerEntry(key, new BooleanEntry(defaultValue)); + return defaultValue; } - return val != null ? val : defaultValue; + return val; } protected boolean getBoolean(ConfigKey key) { diff --git a/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java b/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java index b06d48a8..883a4cd0 100644 --- a/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java @@ -40,9 +40,12 @@ public abstract class ChorusPlantBlockMixin extends Block { @Inject(method = "appendProperties", at = @At("TAIL")) private void beAddProperties(StateManager.Builder builder, CallbackInfo info) { + GeneratorOptions.init(); if (GeneratorOptions.changeChorusPlant()) { builder.add(BlocksHelper.ROOTS); + System.out.println("Added!"); } + System.out.println("Added? " + GeneratorOptions.changeChorusPlant()); } @Inject(method = "withConnectionProperties", at = @At("RETURN"), cancellable = true) @@ -50,11 +53,18 @@ public abstract class ChorusPlantBlockMixin extends Block { BlockState plant = info.getReturnValue(); if (plant.isOf(Blocks.CHORUS_PLANT)) { if (world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) { - info.setReturnValue(plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true)); + if (GeneratorOptions.changeChorusPlant()) { + info.setReturnValue(plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true)); + } + else { + info.setReturnValue(plant.with(Properties.DOWN, true)); + } info.cancel(); } else { - info.setReturnValue(plant.with(BlocksHelper.ROOTS, false)); + if (GeneratorOptions.changeChorusPlant()) { + info.setReturnValue(plant.with(BlocksHelper.ROOTS, false)); + } info.cancel(); } } diff --git a/src/main/resources/assets/betterend/patterns/block/wall_post.json b/src/main/resources/assets/betterend/patterns/block/wall_post.json index 9acedf1f..314e40d3 100644 --- a/src/main/resources/assets/betterend/patterns/block/wall_post.json +++ b/src/main/resources/assets/betterend/patterns/block/wall_post.json @@ -1,6 +1,20 @@ { - "parent": "minecraft:block/template_wall_post", - "textures": { - "wall": "betterend:block/%parent%" - } -} \ No newline at end of file + "textures": { + "wall": "betterend:block/%parent%", + "particle": "#wall" + }, + "elements": [ + { "from": [ 4, -0.01, 4 ], + "to": [ 12, 16, 12 ], + "faces": { + "down": { "texture": "#wall", "cullface": "down" }, + "up": { "texture": "#wall", "cullface": "up" }, + "north": { "texture": "#wall" }, + "south": { "texture": "#wall" }, + "west": { "texture": "#wall" }, + "east": { "texture": "#wall" } + }, + "__comment": "Center post" + } + ] +}