Exporter model

This commit is contained in:
Raoul Van den Berge
2016-07-09 01:48:37 +02:00
parent 2c5e543fc7
commit a802df3ccd
10 changed files with 1777 additions and 22 deletions

View File

@@ -10,6 +10,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.INetworkNode;
import refinedstorage.tile.TileBase;
import refinedstorage.tile.TileCable;
public class BlockCable extends BlockNode {
@@ -51,18 +52,26 @@ public class BlockCable extends BlockNode {
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
return super.getActualState(state, world, pos)
.withProperty(NORTH, hasConnectionWith(world, pos.north()))
.withProperty(EAST, hasConnectionWith(world, pos.east()))
.withProperty(SOUTH, hasConnectionWith(world, pos.south()))
.withProperty(WEST, hasConnectionWith(world, pos.west()))
.withProperty(UP, hasConnectionWith(world, pos.up()))
.withProperty(DOWN, hasConnectionWith(world, pos.down()));
.withProperty(NORTH, hasConnectionWith(world, pos, pos.north()))
.withProperty(EAST, hasConnectionWith(world, pos, pos.east()))
.withProperty(SOUTH, hasConnectionWith(world, pos, pos.south()))
.withProperty(WEST, hasConnectionWith(world, pos, pos.west()))
.withProperty(UP, hasConnectionWith(world, pos, pos.up()))
.withProperty(DOWN, hasConnectionWith(world, pos, pos.down()));
}
public static boolean hasConnectionWith(IBlockAccess world, BlockPos pos) {
private boolean hasConnectionWith(IBlockAccess world, BlockPos basePos, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
return tile instanceof INetworkMaster || tile instanceof INetworkNode;
if (tile instanceof INetworkMaster || tile instanceof INetworkNode) {
if (getPlacementType() != null) {
return ((TileBase) world.getTileEntity(basePos)).getFacingTile() != tile;
}
return true;
}
return false;
}
@Override

View File

@@ -12,7 +12,7 @@ import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageGui;
import refinedstorage.tile.TileExporter;
public class BlockExporter extends BlockNode {
public class BlockExporter extends BlockCable {
public BlockExporter() {
super("exporter");
}
@@ -30,7 +30,7 @@ public class BlockExporter extends BlockNode {
return true;
}
@Override
public EnumPlacementType getPlacementType() {
return EnumPlacementType.ANY;