Redstone Logic for Level Emitters
This commit is contained in:
@@ -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
|
@Override
|
||||||
public boolean canProvidePower()
|
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)
|
public void onNeighborBlockChange(World w, int x, int y, int z, int meh)
|
||||||
{
|
{
|
||||||
cb( w, x, y, z ).onNeighborChanged();
|
cb( w, x, y, z ).onNeighborChanged();
|
||||||
// kinda works
|
|
||||||
/*
|
|
||||||
* if ( cb( w, x, y, z ).isEmpty() ) { w.setBlockToAir( x, y, z ); }
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -225,19 +196,33 @@ public class BlockCableBus extends AEBaseBlock
|
|||||||
@Override
|
@Override
|
||||||
public boolean canConnectRedstone(IBlockAccess w, int x, int y, int z, int side)
|
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
|
@Override
|
||||||
public int isProvidingWeakPower(IBlockAccess w, int x, int y, int z, int side)
|
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
|
@Override
|
||||||
public int isProvidingStrongPower(IBlockAccess w, int x, int y, int z, int side)
|
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
|
@Override
|
||||||
|
|||||||
@@ -34,13 +34,11 @@ import appeng.api.storage.data.IAEStack;
|
|||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.client.texture.CableBusTextures;
|
import appeng.client.texture.CableBusTextures;
|
||||||
import appeng.core.AELog;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
import appeng.tile.inventory.InvOperation;
|
import appeng.tile.inventory.InvOperation;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
|
||||||
|
|
||||||
public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHost, IMEMonitorHandlerReciever<IAEItemStack>
|
public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHost, IMEMonitorHandlerReciever<IAEItemStack>
|
||||||
{
|
{
|
||||||
@@ -96,8 +94,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo
|
|||||||
{
|
{
|
||||||
host.markForUpdate();
|
host.markForUpdate();
|
||||||
TileEntity te = host.getTile();
|
TileEntity te = host.getTile();
|
||||||
te.worldObj.notifyBlocksOfNeighborChange( te.xCoord, te.yCoord, te.zCoord, 0 );
|
|
||||||
prevState = isLevelEmitterOn();
|
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;
|
lastReportedValue = 0;
|
||||||
FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
|
FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||||
Collection<IAEItemStack> fuzzyList = monitor.getStorageList().findFuzzy( myStack, fzMode );
|
Collection<IAEItemStack> fuzzyList = monitor.getStorageList().findFuzzy( myStack, fzMode );
|
||||||
AELog.info( "FuzzyMatches: " + fuzzyList.size() );
|
|
||||||
for (IAEItemStack st : fuzzyList)
|
for (IAEItemStack st : fuzzyList)
|
||||||
{
|
|
||||||
|
|
||||||
AELog.info( "Matched: " + ((AEItemStack) st).getItemDamage() );
|
|
||||||
lastReportedValue += st.getStackSize();
|
lastReportedValue += st.getStackSize();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -490,6 +484,24 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo
|
|||||||
return 16;
|
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
|
@Override
|
||||||
public IInventory getInventoryByName(String name)
|
public IInventory getInventoryByName(String name)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user