Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HappyKiller1O1

Members
  • Joined

  • Last visited

Everything posted by HappyKiller1O1

  1. So, you want me to like add the enchantment in an anvil to the item and see if it stays?
  2. @Abastro Why? I'm pretty sure either you or I are not getting something here. @elix What do you mean?
  3. No no no. I don't want it to be enchant-able. It's not a tool just an item.
  4. So, the NBT tag returns null on client side I'm guessing? Anyway to prevent this?
  5. No it cannot. Nor can it be repaired, enchanted and has durability.
  6. Yup! It get's the player and saves all the data no problem. But, when trying to access it for the information... nothing.
  7. Let me try that... I feel like it would crash considering NBT is run on server side?
  8. Try adding the onUpdate method to your tool class. In it try telling it this: if(this.getDamage <= 0) { //set damage to 0 //change tool material to something that can not mine or cause damage? //Do whatever else you want } The onUpdate method runs every tick for the item. Pretty sure you can do what you want in there.
  9. ("lenght") Never seen that word before.
  10. The extra mods seem to be crashing your game. Remove the ones you've added and just work with the one you're making.
  11. That is an override of the item class one. It interacts with the player just fine but, the nbt tag seems to return null upon setting it for display.
  12. Without a crash report it's hard to say but, it may be that your NBT is still writing the null item? Or reads it while the item is null? If not that, maybe you need to use a preset method to consume the item in slot.
  13. So, the reason why it's not displaying the name is because the stack compound tag is null. I'm not sure how considering the server console says it set the tag. Here's my code (Will use UUID after my testing is complete): public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) { if(entity.worldObj.isRemote) { return false; } if(entity instanceof EntityPlayer) { System.out.println("ENTITY GOTTEN"); EntityPlayer victim = (EntityPlayer)entity; NBTTagCompound cmp = new NBTTagCompound(); String displayName = victim.getDisplayName(); cmp.setString("victim", displayName); stack.setTagCompound(cmp); System.out.println("ORIGINAL DISPLAY NAME: " + displayName); System.out.println("SAVED DISPLAY NAME: " + cmp.getString("victim")); return true; }else { System.out.println("ENTITY WAS NOT PLAYER"); } return false; } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { String defaultDisplay = "No Victim Set"; String victimDisplay = null; if(stack.getTagCompound() != null) { System.out.println("STACK COMPOUND WAS NOT NULL"); victimDisplay = stack.getTagCompound().getString("victim"); }else { System.out.println("STACK COMPOUND WAS NULL"); } list.add(EnumChatFormatting.DARK_AQUA + "When right clicked, it fires"); list.add(EnumChatFormatting.DARK_AQUA + "lightning upon the bound player."); list.add(""); list.add(EnumChatFormatting.RED + "Can only be used four times."); list.add(""); list.add(victimDisplay != null ? victimDisplay : defaultDisplay); list.add(""); list.add(EnumChatFormatting.GREEN + "Hold Shift and Right-Click to"); list.add(EnumChatFormatting.GREEN + "open the victim set menu."); } Any reason why this is caused?
  14. Hm, I'll get to trying that! My question still remains about how to right click a player with my item and it detect it.
  15. Now see, I understand using the UUID for the player. But how would I get the display name? Would I do something like this?: EntityPlayer player = entityLiving.worldObj.getEntityByID(//Player UUID).getDisplayName();
  16. I know I mean, I have to call UUID's from the server, right?
  17. playerEntity is apart of the server world object, correct?
  18. What I read is that only 1.8 and above will see viewable changes to the display name. But might as well take your advice. How would I go about using UUID for the display name?
  19. I get the display name because of name changing not being implemented in 1.7.10. Once I update it I'll change the code.
  20. Actually I am. I probably messed something up because I wrote it late at night. Here's the two methods: public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) { if(entity.worldObj.isRemote) { return false; } if(entity instanceof EntityPlayer) { EntityPlayer victim = (EntityPlayer)entity; NBTTagCompound cmp = new NBTTagCompound(); String displayName = victim.getDisplayName(); cmp.setString("victim", displayName); stack.setTagCompound(cmp); System.out.println("ORIGINAL DISPLAY NAME: " + displayName); System.out.println("SAVED DISPLAY NAME: " + cmp.getString("victim")); return true; } return false; } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) { String defaultDisplay = "No Victim Set"; String victimDisplay = null; if(stack.stackTagCompound != null) { victimDisplay = stack.stackTagCompound.getString("victim"); } list.add(EnumChatFormatting.DARK_AQUA + "When right clicked, it fires"); list.add(EnumChatFormatting.DARK_AQUA + "lightning upon the bound player."); list.add(""); list.add(EnumChatFormatting.RED + "Can only be used four times."); list.add(""); list.add(victimDisplay != null ? victimDisplay : defaultDisplay); list.add(""); list.add(EnumChatFormatting.GREEN + "Hold Shift and Right-Click to"); list.add(EnumChatFormatting.GREEN + "open the victim set menu."); }
  21. Well, basically I have it add information if the stack NBT tag is not null. The information on the item was not set so, it didn't run. I commented out my system print outs by accident before running the server and shit. DERP
  22. Well, I made a server and had my brother join. I did add this though: if(entityLiving.worldObj.isRemote) { return false; } Would that break the code?
  23. Sorry. I mean when I right clicked the player it didn't run the code. I'm not sure if you're suppose to use the EntityPlayer provided.
  24. Now see, I tried that but, when I right clicked a player (tested it on a server) it returned nothing as if it wasn't the player.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.