Refactor and import cleanup (Excluding network PR changed files)

This commit is contained in:
Justin Vitale 2020-07-09 23:04:42 +10:00
parent a36a0e6f4a
commit c4ef977f16
165 changed files with 1572 additions and 1625 deletions

View file

@ -24,7 +24,6 @@
package techreborn.client;
import io.netty.buffer.Unpooled;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
@ -172,7 +171,7 @@ public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler
@Override
public void open(PlayerEntity player, BlockPos pos, World world) {
if(!world.isClient){
if (!world.isClient) {
//This is awful
player.openHandledScreen(new ExtendedScreenHandlerFactory() {
@Override

View file

@ -47,7 +47,7 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
super(player, aesu, aesu.createScreenHandler(syncID, player));
this.blockEntity = aesu;
}
@Override
public void init() {
super.init();
@ -73,7 +73,7 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))
@ -85,11 +85,11 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
drawCentredText(matrixStack, text, 35, 0, 58, layer);
RenderSystem.popMatrix();
}
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(int amount){
public void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(amount, Screen.hasShiftDown(), Screen.hasControlDown(), blockEntity));
}
}

View file

@ -51,7 +51,7 @@ public class GuiAssemblingMachine extends GuiBase<BuiltScreenHandler> {
// Input slots
drawSlot(matrixStack, 55, 35, layer);
drawSlot(matrixStack, 55, 55, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);

View file

@ -64,7 +64,7 @@ public class GuiAutoCrafting extends GuiBase<BuiltScreenHandler> {
renderItemStack(recipe.getOutput(), 95, 42);
}
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(matrixStack, this, blockEntityAutoCraftingTable.getProgress(), blockEntityAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 26, (int) blockEntityAutoCraftingTable.getEnergy(), (int) blockEntityAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer);
}

View file

@ -57,7 +57,7 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 5);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))

View file

@ -46,7 +46,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
public void init() {
super.init();
addButton(new GuiButtonUpDown(x + 64, y + 40, this, b -> onClick(5), UpDownButtonType.FASTFORWARD));
@ -56,7 +56,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
addButton(new GuiButtonSimple(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
}
@Override
protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
@ -69,7 +69,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
drawCentredText(matrixStack, text, 25, 4210752, layer);
}
public void onClick(int amount){
public void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos())));
}
}
}

View file

@ -42,7 +42,7 @@ public class GuiDieselGenerator extends GuiBase<BuiltScreenHandler> {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
@Override
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
@ -51,17 +51,17 @@ public class GuiDieselGenerator extends GuiBase<BuiltScreenHandler> {
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -41,7 +41,7 @@ public class GuiDistillationTower extends GuiBase<BuiltScreenHandler> {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
@Override
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
@ -58,7 +58,7 @@ public class GuiDistillationTower extends GuiBase<BuiltScreenHandler> {
// JEI Button
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
@ -77,7 +77,7 @@ public class GuiDistillationTower extends GuiBase<BuiltScreenHandler> {
}
public void onClick(GuiButtonExtended button, Double x, Double y){
public void onClick(GuiButtonExtended button, Double x, Double y) {
blockEntity.renderMultiblock ^= !hideGuiElements();
}
}

View file

@ -39,7 +39,7 @@ public class GuiGasTurbine extends GuiBase<BuiltScreenHandler> {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
@Override
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
@ -48,16 +48,16 @@ public class GuiGasTurbine extends GuiBase<BuiltScreenHandler> {
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -32,14 +32,14 @@ import reborncore.client.screen.builder.BuiltScreenHandler;
import techreborn.blockentity.machine.tier1.IndustrialElectrolyzerBlockEntity;
public class GuiIndustrialElectrolyzer extends GuiBase<BuiltScreenHandler> {
IndustrialElectrolyzerBlockEntity blockEntity;
public GuiIndustrialElectrolyzer(int syncID, final PlayerEntity player, final IndustrialElectrolyzerBlockEntity blockEntity) {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
@Override
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
@ -54,7 +54,7 @@ public class GuiIndustrialElectrolyzer extends GuiBase<BuiltScreenHandler> {
drawOutputSlotBar(matrixStack, 50, 23, 4, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
@ -63,6 +63,6 @@ public class GuiIndustrialElectrolyzer extends GuiBase<BuiltScreenHandler> {
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, GuiBuilder.ProgressDirection.UP, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -49,14 +49,14 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
IronFurnaceBlockEntity blockEntity;
public GuiIronFurnace(int syncID, PlayerEntity player, IronFurnaceBlockEntity furnace) {
super(player, furnace, furnace.createScreenHandler(syncID, player));
super(player, furnace, furnace.createScreenHandler(syncID, player));
this.blockEntity = furnace;
}
public void onClick(){
public void onClick() {
NetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity));
}
}
@Override
public void init() {
super.init();
@ -87,7 +87,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
++levels;
}
message = message + "+" + String.valueOf(levels) + "L";
message = message + "+" + levels + "L";
}
}
@ -95,17 +95,17 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
list.add(new LiteralText(message));
renderTooltip(matrixStack, list, mouseX, mouseY);
GlStateManager.disableLighting();
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.color4f(1, 1, 1, 1);
}
@Override
public void renderBg(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) {
mc.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y);
}
});
});
}
@Override
protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY);
@ -118,7 +118,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
drawOutputSlot(matrixStack, 116, 35, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);

