@Override public void onInteract(Entity entity, Block block, Action type, BlockFace clickedface) { super.onInteract(entity, block, type, clickedface); if (type == Action.RIGHT_CLICK) { BlockMaterial clickedmat = block.getMaterial(); if (clickedmat.equals(VanillaMaterials.TNT)) { // Detonate TntBlock VanillaMaterials.TNT.onIgnite(block); return; } else { // Default fire creation Block target = block.translate(clickedface); // Default fire placement clickedface = clickedface.getOpposite(); if (VanillaMaterials.FIRE.canPlace(target, (short) 0)) { if (VanillaMaterials.FIRE.onPlacement(target, (short) 0)) { PlayerQuickbar inv = entity.get(Human.class).getInventory().getQuickbar(); inv.addData(inv.getCurrentSlot(), 1); } } // Handle the creation of portals if (VanillaMaterials.PORTAL.createPortal(target.translate(BlockFace.BOTTOM))) { return; } } } }
@Override public void onInteract(Entity entity, Block block, Action type, BlockFace clickedface) { super.onInteract(entity, block, type, clickedface); Block target = block.translate(clickedface); if (target.getMaterial().equals(VanillaMaterials.AIR)) { clickedface = clickedface.getOpposite(); if (VanillaMaterials.FIRE.canPlace(target, (short) 0, clickedface, false)) { if (VanillaMaterials.FIRE.onPlacement(target, (short) 0, clickedface, false)) { Inventory inv = entity.getInventory(); inv.addCurrentItemData(1); } } } }