This commit is contained in:
AlgorithmX2
2014-06-25 23:02:22 -05:00
13 changed files with 56 additions and 145 deletions
+24 -13
View File
@@ -22,6 +22,8 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection;
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
import appeng.api.parts.PartItemStack; import appeng.api.parts.PartItemStack;
@@ -42,11 +44,14 @@ import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR; import appeng.tile.networking.TileCableBusTESR;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockCableBus extends AEBaseBlock @Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = "MFR")
public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
{ {
static private ICableBusContainer nullCB = new NullCableBusContainer(); static private ICableBusContainer nullCB = new NullCableBusContainer();
@@ -318,18 +323,18 @@ public class BlockCableBus extends AEBaseBlock
{ {
return cb( w, x, y, z ).isSolidOnSide( side ); return cb( w, x, y, z ).isSolidOnSide( side );
} }
@Override @Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block meh) public void onNeighborBlockChange(World w, int x, int y, int z, Block meh)
{ {
cb( w, x, y, z ).onNeighborChanged(); cb( w, x, y, z ).onNeighborChanged();
} }
@Override @Override
public void onNeighborChange(IBlockAccess w, int x, int y, int z, int tileX, int tileY, int tileZ) public void onNeighborChange(IBlockAccess w, int x, int y, int z, int tileX, int tileY, int tileZ)
{ {
cb( w, x, y, z ).onNeighborChanged(); cb( w, x, y, z ).onNeighborChanged();
} }
@Override @Override
public Item getItemDropped(int i, Random r, int k) public Item getItemDropped(int i, Random r, int k)
@@ -416,4 +421,10 @@ public class BlockCableBus extends AEBaseBlock
*/ */
boolean ImmibisMicroblocks_TransformableBlockMarker = true; boolean ImmibisMicroblocks_TransformableBlockMarker = true;
@Override
@Method(iname = "MFR")
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side)
{
return cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? RedNetConnectionType.CableSingle : RedNetConnectionType.None;
}
} }
@@ -1,5 +1,7 @@
package appeng.container.implementations; package appeng.container.implementations;
import invtweaks.api.container.IgnoreContainer;
import java.io.IOException; import java.io.IOException;
import java.nio.BufferOverflowException; import java.nio.BufferOverflowException;
@@ -46,6 +48,7 @@ import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost; import appeng.util.IConfigManagerHost;
import appeng.util.Platform; import appeng.util.Platform;
@IgnoreContainer
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigureableObject, IMEMonitorHandlerReceiver<IAEItemStack> public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigureableObject, IMEMonitorHandlerReceiver<IAEItemStack>
{ {
+1 -33
View File
@@ -18,9 +18,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer; import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart; import appeng.api.parts.IFacadePart;
@@ -503,36 +501,6 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
cb.securityBreak(); cb.securityBreak();
} }
@Override
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side)
{
return cb.getConnectionType( world, x, y, z, side );
}
@Override
public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side)
{
return cb.getOutputValues( world, x, y, z, side );
}
@Override
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet)
{
return cb.getOutputValue( world, x, y, z, side, subnet );
}
@Override
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues)
{
cb.onInputsChanged( world, x, y, z, side, inputValues );
}
@Override
public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue)
{
cb.onInputChanged( world, x, y, z, side, inputValue );
}
@Override @Override
public boolean isEmpty() public boolean isEmpty()
{ {
@@ -551,7 +519,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
if ( tile() instanceof TIInventoryTile ) if ( tile() instanceof TIInventoryTile )
((TIInventoryTile) tile()).rebuildSlotMap(); ((TIInventoryTile) tile()).rebuildSlotMap();
if ( world() != null && world().blockExists( x(), y(), z() ) && ! CableBusContainer.isLoading() ) if ( world() != null && world().blockExists( x(), y(), z() ) && !CableBusContainer.isLoading() )
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air ); world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air );
} }
+1 -4
View File
@@ -1,12 +1,9 @@
package appeng.helpers; package appeng.helpers;
import powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet;
import appeng.api.networking.IGridHost; import appeng.api.networking.IGridHost;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
import appeng.transformer.annotations.integration.Interface;
@Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet", iname = "MFR") public interface AEMultiTile extends IGridHost, IPartHost
public interface AEMultiTile extends IGridHost, IPartHost, IConnectableRedNet
{ {
} }
+2 -2
View File
@@ -1,6 +1,6 @@
package appeng.integration.modules; package appeng.integration.modules;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType; import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection;
import appeng.integration.BaseModule; import appeng.integration.BaseModule;
public class MFR extends BaseModule public class MFR extends BaseModule
@@ -9,7 +9,7 @@ public class MFR extends BaseModule
public static MFR instance; public static MFR instance;
public MFR() { public MFR() {
TestClass( RedNetConnectionType.class ); TestClass( IRedNetConnection.class );
} }
@Override @Override
+5 -2
View File
@@ -190,20 +190,23 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( stack, StorageChannel.ITEMS ); IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( stack, StorageChannel.ITEMS );
if ( inv != null && pinv.getCurrentItem() == stack ) if ( inv != null && pinv.getCurrentItem() == stack )
{ {
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( pinv, ForgeDirection.UNKNOWN ); InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() ); IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() );
if ( list.isEmpty() && ia != null ) if ( list.isEmpty() && ia != null )
{ {
pinv.setInventorySlotContents( pinv.currentItem, null ); pinv.setInventorySlotContents( pinv.currentItem, null );
ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) );
ItemStack extraB = ia.addItems( component.stack( 1 ) ); ItemStack extraB = ia.addItems( component.stack( 1 ) );
ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) );
if ( extraA != null ) if ( extraA != null )
player.dropPlayerItemWithRandomChoice( extraA, false ); player.dropPlayerItemWithRandomChoice( extraA, false );
if ( extraB != null ) if ( extraB != null )
player.dropPlayerItemWithRandomChoice( extraB, false ); player.dropPlayerItemWithRandomChoice( extraB, false );
if ( player.inventoryContainer != null )
player.inventoryContainer.detectAndSendChanges();
return true; return true;
} }
} }
+7 -39
View File
@@ -20,7 +20,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnection; import appeng.api.exceptions.FailedConnection;
import appeng.api.implementations.parts.IPartCable; import appeng.api.implementations.parts.IPartCable;
@@ -321,8 +320,9 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
} }
private static final ThreadLocal<Boolean> isLoading = new ThreadLocal(); private static final ThreadLocal<Boolean> isLoading = new ThreadLocal();
public static boolean isLoading() { public static boolean isLoading()
{
Boolean is = isLoading.get(); Boolean is = isLoading.get();
return is != null && is == true; return is != null && is == true;
} }
@@ -331,10 +331,10 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
{ {
if ( inWorld ) if ( inWorld )
return; return;
inWorld = true; inWorld = true;
isLoading.set( true ); isLoading.set( true );
TileEntity te = getTile(); TileEntity te = getTile();
hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord ); hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord );
@@ -381,8 +381,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
} }
partChanged(); partChanged();
isLoading.set(false); isLoading.set( false );
} }
public void removeFromWorld() public void removeFromWorld()
@@ -980,38 +980,6 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
return false; return false;
} }
@Override
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side)
{
return getPart( side ).canConnectRedstone() ? RedNetConnectionType.CableSingle : RedNetConnectionType.None;
}
@Override
public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side)
{
// never called
return null;
}
@Override
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet)
{
// never called
return 0;
}
@Override
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues)
{
// never called
}
@Override
public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue)
{
// never called
}
@Override @Override
public void securityBreak() public void securityBreak()
{ {
+6
View File
@@ -26,6 +26,12 @@ public class PartUpgradeable extends PartBasicState implements ISegmentedInvento
return upgrades.getInstalledUpgrades( u ); return upgrades.getInstalledUpgrades( u );
} }
@Override
public boolean canConnectRedstone()
{
return upgrades.getMaxInstalled( Upgrades.REDSTONE ) > 0;
}
protected int getUpgradeSlots() protected int getUpgradeSlots()
{ {
return 4; return 4;
+1 -1
View File
@@ -62,7 +62,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
return false; return false;
} }
private int getMaxInstalled(Upgrades u) public int getMaxInstalled(Upgrades u)
{ {
Integer max = null; Integer max = null;
for (ItemStack is : u.getSupported().keySet()) for (ItemStack is : u.getSupported().keySet())
+1 -41
View File
@@ -4,7 +4,6 @@ import io.netty.buffer.ByteBuf;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -17,7 +16,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer; import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
@@ -34,7 +32,6 @@ import appeng.parts.CableBusContainer;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.tile.events.AETileEventHandler; import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType; import appeng.tile.events.TileEventType;
import appeng.transformer.annotations.integration.Method;
import appeng.util.Platform; import appeng.util.Platform;
public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision
@@ -292,7 +289,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override @Override
public void notifyNeighbors() public void notifyNeighbors()
{ {
if ( worldObj != null && worldObj.blockExists( xCoord, yCoord, zCoord ) && ! CableBusContainer.isLoading() ) if ( worldObj != null && worldObj.blockExists( xCoord, yCoord, zCoord ) && !CableBusContainer.isLoading() )
worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air ); worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air );
} }
@@ -308,43 +305,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return cb.hasRedstone( side ); return cb.hasRedstone( side );
} }
@Override
@Method(iname = "MFR")
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side)
{
return cb.canConnectRedstone( EnumSet.of( side ) ) ? RedNetConnectionType.CableSingle : RedNetConnectionType.None;
}
@Override
@Method(iname = "MFR")
public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side)
{
// never called!
return null;
}
@Override
@Method(iname = "MFR")
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet)
{
// never called!
return 0;
}
@Override
@Method(iname = "MFR")
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues)
{
// never called!
}
@Override
@Method(iname = "MFR")
public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue)
{
// never called!
}
@Override @Override
public boolean isEmpty() public boolean isEmpty()
{ {
+1 -1
View File
@@ -15,7 +15,7 @@ import cpw.mods.fml.relauncher.FMLRelaunchLog;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
@MCVersion("1.7.2") @MCVersion()
public class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin public class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
{ {
+1 -5
View File
@@ -94,9 +94,6 @@ import appeng.util.item.ItemList;
import appeng.util.item.OreHelper; import appeng.util.item.OreHelper;
import appeng.util.item.OreRefrence; import appeng.util.item.OreRefrence;
import buildcraft.api.tools.IToolWrench; import buildcraft.api.tools.IToolWrench;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
@@ -890,7 +887,6 @@ public class Platform
} }
private static WeakHashMap<World, EntityPlayer> fakePlayers = new WeakHashMap<World, EntityPlayer>(); private static WeakHashMap<World, EntityPlayer> fakePlayers = new WeakHashMap<World, EntityPlayer>();
private static GameProfile myProfile = new GameProfile( "[appeng]", "AE2" );
public static EntityPlayer getPlayer(WorldServer w) public static EntityPlayer getPlayer(WorldServer w)
{ {
@@ -898,7 +894,7 @@ public class Platform
if ( wrp != null ) if ( wrp != null )
return wrp; return wrp;
EntityPlayer p = FakePlayerFactory.get( w, myProfile ); EntityPlayer p = FakePlayerFactory.getMinecraft( w );
fakePlayers.put( w, p ); fakePlayers.put( w, p );
return p; return p;
} }
+3 -4
View File
@@ -2,8 +2,9 @@ package appeng.util.item;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.DataInput; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
@@ -18,8 +19,6 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAETagCompound; import appeng.api.storage.data.IAETagCompound;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.io.ByteStreams;
public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFluidStack, Comparable<AEFluidStack> public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFluidStack, Comparable<AEFluidStack>
{ {
@@ -271,7 +270,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
byte[] bd = new byte[len]; byte[] bd = new byte[len];
data.readBytes( bd ); data.readBytes( bd );
DataInput di = ByteStreams.newDataInput( bd ); DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) );
d.setTag( "tag", CompressedStreamTools.read( di ) ); d.setTag( "tag", CompressedStreamTools.read( di ) );
} }