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

bl4ckscor3

Members
  • Posts

    86
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Germany
  • Personal Text
    ""

bl4ckscor3's Achievements

Stone Miner

Stone Miner (3/8)

5

Reputation

  1. I am still supporting 1.7.10 in the mod I'm writing this for, along with 1.8 and 1.8.9. 1.9.4 and 1.10.2 will be supported, too.
  2. Hi, I have a GUI which opens upon rightclicking a custom item. Basically you can add and remove players to/from the item, and in order to save the players I'm using the ItemStack's NBTTagCompound via player.getCurrentEquippedItem().getTagCompound(). Whenever the NBT data gets changed and the GUI is closed and quickly reopened, I get a serverside crash: This is the method from the item's class where the GUI is opened from: public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if(!par2World.isRemote) { if(!par1ItemStack.hasTagCompound()) { par1ItemStack.stackTagCompound = new NBTTagCompound(); ClientUtils.syncItemNBT(par1ItemStack); } if(aBoolean) par3EntityPlayer.openGui(Main.instance, guiToOpen, par2World, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ); } return par1ItemStack; } This is ClientUtils.syncItemNBT(): @SideOnly(Side.CLIENT) public static void syncItemNBT(ItemStack item) { Main.network.sendToServer(new PacketSUpdateNBTTag(item)); } The Packet: public class PacketSUpdateNBTTag implements IMessage { private NBTTagCompound stack; private String itemName; public PacketSUpdateNBTTag(ItemStack par1ItemStack) { if(par1ItemStack != null && par1ItemStack.hasTagCompound()) { this.stack = par1ItemStack.stackTagCompound; this.itemName = par1ItemStack.getUnlocalizedName(); } } public void fromBytes(ByteBuf buf) { this.stack = ByteBufUtils.readTag(buf); this.itemName = ByteBufUtils.readUTF8String(buf); } public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, this.stack); ByteBufUtils.writeUTF8String(buf, this.itemName); } public static class Handler extends PacketHelper implements IMessageHandler<PacketSUpdateNBTTag, IMessage> { public IMessage onMessage(PacketSUpdateNBTTag message, MessageContext context) { if(context.getServerHandler().playerEntity.getCurrentEquippedItem() != null && context.getServerHandler().playerEntity.getCurrentEquippedItem().getItem().getUnlocalizedName().matches(message.itemName)) context.getServerHandler().playerEntity.getCurrentEquippedItem().stackTagCompound = message.stack; return null; } } } What causes this crash and how can I fix it? Thanks in advance for any help!
  3. Hello! I'm using the ClientChatReceivedEvent to check for specific words in the message, then giving a sound to the player. But I don't want the sound to play, if the current Player writes that specific word. So I need to get the name of the player who sent the message. I already tried the ClientChatReceivedEvent.message.func_150260_c(); method (which returns the message just as you see it in the chat) and then extracting the players name, but that does not work on servers with custom chat formats, since I search for "<" and ">". Is there any way to get the name without searching for specific symbols in the message and extracting them? Thanks in advance ~bl4ck
  4. Could you post the Handler as well please?
  5. Like I already told you in the Minecraft forums, it may have something todo with the file itself. That was the solution for me. And if your preInit is missing @EventManager and it still doesn't work, try the thing with GoldWaves again. And it is missing the FMLPreInitializationEvent event in the brackets.
  6. Thanks But what is the rarity of some vanilla Item, let's say a music disc? I need a number to navigate with.
  7. Hi guys! What I'd like to do is adding a custom item to a dungeon/mineshaft/stronghold chest. How would I do this?
  8. What do you mean by "you can read from them but not write"?
  9. But that is for a custom Block - I'd like it for the vanilla pumpkin. And without editing the base class...
  10. Thank you so far. But how can I add my Golems to the "Awake-List" without editing BlockPumpkin.java?
  11. Hello guys! I'd like to make a new mob and I want it so that you have to put some blocks down in a specific shape and the mob spawns when placing the Pumpkin (Yes, my mob has a pumpkin as a head ). I already looked at several source codes and I searched the vanilla one for solutions but I couldn't find anything. Can you please help me out?
  12. The sounds are loaded... I'm going to PM you my source code, maybe something is wrong in the depths of it.
×
×
  • Create New...

Important Information

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