Redstone Logic for Level Emitters
This commit is contained in:
parent
53c5285ea0
commit
57a91c2969
|
@ -157,31 +157,6 @@ public class BlockCableBus extends AEBaseBlock
|
|||
|
||||
}
|
||||
|
||||
private int rs(int side)
|
||||
{
|
||||
int s = 0;
|
||||
switch (side)
|
||||
{
|
||||
case -1:
|
||||
s = 1;
|
||||
break;
|
||||
case 1:
|
||||
s = 2;
|
||||
break;
|
||||
case 2:
|
||||
s = 5;
|
||||
break;
|
||||
case 3:
|
||||
s = 3;
|
||||
break;
|
||||
case 4:
|
||||
s = 4;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
|
@ -198,10 +173,6 @@ public class BlockCableBus extends AEBaseBlock
|
|||
public void onNeighborBlockChange(World w, int x, int y, int z, int meh)
|
||||
{
|
||||
cb( w, x, y, z ).onNeighborChanged();
|
||||
// kinda works
|
||||
/*
|
||||
* if ( cb( w, x, y, z ).isEmpty() ) { w.setBlockToAir( x, y, z ); }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -225,19 +196,33 @@ public class BlockCableBus extends AEBaseBlock
|
|||
@Override
|
||||
public boolean canConnectRedstone(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
return cb( w, x, y, z ).canConnectRedstone( ForgeDirection.getOrientation( rs( side ) ) );
|
||||
switch (side)
|
||||
{
|
||||
case -1:
|
||||
case 4:
|
||||
return cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) );
|
||||
case 0:
|
||||
return cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.NORTH ) );
|
||||
case 1:
|
||||
return cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.EAST ) );
|
||||
case 2:
|
||||
return cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.SOUTH ) );
|
||||
case 3:
|
||||
return cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.WEST ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
return cb( w, x, y, z ).isProvidingWeakPower( ForgeDirection.getOrientation( side ) );
|
||||
return cb( w, x, y, z ).isProvidingWeakPower( ForgeDirection.getOrientation( side ).getOpposite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
return cb( w, x, y, z ).isProvidingStrongPower( ForgeDirection.getOrientation( side ) );
|
||||
return cb( w, x, y, z ).isProvidingStrongPower( ForgeDirection.getOrientation( side ).getOpposite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,13 +34,11 @@ import appeng.api.storage.data.IAEStack;
|
|||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHost, IMEMonitorHandlerReciever<IAEItemStack>
|
||||
{
|
||||
|
@ -96,8 +94,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo
|
|||
{
|
||||
host.markForUpdate();
|
||||
TileEntity te = host.getTile();
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
||||
prevState = isLevelEmitterOn();
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,13 +205,8 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo
|
|||
lastReportedValue = 0;
|
||||
FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
Collection<IAEItemStack> fuzzyList = monitor.getStorageList().findFuzzy( myStack, fzMode );
|
||||
AELog.info( "FuzzyMatches: " + fuzzyList.size() );
|
||||
for (IAEItemStack st : fuzzyList)
|
||||
{
|
||||
|
||||
AELog.info( "Matched: " + ((AEItemStack) st).getItemDamage() );
|
||||
lastReportedValue += st.getStackSize();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -490,6 +484,24 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo
|
|||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower()
|
||||
{
|
||||
return prevState ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower()
|
||||
{
|
||||
return prevState ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue