Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

jangofett890

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

jangofett890's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I start the server side in eclipse and then the client join the server excute a keybind, that gives me a new item and I need a packet to let the server know whats going on. So I got one and it works fine for singleplayer when before it would just switch back to nothing this is the error I get when sending the packet in singleplayer or multiplayer. 2013-10-04 16:11:21 [iNFO] [sTDERR] java.io.EOFException 2013-10-04 16:11:21 [iNFO] [sTDERR] at java.io.DataInputStream.readByte(Unknown Source) 2013-10-04 16:11:21 [iNFO] [sTDERR] at JangosMods.StarWarsSimpleMod.common.network.packet.PacketItemUpdate.readData(PacketItemUpdate.java:51) 2013-10-04 16:11:21 [iNFO] [sTDERR] at JangosMods.StarWarsSimpleMod.common.network.packet.PacketSWSMJ.readPopulate(PacketSWSMJ.java:44) 2013-10-04 16:11:21 [iNFO] [sTDERR] at JangosMods.StarWarsSimpleMod.common.network.PacketTypeHandler.buildPacket(PacketTypeHandler.java:44) 2013-10-04 16:11:21 [iNFO] [sTDERR] at JangosMods.StarWarsSimpleMod.common.network.PacketHandler.onPacketData(PacketHandler.java:25) 2013-10-04 16:11:21 [iNFO] [sTDERR] at cpw.mods.fml.common.network.NetworkRegistry.handlePacket(NetworkRegistry.java:255) 2013-10-04 16:11:21 [iNFO] [sTDERR] at cpw.mods.fml.common.network.NetworkRegistry.handleCustomPacket(NetworkRegistry.java:245) 2013-10-04 16:11:21 [iNFO] [sTDERR] at cpw.mods.fml.common.network.FMLNetworkHandler.handlePacket250Packet(FMLNetworkHandler.java:84) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.handleCustomPayload(NetServerHandler.java:1111) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet250CustomPayload.processPacket(Packet250CustomPayload.java:70) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) 2013-10-04 16:11:21 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) This is the packet handler public class PacketHandler implements IPacketHandler { @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { // Build a PacketEE object from the data contained within the Packet250CustomPayload packet PacketSWSMJ packetEE = PacketTypeHandler.buildPacket(packet.data); // Execute the appropriate actions based on the PacketEE type packetEE.execute(manager, player); if (packet.data != null && packet.data.length == 1 && packet.data[0] == 2) { ArrayList<ItemStack> itemListToSend = new ArrayList<ItemStack>(); EntityPlayerMP thePlayer = (EntityPlayerMP) player; thePlayer.inventory.setInventorySlotContents(Minecraft.getMinecraft().thePlayer.inventory.currentItem, new ItemStack(modItems.lightsaberON.itemID, 1, (Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem).getItemDamage()))); for (int i = 0; i < thePlayer.openContainer.inventorySlots.size(); ++i) { itemListToSend.add(((Slot) thePlayer.openContainer.inventorySlots.get(i)).getStack()); } thePlayer.sendContainerAndContentsToPlayer(thePlayer.openContainer, itemListToSend); } if (packet.data != null && packet.data.length == 1 && packet.data[0] == 1) { ArrayList<ItemStack> itemListToSend = new ArrayList<ItemStack>(); EntityPlayerMP thePlayer = (EntityPlayerMP) player; thePlayer.inventory.setInventorySlotContents(Minecraft.getMinecraft().thePlayer.inventory.currentItem, new ItemStack(modItems.lightsaber.itemID, 1, (Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem).getItemDamage()))); for (int i = 0; i < thePlayer.openContainer.inventorySlots.size(); ++i) { itemListToSend.add(((Slot) thePlayer.openContainer.inventorySlots.get(i)).getStack()); } thePlayer.sendContainerAndContentsToPlayer(thePlayer.openContainer, itemListToSend); } } } The code that sends the packet @Override public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) { int CurrentItem = Minecraft.getMinecraft().thePlayer.inventory.currentItem; ItemStack ItemInHand = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(CurrentItem); if (keyBinding.equals(ConfigurationSettings.LIGHTSABER_ONOFF)) { PacketDispatcher.sendPacketToServer(new Packet250CustomPayload(Reference.CHANNEL_NAME, new byte[] { 2 })); } } Server side error [sEVERE] Encountered an unexpected exception AbstractMethodError java.lang.AbstractMethodError: JangosMods.StarWarsSimpleMod.common.Items.ItemLightsaber.doKeyBindingAction(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/item/ItemStack;Ljava/lang/String;)V at JangosMods.StarWarsSimpleMod.common.network.packet.PacketKeyPressed.execute(PacketKeyPressed.java:48) at JangosMods.StarWarsSimpleMod.common.network.PacketHandler.onPacketData(PacketHandler.java:28) at cpw.mods.fml.common.network.NetworkRegistry.handlePacket(NetworkRegistry.java:255) at cpw.mods.fml.common.network.NetworkRegistry.handleCustomPacket(NetworkRegistry.java:245) at cpw.mods.fml.common.network.FMLNetworkHandler.handlePacket250Packet(FMLNetworkHandler.java:84) at net.minecraft.network.NetServerHandler.handleCustomPayload(NetServerHandler.java:1111) at net.minecraft.network.packet.Packet250CustomPayload.processPacket(Packet250CustomPayload.java:70) at net.minecraft.network.TcpConnection.processReadPackets(TcpConnection.java:462) at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) at net.minecraft.server.dedicated.DedicatedServerListenThread.networkTick(DedicatedServerListenThread.java:34) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689) at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:275) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) any ideas?
  2. And again there is no such method and getClient() i have static-nonstatic errors.
  3. there is no such method as getMinecraftInstance in that class
  4. i have it like that because i have multiple if statements like that on the inside of it for a bunch of meta data and that is required. also that is not the problem its the server replacing it when i use the replaceItemStack or whatever method it dosent work anymore due to the server and client merge so you need to send packets to the server letting it know the inventory has changed but i dont know how to do this that is the problem.
  5. Its in a keybind a ModLoader one i find that Forge keybinds are verry over complicated so this is what im using public void keyboardEvent(KeyBinding var1) { if (var1.isPressed() && var1.keyCode == 19) { int var2 = ModLoader.getMinecraftInstance().thePlayer.inventory.currentItem; ItemStack var3 = ModLoader.getMinecraftInstance().thePlayer.inventory.getStackInSlot(var2); if (var3 == null) { return; } if (var3.itemID == mod_jangostarwars.LightSaberOFF.shiftedIndex) { sabersound.sndManager.playSoundFX("LightSaberSound.LightSaberOnSound", 1.0F, 1.0F); if(var3.itemID == mod_jangostarwars.LightSaberOFF.shiftedIndex && var3.getItemDamage() == 0) { Minecraft.getMinecraft().thePlayer.inventory.setInventorySlotContents(var2, new ItemStack(mod_jangostarwars.LightSaber,1,0)); } } }
  6. So ive been searching everywhere looking for how to let the server know when you update your inventory such as ModLoader.getMinecraftInstance().thePlayer.inventory.setInventorySlotContents(var2, new ItemStack(ITEM.shiftedIndex,1,0)); but i havent found out how. i know it requires packets though which ive never had to use in minecraft mod before so im sorta confused ive followed a packet tutorial but i still didnt get it so would someone tell me/create a guide on letting the server know if you inventory is changed? thanks in advanced. -Jango
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.