Jump to content

Recommended Posts

Posted

I created a block. Now, if i drop an item on a block the tile entity have to do that: variable +=1.

My code doesnt work.  :'( pls help me

 

code:

 

public void onDrop(ItemTossEvent e){

 

if(e.getEntity().getEntityWorld().getBlockState(e.getEntityItem().getPosition().add(0, 1, 0)).getBlock() == ModBlocks.earth_totem ||

e.getEntity().getEntityWorld().getBlockState(e.getEntityItem().getPosition()).getBlock() == ModBlocks.earth_totem ){

 

Item item = e.getEntityItem().getEntityItem().getItem();

 

if(item == Items.glowstone_dust){

 

TileEntity te = e.getEntity().getEntityWorld().getTileEntity(e.getEntityItem().getPosition().add(0, -1, 0));

te.getTileData().setInteger("Power", te.getTileData().getInteger("Power") + 1);

e.getEntity().getEntityWorld().removeEntity(e.getEntity());

 

}

 

}

 

}

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.