fix: drill range

This commit is contained in:
Michael Hillcox 2024-03-09 00:06:58 +00:00
parent 1183a169d8
commit d36cb9c76e

View file

@ -48,10 +48,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.neoforged.neoforge.common.CommonHooks; import net.neoforged.neoforge.common.*;
import net.neoforged.neoforge.common.TierSortingRegistry;
import net.neoforged.neoforge.common.ToolAction;
import net.neoforged.neoforge.common.ToolActions;
import net.neoforged.neoforge.items.IItemHandler; import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.items.IItemHandlerModifiable; import net.neoforged.neoforge.items.IItemHandlerModifiable;
@ -236,7 +233,7 @@ public class DrillItem extends ItemEnergy {
} }
//Block hit //Block hit
HitResult ray = WorldUtil.getNearestBlockWithDefaultReachDistance(player.level(), player); HitResult ray = player.pick(8f, 1f, false);
if (ray != null && ray.getType() == HitResult.Type.BLOCK) { if (ray != null && ray.getType() == HitResult.Type.BLOCK) {
BlockHitResult trace = (BlockHitResult) ray; BlockHitResult trace = (BlockHitResult) ray;
//Breaks the Blocks //Breaks the Blocks
@ -412,7 +409,7 @@ public class DrillItem extends ItemEnergy {
} }
if (side.getAxis() == Direction.Axis.X) { if (side.getAxis() == Direction.Axis.X) {
xRange = 0; xRange = 0;
zRange = radius; w zRange = radius;
} }
//Not defined later because main Block is getting broken below //Not defined later because main Block is getting broken below