Removing a Mob with Right Click

Started by gustavowizard123 on Sat, 10/15/2016 - 00:31

Topic category: Help with MCreator modding

Last seen on 10:58, 2. Dec 2018
Joined Sep 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Removing a Mob with Right Click
Sat, 10/15/2016 - 00:31

I need to remove a Mob when i Right Click it with A Bottle, im makign a Devil in a Bottle,here is the part i think i need to change:

 

    @Override
        public boolean processInteract(EntityPlayer entity, EnumHand hand, ItemStack stack){
            super.processInteract(entity,hand,stack);
            int i = (int)this.posX;
            int j = (int)this.posY;
            int k = (int)this.posZ;
            
if(entity.inventory.getCurrentItem()!=null&&entity.inventory.getCurrentItem().getItem() == mcreator_devilBottleItemEmpty.block){

if(true){
despawnEntity();              <--------------------------------------- I ADDED THIS - THE CODE ACCEPT BUT NOTHING HAPPENS...  ANY IDEAS GUYS? thanks!
}

if(true){
if(entity instanceof EntityPlayer)((EntityPlayer)entity).inventory.clearMatchingItems(mcreator_devilBottleItemEmpty.block,-1,1,null);
}

if(true){
if(entity instanceof EntityPlayer)((EntityPlayer)entity).inventory.addItemStackToInventory(new ItemStack(mcreator_bottleDevil.block, 1));
}

}

Last seen on 07:05, 15. Sep 2019
Joined Jul 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
You can put setDead (),…
Tue, 11/21/2017 - 00:39

You can put setDead (), rather than

If (true){

despawnEntity ();

}

Last seen on 07:05, 15. Sep 2019
Joined Jul 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Hey one question... how can…
Tue, 11/21/2017 - 00:42

Hey one question... how can i do this "java" without the "item," but using your empty hand?