Merge branch 'master' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1
This commit is contained in:
+42
-2
@@ -1,8 +1,15 @@
|
||||
package appeng.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.core.api.IIMCHandler;
|
||||
import appeng.core.api.imc.IMCGrinder;
|
||||
import appeng.core.api.imc.IMCMatterCannon;
|
||||
import appeng.core.api.imc.IMCP2PAttunement;
|
||||
import appeng.core.api.imc.IMCSpatial;
|
||||
import appeng.core.crash.CrashEnhancement;
|
||||
import appeng.core.crash.CrashInfo;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -21,6 +28,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
||||
@@ -42,6 +51,8 @@ public class AppEng
|
||||
public final static String modid = "appliedenergistics2";
|
||||
public final static String name = "Applied Energistics 2";
|
||||
|
||||
HashMap<String, IIMCHandler> IMCHandlers = new HashMap();
|
||||
|
||||
public static AppEng instance;
|
||||
|
||||
public final static String dependencies =
|
||||
@@ -51,8 +62,7 @@ public class AppEng
|
||||
"after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
|
||||
|
||||
// depend on version of forge used for build.
|
||||
"required-after:AppliedEnergistics2-Core;" +
|
||||
"required-after:Forge@[" // require forge.
|
||||
"required-after:AppliedEnergistics2-Core;" + "required-after:Forge@[" // require forge.
|
||||
+ net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
|
||||
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
|
||||
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
|
||||
@@ -61,6 +71,15 @@ public class AppEng
|
||||
public AppEng() {
|
||||
instance = this;
|
||||
|
||||
IMCHandlers.put( "whitelist-spatial", new IMCSpatial() );
|
||||
IMCHandlers.put( "add-grindable", new IMCGrinder() );
|
||||
IMCHandlers.put( "add-mattercannon-ammo", new IMCMatterCannon() );
|
||||
|
||||
for (TunnelType type : TunnelType.values())
|
||||
{
|
||||
IMCHandlers.put( "add-p2p-attunement-" + type.name().replace( '_', '-' ).toLowerCase(), new IMCP2PAttunement() );
|
||||
}
|
||||
|
||||
for (CrashInfo ci : CrashInfo.values())
|
||||
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( ci ) );
|
||||
}
|
||||
@@ -147,6 +166,27 @@ public class AppEng
|
||||
AELog.info( "PostInit ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void processIMC(FMLInterModComms.IMCEvent event)
|
||||
{
|
||||
for (IMCMessage m : event.getMessages())
|
||||
{
|
||||
try
|
||||
{
|
||||
IIMCHandler handler = IMCHandlers.get( m.key );
|
||||
if ( handler != null )
|
||||
handler.post( m );
|
||||
else
|
||||
throw new RuntimeException( "Invalid IMC Called: " + m.key );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
AELog.warning( "Problem detected when processing IMC " + m.key + " from " + m.getSender() );
|
||||
AELog.error( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package appeng.core.api;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public interface IIMCHandler
|
||||
{
|
||||
|
||||
void post(IMCMessage m);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* Example:
|
||||
|
||||
NBTTagCompound msg = new NBTTagCompound();
|
||||
NBTTagCompound in = new NBTTagCompound();
|
||||
NBTTagCompound out = new NBTTagCompound();
|
||||
|
||||
new ItemStack( Blocks.iron_ore ).writeToNBT( in );
|
||||
new ItemStack( Items.iron_ingot ).writeToNBT( out );
|
||||
msg.setTag( "in", in );
|
||||
msg.setTag( "out", out );
|
||||
msg.setInteger( "turns", 8 );
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg );
|
||||
|
||||
-- or --
|
||||
|
||||
NBTTagCompound msg = new NBTTagCompound();
|
||||
NBTTagCompound in = new NBTTagCompound();
|
||||
NBTTagCompound out = new NBTTagCompound();
|
||||
NBTTagCompound optional = new NBTTagCompound();
|
||||
|
||||
new ItemStack( Blocks.iron_ore ).writeToNBT( in );
|
||||
new ItemStack( Items.iron_ingot ).writeToNBT( out );
|
||||
new ItemStack( Blocks.gravel ).writeToNBT( optional );
|
||||
msg.setTag( "in", in );
|
||||
msg.setTag( "out", out );
|
||||
msg.setTag( "optional", optional );
|
||||
msg.setFloat( "chance", 0.5 );
|
||||
msg.setInteger( "turns", 8 );
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg );
|
||||
|
||||
*/
|
||||
package appeng.core.api.imc;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.api.IIMCHandler;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public class IMCGrinder implements IIMCHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void post(IMCMessage m)
|
||||
{
|
||||
NBTTagCompound msg = m.getNBTValue();
|
||||
NBTTagCompound inTag = (NBTTagCompound) msg.getTag( "in" );
|
||||
NBTTagCompound outTag = (NBTTagCompound) msg.getTag( "out" );
|
||||
|
||||
ItemStack in = ItemStack.loadItemStackFromNBT( inTag );
|
||||
ItemStack out = ItemStack.loadItemStackFromNBT( outTag );
|
||||
|
||||
int turns = msg.getInteger( "turns" );
|
||||
|
||||
if ( in == null )
|
||||
throw new RuntimeException( "invalid input" );
|
||||
|
||||
if ( out == null )
|
||||
throw new RuntimeException( "invalid output" );
|
||||
|
||||
if ( msg.hasKey( "optional" ) )
|
||||
{
|
||||
NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" );
|
||||
ItemStack optional = ItemStack.loadItemStackFromNBT( optionalTag );
|
||||
|
||||
if ( optional == null )
|
||||
throw new RuntimeException( "invalid optional" );
|
||||
|
||||
float chance = msg.getFloat( "chance" );
|
||||
|
||||
AEApi.instance().registries().grinder().addRecipe( in, out, optional, chance, turns );
|
||||
}
|
||||
else
|
||||
AEApi.instance().registries().grinder().addRecipe( in, out, turns );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/* Example:
|
||||
|
||||
NBTTagCompound msg = new NBTTagCompound();
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
|
||||
new ItemStack( Blocks.anvil ).writeToNBT( item );
|
||||
msg.setTag( "item", item );
|
||||
msg.setDouble( "weight", 32.0 );
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-mattercannon-ammo", msg );
|
||||
|
||||
*/
|
||||
package appeng.core.api.imc;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.api.IIMCHandler;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public class IMCMatterCannon implements IIMCHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void post(IMCMessage m)
|
||||
{
|
||||
NBTTagCompound msg = m.getNBTValue();
|
||||
NBTTagCompound item = (NBTTagCompound) msg.getTag( "item" );
|
||||
|
||||
ItemStack ammo = ItemStack.loadItemStackFromNBT( item );
|
||||
double weight = msg.getDouble( "weight" );
|
||||
|
||||
if ( ammo == null )
|
||||
throw new RuntimeException( "invalid item" );
|
||||
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/* Example:
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-me", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-bc-power", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-ic2-power", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-redstone", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-fluid", new ItemStack( myBlockOrItem ) );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-item", new ItemStack( myBlockOrItem ) );
|
||||
|
||||
*/
|
||||
package appeng.core.api.imc;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.core.api.IIMCHandler;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public class IMCP2PAttunement implements IIMCHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void post(IMCMessage m)
|
||||
{
|
||||
String key = m.key.substring( "add-p2p-attunement-".length() ).replace( '-', '_' ).toUpperCase();
|
||||
|
||||
TunnelType type = TunnelType.valueOf( key );
|
||||
|
||||
if ( type != null )
|
||||
{
|
||||
ItemStack is = m.getItemStackValue();
|
||||
if ( is != null )
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type );
|
||||
else
|
||||
throw new RuntimeException( "invalid item" );
|
||||
}
|
||||
else
|
||||
throw new RuntimeException( "invalid type" );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/* Example:
|
||||
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "whitelist-spatial", "mymod.tileentities.MyTileEntity" );
|
||||
|
||||
*/
|
||||
package appeng.core.api.imc;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.api.IIMCHandler;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public class IMCSpatial implements IIMCHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void post(IMCMessage m)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
Class classInstance = Class.forName( m.getStringValue() );
|
||||
AEApi.instance().registries().moveable().whiteListTileEntity( classInstance );
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
AELog.info( "Bad Class Registered: " + m.getStringValue() + " by " + m.getSender() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package appeng.core.features.registries.entries;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
@@ -18,7 +19,7 @@ public class ExternalIInv implements IExternalStorageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel)
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src)
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS && te instanceof IInventory )
|
||||
return new MEMonitorIInventory( (IInventory) te, d );
|
||||
|
||||
@@ -158,10 +158,10 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
||||
IAEItemStack req = config.getAEStackInSlot( slot );
|
||||
if ( req != null && req.getStackSize() <= 0 )
|
||||
{
|
||||
config.setInventorySlotContents(slot, null);
|
||||
config.setInventorySlotContents( slot, null );
|
||||
req = null;
|
||||
}
|
||||
|
||||
|
||||
ItemStack Stored = storage.getStackInSlot( slot );
|
||||
|
||||
if ( req == null && Stored != null )
|
||||
@@ -478,6 +478,29 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src, IStorageMonitorable myInterface)
|
||||
{
|
||||
if ( Platform.canAccess( gridProxy, src ) )
|
||||
return myInterface;
|
||||
|
||||
final DualityInterface di = this;
|
||||
|
||||
return new IStorageMonitorable() {
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return new InterfaceInventory( di );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Type;
|
||||
|
||||
public class TickHandler
|
||||
@@ -104,7 +105,7 @@ public class TickHandler
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent ev)
|
||||
{
|
||||
if ( ev.type == Type.SERVER )
|
||||
if ( ev.type == Type.SERVER && ev.phase == Phase.END )
|
||||
{
|
||||
HandlerRep repo = getRepo();
|
||||
while (!repo.tiles.isEmpty())
|
||||
|
||||
@@ -2,6 +2,7 @@ package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
@@ -17,7 +18,7 @@ public class BCPipeHandler implements IExternalStorageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan)
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src)
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS )
|
||||
return new BCPipeInventory( te, d );
|
||||
|
||||
@@ -2,6 +2,7 @@ package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
@@ -17,7 +18,7 @@ public class FactorizationHandler implements IExternalStorageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan)
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src)
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS )
|
||||
return FZ.instance.getFactorizationBarrel( te );
|
||||
|
||||
@@ -2,6 +2,7 @@ package appeng.integration.modules.helpers;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
@@ -17,7 +18,7 @@ public class MFRDSUHandler implements IExternalStorageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan)
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src)
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS )
|
||||
return DSU.instance.getDSU( te );
|
||||
|
||||
@@ -3,6 +3,7 @@ package appeng.me.storage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
@@ -24,7 +25,7 @@ public class AEExternalHandler implements IExternalStorageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel)
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src)
|
||||
{
|
||||
if ( te instanceof TileCondenser )
|
||||
{
|
||||
@@ -37,7 +38,7 @@ public class AEExternalHandler implements IExternalStorageHandler
|
||||
if ( te instanceof ITileStorageMonitorable )
|
||||
{
|
||||
ITileStorageMonitorable iface = (ITileStorageMonitorable) te;
|
||||
IStorageMonitorable sm = iface.getMonitorable( d );
|
||||
IStorageMonitorable sm = iface.getMonitorable( d, src );
|
||||
|
||||
if ( channel == StorageChannel.ITEMS && sm != null )
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
@@ -277,8 +278,8 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISeg
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side)
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
|
||||
{
|
||||
return this;
|
||||
return duality.getMonitorable( side, src, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS );
|
||||
if ( esh != null )
|
||||
{
|
||||
IMEInventory inv = esh.getInventory( target, side.getOpposite(), StorageChannel.ITEMS );
|
||||
IMEInventory inv = esh.getInventory( target, side.getOpposite(), StorageChannel.ITEMS, mySrc );
|
||||
|
||||
if ( inv instanceof MEMonitorIInventory )
|
||||
((MEMonitorIInventory) inv).mySource = new MachineSource( this );
|
||||
|
||||
@@ -13,8 +13,7 @@ public class PartDarkMonitor extends PartMonitor
|
||||
{
|
||||
|
||||
public PartDarkMonitor(ItemStack is) {
|
||||
super( PartDarkMonitor.class, is,false );
|
||||
|
||||
super( PartDarkMonitor.class, is, false );
|
||||
notLightSource = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,12 +111,12 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
|
||||
}
|
||||
|
||||
public PartMonitor(ItemStack is) {
|
||||
super( PartMonitor.class, is );
|
||||
this( PartMonitor.class, is, false );
|
||||
}
|
||||
|
||||
protected PartMonitor(Class c, ItemStack is, boolean requireChannel ) {
|
||||
protected PartMonitor(Class c, ItemStack is, boolean requireChannel) {
|
||||
super( c, is );
|
||||
|
||||
|
||||
if ( requireChannel )
|
||||
proxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
else
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
@@ -191,9 +192,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IS
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side)
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
|
||||
{
|
||||
return this;
|
||||
return duality.getMonitorable( side, src, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -706,9 +706,11 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side)
|
||||
public IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src)
|
||||
{
|
||||
return this;
|
||||
if ( Platform.canAccess( gridProxy, src ) )
|
||||
return this;
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getStorageType()
|
||||
|
||||
@@ -62,7 +62,10 @@ import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
@@ -77,7 +80,9 @@ import appeng.api.util.AEItemDefinition;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
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;
|
||||
@@ -1567,4 +1572,27 @@ public class Platform
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean canAccess(AENetworkProxy gridProxy, BaseActionSource src)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( src.isPlayer() )
|
||||
{
|
||||
return gridProxy.getSecurity().hasPermission( ((PlayerSource) src).player, SecurityPermissions.BUILD );
|
||||
}
|
||||
else if ( src.isMachine() )
|
||||
{
|
||||
IActionHost te = ((MachineSource) src).via;
|
||||
int playerID = te.getActionableNode().getPlayerID();
|
||||
return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
catch (GridAccessException gae)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user