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.World;
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.IPartHost;
import appeng.api.parts.PartItemStack;
@@ -42,11 +44,14 @@ import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
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();
@@ -318,18 +323,18 @@ public class BlockCableBus extends AEBaseBlock
{
return cb( w, x, y, z ).isSolidOnSide( side );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block meh)
{
cb( w, x, y, z ).onNeighborChanged();
}
@Override
public void onNeighborChange(IBlockAccess w, int x, int y, int z, int tileX, int tileY, int tileZ)
{
cb( w, x, y, z ).onNeighborChanged();
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block meh)
{
cb( w, x, y, z ).onNeighborChanged();
}
@Override
public void onNeighborChange(IBlockAccess w, int x, int y, int z, int tileX, int tileY, int tileZ)
{
cb( w, x, y, z ).onNeighborChanged();
}
@Override
public Item getItemDropped(int i, Random r, int k)
@@ -416,4 +421,10 @@ public class BlockCableBus extends AEBaseBlock
*/
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;
import invtweaks.api.container.IgnoreContainer;
import java.io.IOException;
import java.nio.BufferOverflowException;
@@ -46,6 +48,7 @@ import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
@IgnoreContainer
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.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
@@ -503,36 +501,6 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
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
public boolean isEmpty()
{
@@ -551,7 +519,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
if ( tile() instanceof TIInventoryTile )
((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 );
}
+1 -4
View File
@@ -1,12 +1,9 @@
package appeng.helpers;
import powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet;
import appeng.api.networking.IGridHost;
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, IConnectableRedNet
public interface AEMultiTile extends IGridHost, IPartHost
{
}
+2 -2
View File
@@ -1,6 +1,6 @@
package appeng.integration.modules;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection;
import appeng.integration.BaseModule;
public class MFR extends BaseModule
@@ -9,7 +9,7 @@ public class MFR extends BaseModule
public static MFR instance;
public MFR() {
TestClass( RedNetConnectionType.class );
TestClass( IRedNetConnection.class );
}
@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 );
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() );
if ( list.isEmpty() && ia != null )
{
pinv.setInventorySlotContents( pinv.currentItem, null );
ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) );
ItemStack extraB = ia.addItems( component.stack( 1 ) );
ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) );
if ( extraA != null )
player.dropPlayerItemWithRandomChoice( extraA, false );
if ( extraB != null )
player.dropPlayerItemWithRandomChoice( extraB, false );
if ( player.inventoryContainer != null )
player.inventoryContainer.detectAndSendChanges();
return true;
}
}
+7 -39
View File
@@ -20,7 +20,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnection;
import appeng.api.implementations.parts.IPartCable;
@@ -321,8 +320,9 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
}
private static final ThreadLocal<Boolean> isLoading = new ThreadLocal();
public static boolean isLoading() {
public static boolean isLoading()
{
Boolean is = isLoading.get();
return is != null && is == true;
}
@@ -331,10 +331,10 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
{
if ( inWorld )
return;
inWorld = true;
isLoading.set( true );
TileEntity te = getTile();
hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord );
@@ -381,8 +381,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
}
partChanged();
isLoading.set(false);
isLoading.set( false );
}
public void removeFromWorld()
@@ -980,38 +980,6 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
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
public void securityBreak()
{
+6
View File
@@ -26,6 +26,12 @@ public class PartUpgradeable extends PartBasicState implements ISegmentedInvento
return upgrades.getInstalledUpgrades( u );
}
@Override
public boolean canConnectRedstone()
{
return upgrades.getMaxInstalled( Upgrades.REDSTONE ) > 0;
}
protected int getUpgradeSlots()
{
return 4;
+1 -1
View File
@@ -62,7 +62,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
return false;
}
private int getMaxInstalled(Upgrades u)
public int getMaxInstalled(Upgrades u)
{
Integer max = null;
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.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
@@ -17,7 +16,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IPart;
@@ -34,7 +32,6 @@ import appeng.parts.CableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType;
import appeng.transformer.annotations.integration.Method;
import appeng.util.Platform;
public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision
@@ -292,7 +289,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override
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 );
}
@@ -308,43 +305,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
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
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.MCVersion;
@MCVersion("1.7.2")
@MCVersion()
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.OreRefrence;
import buildcraft.api.tools.IToolWrench;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
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 GameProfile myProfile = new GameProfile( "[appeng]", "AE2" );
public static EntityPlayer getPlayer(WorldServer w)
{
@@ -898,7 +894,7 @@ public class Platform
if ( wrp != null )
return wrp;
EntityPlayer p = FakePlayerFactory.get( w, myProfile );
EntityPlayer p = FakePlayerFactory.getMinecraft( w );
fakePlayers.put( w, p );
return p;
}
+3 -4
View File
@@ -2,8 +2,9 @@ package appeng.util.item;
import io.netty.buffer.ByteBuf;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@@ -18,8 +19,6 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAETagCompound;
import appeng.util.Platform;
import com.google.common.io.ByteStreams;
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];
data.readBytes( bd );
DataInput di = ByteStreams.newDataInput( bd );
DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) );
d.setTag( "tag", CompressedStreamTools.read( di ) );
}