Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinTimeCuber committed Oct 26, 2023
1 parent 54a6994 commit 6ff7944
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
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;
import se.llbit.chunky.block.minecraft.*;
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;
Expand Down
17 changes: 12 additions & 5 deletions chunky/src/java/se/llbit/chunky/block/minecraft/CopperBulb.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
10 changes: 5 additions & 5 deletions chunky/src/java/se/llbit/chunky/chunk/BlockPalette.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public static Map<String, Consumer<Block>> 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;
}
});
Expand Down Expand Up @@ -582,22 +582,22 @@ public static Map<String, Consumer<Block>> 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;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -71,7 +70,6 @@ public void rotateY(int r) {
}
switch(r) {
case 1:
System.out.println("ry1");
quads = Model.rotateY(quads);
break;
case 2:
Expand Down
3 changes: 0 additions & 3 deletions chunky/src/java/se/llbit/chunky/resources/Texture.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 6ff7944

Please sign in to comment.