Merged changes
This commit is contained in:
parent
f7f4bd7243
commit
c59b64f7c9
2 changed files with 33 additions and 7 deletions
|
@ -207,7 +207,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
{
|
{
|
||||||
byte connections = 0x00;
|
byte connections = 0x00;
|
||||||
|
|
||||||
if(handlesRedstone() && redstoneReactive && world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
if(handlesRedstone() && redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile())))
|
||||||
{
|
{
|
||||||
return connections;
|
return connections;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
{
|
{
|
||||||
byte connections = 0x00;
|
byte connections = 0x00;
|
||||||
|
|
||||||
if(handlesRedstone() && redstoneReactive && world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
if(handlesRedstone() && redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile())))
|
||||||
{
|
{
|
||||||
return connections;
|
return connections;
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnect(ForgeDirection side)
|
public boolean canConnect(ForgeDirection side)
|
||||||
{
|
{
|
||||||
boolean powered = world().isBlockIndirectlyGettingPowered(x(), y(), z());
|
boolean powered = MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
|
||||||
|
|
||||||
if(handlesRedstone() && redstoneReactive && powered)
|
if(handlesRedstone() && redstoneReactive && powered)
|
||||||
{
|
{
|
||||||
|
@ -504,7 +504,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
|
|
||||||
public void redstoneRefresh()
|
public void redstoneRefresh()
|
||||||
{
|
{
|
||||||
boolean nowPowered = redstoneReactive && world().isBlockIndirectlyGettingPowered(x(), y(), z());
|
boolean nowPowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
|
||||||
|
|
||||||
if(nowPowered != redstonePowered)
|
if(nowPowered != redstonePowered)
|
||||||
{
|
{
|
||||||
|
@ -522,7 +522,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
{
|
{
|
||||||
if(handlesRedstone())
|
if(handlesRedstone())
|
||||||
{
|
{
|
||||||
boolean nowPowered = redstoneReactive && world().isBlockIndirectlyGettingPowered(x(), y(), z());
|
boolean nowPowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
|
||||||
|
|
||||||
if(nowPowered != redstonePowered)
|
if(nowPowered != redstonePowered)
|
||||||
{
|
{
|
||||||
|
@ -563,7 +563,8 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
public void onAdded()
|
public void onAdded()
|
||||||
{
|
{
|
||||||
super.onAdded();
|
super.onAdded();
|
||||||
redstonePowered = redstoneReactive && world().isBlockIndirectlyGettingPowered(x(), y(), z());
|
|
||||||
|
redstonePowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
|
||||||
refreshConnections();
|
refreshConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +572,8 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
public void onChunkLoad()
|
public void onChunkLoad()
|
||||||
{
|
{
|
||||||
super.onChunkLoad();
|
super.onChunkLoad();
|
||||||
redstonePowered = redstoneReactive && world().isBlockIndirectlyGettingPowered(x(), y(), z());
|
|
||||||
|
redstonePowered = redstoneReactive && MekanismUtils.isGettingPowered(world(), Coord4D.get(tile()));
|
||||||
refreshConnections();
|
refreshConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -673,6 +673,30 @@ public final class MekanismUtils
|
||||||
return def * Math.pow(general.maxUpgradeMultiplier, numUpgrades/(float)Upgrade.ENERGY.getMax());
|
return def * Math.pow(general.maxUpgradeMultiplier, numUpgrades/(float)Upgrade.ENERGY.getMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A better "isBlockIndirectlyGettingPowered()" that doesn't load chunks
|
||||||
|
* @param world - the world to perform the check in
|
||||||
|
* @param coord - the coordinate of the block performing the check
|
||||||
|
* @return if the block is indirectly getting powered by LOADED chunks
|
||||||
|
*/
|
||||||
|
public static boolean isGettingPowered(World world, Coord4D coord)
|
||||||
|
{
|
||||||
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
Coord4D sideCoord = coord.getFromSide(side);
|
||||||
|
|
||||||
|
if(sideCoord.exists(world))
|
||||||
|
{
|
||||||
|
if(world.getIndirectPowerLevelTo(sideCoord.xCoord, sideCoord.yCoord, sideCoord.zCoord, side.ordinal()) > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Places a fake bounding block at the defined location.
|
* Places a fake bounding block at the defined location.
|
||||||
* @param world - world to place block in
|
* @param world - world to place block in
|
||||||
|
|
Loading…
Reference in a new issue