View file

@ -57,15 +57,15 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation)
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation)
, 35, 0, 58, layer);
RenderSystem.popMatrix();

View file

@ -59,9 +59,9 @@ public class GuiManual extends Screen {
@Override
public void init() {
int y = (height / 2) - guiHeight / 2;
y+= 40;
y += 40;
addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
if(t){
if (t) {
Util.getOperatingSystem().open("http://wiki.techreborn.ovh");
this.client.openScreen(this);
} else {
@ -69,14 +69,14 @@ public class GuiManual extends Screen {
}
}, "http://wiki.techreborn.ovh", false))));
addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
if(t){
if (t) {
Util.getOperatingSystem().open("https://discord.gg/teamreborn");
this.client.openScreen(this);
}else {
} else {
this.client.openScreen(this);
}
}, "https://discord.gg/teamreborn", false))));
if(TechRebornConfig.allowManualRefund){
if (TechRebornConfig.allowManualRefund) {
addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> {
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
this.client.openScreen(null);

View file

@ -46,7 +46,7 @@ public class GuiMatterFabricator extends GuiBase<BuiltScreenHandler> {
final Layer layer = Layer.BACKGROUND;
drawSlot(matrixStack, 8, 72, layer);
drawSlot(matrixStack, 30, 20, layer);
drawSlot(matrixStack, 50, 20, layer);
drawSlot(matrixStack, 70, 20, layer);

View file

@ -35,7 +35,6 @@ import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
/**
* @author drcrazy
*
*/
@Environment(EnvType.CLIENT)
public class GuiPlasmaGenerator extends GuiBase<BuiltScreenHandler> {
@ -51,7 +50,7 @@ public class GuiPlasmaGenerator extends GuiBase<BuiltScreenHandler> {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
@Override
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
@ -60,17 +59,17 @@ public class GuiPlasmaGenerator extends GuiBase<BuiltScreenHandler> {
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -38,7 +38,7 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
RollingMachineBlockEntity rollingMachine;
public GuiRollingMachine(int syncID, final PlayerEntity player, final RollingMachineBlockEntity blockEntityRollingmachine) {
super(player, blockEntityRollingmachine, blockEntityRollingmachine.createScreenHandler(syncID, player));
super(player, blockEntityRollingmachine, blockEntityRollingmachine.createScreenHandler(syncID, player));
this.rollingMachine = blockEntityRollingmachine;
}
@ -62,7 +62,7 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
drawOutputSlot(matrixStack, 124, gridYPos + 18, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
builder.drawLockButton(matrixStack, this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked);
builder.drawLockButton(matrixStack, this, 130, 4, mouseX, mouseY, layer, rollingMachine.locked);
}
@Override
@ -76,7 +76,7 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if(isPointInRect(130, 4, 20, 12, mouseX, mouseY)){
if (isPointInRect(130, 4, 20, 12, mouseX, mouseY)) {
NetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked));
return true;
}

View file

@ -39,7 +39,7 @@ public class GuiSemifluidGenerator extends GuiBase<BuiltScreenHandler> {
super(player, blockEntity, blockEntity.createScreenHandler(syncID, player));
this.blockEntity = blockEntity;
}
@Override
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
@ -48,16 +48,16 @@ public class GuiSemifluidGenerator extends GuiBase<BuiltScreenHandler> {
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -48,16 +48,16 @@ public class GuiThermalGenerator extends GuiBase<BuiltScreenHandler> {
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -58,7 +58,9 @@ import java.util.function.Supplier;
public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel {
public abstract ModelIdentifier getBaseModel();
public abstract ModelIdentifier getBackgroundModel();
public abstract ModelIdentifier getFluidModel();
@Override

View file

@ -58,8 +58,8 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
public void render(EntityNukePrimed entity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
matrixStack.push();
matrixStack.translate(0.0D, 0.5D, 0.0D);
if ((float)entity.getFuseTimer() - g + 1.0F < 10.0F) {
float h = 1.0F - ((float)entity.getFuseTimer() - g + 1.0F) / 10.0F;
if ((float) entity.getFuseTimer() - g + 1.0F < 10.0F) {
float h = 1.0F - ((float) entity.getFuseTimer() - g + 1.0F) / 10.0F;
h = MathHelper.clamp(h, 0.0F, 1.0F);
h *= h;
h *= h;

View file

@ -24,34 +24,20 @@
package techreborn.client.render.entitys;
import net.minecraft.block.BlockState;
import net.minecraft.block.SignBlock;
import net.minecraft.block.WallSignBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.item.ItemStack;
import net.minecraft.text.StringRenderable;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.util.math.Direction;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import java.util.List;
import static net.minecraft.client.render.block.entity.SignBlockEntityRenderer.getModelTexture;
/**
* Created by drcrazy on 07-Jan-20 for TechReborn-1.15.
*/
@ -96,22 +82,22 @@ public class StorageUnitRenderer extends BlockEntityRenderer<StorageUnitBaseBloc
TextRenderer textRenderer = this.dispatcher.getTextRenderer();
switch (storage.getFacing()){
switch (storage.getFacing()) {
case NORTH:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().getOpposite().asRotation()));
matrices.translate(0.5f,0.5,-0.001f);
matrices.translate(0.5f, 0.5, -0.001f);
break;
case SOUTH:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().getOpposite().asRotation()));
matrices.translate(-0.5f,0.5,-1.001f);
matrices.translate(-0.5f, 0.5, -1.001f);
break;
case EAST:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().asRotation()));
matrices.translate(0.5f,0.5,-1.001f);
matrices.translate(0.5f, 0.5, -1.001f);
break;
case WEST:
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(storage.getFacing().asRotation()));
matrices.translate(-0.5f,0.5,-0.001f);
matrices.translate(-0.5f, 0.5, -0.001f);
break;
}
@ -121,12 +107,12 @@ public class StorageUnitRenderer extends BlockEntityRenderer<StorageUnitBaseBloc
// Render item count
String count = String.valueOf(storage.storedAmount);
xPosition = (float)(-textRenderer.getWidth(count) / 2);
xPosition = (float) (-textRenderer.getWidth(count) / 2);
textRenderer.draw(count, xPosition, -4f + 40, 0, false, matrices.peek().getModel(), vertexConsumers, false, 0, light);
// Render name
String item = stack.getName().asTruncatedString(18);
xPosition = (float)(-textRenderer.getWidth(item) / 2);
xPosition = (float) (-textRenderer.getWidth(item) / 2);
textRenderer.draw(item, xPosition, -4f - 40, 0, false, matrices.peek().getModel(), vertexConsumers, false, 0, light);
matrices.pop();

View file

@ -34,8 +34,8 @@ import techreborn.init.TRContent;
public class DestructoPackScreenHandler extends ScreenHandler {
private PlayerEntity player;
private RebornInventory<?> inv;
private final PlayerEntity player;
private final RebornInventory<?> inv;
public DestructoPackScreenHandler(int syncID, PlayerEntity player) {
super(null, syncID);
@ -51,7 +51,7 @@ public class DestructoPackScreenHandler extends ScreenHandler {
private void buildContainer() {
this.addSlot(
new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[] { TRContent.Parts.MACHINE_PARTS.getStack() }));
new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[]{TRContent.Parts.MACHINE_PARTS.getStack()}));
int i;
for (i = 0; i < 3; ++i) {

View file

@ -37,19 +37,16 @@ public class FurnaceFuelSlot extends BaseSlot {
}
@Override
public boolean canInsert(ItemStack stack)
{
public boolean canInsert(ItemStack stack) {
return AbstractFurnaceBlockEntity.canUseAsFuel(stack) || isBucket(stack);
}
@Override
public int getMaxStackAmount(ItemStack stack)
{
public int getMaxStackAmount(ItemStack stack) {
return isBucket(stack) ? 1 : super.getMaxStackAmount(stack);
}
public static boolean isBucket(ItemStack stack)
{
public static boolean isBucket(ItemStack stack) {
return stack.getItem() == Items.BUCKET;
}
}