This commit is contained in:
paulevsGitch 2021-01-11 09:43:31 +03:00
parent 2511122d50
commit 53b34857be
4 changed files with 40 additions and 15 deletions

View file

@ -39,6 +39,9 @@ public class BetterEnd implements ModInitializer {
public static final Logger LOGGER = Logger.get(); public static final Logger LOGGER = Logger.get();
@Override @Override
public void onInitialize() { public void onInitialize() {
TerrainGenerator.init();
GeneratorOptions.init();
EndSounds.register(); EndSounds.register();
EndItems.register(); EndItems.register();
EndBlocks.register(); EndBlocks.register();
@ -60,8 +63,6 @@ public class BetterEnd implements ModInitializer {
EndStructures.register(); EndStructures.register();
Integrations.register(); Integrations.register();
BonemealUtil.init(); BonemealUtil.init();
TerrainGenerator.init();
GeneratorOptions.init();
if (hasGuideBook()) { if (hasGuideBook()) {
GuideBookItem.register(); GuideBookItem.register();

View file

@ -103,10 +103,10 @@ public abstract class Config {
protected float getFloat(ConfigKey key, float defaultValue) { protected float getFloat(ConfigKey key, float defaultValue) {
Float val = keeper.getValue(key, FloatEntry.class); Float val = keeper.getValue(key, FloatEntry.class);
if (val == null) { if (val == null) {
FloatEntry entry = keeper.registerEntry(key, new FloatEntry(defaultValue)); keeper.registerEntry(key, new FloatEntry(defaultValue));
return entry.getValue(); return defaultValue;
} }
return val != null ? val : defaultValue; return val;
} }
protected float getFloat(ConfigKey key) { protected float getFloat(ConfigKey key) {
@ -129,10 +129,10 @@ public abstract class Config {
protected boolean getBoolean(ConfigKey key, boolean defaultValue) { protected boolean getBoolean(ConfigKey key, boolean defaultValue) {
Boolean val = keeper.getValue(key, BooleanEntry.class); Boolean val = keeper.getValue(key, BooleanEntry.class);
if (val == null) { if (val == null) {
BooleanEntry entry = keeper.registerEntry(key, new BooleanEntry(defaultValue)); keeper.registerEntry(key, new BooleanEntry(defaultValue));
return entry.getValue(); return defaultValue;
} }
return val != null ? val : defaultValue; return val;
} }
protected boolean getBoolean(ConfigKey key) { protected boolean getBoolean(ConfigKey key) {

View file

@ -40,9 +40,12 @@ public abstract class ChorusPlantBlockMixin extends Block {
@Inject(method = "appendProperties", at = @At("TAIL")) @Inject(method = "appendProperties", at = @At("TAIL"))
private void beAddProperties(StateManager.Builder<Block, BlockState> builder, CallbackInfo info) { private void beAddProperties(StateManager.Builder<Block, BlockState> builder, CallbackInfo info) {
GeneratorOptions.init();
if (GeneratorOptions.changeChorusPlant()) { if (GeneratorOptions.changeChorusPlant()) {
builder.add(BlocksHelper.ROOTS); builder.add(BlocksHelper.ROOTS);
System.out.println("Added!");
} }
System.out.println("Added? " + GeneratorOptions.changeChorusPlant());
} }
@Inject(method = "withConnectionProperties", at = @At("RETURN"), cancellable = true) @Inject(method = "withConnectionProperties", at = @At("RETURN"), cancellable = true)
@ -50,11 +53,18 @@ public abstract class ChorusPlantBlockMixin extends Block {
BlockState plant = info.getReturnValue(); BlockState plant = info.getReturnValue();
if (plant.isOf(Blocks.CHORUS_PLANT)) { if (plant.isOf(Blocks.CHORUS_PLANT)) {
if (world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) { 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(); info.cancel();
} }
else { else {
info.setReturnValue(plant.with(BlocksHelper.ROOTS, false)); if (GeneratorOptions.changeChorusPlant()) {
info.setReturnValue(plant.with(BlocksHelper.ROOTS, false));
}
info.cancel(); info.cancel();
} }
} }

View file

@ -1,6 +1,20 @@
{ {
"parent": "minecraft:block/template_wall_post", "textures": {
"textures": { "wall": "betterend:block/%parent%",
"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"
}
]
}