Started by
joe69
on
Topic category: Advanced modding
I want to have my portal activated by flint and steel, but I don't know how to add this to regular flint and steel
public static class ModTrigger extends Item {
/*public ModTrigger() {
super();
this.maxStackSize = 1;
setMaxDamage(64);
setCreativeTab(null);
}*/
@Override
public EnumActionResult onItemUse(EntityPlayer entity, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY,
float hitZ) {
pos = pos.offset(facing);
ItemStack itemstack = entity.getHeldItem(hand);
if (!entity.canPlayerEdit(pos, facing, itemstack)) {
return EnumActionResult.FAIL;
} else {
if (world.isAirBlock(pos))
portal.portalSpawn(world, pos);
itemstack.damageItem(1, entity);
return EnumActionResult.SUCCESS;
}
}
}
you disable the portal option then you add a custom procedure to the portal block to detect click events and check item if flint and steel check for blocks then place portal teleporter blocks with the if touching player switch dimension procedure.
Can you give an example?