Using flint and steel as a lighter for a custom portal

Started by joe69 on Sat, 03/07/2020 - 05:21

Topic category: Advanced modding

Last seen on 06:58, 26. Mar 2020
Joined Feb 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Using flint and steel as a lighter for a custom portal
Sat, 03/07/2020 - 05:21

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;
			}
		}
	}
Last seen on 18:02, 23. Oct 2020
Joined Apr 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 18:57, 24. Apr 2020
Joined Dec 2014
User points:

User statistics:

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

Can you give an example?