This commit is contained in:
parent
17598cc9e9
commit
cb7aef646a
5 changed files with 13 additions and 3 deletions
|
@ -21,6 +21,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ public abstract class TileEntityIWBase extends TileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
|
||||||
super.onDataPacket(net, pkt);
|
super.onDataPacket(net, pkt);
|
||||||
readNBT(pkt.getNbtCompound(), true);
|
readNBT(pkt.getNbtCompound(), true);
|
||||||
|
|
|
@ -45,6 +45,8 @@ import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.Vec3i;
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -92,8 +94,8 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||||
|
|
||||||
tooltip.add(I18n.format(IndustrialWires.MODID + ".desc.wireLength", getLength(stack)));
|
tooltip.add(I18n.format(IndustrialWires.MODID + ".desc.wireLength", getLength(stack)));
|
||||||
IC2Wiretype wireType = IC2Wiretype.ALL[stack.getMetadata()];
|
IC2Wiretype wireType = IC2Wiretype.ALL[stack.getMetadata()];
|
||||||
int transferRate = wireType.getTransferRate();
|
int transferRate = wireType.getTransferRate();
|
||||||
|
|
|
@ -28,6 +28,8 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.nbt.NBTTagString;
|
import net.minecraft.nbt.NBTTagString;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -50,6 +52,7 @@ public class ItemKey extends Item implements INetGUIItem {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public String getItemStackDisplayName(@Nonnull ItemStack stack) {
|
public String getItemStackDisplayName(@Nonnull ItemStack stack) {
|
||||||
NBTTagCompound nbt = stack.getTagCompound();
|
NBTTagCompound nbt = stack.getTagCompound();
|
||||||
if (nbt!=null&&nbt.hasKey(NAME)&&!nbt.getString(NAME).trim().isEmpty()) {
|
if (nbt!=null&&nbt.hasKey(NAME)&&!nbt.getString(NAME).trim().isEmpty()) {
|
||||||
|
@ -59,6 +62,7 @@ public class ItemKey extends Item implements INetGUIItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||||
super.addInformation(stack, worldIn, tooltip, flagIn);
|
super.addInformation(stack, worldIn, tooltip, flagIn);
|
||||||
if (stack.getMetadata()==2&&stack.getTagCompound()!=null) {
|
if (stack.getMetadata()==2&&stack.getTagCompound()!=null) {
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag flag) {
|
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag flag) {
|
||||||
if (GuiScreen.isShiftKeyDown()) {
|
if (GuiScreen.isShiftKeyDown()) {
|
||||||
NBTTagCompound nbt = getTagCompound(stack);
|
NBTTagCompound nbt = getTagCompound(stack);
|
||||||
|
|
|
@ -17,7 +17,6 @@ package malte0811.industrialWires.network;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import malte0811.industrialWires.items.INetGUIItem;
|
import malte0811.industrialWires.items.INetGUIItem;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -54,7 +53,8 @@ public class MessageItemSync implements IMessage {
|
||||||
public static class HandlerServer implements IMessageHandler<MessageItemSync, IMessage> {
|
public static class HandlerServer implements IMessageHandler<MessageItemSync, IMessage> {
|
||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(MessageItemSync message, MessageContext ctx) {
|
public IMessage onMessage(MessageItemSync message, MessageContext ctx) {
|
||||||
Minecraft.getMinecraft().addScheduledTask(()-> {
|
ctx.getServerHandler().player.getServerWorld()
|
||||||
|
.addScheduledTask(()-> {
|
||||||
EntityPlayer player = ctx.getServerHandler().player;
|
EntityPlayer player = ctx.getServerHandler().player;
|
||||||
ItemStack held = player.getHeldItem(message.hand);
|
ItemStack held = player.getHeldItem(message.hand);
|
||||||
if (held.getItem() instanceof INetGUIItem) {
|
if (held.getItem() instanceof INetGUIItem) {
|
||||||
|
|
Loading…
Reference in a new issue