@@ -14,6 +14,7 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
@@ -32,15 +33,13 @@ public class WrenchClickHook {
|
|||||||
|
|
||||||
if (event instanceof PlayerInteractEvent.RightClickBlock && !event.getEntityPlayer().world.isRemote) {
|
if (event instanceof PlayerInteractEvent.RightClickBlock && !event.getEntityPlayer().world.isRemote) {
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
if (player instanceof FakePlayer) return;
|
||||||
|
|
||||||
EnumHand hand = event.getHand();
|
EnumHand hand = event.getHand();
|
||||||
BlockPos pos = event.getPos();
|
BlockPos pos = event.getPos();
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
ItemStack held = event.getItemStack();
|
ItemStack held = event.getItemStack();
|
||||||
|
|
||||||
if (!Platform.hasPermissions(new DimensionalCoord(world, pos), player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.isSneaking() && Platform.isWrench(player, held, pos)) {
|
if (player.isSneaking() && Platform.isWrench(player, held, pos)) {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
@@ -48,6 +47,10 @@ public class WrenchClickHook {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Platform.hasPermissions(new DimensionalCoord(world, pos), player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final LookDirection dir = Platform.getPlayerRay(player, player.getEyeHeight());
|
final LookDirection dir = Platform.getPlayerRay(player, player.getEyeHeight());
|
||||||
final RayTraceResult mop = block.collisionRayTrace(world.getBlockState(pos), world, pos, dir.getA(), dir.getB());
|
final RayTraceResult mop = block.collisionRayTrace(world.getBlockState(pos), world, pos, dir.getA(), dir.getB());
|
||||||
if (mop != null) {
|
if (mop != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user