Skip to content

Commit

Permalink
Fix Lumberjack
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Oct 3, 2024
1 parent e1a937e commit 3b8f371
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ForceAxeItem(Item.Properties properties) {
}

public static boolean fellTree(ItemStack stack, BlockPos pos, Player player) {
if (player.getCommandSenderWorld().isClientSide) {
if (player.level().isClientSide) {
return true;
}
NeoForge.EVENT_BUS.register(new TreeChopTask(stack, pos, player, 10));
Expand All @@ -53,23 +53,22 @@ public static class TreeChopTask {
public Set<BlockPos> visited = new HashSet<>();

public TreeChopTask(ItemStack tool, BlockPos start, Player player, int blocksPerTick) {
this.level = player.getCommandSenderWorld();
this.level = player.level();
this.player = player;
this.tool = tool;
this.blocksPerTick = blocksPerTick;

this.blocks.add(start);
this.blocks.add(start.above());
}

@SubscribeEvent
public void chop(LevelTickEvent.Post event) {
Level level = event.getLevel();
if (level.isClientSide()) {
finish();
return;
}
// only if same dimension
if (level.dimension().location().equals(level.dimension().location())) {
if (!this.level.dimension().location().equals(level.dimension().location())) {
return;
}

Expand Down

0 comments on commit 3b8f371

Please sign in to comment.