Added Numerous "CanMine" Checks to part manipulation and other places.
This commit is contained in:
@@ -28,6 +28,7 @@ import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.GuiNull;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -75,7 +76,6 @@ import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.server.AccessType;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
@@ -395,7 +395,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
{
|
||||
World w = player.getEntityWorld();
|
||||
|
||||
if ( Platform.hasPermissions( x, y, z, player, AccessType.BLOCK_ACCESS ) )
|
||||
if ( Platform.hasPermissions( te != null ? new DimensionalCoord( te ) : new DimensionalCoord( player.worldObj, x, y, z ), player ) )
|
||||
{
|
||||
if ( type.isItem() )
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CommonHelper;
|
||||
@@ -123,6 +124,9 @@ public class PartPlacement
|
||||
|
||||
if ( held != null && Platform.isWrench( player, held, x, y, z ) && player.isSneaking() )
|
||||
{
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||
return false;
|
||||
|
||||
Block block = world.getBlock( x, y, z );
|
||||
TileEntity tile = world.getTileEntity( x, y, z );
|
||||
IPartHost host = null;
|
||||
@@ -134,7 +138,7 @@ public class PartPlacement
|
||||
{
|
||||
if ( !world.isRemote )
|
||||
{
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset(player) );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
|
||||
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
@@ -247,7 +251,7 @@ public class PartPlacement
|
||||
Block block = world.getBlock( x, y, z );
|
||||
if ( host != null && player.isSneaking() && block != null )
|
||||
{
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset(player) );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
|
||||
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
@@ -365,7 +369,7 @@ public class PartPlacement
|
||||
if ( !world.isRemote )
|
||||
{
|
||||
Block block = world.getBlock( x, y, z );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset(player) );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
|
||||
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
@@ -378,6 +382,10 @@ public class PartPlacement
|
||||
}
|
||||
}
|
||||
|
||||
DimensionalCoord dc = host.getLocation();
|
||||
if ( !Platform.hasPermissions( dc, player ) )
|
||||
return false;
|
||||
|
||||
ForgeDirection mySide = host.addPart( held, side, player );
|
||||
if ( mySide != null )
|
||||
{
|
||||
@@ -413,11 +421,12 @@ public class PartPlacement
|
||||
}
|
||||
|
||||
public static float eyeHeight = 0.0f;
|
||||
private static float getEyeOffset( EntityPlayer p )
|
||||
|
||||
private static float getEyeOffset(EntityPlayer p)
|
||||
{
|
||||
if ( p.worldObj.isRemote )
|
||||
return Platform.getEyeOffset( p );
|
||||
|
||||
|
||||
return eyeHeight;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
if ( !proxy.isActive() )
|
||||
return false;
|
||||
|
||||
if ( !Platform.hasPermissions( getLocation(), player ) )
|
||||
return false;
|
||||
|
||||
boolean ModeB = false;
|
||||
|
||||
ItemStack item = player.getCurrentEquippedItem();
|
||||
|
||||
@@ -111,6 +111,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
if ( !proxy.isActive() )
|
||||
return false;
|
||||
|
||||
if ( !Platform.hasPermissions( getLocation(), player ) )
|
||||
return false;
|
||||
|
||||
TileEntity te = this.tile;
|
||||
ItemStack eq = player.getCurrentEquippedItem();
|
||||
if ( Platform.isWrench( player, eq, te.xCoord, te.yCoord, te.zCoord ) )
|
||||
|
||||
@@ -19,8 +19,8 @@ import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.server.AccessType;
|
||||
import appeng.tile.events.AETileEventHandler;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkPowerTile;
|
||||
@@ -224,7 +224,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
|
||||
public void activate(EntityPlayer player)
|
||||
{
|
||||
if ( !Platform.hasPermissions( xCoord, yCoord, zCoord, player, AccessType.BLOCK_ACCESS ) )
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( this ), player ) )
|
||||
return;
|
||||
|
||||
ItemStack myItem = getStackInSlot( 0 );
|
||||
|
||||
+5
-5
@@ -87,6 +87,7 @@ import appeng.api.storage.data.IAETagCompound;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
@@ -98,7 +99,6 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.server.AccessType;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.AESharedNBT;
|
||||
import appeng.util.item.OreHelper;
|
||||
@@ -315,9 +315,9 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasPermissions(int x, int y, int z, EntityPlayer player, AccessType blockAccess)
|
||||
public static boolean hasPermissions(DimensionalCoord dc, EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
return dc.getWorld().canMineBlock( player, dc.x, dc.y, dc.z );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1208,7 +1208,7 @@ public class Platform
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double d1 = eyeoffset;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
|
||||
|
||||
Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
|
||||
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
|
||||
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
|
||||
@@ -1795,6 +1795,6 @@ public class Platform
|
||||
public static float getEyeOffset(EntityPlayer player)
|
||||
{
|
||||
assert player.worldObj.isRemote : "Valid only on client";
|
||||
return (float) (player.posY +player.getEyeHeight() - player.getDefaultEyeHeight());
|
||||
return (float) (player.posY + player.getEyeHeight() - player.getDefaultEyeHeight());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user