Using flint and steel as a lighter for a custom portal

Started by joe69 on

Topic category: Advanced modding

Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Using flint and steel as a lighter for a custom portal

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;
			}
		}
	}
Joined Apr 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you disable the portal…
Mon, 03/23/2020 - 18:52

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.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you give an example?
Sun, 04/12/2020 - 02:06

Can you give an example?