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


  • Posts

  • Joined

  • Last visited

Everything posted by grand_mind1

  1. If I understand you correctly, you're only letting the item be set if it has already been set before (Because an item's nbt tag, by default, is null). You probably want that the other way around. Sorry, it occured to me that you probably aren't talking about setting the tag in itemInteractionForEntity(). Can I see your code for adding the information?
  2. No, in fact, I forgot that part in my example. I mean how can you tell that the code did not run? Are you logging anything or doing anything with the new nbt tag?
  3. Hmm, very strange. I think the EntityPlayer is the player that did the right-clicking, not the one that was right-clicked. It seemed to work fine on this sheep (no one to test with ). How are you determining that the code did not run?
  4. I'm sorry, I don't understand. What do you mean it returned nothing?
  5. You can override the method itemInteractionForEntity() in your Item class to handle the right clicking of a player. You can use the method getDisplayName() in the EntityPlayer class to get a player's name, and you can save the name to nbt using the nbt methods in ItemStack. Sample (Not tested): @Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase livingBase) { if (livingBase instanceof EntityPlayer) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setString("playerName", ((EntityPlayer) livingBase).getDisplayName()); stack.setTagCompound(tagCompound); return true; } return false; }
  6. The reason it moves with your mouse is because you're drawing the texture to the position of your mouse in drawScreen(). You're passing the x and y coordinates given to you by drawScreen() to drawTexturedModalRect(), but these coordinates are the coordinates of the mouse. You need to pass it the position you want the texture to be drawn to. I'm guessing the texture can't be found because I think you need to set your mod id to lowercase when you create a ResourceLocation, but I'm not positive on that one.
  7. Hi, I'm trying to make an item change state when a player has it in their hand while holding shift and scrolling with their mouse wheel. I've seen some mods do this, but I just can't find where it is triggered in their code. Thanks!
  8. I assume you mean a bukkit plugin, in which case, I doubt it. As far as I know, the plugin would have to be made specifically to interact with the mod using some intermediary like chat (or, as pointed out by Ernio, an api), for instance. I doubt this is what you want, though.
  9. If you still want to get the model to render in the inventory, you should know that you don't add stuff to your renderer class, you make a new class that implements IItemRenderer. Here's an example, if you need one: https://github.com/grandmind/Pandas-Things/blob/master/src/main/java/com/darichey/PandasThings/item/itemRenderer/ItemRendererPoweredAnvil.java
  10. Hi, I have a quick question about packets. I have a GUI with a button and want to change the player's position when they press the button. I just wanted to know if packets are the best way to do this or if there is a better way. Thanks!
  11. It looks like you're trying to render items on the server. Proxies are your friends.
  12. Yeah, you'll need to make changes in your ItemRenderer class. If you don't have one yet, there are plenty of tutorials. Once you have that, you can change the way it renders based on metadata using the itemstack in renderItem().
  13. Do you mean the "icon" when it's rendered in your hand? In that case, you'd need to make changes in your ItemRenderer.
  14. The only way I can think of is to not extend BlockFurnace and instead mimic it's functionality, but someone smarter than me may have a better idea.
  15. Thanks, it seems that's correct. I think the problem with the documentation is the difference between "Durability" and "Damage". The word could be switched and it would then make sense. Oh well, thanks again.
  16. If you just want the material to be rock, nothing needs to be done. You're extending BlockFurnace which already passed Material.rock as its material. EDIT: This is also the reason why you get that error. blockMaterial, which is final, has already been assigned by BlockFurnace.
  17. Yeah, sorry, I meant to say that. 80k should be a full item. I got the items from the creative menu. This is the code I used to add the full item to the menu, if it is relevant: @Override public void getSubItems(Item item, CreativeTabs creativeTabs, List list) { list.add(new ItemStack(this, 1)); ItemStack fullEnergy = new ItemStack(this, 1); this.setEnergyStored(fullEnergy, 80000); list.add(fullEnergy); } setEnergyStored() just manipulates the NBT value used to store the amount of energy.
  18. Hi, I'm trying to make an item that can store "energy". I'd like the item to have a durability bar that displays how much energy it currently stores. I've tried to use showDurabilityBar() and getDurabilityForDisplay(), however it seems that the durability bar displays the opposite of what it should. (i.e. the bar is completely green when the item is empty and empty when the item is full) Here is an example of what I mean: http://i.imgur.com/U2byBbA.png The item on the left is empty and the item on the right is full. This is the code I have for the durability bar: @Override public boolean showDurabilityBar(ItemStack itemStack) { return true; } @Override public double getDurabilityForDisplay(ItemStack itemStack) { if (itemStack.getTagCompound() == null || !itemStack.getTagCompound().hasKey("Energy")) { itemStack.stackTagCompound = new NBTTagCompound(); itemStack.getTagCompound().setInteger("Energy", 0); } return itemStack.getTagCompound().getInteger("Energy") / 80000; } According to the documentation for getDurabilityForDisplay(), you are to pass 1 for 100% durability and 0 for 0%. I thought that this is what this would accomplish, but I must have done something wrong. Thanks!
  19. Ah, I was trying to make it a soft dependancy, but only just learned about the @Optional annotation. If you don't mind, I have another question about the annotation. I've upated the class here: https://github.com/grandmind/Pandas-Things/blob/6b62cadb90ed9e4424b62d51d62db5e8105b1189/src/main/java/com/darichey/PandasThings/tileEntity/TileEntityPoweredAnvil.java The game now crashes because of my use of EnergyStorage. I understand now why this happens, but I'm not sure how to fix it. Is there any similar thing to the optional annotation that I can use for the field?
  20. Yes, that is how I got the jar. I ran it again just to make sure, but it made no difference.
  21. Hi, as the title says, I'm having trouble with my mod once it has been built and is no longer being run through my development environmet. The mod works fine in the dev environment. The game crashes on launch with the follwing crash report: http://pastebin.com/JTcY3vVJ Because I think it's easier to read code on github, here's a link to the referenced class: https://github.com/grandmind/Pandas-Things/blob/master/src/main/java/com/darichey/PandasThings/tileEntity/TileEntityPoweredAnvil.java I'm sure I've just done something stupid with tile entities, as usual. Any help is appreciated. Thanks!
  22. This is where it is being done in the EntityLargeFireball class: this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, true, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); As you can see, the entity(first param of newExplosion()) is being set to null.
  23. Sorry, I worded it kind of strangely. Let me try to correct myself and clarify. I'm talking about the fireball that is fired by the ghast. As far as I can tell, the game separates the blaze/fire charge and ghast fireball into EntitySmallFireball and EntityLargeFireball, respectively. I'm trying to detect the explosion made by the large fireball in the ExplosionEvent. However, this it is not possible to distinguish, in the ExplosionEvent, if the explosion was caused by an EntityLargeFireball. This is because when the fireball creates the explosion, it sets the cause of the newly created explosion to null.
  24. Hey guys, quick question. EntityLargeFireball creates an explosion on impact like normal with worldObj.newExplosion(), however it sets the entity for the cause of the explosion to null, rather than EntityLargeFireball for some reason. I was just wondering if there is any way around this, because I would like to be able to get the cause of explosions. Thanks!
  25. Hey, title says most of it. I'm trying to create an explosion that will not damage the environment (only damage the player, play sound, create particles). I'm trying to do this under certain conditions for creepers. According to the documentation of the Explosion class, doExplosionB() should do what I want. This is what I have right now: @SubscribeEvent public void onWorldExplosion(ExplosionEvent.Start event) { Entity cause = event.explosion.exploder; if (cause instanceof EntityCreeper) { event.setCanceled(true); Explosion explosion = new Explosion(event.world, cause, event.explosion.explosionX, event.explosion.explosionY, event.explosion.explosionZ, ((EntityCreeper) cause).getPowered() ? 6 : 3); explosion.doExplosionB(true); } } However, I must not understand the consequences of using doExplosionB() without doExplosion(), because this does not work. The creeper disappears and no explosion is created.
  • Create New...

Important Information

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