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:
@@ -325,6 +325,17 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
{
|
{
|
||||||
if ( p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode() )
|
if ( p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode() )
|
||||||
{
|
{
|
||||||
|
for (Slot s : (List<Slot>) inventorySlots.inventorySlots)
|
||||||
|
{
|
||||||
|
if ( s.getSlotIndex() == j && s.inventory == ((AEBaseContainer) inventorySlots).getPlayerInv() )
|
||||||
|
{
|
||||||
|
if ( !s.canTakeStack( ((AEBaseContainer) inventorySlots).getPlayerInv().player ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( theSlot.getSlotStackLimit() == 64 )
|
if ( theSlot.getSlotStackLimit() == 64 )
|
||||||
{
|
{
|
||||||
this.handleMouseClick( theSlot, theSlot.slotNumber, j, 2 );
|
this.handleMouseClick( theSlot, theSlot.slotNumber, j, 2 );
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public enum GuiText
|
|||||||
|
|
||||||
CopyMode, CopyModeDesc, PatternTerminal, CraftingPattern, ProcessingPattern, Crafts, Creates, And, With, MolecularAssembler,
|
CopyMode, CopyModeDesc, PatternTerminal, CraftingPattern, ProcessingPattern, Crafts, Creates, And, With, MolecularAssembler,
|
||||||
|
|
||||||
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurificationCertus, inWorldPurificationNether, inWorldPurificationFluix, inWorldSingularity,
|
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurificationCertus, inWorldPurificationNether, inWorldPurificationFluix, inWorldSingularity, ChargedQuartz,
|
||||||
|
|
||||||
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty;
|
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package appeng.core.settings;
|
|||||||
|
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
|
|
||||||
public enum TickRates {
|
public enum TickRates
|
||||||
|
{
|
||||||
|
|
||||||
Interface(5,120),
|
Interface(5, 120),
|
||||||
|
|
||||||
ImportBus(5, 40),
|
ImportBus(5, 40),
|
||||||
|
|
||||||
@@ -22,21 +23,25 @@ public enum TickRates {
|
|||||||
|
|
||||||
VibrationChamber(10, 40),
|
VibrationChamber(10, 40),
|
||||||
|
|
||||||
StorageBus(5, 60);
|
StorageBus(5, 60),
|
||||||
|
|
||||||
|
ItemTunnel(5, 60);
|
||||||
|
|
||||||
public int min;
|
public int min;
|
||||||
public int max;
|
public int max;
|
||||||
|
|
||||||
private TickRates( int min, int max ) {
|
private TickRates(int min, int max) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load( AEConfig config )
|
public void Load(AEConfig config)
|
||||||
{
|
{
|
||||||
config.addCustomCategoryComment("TickRates", " Min / Max Tickrates for dynamic ticking, most of these components also use sleeping, to prevent constant ticking, adjust with care, non standard rates are not supported or tested." );
|
config.addCustomCategoryComment(
|
||||||
min = config.get( "TickRates", name()+".min", min ).getInt(min);
|
"TickRates",
|
||||||
max = config.get( "TickRates", name()+".max", max ).getInt(max);
|
" Min / Max Tickrates for dynamic ticking, most of these components also use sleeping, to prevent constant ticking, adjust with care, non standard rates are not supported or tested." );
|
||||||
|
min = config.get( "TickRates", name() + ".min", min ).getInt( min );
|
||||||
|
max = config.get( "TickRates", name() + ".max", max ).getInt( max );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-5
@@ -80,6 +80,12 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
|||||||
public static ThreadLocal<Boolean> disableFacadeOcclusion = new ThreadLocal<Boolean>();
|
public static ThreadLocal<Boolean> disableFacadeOcclusion = new ThreadLocal<Boolean>();
|
||||||
public CableBusContainer cb = new CableBusContainer( this );
|
public CableBusContainer cb = new CableBusContainer( this );
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInWorld()
|
||||||
|
{
|
||||||
|
return cb.isInWorld();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesTick()
|
public boolean doesTick()
|
||||||
{
|
{
|
||||||
@@ -467,11 +473,7 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
|||||||
@Override
|
@Override
|
||||||
public void partChanged()
|
public void partChanged()
|
||||||
{
|
{
|
||||||
if ( tile() instanceof TIInventoryTile )
|
notifyNeighbors();
|
||||||
((TIInventoryTile) tile()).rebuildSlotMap();
|
|
||||||
|
|
||||||
if ( world() != null )
|
|
||||||
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -543,4 +545,14 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
|||||||
tile().remPart( this );
|
tile().remPart( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyNeighbors()
|
||||||
|
{
|
||||||
|
if ( tile() instanceof TIInventoryTile )
|
||||||
|
((TIInventoryTile) tile()).rebuildSlotMap();
|
||||||
|
|
||||||
|
if ( world() != null && world().blockExists( x(), y(), z() ) )
|
||||||
|
world().notifyBlocksOfNeighborChange( x(), y(), z(), Platform.air );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,4 +140,16 @@ public class AECableSchematicTile extends AEGenericSchematicTile implements IPar
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyNeighbors()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInWorld()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
|||||||
|
|
||||||
private void addRecipes()
|
private void addRecipes()
|
||||||
{
|
{
|
||||||
|
addRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged, GuiText.ChargedQuartz.getLocal() );
|
||||||
|
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||||
addRecipe( AEApi.instance().materials().materialFluixCrystal, GuiText.inWorldFluix.getLocal() );
|
addRecipe( AEApi.instance().materials().materialFluixCrystal, GuiText.inWorldFluix.getLocal() );
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class Grid implements IGrid
|
|||||||
HashMap<Class<? extends IGridCache>, GridCacheWrapper> caches = new HashMap<Class<? extends IGridCache>, GridCacheWrapper>();
|
HashMap<Class<? extends IGridCache>, GridCacheWrapper> caches = new HashMap<Class<? extends IGridCache>, GridCacheWrapper>();
|
||||||
|
|
||||||
GridNode pivot;
|
GridNode pivot;
|
||||||
|
int isImportant; // how import is this network?
|
||||||
|
|
||||||
public Grid(GridNode center) {
|
public Grid(GridNode center) {
|
||||||
this.pivot = center;
|
this.pivot = center;
|
||||||
@@ -228,4 +229,10 @@ public class Grid implements IGrid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setImportantFlag(int i, boolean publicHasPower)
|
||||||
|
{
|
||||||
|
int flag = 1 << i;
|
||||||
|
isImportant = (isImportant & ~flag) | (publicHasPower ? flag : 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
GridPropagator gp = new GridPropagator( a.getInternalGrid() );
|
GridPropagator gp = new GridPropagator( a.getInternalGrid() );
|
||||||
b.beginVisition( gp );
|
b.beginVisition( gp );
|
||||||
}
|
}
|
||||||
else if ( a.myGrid.size() > b.myGrid.size() )
|
else if ( isNetworkABetter( a, b ) )
|
||||||
{
|
{
|
||||||
GridPropagator gp = new GridPropagator( a.getInternalGrid() );
|
GridPropagator gp = new GridPropagator( a.getInternalGrid() );
|
||||||
b.beginVisition( gp );
|
b.beginVisition( gp );
|
||||||
@@ -82,6 +82,11 @@ public class GridConnection implements IGridConnection, IPathItem
|
|||||||
sideB.addConnection( this );
|
sideB.addConnection( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isNetworkABetter(GridNode a, GridNode b)
|
||||||
|
{
|
||||||
|
return ((Grid) a.myGrid).isImportant > ((Grid) b.myGrid).isImportant || a.myGrid.size() > b.myGrid.size();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy()
|
||||||
{
|
{
|
||||||
|
|||||||
Vendored
+2
@@ -27,6 +27,7 @@ import appeng.api.networking.events.MENetworkPowerStatusChange;
|
|||||||
import appeng.api.networking.events.MENetworkPowerStorage;
|
import appeng.api.networking.events.MENetworkPowerStorage;
|
||||||
import appeng.api.networking.pathing.IPathingGrid;
|
import appeng.api.networking.pathing.IPathingGrid;
|
||||||
import appeng.api.networking.storage.IStackWatcherHost;
|
import appeng.api.networking.storage.IStackWatcherHost;
|
||||||
|
import appeng.me.Grid;
|
||||||
import appeng.me.GridNode;
|
import appeng.me.GridNode;
|
||||||
import appeng.me.energy.EnergyThreshold;
|
import appeng.me.energy.EnergyThreshold;
|
||||||
import appeng.me.energy.EnergyWatcher;
|
import appeng.me.energy.EnergyWatcher;
|
||||||
@@ -379,6 +380,7 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
publicHasPower = newState;
|
publicHasPower = newState;
|
||||||
|
((Grid) myGrid).setImportantFlag( 0, publicHasPower );
|
||||||
grid.postEvent( new MENetworkPowerStatusChange() );
|
grid.postEvent( new MENetworkPowerStatusChange() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+15
-7
@@ -74,8 +74,8 @@ public class P2PCache implements IGridCache
|
|||||||
|
|
||||||
// AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq
|
// AELog.info( "update-" + (t.output ? "output: " : "input: ") + t.freq
|
||||||
// );
|
// );
|
||||||
updateTunnel( t.freq, t.output );
|
updateTunnel( t.freq, t.output, true );
|
||||||
updateTunnel( t.freq, !t.output );
|
updateTunnel( t.freq, !t.output, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -98,7 +98,7 @@ public class P2PCache implements IGridCache
|
|||||||
else
|
else
|
||||||
inputs.put( t.freq, t );
|
inputs.put( t.freq, t );
|
||||||
|
|
||||||
updateTunnel( t.freq, !t.output );
|
updateTunnel( t.freq, !t.output, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,18 +122,26 @@ public class P2PCache implements IGridCache
|
|||||||
else
|
else
|
||||||
inputs.remove( t.freq );
|
inputs.remove( t.freq );
|
||||||
|
|
||||||
updateTunnel( t.freq, !t.output );
|
updateTunnel( t.freq, !t.output, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTunnel(long freq, boolean updateOutputs)
|
private void updateTunnel(long freq, boolean updateOutputs, boolean configChange)
|
||||||
{
|
{
|
||||||
for (PartP2PTunnel p : outputs.get( freq ))
|
for (PartP2PTunnel p : outputs.get( freq ))
|
||||||
p.onChange();
|
{
|
||||||
|
if ( configChange )
|
||||||
|
p.onTunnelConfigChange();
|
||||||
|
p.onTunnelNetworkChange();
|
||||||
|
}
|
||||||
|
|
||||||
PartP2PTunnel in = inputs.get( freq );
|
PartP2PTunnel in = inputs.get( freq );
|
||||||
if ( in != null )
|
if ( in != null )
|
||||||
in.onChange();
|
{
|
||||||
|
if ( configChange )
|
||||||
|
in.onTunnelConfigChange();
|
||||||
|
in.onTunnelNetworkChange();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TunnelCollection<PartP2PTunnel> getOutputs(long freq, Class<? extends PartP2PTunnel> c)
|
public TunnelCollection<PartP2PTunnel> getOutputs(long freq, Class<? extends PartP2PTunnel> c)
|
||||||
|
|||||||
@@ -64,6 +64,12 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
boolean inWorld = false;
|
boolean inWorld = false;
|
||||||
public boolean requiresDynamicRender = false;
|
public boolean requiresDynamicRender = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInWorld()
|
||||||
|
{
|
||||||
|
return inWorld;
|
||||||
|
}
|
||||||
|
|
||||||
public void setHost(IPartHost host)
|
public void setHost(IPartHost host)
|
||||||
{
|
{
|
||||||
tcb.clearContainer();
|
tcb.clearContainer();
|
||||||
@@ -364,12 +370,15 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromWorld()
|
public void removeFromWorld()
|
||||||
{
|
{
|
||||||
if ( !inWorld )
|
if ( !inWorld )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inWorld = false;
|
inWorld = false;
|
||||||
|
|
||||||
for (ForgeDirection s : ForgeDirection.values())
|
for (ForgeDirection s : ForgeDirection.values())
|
||||||
@@ -378,6 +387,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
if ( part != null )
|
if ( part != null )
|
||||||
part.removeFromWorld();
|
part.removeFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectRedstone(EnumSet<ForgeDirection> enumSet)
|
public boolean canConnectRedstone(EnumSet<ForgeDirection> enumSet)
|
||||||
@@ -1014,4 +1025,10 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
tcb.cleanup();
|
tcb.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyNeighbors()
|
||||||
|
{
|
||||||
|
tcb.notifyNeighbors();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
|||||||
return getEnergySinkTile().getWorldObj();
|
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()
|
final private void addToENet()
|
||||||
{
|
{
|
||||||
if ( getEnergySinkWorld() == null )
|
if ( getEnergySinkWorld() == null )
|
||||||
@@ -42,7 +52,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
|
|||||||
// re-add
|
// re-add
|
||||||
removeFromENet();
|
removeFromENet();
|
||||||
|
|
||||||
if ( !isInIC2() && Platform.isServer() )
|
if ( !isInIC2() && Platform.isServer() && isTileValid() )
|
||||||
{
|
{
|
||||||
getLayerFlags().add( LayerFlags.IC2_ENET );
|
getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) getEnergySinkTile() ) );
|
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()
|
final private boolean interestedInIC2()
|
||||||
{
|
{
|
||||||
|
if ( !((IPartHost) this).isInWorld() )
|
||||||
|
return false;
|
||||||
|
|
||||||
int interested = 0;
|
int interested = 0;
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,14 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
|||||||
return getEnergySourceTile().getWorldObj();
|
return getEnergySourceTile().getWorldObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isTileValid()
|
||||||
|
{
|
||||||
|
TileEntity te = getEnergySourceTile();
|
||||||
|
if ( te == null )
|
||||||
|
return false;
|
||||||
|
return !te.isInvalid();
|
||||||
|
}
|
||||||
|
|
||||||
final private void addToENet()
|
final private void addToENet()
|
||||||
{
|
{
|
||||||
if ( getEnergySourceWorld() == null )
|
if ( getEnergySourceWorld() == null )
|
||||||
@@ -43,7 +51,7 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
|
|||||||
// re-add
|
// re-add
|
||||||
removeFromENet();
|
removeFromENet();
|
||||||
|
|
||||||
if ( !isInIC2() && Platform.isServer() )
|
if ( !isInIC2() && Platform.isServer() && isTileValid() )
|
||||||
{
|
{
|
||||||
getLayerFlags().add( LayerFlags.IC2_ENET );
|
getLayerFlags().add( LayerFlags.IC2_ENET );
|
||||||
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) getEnergySourceTile() ) );
|
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()
|
final private boolean interestedInIC2()
|
||||||
{
|
{
|
||||||
|
if ( !((IPartHost) this).isInWorld() )
|
||||||
|
return false;
|
||||||
|
|
||||||
int interested = 0;
|
int interested = 0;
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
|||||||
* Recalculate inventory wrapper cache.
|
* Recalculate inventory wrapper cache.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void partChanged()
|
public void notifyNeighbors()
|
||||||
{
|
{
|
||||||
invs = new ArrayList();
|
invs = new ArrayList();
|
||||||
int slotCount = 0;
|
int slotCount = 0;
|
||||||
@@ -90,7 +90,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make sure inventory is updated before we call FMP.
|
// make sure inventory is updated before we call FMP.
|
||||||
super.partChanged();
|
super.notifyNeighbors();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -62,12 +62,6 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
return BusSupport.CABLE;
|
return BusSupport.CABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightLevel()
|
|
||||||
{
|
|
||||||
return 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IIcon getGlassTexture(AEColor c)
|
public IIcon getGlassTexture(AEColor c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
|
|||||||
@@ -103,7 +103,13 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
|
{
|
||||||
|
getHost().notifyNeighbors();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTunnelConfigChange()
|
||||||
{
|
{
|
||||||
getHost().partChanged();
|
getHost().partChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-12
@@ -13,11 +13,16 @@ import net.minecraft.tileentity.TileEntityChest;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.config.TunnelType;
|
import appeng.api.config.TunnelType;
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
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.AppEng;
|
||||||
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.integration.abstraction.IBC;
|
import appeng.integration.abstraction.IBC;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.cache.helpers.TunnelCollection;
|
import appeng.me.cache.helpers.TunnelCollection;
|
||||||
@@ -34,7 +39,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@Interface(iface = "buildcraft.api.transport.IPipeConnection", iname = "BC")
|
@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()
|
public TunnelType getTunnelType()
|
||||||
@@ -47,6 +52,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
int oldSize = 0;
|
int oldSize = 0;
|
||||||
|
boolean requsted;
|
||||||
IInventory cachedInv;
|
IInventory cachedInv;
|
||||||
|
|
||||||
LinkedList<IInventory> which = new LinkedList<IInventory>();
|
LinkedList<IInventory> which = new LinkedList<IInventory>();
|
||||||
@@ -116,11 +122,31 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
|||||||
cachedInv = null;
|
cachedInv = null;
|
||||||
PartP2PItems input = getInput();
|
PartP2PItems input = getInput();
|
||||||
if ( input != null && output )
|
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()
|
IInventory getDest()
|
||||||
{
|
{
|
||||||
|
requsted = true;
|
||||||
|
|
||||||
if ( cachedInv != null )
|
if ( cachedInv != null )
|
||||||
return cachedInv;
|
return cachedInv;
|
||||||
|
|
||||||
@@ -161,8 +187,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
|||||||
oldSize = getDest().getSizeInventory();
|
oldSize = getDest().getSizeInventory();
|
||||||
if ( olderSize != oldSize )
|
if ( olderSize != oldSize )
|
||||||
{
|
{
|
||||||
getHost().partChanged();
|
getHost().notifyNeighbors();
|
||||||
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,8 +202,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
|||||||
oldSize = getDest().getSizeInventory();
|
oldSize = getDest().getSizeInventory();
|
||||||
if ( olderSize != oldSize )
|
if ( olderSize != oldSize )
|
||||||
{
|
{
|
||||||
getHost().partChanged();
|
getHost().notifyNeighbors();
|
||||||
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,14 +217,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
|||||||
oldSize = getDest().getSizeInventory();
|
oldSize = getDest().getSizeInventory();
|
||||||
if ( olderSize != oldSize )
|
if ( olderSize != oldSize )
|
||||||
{
|
{
|
||||||
getHost().partChanged();
|
getHost().notifyNeighbors();
|
||||||
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
{
|
{
|
||||||
if ( !output )
|
if ( !output )
|
||||||
{
|
{
|
||||||
@@ -209,15 +232,14 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
|||||||
oldSize = getDest().getSizeInventory();
|
oldSize = getDest().getSizeInventory();
|
||||||
if ( olderSize != oldSize )
|
if ( olderSize != oldSize )
|
||||||
{
|
{
|
||||||
getHost().partChanged();
|
getHost().notifyNeighbors();
|
||||||
tile.getWorldObj().notifyBlocksOfNeighborChange( tile.xCoord, tile.yCoord, tile.zCoord, Platform.air );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartP2PItems input = getInput();
|
PartP2PItems input = getInput();
|
||||||
if ( input != null )
|
if ( input != null )
|
||||||
input.onChange();
|
input.getHost().notifyNeighbors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,12 +116,12 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
|||||||
{
|
{
|
||||||
PartP2PLiquids in = getInput();
|
PartP2PLiquids in = getInput();
|
||||||
if ( in != null )
|
if ( in != null )
|
||||||
in.onChange();
|
in.onTunnelNetworkChange();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
{
|
{
|
||||||
cachedTank = null;
|
cachedTank = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements cof
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
{
|
{
|
||||||
getHost().partChanged();
|
getHost().notifyNeighbors();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPowerDrainPerTick()
|
public float getPowerDrainPerTick()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
{
|
{
|
||||||
setNetworkReady();
|
setNetworkReady();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
|||||||
// :P
|
// :P
|
||||||
}
|
}
|
||||||
|
|
||||||
newTunnel.onChange();
|
newTunnel.onTunnelNetworkChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
|
mc.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
|
||||||
@@ -165,7 +165,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
|||||||
{
|
{
|
||||||
PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
PartP2PTunnel newTunnel = (PartP2PTunnel) newBus;
|
||||||
newTunnel.output = oldOutput;
|
newTunnel.output = oldOutput;
|
||||||
newTunnel.onChange();
|
newTunnel.onTunnelNetworkChange();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -216,7 +216,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange();
|
onTunnelConfigChange();
|
||||||
|
|
||||||
ItemStack p2pItem = getItemStack( PartItemStack.Wrench );
|
ItemStack p2pItem = getItemStack( PartItemStack.Wrench );
|
||||||
String type = p2pItem.getUnlocalizedName();
|
String type = p2pItem.getUnlocalizedName();
|
||||||
@@ -231,6 +231,10 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onTunnelConfigChange()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack(PartItemStack type)
|
public ItemStack getItemStack(PartItemStack type)
|
||||||
{
|
{
|
||||||
if ( type == PartItemStack.World || type == PartItemStack.Network || type == PartItemStack.Wrench || type == PartItemStack.Pick )
|
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() );
|
return new TunnelCollection( new ArrayList(), getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,9 +92,9 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange()
|
public void onTunnelNetworkChange()
|
||||||
{
|
{
|
||||||
super.onChange();
|
super.onTunnelNetworkChange();
|
||||||
if ( !output )
|
if ( !output )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInWorld()
|
||||||
|
{
|
||||||
|
return cb.isInWorld();
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateTileSetting()
|
protected void updateTileSetting()
|
||||||
{
|
{
|
||||||
if ( cb.requiresDynamicRender )
|
if ( cb.requiresDynamicRender )
|
||||||
@@ -283,7 +289,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
|||||||
@Override
|
@Override
|
||||||
public void partChanged()
|
public void partChanged()
|
||||||
{
|
{
|
||||||
if ( worldObj != null )
|
notifyNeighbors();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyNeighbors()
|
||||||
|
{
|
||||||
|
if ( worldObj != null && worldObj.blockExists( xCoord, yCoord, zCoord ) )
|
||||||
worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air );
|
worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, Platform.air );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,18 @@ public class WrapperChainedInventory implements IInventory
|
|||||||
setInventory( ilist );
|
setInventory( ilist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cycleOrder()
|
||||||
|
{
|
||||||
|
if ( l.size() > 1 )
|
||||||
|
{
|
||||||
|
List<IInventory> newOrder = new ArrayList( l.size() );
|
||||||
|
newOrder.add( l.get( l.size() - 1 ) );
|
||||||
|
for (int x = 0; x < l.size() - 1; x++)
|
||||||
|
newOrder.add( l.get( x ) );
|
||||||
|
setInventory( newOrder );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void calculateSizes()
|
public void calculateSizes()
|
||||||
{
|
{
|
||||||
offsets = new HashMap<Integer, WrapperChainedInventory.InvOffset>();
|
offsets = new HashMap<Integer, WrapperChainedInventory.InvOffset>();
|
||||||
@@ -195,4 +207,5 @@ public class WrapperChainedInventory implements IInventory
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user