From 1c95ca4967f4c888d44c9d9984a9bdb745904288 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Sun, 1 Oct 2017 03:03:05 +0300 Subject: [PATCH] Fixed warnings for Location and getStateFromMeta --- .../client/gui/GuiBlastFurnace.java | 6 +- .../client/gui/GuiFusionReactor.java | 34 +++++----- .../client/gui/GuiImplosionCompressor.java | 7 +- .../client/gui/GuiIndustrialGrinder.java | 64 ++++++++++--------- 4 files changed, 58 insertions(+), 53 deletions(-) diff --git a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java index cae9b57b6..c1d11bdaf 100644 --- a/src/main/java/techreborn/client/gui/GuiBlastFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiBlastFurnace.java @@ -33,7 +33,6 @@ import net.minecraft.util.math.BlockPos; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import reborncore.common.misc.Location; import techreborn.client.gui.widget.GuiButtonHologram; import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; @@ -154,8 +153,9 @@ public class GuiBlastFurnace extends GuiBase { final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(), - this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); + ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); +// new Location(this.tile.getPos().getX(), +// this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); MultiblockRenderEvent.anchor = new BlockPos( this.tile.getPos().getX() - EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2, diff --git a/src/main/java/techreborn/client/gui/GuiFusionReactor.java b/src/main/java/techreborn/client/gui/GuiFusionReactor.java index 666b6290d..eea92e1ad 100644 --- a/src/main/java/techreborn/client/gui/GuiFusionReactor.java +++ b/src/main/java/techreborn/client/gui/GuiFusionReactor.java @@ -34,7 +34,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.client.resources.I18n; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import reborncore.common.misc.Location; import reborncore.common.powerSystem.PowerSystem; import techreborn.client.ClientMultiBlocks; import techreborn.proxies.ClientProxy; @@ -47,11 +46,11 @@ public class GuiFusionReactor extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/fusion_reactor.png"); - TileFusionControlComputer fusionController; + TileFusionControlComputer tile; public GuiFusionReactor(final EntityPlayer player, final TileFusionControlComputer fusion) { super(fusion.createContainer(player)); - this.fusionController = fusion; + this.tile = fusion; } @Override @@ -61,13 +60,13 @@ public class GuiFusionReactor extends GuiContainer { this.fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - this.fontRenderer.drawString(PowerSystem.getLocaliszedPower(this.fusionController.getEnergy()), 11, 8, + this.fontRenderer.drawString(PowerSystem.getLocaliszedPower(this.tile.getEnergy()), 11, 8, 16448255); - this.fontRenderer.drawString("Coils: " + (this.fusionController.getCoilStatus() == 1 ? "Yes" : "No"), 11, 16, + this.fontRenderer.drawString("Coils: " + (this.tile.getCoilStatus() == 1 ? "Yes" : "No"), 11, 16, 16448255); - if (this.fusionController.getNeededPower() > 1 && this.fusionController.getCrafingTickTime() < 1) + if (this.tile.getNeededPower() > 1 && this.tile.getCrafingTickTime() < 1) this.fontRenderer.drawString("Start: " - + this.percentage(this.fusionController.getNeededPower(), (int) this.fusionController.getEnergy()) + + this.percentage(this.tile.getNeededPower(), (int) this.tile.getEnergy()) + "%", 11, 24, 16448255); } @@ -80,10 +79,10 @@ public class GuiFusionReactor extends GuiContainer { this.buttonList.add(button); super.initGui(); final BlockPos coordinates = new BlockPos( - this.fusionController.getPos().getX() - - EnumFacing.getFront(this.fusionController.getFacingInt()).getFrontOffsetX() * 2, - this.fusionController.getPos().getY() - 1, this.fusionController.getPos().getZ() - - EnumFacing.getFront(this.fusionController.getFacingInt()).getFrontOffsetZ() * 2); + this.tile.getPos().getX() + - EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2, + this.tile.getPos().getY() - 1, this.tile.getPos().getZ() + - EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2); if (coordinates.equals(MultiblockRenderEvent.anchor)) { ClientProxy.multiblockRenderEvent.setMultiblock(null); button.displayString = "B"; @@ -105,7 +104,7 @@ public class GuiFusionReactor extends GuiContainer { this.drawTexturedModalRect(k + 88, l + 36, 176, 0, 14, 14); // progressBar - this.drawTexturedModalRect(k + 111, l + 34, 176, 14, this.fusionController.getProgressScaled(), 16); + this.drawTexturedModalRect(k + 111, l + 34, 176, 14, this.tile.getProgressScaled(), 16); } @@ -124,11 +123,12 @@ public class GuiFusionReactor extends GuiContainer { // theselected one. final MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = new Location(this.fusionController.getPos().getX(), - this.fusionController.getPos().getY(), this.fusionController.getPos().getZ(), - this.fusionController.getWorld()); - MultiblockRenderEvent.anchor = new BlockPos(this.fusionController.getPos().getX(), - this.fusionController.getPos().getY() - 1, this.fusionController.getPos().getZ()); + ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); +// new Location(this.fusionController.getPos().getX(), +// this.fusionController.getPos().getY(), this.fusionController.getPos().getZ(), +// this.fusionController.getWorld()); + MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), + this.tile.getPos().getY() - 1, this.tile.getPos().getZ()); button.displayString = "A"; } else { diff --git a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java index 573843739..419c5e5bf 100644 --- a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java @@ -32,7 +32,7 @@ import net.minecraft.util.math.BlockPos; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import reborncore.common.misc.Location; +import techreborn.blocks.BlockMachineCasing; import techreborn.client.gui.widget.GuiButtonHologram; import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; @@ -116,7 +116,7 @@ public class GuiImplosionCompressor extends GuiBase { for (int y = -4; y <= -2; y++) { for (int z = -1; z <= 1; z++) { if (!((x == 0) && (y == -3) && (z == 0))) { - this.addComponent(x, y, z, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); + this.addComponent(x, y, z, ModBlocks.MACHINE_CASINGS.getDefaultState().withProperty(BlockMachineCasing.TYPE, "reinforced"), multiblock); } } } @@ -124,7 +124,8 @@ public class GuiImplosionCompressor extends GuiBase { final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); + ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); + //new Location(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ()); } } else { diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java index a0429d86b..98b11aa8e 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java @@ -33,7 +33,7 @@ import net.minecraft.util.math.BlockPos; import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import reborncore.common.misc.Location; +import techreborn.blocks.BlockMachineCasing; import techreborn.client.gui.widget.GuiButtonHologram; import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; @@ -112,41 +112,45 @@ public class GuiIndustrialGrinder extends GuiBase { { // This code here makes a basic multiblock and then sets to the selected one. final Multiblock multiblock = new Multiblock(); - this.addComponent(0, -1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(1, -1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(0, -1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(-1, -1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(0, -1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(-1, -1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(-1, -1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(1, -1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(1, -1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); + IBlockState standardCasing = ModBlocks.MACHINE_CASINGS.getDefaultState().withProperty(BlockMachineCasing.TYPE, "standard"); + IBlockState reinforcedCasing = ModBlocks.MACHINE_CASINGS.getDefaultState().withProperty(BlockMachineCasing.TYPE, "reinforced"); + + this.addComponent(0, -1, 0, standardCasing, multiblock); + this.addComponent(1, -1, 0, standardCasing, multiblock); + this.addComponent(0, -1, 1, standardCasing, multiblock); + this.addComponent(-1, -1, 0, standardCasing, multiblock); + this.addComponent(0, -1, -1, standardCasing, multiblock); + this.addComponent(-1, -1, -1, standardCasing, multiblock); + this.addComponent(-1, -1, 1, standardCasing, multiblock); + this.addComponent(1, -1, -1, standardCasing, multiblock); + this.addComponent(1, -1, 1, standardCasing, multiblock); this.addComponent(0, 0, 0, Blocks.WATER.getDefaultState(), multiblock); - this.addComponent(1, 0, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(0, 0, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(-1, 0, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(0, 0, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(-1, 0, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(-1, 0, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(1, 0, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); - this.addComponent(1, 0, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); + this.addComponent(1, 0, 0, reinforcedCasing, multiblock); + this.addComponent(0, 0, 1, reinforcedCasing, multiblock); + this.addComponent(-1, 0, 0, reinforcedCasing, multiblock); + this.addComponent(0, 0, -1, reinforcedCasing, multiblock); + this.addComponent(-1, 0, -1, reinforcedCasing, multiblock); + this.addComponent(-1, 0, 1, reinforcedCasing, multiblock); + this.addComponent(1, 0, -1, reinforcedCasing, multiblock); + this.addComponent(1, 0, 1, reinforcedCasing, multiblock); - this.addComponent(0, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(0, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(1, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(0, 1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(-1, 1, 0, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(0, 1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(-1, 1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(-1, 1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(1, 1, -1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); - this.addComponent(1, 1, 1, ModBlocks.MACHINE_CASINGS.getStateFromMeta(0), multiblock); + this.addComponent(0, 1, 0, standardCasing, multiblock); + this.addComponent(0, 1, 0, standardCasing, multiblock); + this.addComponent(1, 1, 0, standardCasing, multiblock); + this.addComponent(0, 1, 1, standardCasing, multiblock); + this.addComponent(-1, 1, 0, standardCasing, multiblock); + this.addComponent(0, 1, -1, standardCasing, multiblock); + this.addComponent(-1, 1, -1, standardCasing, multiblock); + this.addComponent(-1, 1, 1, standardCasing, multiblock); + this.addComponent(1, 1, -1, standardCasing, multiblock); + this.addComponent(1, 1, 1, standardCasing, multiblock); final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); - ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(), - this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); + ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); + //new Location(this.tile.getPos().getX(), + //this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); MultiblockRenderEvent.anchor = new BlockPos( this.tile.getPos().getX() - EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,