Remove old code
This commit is contained in:
parent
8c61707317
commit
99404f8a46
4 changed files with 1 additions and 202 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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")
|
||||
|
|
|
@ -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<PacketSyncSideConfig> {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue