Jump to content

[1.8.9] How to use markDirty() ?


TANDEROID

Recommended Posts

If I use markDirty() to save inventory changes, it get me fail. What can make problems? May be I must import library, or something else?

Part of code where I use it

if (entity.capabilities.isCreativeMode) {
                         if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_expand1.block) {
                              if (true) {
                                   if (entity instanceof EntityPlayer)
                                        ((EntityPlayer) entity).inventory.setInventorySlotContents(selSlot, new ItemStack(mcreator_expand50.block, 1));
                                        stopExpand = 1;
                                        markDirty();
                              }
                         }
                       }

 

Link to comment
Share on other sites

I solve the problem with fail

if (entity.capabilities.isCreativeMode) {
	if (entity.inventory.getCurrentItem() != null && entity.inventory.getCurrentItem().getItem() == mcreator_expand1.block) {
		if (true) {
			if (entity instanceof EntityPlayer)
			((EntityPlayer) entity).inventory.setInventorySlotContents(selSlot, new ItemS(mcreator_expand50.block, 1));
			((EntityPlayer) entity).inventory.markDirty();
		}
	}
}

but it isn`t help with my problem...

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.