From 6ff79444592ba3c88a8241df6be501682e9652f6 Mon Sep 17 00:00:00 2001 From: JustinTimeCuber Date: Thu, 26 Oct 2023 11:31:19 -0400 Subject: [PATCH] code cleanup --- .../chunky/block/MinecraftBlockProvider.java | 2 -- .../chunky/block/minecraft/CopperBulb.java | 17 ++++++++++++----- .../chunky/block/minecraft/RedstoneLamp.java | 10 +++++++--- .../se/llbit/chunky/chunk/BlockPalette.java | 10 +++++----- .../llbit/chunky/model/RotatableBlockModel.java | 2 -- .../java/se/llbit/chunky/resources/Texture.java | 3 --- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java b/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java index dde84b1227..f5421d9c7c 100644 --- a/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java +++ b/chunky/src/java/se/llbit/chunky/block/MinecraftBlockProvider.java @@ -1,6 +1,5 @@ package se.llbit.chunky.block; -import org.w3c.dom.Text; import se.llbit.chunky.block.minecraft.Comparator; import se.llbit.chunky.block.minecraft.Observer; import se.llbit.chunky.block.minecraft.Tripwire; @@ -8,7 +7,6 @@ import se.llbit.chunky.entity.SkullEntity; import se.llbit.chunky.model.minecraft.FlowerPotModel; import se.llbit.chunky.model.minecraft.FlowerPotModel.Kind; -import se.llbit.chunky.resources.EntityTexture; import se.llbit.chunky.resources.ShulkerTexture; import se.llbit.chunky.resources.Texture; import se.llbit.chunky.world.BlockData; diff --git a/chunky/src/java/se/llbit/chunky/block/minecraft/CopperBulb.java b/chunky/src/java/se/llbit/chunky/block/minecraft/CopperBulb.java index 2b89fef72b..31cc91ccae 100644 --- a/chunky/src/java/se/llbit/chunky/block/minecraft/CopperBulb.java +++ b/chunky/src/java/se/llbit/chunky/block/minecraft/CopperBulb.java @@ -22,16 +22,23 @@ import se.llbit.chunky.resources.Texture; public class CopperBulb extends MinecraftBlock { - public final boolean isLit; - public final boolean isPowered; + private final boolean lit; + private final boolean powered; public CopperBulb(String name, boolean lit, boolean powered, Texture lp, Texture lnp, Texture nlp, Texture nlnp) { super(name, lit ? (powered ? lp : lnp) : (powered ? nlp : nlnp)); - this.isLit = lit; - this.isPowered = powered; + this.lit = lit; + this.powered = powered; + } + public boolean isLit() { + return lit; + } + + public boolean isPowered() { + return powered; } @Override public String description() { - return "lit=" + isLit + ", powered=" + isPowered; + return "lit=" + lit + ", powered=" + powered; } } diff --git a/chunky/src/java/se/llbit/chunky/block/minecraft/RedstoneLamp.java b/chunky/src/java/se/llbit/chunky/block/minecraft/RedstoneLamp.java index 6b6008b2cb..c9930f607d 100644 --- a/chunky/src/java/se/llbit/chunky/block/minecraft/RedstoneLamp.java +++ b/chunky/src/java/se/llbit/chunky/block/minecraft/RedstoneLamp.java @@ -22,14 +22,18 @@ import se.llbit.chunky.resources.Texture; public class RedstoneLamp extends MinecraftBlock { - public final boolean isLit; + private final boolean lit; public RedstoneLamp(boolean lit) { super("redstone_lamp", lit ? Texture.redstoneLampOn : Texture.redstoneLampOff); - this.isLit = lit; + this.lit = lit; + } + + public boolean isLit() { + return lit; } @Override public String description() { - return "lit=" + isLit; + return "lit=" + lit; } } diff --git a/chunky/src/java/se/llbit/chunky/chunk/BlockPalette.java b/chunky/src/java/se/llbit/chunky/chunk/BlockPalette.java index e608a28e1b..93394c1338 100644 --- a/chunky/src/java/se/llbit/chunky/chunk/BlockPalette.java +++ b/chunky/src/java/se/llbit/chunky/chunk/BlockPalette.java @@ -381,7 +381,7 @@ public static Map> getDefaultMaterialProperties() { block.ior = 1.52f; }); materialProperties.put("minecraft:redstone_lamp", block -> { - if (block instanceof RedstoneLamp && ((RedstoneLamp) block).isLit) { + if (block instanceof RedstoneLamp && ((RedstoneLamp) block).isLit()) { block.emittance = 1.0f; } }); @@ -582,22 +582,22 @@ public static Map> getDefaultMaterialProperties() { }); for(String s : new String[]{"minecraft:", "minecraft:waxed_"}) { materialProperties.put(s + "copper_bulb", block -> { - if(block instanceof CopperBulb && ((CopperBulb) block).isLit) { + if(block instanceof CopperBulb && ((CopperBulb) block).isLit()) { block.emittance = 1.0f; } }); materialProperties.put(s + "exposed_copper_bulb", block -> { - if(block instanceof CopperBulb && ((CopperBulb) block).isLit) { + if(block instanceof CopperBulb && ((CopperBulb) block).isLit()) { block.emittance = 12 / 15f; } }); materialProperties.put(s + "weathered_copper_bulb", block -> { - if(block instanceof CopperBulb && ((CopperBulb) block).isLit) { + if(block instanceof CopperBulb && ((CopperBulb) block).isLit()) { block.emittance = 8 / 15f; } }); materialProperties.put(s + "oxidized_copper_bulb", block -> { - if(block instanceof CopperBulb && ((CopperBulb) block).isLit) { + if(block instanceof CopperBulb && ((CopperBulb) block).isLit()) { block.emittance = 4 / 15f; } }); diff --git a/chunky/src/java/se/llbit/chunky/model/RotatableBlockModel.java b/chunky/src/java/se/llbit/chunky/model/RotatableBlockModel.java index daeea74ba0..a397387a13 100644 --- a/chunky/src/java/se/llbit/chunky/model/RotatableBlockModel.java +++ b/chunky/src/java/se/llbit/chunky/model/RotatableBlockModel.java @@ -27,7 +27,6 @@ * For example, command blocks and observer blocks. */ public class RotatableBlockModel extends QuadModel { - // Facing up: private Quad[] quads = new Quad[] { FULL_BLOCK_NORTH_SIDE, FULL_BLOCK_EAST_SIDE, @@ -71,7 +70,6 @@ public void rotateY(int r) { } switch(r) { case 1: - System.out.println("ry1"); quads = Model.rotateY(quads); break; case 2: diff --git a/chunky/src/java/se/llbit/chunky/resources/Texture.java b/chunky/src/java/se/llbit/chunky/resources/Texture.java index 48754407ce..5bda12f467 100644 --- a/chunky/src/java/se/llbit/chunky/resources/Texture.java +++ b/chunky/src/java/se/llbit/chunky/resources/Texture.java @@ -1421,9 +1421,6 @@ public class Texture { public static final Texture oxidizedCopperDoorBottom = new Texture(); @TexturePath("assets/minecraft/textures/block/oxidized_copper_trapdoor") public static final Texture oxidizedCopperTrapdoor = new Texture(); - // Texture.crafterNorth, Texture.crafterNorthCrafting, Texture.crafterEast, Texture.crafterEastCrafting, Texture.crafterEastTriggered, - // Texture.crafterSouth, Texture.crafterSouthTriggered, Texture.crafterWest, Texture.crafterWestCrafting, Texture.crafterWestTriggered, - // Texture.crafterTop, Texture.crafterTopCrafting, Texture.crafterTopTriggered, Texture.crafterBottom)); @TexturePath("assets/minecraft/textures/block/crafter_north") public static final Texture crafterNorth = new Texture(); @TexturePath("assets/minecraft/textures/block/crafter_north_crafting")