From 99404f8a46843a1404f1cf33c360bd9215889b85 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 21 Apr 2018 16:04:59 +0100 Subject: [PATCH] Remove old code --- src/main/java/techreborn/Core.java | 1 - .../client/gui/upgrades/GuiSideConfig.java | 115 ------------------ .../java/techreborn/items/ItemUpgrades.java | 9 +- .../packets/PacketSyncSideConfig.java | 78 ------------ 4 files changed, 1 insertion(+), 202 deletions(-) delete mode 100644 src/main/java/techreborn/client/gui/upgrades/GuiSideConfig.java delete mode 100644 src/main/java/techreborn/packets/PacketSyncSideConfig.java diff --git a/src/main/java/techreborn/Core.java b/src/main/java/techreborn/Core.java index 27bb53123..69b69bbbd 100644 --- a/src/main/java/techreborn/Core.java +++ b/src/main/java/techreborn/Core.java @@ -174,7 +174,6 @@ public class Core { @SubscribeEvent public void LoadPackets(RegisterPacketEvent event) { - event.registerPacket(PacketSyncSideConfig.class, Side.SERVER); event.registerPacket(PacketAesu.class, Side.SERVER); event.registerPacket(PacketIdsu.class, Side.SERVER); event.registerPacket(PacketSetRecipe.class, Side.SERVER); diff --git a/src/main/java/techreborn/client/gui/upgrades/GuiSideConfig.java b/src/main/java/techreborn/client/gui/upgrades/GuiSideConfig.java deleted file mode 100644 index e3ccf5d8a..000000000 --- a/src/main/java/techreborn/client/gui/upgrades/GuiSideConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.client.gui.upgrades; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import reborncore.common.network.NetworkManager; -import techreborn.client.container.builder.BuiltContainer; -import techreborn.client.gui.GuiBase; -import techreborn.packets.PacketSyncSideConfig; - -import java.io.IOException; - -/** - * Created by Mark on 12/04/2017. - */ -public class GuiSideConfig extends GuiBase { - - TileEntity tileEntity; - int slotID; - - public GuiSideConfig(EntityPlayer player, TileEntity tile, BuiltContainer container, int slotID) { - super(player, tile, container); - this.tileEntity = tile; - this.slotID = slotID; - } - - @Override - public void initGui() { - super.initGui(); - this.buttonList.clear(); - int i = 0; - for (EnumFacing facing : EnumFacing.VALUES) { - buttonList.add(new GuiButton(facing.getIndex(), guiLeft + 150, guiTop + i++ * 23 + 22, 20, 20, "✓")); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { - super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { - super.drawGuiContainerForegroundLayer(mouseX, mouseY); - final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; - int offset = 10; - RenderHelper.enableStandardItemLighting(); - RenderHelper.enableGUIStandardItemLighting(); - for (EnumFacing facing : EnumFacing.VALUES) { - BlockPos pos = tileEntity.getPos().offset(facing); - IBlockState state = tileEntity.getWorld().getBlockState(pos); - ItemStack stack = state.getBlock().getPickBlock(state, new RayTraceResult(new Vec3d(0, 0, 0), facing, pos), tileEntity.getWorld(), pos, Minecraft.getMinecraft().player); - if (stack != null && !stack.isEmpty() && stack.getItem() != null) { - drawCentredString(stack.getDisplayName() + " - " + facing.getName(), offset += 22, 4210752, layer); - itemRender.renderItemIntoGUI(stack, 10, offset - 2); - } else { - drawCentredString(state.getBlock().getLocalizedName() + " - " + facing.getName(), offset += 22, 4210752, layer); - } - } - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - super.actionPerformed(button); - NetworkManager.sendToServer(new PacketSyncSideConfig(slotID, button.id, tileEntity.getPos())); - Minecraft.getMinecraft().displayGuiScreen(null); - } - - @Override - protected void drawTitle() { - drawCentredString("Side Configuration", 6, 4210752, Layer.FOREGROUND); - } - - @Override - public boolean tryAddUpgrades() { - return false; - } - - @Override - public boolean drawPlayerSlots() { - return false; - } -} diff --git a/src/main/java/techreborn/items/ItemUpgrades.java b/src/main/java/techreborn/items/ItemUpgrades.java index 2cbb67f39..c681efe85 100644 --- a/src/main/java/techreborn/items/ItemUpgrades.java +++ b/src/main/java/techreborn/items/ItemUpgrades.java @@ -24,7 +24,6 @@ package techreborn.items; -import net.minecraft.client.Minecraft; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -47,7 +46,6 @@ import techreborn.Core; import techreborn.client.TechRebornCreativeTabMisc; import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.ContainerBuilder; -import techreborn.client.gui.upgrades.GuiSideConfig; import techreborn.init.ModItems; import techreborn.lib.ModInfo; @@ -157,12 +155,7 @@ public class ItemUpgrades extends ItemTR implements IUpgrade { @Override @SideOnly(Side.CLIENT) public void handleRightClick(TileEntity tile, ItemStack stack, Container container, int slotID) { - if (tile.getWorld().isRemote) { - if (stack.getItemDamage() == 4 || stack.getItemDamage() == 5) { - //TODO use the full gui handler - Minecraft.getMinecraft().displayGuiScreen(new GuiSideConfig(Minecraft.getMinecraft().player, tile, getContainer(Minecraft.getMinecraft().player), slotID)); - } - } + } @SuppressWarnings("deprecation") diff --git a/src/main/java/techreborn/packets/PacketSyncSideConfig.java b/src/main/java/techreborn/packets/PacketSyncSideConfig.java deleted file mode 100644 index c4ec6bec1..000000000 --- a/src/main/java/techreborn/packets/PacketSyncSideConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.packets; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import reborncore.api.tile.IUpgradeable; -import reborncore.common.network.ExtendedPacketBuffer; -import reborncore.common.network.INetworkPacket; -import reborncore.common.util.ItemNBTHelper; - -import java.io.IOException; - -/** - * Created by Mark on 12/04/2017. - */ -public class PacketSyncSideConfig implements INetworkPacket { - - int slotID; - int side; - BlockPos pos; - - public PacketSyncSideConfig(int slotID, int side, BlockPos pos) { - this.slotID = slotID; - this.side = side; - this.pos = pos; - } - - public PacketSyncSideConfig() { - } - - @Override - public void writeData(ExtendedPacketBuffer buffer) throws IOException { - buffer.writeInt(slotID); - buffer.writeInt(side); - buffer.writeBlockPos(pos); - } - - @Override - public void readData(ExtendedPacketBuffer buffer) throws IOException { - slotID = buffer.readInt(); - side = buffer.readInt(); - pos = buffer.readBlockPos(); - } - - @Override - public void processData(PacketSyncSideConfig message, MessageContext context) { - TileEntity tileEntity = context.getServerHandler().player.world.getTileEntity(message.pos); - if (tileEntity instanceof IUpgradeable) { - ItemStack stack = ((IUpgradeable) tileEntity).getUpgradeInvetory().getStackInSlot(message.slotID); - ItemNBTHelper.setInt(stack, "side", message.side); - } - } -}