Jump to content

Item taking damage in inventory [SOLVED] [1.7.10] [Re: Block larger than 1x1x1]


TheEpicTekkit

Recommended Posts

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.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

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?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

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?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

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?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

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.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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