TheEpicTekkit Posted August 25, 2014 Posted August 25, 2014 Ok, this would be in my Custom rendered block larger than 1x1x1 pose, but i now for some reason cant see any replies in it even though i know people have replied because the number of replies has increased. So I created a new post. Sorry if that annoys any moderators. I want an item to take damage in my wind turbines inventory if it is in a certain slot of my wind turbine. I want it to take damage every 36 degrees of rotation on the rotor. I have been trying to do this for over an hour now and cant get it working, any attempt has crashed the client when open the inventory of had no effect at all. Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 Yes, I do the rotation in the tileentity, and using modulo is a good idea, diddnt think of that, but what is the method that I would use to make the item take damage? and where would I put it? Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 im not sure exactly how to add to the damage value of an item and I dont know where to put it, in the tileentity class or in the block class, and where in either of those classes? if it goes in the tileentity, i would have thought that it would go in the updateEntity() method. or am i wrong? Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 but where do I put the setItemDamage method? Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 in the tileentity in the updateEntity method, I have added this: ItemStack itemStack; itemStack = this.getStackInSlot(0); if (itemStack != null && itemStack.stackSize > 0) { if (itemStack.getItem() == ItemHandler.itemTurbineRotorIron) { for (int i = 0; i <= itemStack.getMaxDamage(); i++) { itemStack.setItemDamage(i); } } } Should this work? Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 Okay, well, thanks for the help. I got it working. And the for loop works perfectly fine for the damage, but I don't see why your method wouldn't work either Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 Okay, thanks. I'll change it in that case. Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 how do I stop the item from being able to be repaired in an anvil? Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 Okay thanks. Now I have found a strange bug. When the durability of the item runs out, the item deletes itself, but stays in the inventory as a ghost item. When i remove the ghost item it is in my inventory, but if i click it, or throw it on the ground, it vanishes. This is annoying because even when the ghost item is in the inventory, the wind turbine still produces power as if there was a real item in the slot. Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
TheEpicTekkit Posted August 25, 2014 Author Posted August 25, 2014 Okay. Thanks for all the help. Quote I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.