Constructor / Destructor have a connected state

This commit is contained in:
Raoul Van den Berge
2016-09-27 18:39:10 +02:00
parent 5e111c8dd4
commit 398f9c1ca8
7 changed files with 49 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ public class BlockCable extends BlockCoverable {
protected static final PropertyBool WEST = PropertyBool.create("west");
protected static final PropertyBool UP = PropertyBool.create("up");
protected static final PropertyBool DOWN = PropertyBool.create("down");
protected static final PropertyBool CONNECTED = PropertyBool.create("connected");
private String name;
@@ -97,6 +98,10 @@ public class BlockCable extends BlockCoverable {
return new TileCable();
}
public boolean hasConnectivityState() {
return false;
}
@Override
protected BlockStateContainer createBlockState() {
BlockStateContainer.Builder builder = new BlockStateContainer.Builder(this);
@@ -113,6 +118,10 @@ public class BlockCable extends BlockCoverable {
builder.add(DIRECTION);
}
if (hasConnectivityState()) {
builder.add(CONNECTED);
}
return builder.build();
}
@@ -127,8 +136,14 @@ public class BlockCable extends BlockCoverable {
.withProperty(UP, hasConnectionWith(world, pos, EnumFacing.UP))
.withProperty(DOWN, hasConnectionWith(world, pos, EnumFacing.DOWN));
TileNode tile = (TileNode) world.getTileEntity(pos);
if (getPlacementType() != null) {
state = state.withProperty(DIRECTION, ((TileNode) world.getTileEntity(pos)).getDirection());
state = state.withProperty(DIRECTION, tile.getDirection());
}
if (hasConnectivityState()) {
state = state.withProperty(CONNECTED, tile.isConnected());
}
return state;

View File

@@ -91,6 +91,11 @@ public class BlockConstructor extends BlockCable {
return true;
}
@Override
public boolean hasConnectivityState() {
return true;
}
@Override
public EnumPlacementType getPlacementType() {
return EnumPlacementType.ANY;

View File

@@ -48,6 +48,11 @@ public class BlockDestructor extends BlockCable {
return true;
}
@Override
public boolean hasConnectivityState() {
return true;
}
@Override
public EnumPlacementType getPlacementType() {
return EnumPlacementType.ANY;

View File

@@ -44,6 +44,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
block = SlotSpecimen.getBlockState(worldObj, pos.offset(getDirection()), getStackInSlot(0));
}
};
private ItemHandlerFluid fluidFilters = new ItemHandlerFluid(1, this);
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_CRAFTING);
@@ -172,6 +173,11 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
return upgrades;
}
@Override
public boolean hasConnectivityState() {
return true;
}
@Override
public int getType() {
return worldObj.isRemote ? TYPE.getValue() : type;

View File

@@ -194,6 +194,11 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
return itemFilters;
}
@Override
public boolean hasConnectivityState() {
return true;
}
@Override
public IItemHandler getDrops() {
return upgrades;

View File

@@ -17,6 +17,12 @@
"transform": "forge:default-block"
}
],
"connected": {
"true": {
},
"false": {
}
},
"direction": {
"north": {
"submodel": "refinedstorage:constructor_destructor_north"

View File

@@ -17,6 +17,12 @@
"transform": "forge:default-block"
}
],
"connected": {
"true": {
},
"false": {
}
},
"direction": {
"north": {
"submodel": "refinedstorage:constructor_destructor_north"