Also Cables no longer glow in the dark :P

Merge branch 'master' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1

Conflicts:
	core/localization/GuiText.java
This commit is contained in:
AlgorithmX2
2014-06-08 21:13:53 -05:00
24 changed files with 226 additions and 70 deletions
+17
View File
@@ -64,6 +64,12 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
boolean inWorld = false;
public boolean requiresDynamicRender = false;
@Override
public boolean isInWorld()
{
return inWorld;
}
public void setHost(IPartHost host)
{
tcb.clearContainer();
@@ -364,12 +370,15 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
}
}
}
partChanged();
}
public void removeFromWorld()
{
if ( !inWorld )
return;
inWorld = false;
for (ForgeDirection s : ForgeDirection.values())
@@ -378,6 +387,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
if ( part != null )
part.removeFromWorld();
}
partChanged();
}
public boolean canConnectRedstone(EnumSet<ForgeDirection> enumSet)
@@ -1014,4 +1025,10 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
tcb.cleanup();
}
@Override
public void notifyNeighbors()
{
tcb.notifyNeighbors();
}
}
+15 -2
View File
@@ -30,10 +30,20 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
{
if ( getEnergySinkTile() == null )
return null;
return getEnergySinkTile().getWorldObj();
}
private boolean isTileValid()
{
TileEntity te = getEnergySinkTile();
if ( te == null )
return false;
return !te.isInvalid() && te.getWorldObj().blockExists( te.xCoord, te.yCoord, te.zCoord );
}
final private void addToENet()
{
if ( getEnergySinkWorld() == null )
@@ -42,7 +52,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
// re-add
removeFromENet();
if ( !isInIC2() && Platform.isServer() )
if ( !isInIC2() && Platform.isServer() && isTileValid() )
{
getLayerFlags().add( LayerFlags.IC2_ENET );
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) getEnergySinkTile() ) );
@@ -63,6 +73,9 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
final private boolean interestedInIC2()
{
if ( !((IPartHost) this).isInWorld() )
return false;
int interested = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
+12 -1
View File
@@ -35,6 +35,14 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
return getEnergySourceTile().getWorldObj();
}
private boolean isTileValid()
{
TileEntity te = getEnergySourceTile();
if ( te == null )
return false;
return !te.isInvalid();
}
final private void addToENet()
{
if ( getEnergySourceWorld() == null )
@@ -43,7 +51,7 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
// re-add
removeFromENet();
if ( !isInIC2() && Platform.isServer() )
if ( !isInIC2() && Platform.isServer() && isTileValid() )
{
getLayerFlags().add( LayerFlags.IC2_ENET );
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) getEnergySourceTile() ) );
@@ -64,6 +72,9 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
final private boolean interestedInIC2()
{
if ( !((IPartHost) this).isInWorld() )
return false;
int interested = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
+2 -2
View File
@@ -38,7 +38,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
* Recalculate inventory wrapper cache.
*/
@Override
public void partChanged()
public void notifyNeighbors()
{
invs = new ArrayList();
int slotCount = 0;
@@ -90,7 +90,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
}
// make sure inventory is updated before we call FMP.
super.partChanged();
super.notifyNeighbors();
}
/**
-6
View File
@@ -62,12 +62,6 @@ public class PartCable extends AEBasePart implements IPartCable
return BusSupport.CABLE;
}
@Override
public int getLightLevel()
{
return 11;
}
public IIcon getGlassTexture(AEColor c)
{
switch (c)
+7 -1
View File
@@ -103,7 +103,13 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
}
@Override
public void onChange()
public void onTunnelNetworkChange()
{
getHost().notifyNeighbors();
}
@Override
public void onTunnelConfigChange()
{
getHost().partChanged();
}
+34 -12
View File
@@ -13,11 +13,16 @@ import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.TunnelType;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkBootingStatusChange;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.integration.abstraction.IBC;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
@@ -34,7 +39,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Interface(iface = "buildcraft.api.transport.IPipeConnection", iname = "BC")
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeConnection, IInventory, ISidedInventory
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeConnection, IInventory, ISidedInventory, IGridTickable
{
public TunnelType getTunnelType()
@@ -47,6 +52,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
int oldSize = 0;
boolean requsted;
IInventory cachedInv;
LinkedList<IInventory> which = new LinkedList<IInventory>();
@@ -116,11 +122,31 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
cachedInv = null;
PartP2PItems input = getInput();
if ( input != null && output )
input.onChange();
input.onTunnelNetworkChange();
}
@Override
public TickingRequest getTickingRequest(IGridNode node)
{
return new TickingRequest( TickRates.ItemTunnel.min, TickRates.ItemTunnel.max, false, false );
}
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
{
boolean wasReq = requsted;
if ( requsted && cachedInv != null )
((WrapperChainedInventory) cachedInv).cycleOrder();
requsted = false;
return wasReq ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
}
IInventory getDest()
{
requsted = true;
if ( cachedInv != null )
return cachedInv;
@@ -161,8 +187,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
oldSize = getDest().getSizeInventory();
if ( olderSize != oldSize )
{
getHost().partChanged();
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
getHost().notifyNeighbors();
}
}
}
@@ -177,8 +202,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
oldSize = getDest().getSizeInventory();
if ( olderSize != oldSize )
{
getHost().partChanged();
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
getHost().notifyNeighbors();
}
}
}
@@ -193,14 +217,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
oldSize = getDest().getSizeInventory();
if ( olderSize != oldSize )
{
getHost().partChanged();
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
getHost().notifyNeighbors();
}
}
}
@Override
public void onChange()
public void onTunnelNetworkChange()
{
if ( !output )
{
@@ -209,15 +232,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
oldSize = getDest().getSizeInventory();
if ( olderSize != oldSize )
{
getHost().partChanged();
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
getHost().notifyNeighbors();
}
}
else
{
PartP2PItems input = getInput();
if ( input != null )
input.onChange();
input.getHost().notifyNeighbors();
}
}
+2 -2
View File
@@ -116,12 +116,12 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
{
PartP2PLiquids in = getInput();
if ( in != null )
in.onChange();
in.onTunnelNetworkChange();
}
};
@Override
public void onChange()
public void onTunnelNetworkChange()
{
cachedTank = null;
}
+2 -2
View File
@@ -67,9 +67,9 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements cof
}
@Override
public void onChange()
public void onTunnelNetworkChange()
{
getHost().partChanged();
getHost().notifyNeighbors();
}
public float getPowerDrainPerTick()
+1 -1
View File
@@ -49,7 +49,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
}
@Override
public void onChange()
public void onTunnelNetworkChange()
{
setNetworkReady();
}
+8 -4
View File
@@ -105,7 +105,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
// :P
}
newTunnel.onChange();
newTunnel.onTunnelNetworkChange();
}
mc.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
@@ -165,7 +165,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
{
PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
newTunnel.output = oldOutput;
newTunnel.onChange();
newTunnel.onTunnelNetworkChange();
try
{
@@ -216,7 +216,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
}
}
onChange();
onTunnelConfigChange();
ItemStack p2pItem = getItemStack( PartItemStack.Wrench );
String type = p2pItem.getUnlocalizedName();
@@ -231,6 +231,10 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
return false;
}
public void onTunnelConfigChange()
{
}
public ItemStack getItemStack(PartItemStack type)
{
if ( type == PartItemStack.World || type == PartItemStack.Network || type == PartItemStack.Wrench || type == PartItemStack.Pick )
@@ -271,7 +275,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
return new TunnelCollection( new ArrayList(), getClass() );
}
public void onChange()
public void onTunnelNetworkChange()
{
}
+2 -2
View File
@@ -92,9 +92,9 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public void onChange()
public void onTunnelNetworkChange()
{
super.onChange();
super.onTunnelNetworkChange();
if ( !output )
{
try