Item Nodes can now be disabled by a (weak) redstone signal

This commit is contained in:
WayofTime 2016-06-26 12:51:25 -04:00
parent adc100ee17
commit 587e94d197
4 changed files with 44 additions and 14 deletions

View file

@ -2,6 +2,7 @@
Version 2.0.2-47 Version 2.0.2-47
------------------------------------------------------ ------------------------------------------------------
- Fixed horrible memory leak in the Living Armour. - Fixed horrible memory leak in the Living Armour.
- Item Nodes can now be disabled by a (weak) redstone signal.
------------------------------------------------------ ------------------------------------------------------
Version 2.0.2-46 Version 2.0.2-46

View file

@ -41,6 +41,12 @@ public abstract class BlockRoutingNode extends BlockContainer
this.setDefaultState(this.blockState.getBaseState().withProperty(DOWN, false).withProperty(UP, false).withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false)); this.setDefaultState(this.blockState.getBaseState().withProperty(DOWN, false).withProperty(UP, false).withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false));
} }
@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
return true;
}
@Override @Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{ {

View file

@ -27,6 +27,8 @@ import WayofTime.bloodmagic.tile.TileInventory;
public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable
{ {
private int currentInput;
public TileMasterRoutingNode() public TileMasterRoutingNode()
{ {
super(0, "masterRoutingNode"); super(0, "masterRoutingNode");
@ -43,6 +45,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
@Override @Override
public void update() public void update()
{ {
if (!worldObj.isRemote)
{
// currentInput = worldObj.isBlockIndirectlyGettingPowered(pos);
currentInput = worldObj.getStrongPower(pos);
// System.out.println(currentInput);
}
if (worldObj.isRemote || worldObj.getTotalWorldTime() % tickRate != 0) //Temporary tick rate solver if (worldObj.isRemote || worldObj.getTotalWorldTime() % tickRate != 0) //Temporary tick rate solver
{ {
return; return;
@ -262,7 +272,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
@Override @Override
public boolean isConnectionEnabled(BlockPos testPos) public boolean isConnectionEnabled(BlockPos testPos)
{ {
return true; return currentInput <= 0;
} }
@Override @Override

View file

@ -1,29 +1,42 @@
package WayofTime.bloodmagic.tile.routing; package WayofTime.bloodmagic.tile.routing;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.routing.IItemRoutingNode; import WayofTime.bloodmagic.routing.IItemRoutingNode;
import WayofTime.bloodmagic.routing.IMasterRoutingNode; import WayofTime.bloodmagic.routing.IMasterRoutingNode;
import WayofTime.bloodmagic.routing.IRoutingNode; import WayofTime.bloodmagic.routing.IRoutingNode;
import WayofTime.bloodmagic.tile.TileInventory; import WayofTime.bloodmagic.tile.TileInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.LinkedList; public class TileRoutingNode extends TileInventory implements IRoutingNode, IItemRoutingNode, ITickable
import java.util.List;
public class TileRoutingNode extends TileInventory implements IRoutingNode, IItemRoutingNode
{ {
private int currentInput;
public TileRoutingNode(int size, String name) public TileRoutingNode(int size, String name)
{ {
super(size, name); super(size, name);
} }
@Override
public void update()
{
if (!worldObj.isRemote)
{
currentInput = worldObj.isBlockIndirectlyGettingPowered(pos);
// currentInput = worldObj.getStrongPower(pos);
}
}
private BlockPos masterPos = BlockPos.ORIGIN; private BlockPos masterPos = BlockPos.ORIGIN;
private List<BlockPos> connectionList = new LinkedList<BlockPos>(); private List<BlockPos> connectionList = new LinkedList<BlockPos>();
@ -144,7 +157,7 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
@Override @Override
public boolean isConnectionEnabled(BlockPos testPos) public boolean isConnectionEnabled(BlockPos testPos)
{ {
return true; return currentInput <= 0;
} }
@Override @Override