Jump to content

TheRealMcrafter

Forge Modder
  • Posts

    137
  • Joined

  • Last visited

Everything posted by TheRealMcrafter

  1. Not to be mean, but you clearly don't understand what @Override actually does - it is simply an extra layer of error-checking within the IDE - it has no effect whatsoever on the compiled code. I'm aware of this, just pointing out that thats not where override goes.
  2. You clearly dont understand how to override a method. You need to put @Override above onItemRightClick. Also get rid of all the extra code that doesnt work. If you want to spawn it where the player is looking, why do you need to ray trace when you already use a Vec3 look vector?
  3. I think what diesieben07 was implying is that you need to have some checks on the server to see if it is possible for the client to set that block, ie: distance from the block, permissions, etc. Otherwise, your mod could be open to some hacking.
  4. You are dropping the items on the server side and the client side. Do a !world.isRemote check first.
  5. Can you throw in a System.err.println(); to check if the addInformation method is being called?
  6. You need to make a class that implements IExtendedEntityProperties, and when they player is constructed, bind an instance of that class to the player.
  7. Isnt there a method that takes x, y, and z parameters? I think its world.spawnEntityInWorld(entity, x, y, z, motionX, motionY, motionZ); I think your problem is that your entity hasn't been spawned before you set its coordinates.
  8. Create your own EntityAIAttackWhatever class, and override shouldExecute() and write your own condition. Like public boolean shouldExecute() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); if (entitylivingbase == null) { return false; } else if (!entitylivingbase.isEntityAlive()) { return false; } else if (entitylivingbase instanceof YourMobNameHere) { return false; } //All the other checks, etc. } else { return true; } } }
  9. detectAndSendChanges() scans the players server side inventory and pushes the changes to the client, forcing it to update.
  10. I just tried this: @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ if (!world.isRemote){ player.inventory.addItemStackToInventory(new ItemStack(SirenMod.FireExtinguisherItem, 1)); player.inventoryContainer.detectAndSendChanges(); } return stack; } and it worked fine for me.
  11. You should add the itemstack on the server side, ie: !world.isRemote. You might have to call player.inventoryContainer.detectAndSendChanges(); after you add the new itemstack for it to update to the client.
  12. I've also used the getDrops method. And the reason I did that was because when I first started modding I didnt know the proper way to do it.
  13. What I did in my mod was return null in getItemDropped, and then in the BreakEvent I spawned whatever ItemStack I wanted. EDIT: An easier alternative would be to spawn the itemstack in the breakBlock method
  14. Woops, my bad. Your tutorials are the best, credit given
  15. Example: I use this to send a string to the server from the client: The message class: https://github.com/TheRealMcrafter/SirenMod/blob/master/src/main/java/TheRealMcrafter/SirenMod/packet/SirenModUpdateSirenColorMessage.java Feel free to browse around my source to figure it out.
  16. I had the same exact issue, and instead of using PlayerTickEvent i used EntityJoinWorldEvent and casted. Fixed the probem, and everything works nice now.
  17. Yea, if you spawn it on the client side it will just be a ghost item. You need to send a packet to the server and spawn it there.
  18. Are you spawning it on the client side or the server side?
  19. You could also use the default tile entity syncing, getDescriptionPacket() and onDataPacket(), and whenever you need to send data to the client, mark the block for an update.
  20. Not working, I cant publish to the server
  21. Hey, how can I put my existing mod source into a new repository on GitHub? I cant find a tutorial to do this in Eclipse. I already have a GitHub account.
×
×
  • Create New...

Important Information

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