Skip to content

Commit

Permalink
Modified to follow NeoForge's source instead of Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
StarSNG25 committed Feb 27, 2024
1 parent 133c176 commit 5ce008c
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public InteractionResult useOn(UseOnContext context) //From FlintAndSteelItem
BlockPos blockPos = context.getClickedPos();
BlockState blockState = level.getBlockState(blockPos);

// || blockState.getMaterial() == Material.EXPLOSIVE //From 1.19.4, Material class missing in newer version, MapColor doesn't have EXPLOSIVE
if (blockState.getBlock() instanceof TntBlock) //To prime/ignite TNT
if (blockState.getBlock() instanceof TntBlock) //To prime/ignite TNT // || blockState.getMaterial() == Material.EXPLOSIVE //From 1.19.4, Material class missing in newer version
{
blockState.getBlock().onCaughtFire(blockState, level, blockPos, null, player);
level.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 11);
Expand All @@ -57,10 +56,7 @@ else if (!CampfireBlock.canLight(blockState) && !CandleBlock.canLight(blockState
if (player instanceof ServerPlayer)
{
CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer) player, blockPos1, itemStack);
itemStack.hurtAndBreak(1, player, (livingEntity) ->
{
livingEntity.broadcastBreakEvent(context.getHand());
});
itemStack.hurtAndBreak(1, player, livingEntity -> livingEntity.broadcastBreakEvent(context.getHand()));
}
}
else
Expand All @@ -73,10 +69,7 @@ else if (!CampfireBlock.canLight(blockState) && !CandleBlock.canLight(blockState
level.gameEvent(player, GameEvent.BLOCK_CHANGE, blockPos);

if (player != null)
context.getItemInHand().hurtAndBreak(1, player, (livingEntity) ->
{
livingEntity.broadcastBreakEvent(context.getHand());
});
context.getItemInHand().hurtAndBreak(1, player, livingEntity -> livingEntity.broadcastBreakEvent(context.getHand()));
}

return InteractionResult.sidedSuccess(level.isClientSide());
Expand Down

0 comments on commit 5ce008c

Please sign in to comment.