Started on switch and detector wires
This commit is contained in:
parent
c22c3fb9be
commit
c032625573
3 changed files with 73 additions and 0 deletions
|
@ -78,6 +78,19 @@ public class BlockWire extends BlockMachine
|
||||||
return this.zeroRendering ? 0 : -1;
|
return this.zeroRendering ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TileEntity createTileEntity(World world, int metadata)
|
||||||
|
{
|
||||||
|
if (metadata == 1)
|
||||||
|
{
|
||||||
|
return new TileEntityDetectorWire();
|
||||||
|
}
|
||||||
|
else if (metadata == 2)
|
||||||
|
{
|
||||||
|
return new TileEntitySwitchWire();
|
||||||
|
}
|
||||||
|
return this.createNewTileEntity(world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world)
|
public TileEntity createNewTileEntity(World world)
|
||||||
{
|
{
|
||||||
|
|
20
src/dark/core/common/transmit/TileEntityDetectorWire.java
Normal file
20
src/dark/core/common/transmit/TileEntityDetectorWire.java
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package dark.core.common.transmit;
|
||||||
|
|
||||||
|
public class TileEntityDetectorWire extends TileEntityWire
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity()
|
||||||
|
{
|
||||||
|
if (!this.worldObj.isRemote && this.getNetwork() != null && this.ticks % 5 == 0)
|
||||||
|
{
|
||||||
|
//TODO if produced watts > minimal set value by the detector gui activate redstone on all sides
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUpdate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
40
src/dark/core/common/transmit/TileEntitySwitchWire.java
Normal file
40
src/dark/core/common/transmit/TileEntitySwitchWire.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package dark.core.common.transmit;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
public class TileEntitySwitchWire extends TileEntityWire
|
||||||
|
{
|
||||||
|
protected boolean activated = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity[] getAdjacentConnections()
|
||||||
|
{
|
||||||
|
if (activated)
|
||||||
|
{
|
||||||
|
return super.getAdjacentConnections();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivate(boolean yes)
|
||||||
|
{
|
||||||
|
boolean p = this.activated;
|
||||||
|
this.activated = yes;
|
||||||
|
if(p != this.activated)
|
||||||
|
{
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getActivated()
|
||||||
|
{
|
||||||
|
return this.activated;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnect(ForgeDirection direction)
|
||||||
|
{
|
||||||
|
return this.getActivated();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue