mirror of
https://github.com/TeamMidnightDust/ThisRocks.git
synced 2025-12-17 11:25:10 +01:00
clean up terrible code
This commit is contained in:
@@ -2,38 +2,16 @@ package eu.midnightdust.motschen.rocks.block.blockentity;
|
|||||||
|
|
||||||
import eu.midnightdust.motschen.rocks.RocksMain;
|
import eu.midnightdust.motschen.rocks.RocksMain;
|
||||||
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
|
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.util.Tickable;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
|
|
||||||
public class StarfishBlockEntity extends BlockEntity implements Tickable {
|
public class StarfishBlockEntity extends BlockEntity {
|
||||||
private String variation;
|
|
||||||
|
|
||||||
public StarfishBlockEntity() {
|
public StarfishBlockEntity() {
|
||||||
super(BlockEntityInit.STARFISH_BE);
|
super(BlockEntityInit.STARFISH_BE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public StarfishVariation getVariation() {
|
||||||
public void tick() {
|
return this.world.getBlockState(pos).get(RocksMain.STARFISH_VARIATION);
|
||||||
BlockPos pos = this.pos;
|
|
||||||
BlockState state = this.world.getBlockState(pos);
|
|
||||||
|
|
||||||
if (world != null && state.get(RocksMain.STARFISH_VARIATION) == StarfishVariation.RED) {
|
|
||||||
variation = String.valueOf(StarfishVariation.RED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (world != null && state.get(RocksMain.STARFISH_VARIATION) == StarfishVariation.PINK) {
|
|
||||||
variation = String.valueOf(StarfishVariation.PINK);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
variation = String.valueOf(StarfishVariation.ORANGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public String getVariation() {
|
|
||||||
return variation;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class StarfishBlockEntityRenderer extends BlockEntityRenderer<StarfishBlo
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void render(StarfishBlockEntity blockEntity, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
public void render(StarfishBlockEntity blockEntity, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||||
if (blockEntity.getVariation() == String.valueOf(StarfishVariation.RED)) {
|
if (blockEntity.getVariation().equals(StarfishVariation.RED)) {
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_red.png")));
|
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_red.png")));
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ public class StarfishBlockEntityRenderer extends BlockEntityRenderer<StarfishBlo
|
|||||||
bb_main.render(matrixStack, vertexConsumer, light, overlay);
|
bb_main.render(matrixStack, vertexConsumer, light, overlay);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
}
|
}
|
||||||
else if (blockEntity.getVariation() == String.valueOf(StarfishVariation.PINK)) {
|
else if (blockEntity.getVariation().equals(StarfishVariation.PINK)) {
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_pink.png")));
|
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_pink.png")));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user