Importer model
This commit is contained in:
@@ -8,7 +8,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.INetworkNode;
|
||||
import refinedstorage.tile.TileCable;
|
||||
|
||||
@@ -22,27 +22,30 @@ public class BlockCable extends BlockNode {
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool DOWN = PropertyBool.create("down");
|
||||
|
||||
public BlockCable() {
|
||||
super("cable");
|
||||
public BlockCable(String name) {
|
||||
super(name);
|
||||
|
||||
setHardness(0.6F);
|
||||
}
|
||||
|
||||
public BlockCable() {
|
||||
this("cable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileCable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return createBlockStateBuilder()
|
||||
protected BlockStateContainer.Builder createBlockStateBuilder() {
|
||||
return super.createBlockStateBuilder()
|
||||
.add(NORTH)
|
||||
.add(EAST)
|
||||
.add(SOUTH)
|
||||
.add(WEST)
|
||||
.add(UP)
|
||||
.add(DOWN)
|
||||
.build();
|
||||
.add(DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,8 +59,10 @@ public class BlockCable extends BlockNode {
|
||||
.withProperty(DOWN, hasConnectionWith(world, pos.down()));
|
||||
}
|
||||
|
||||
private boolean hasConnectionWith(IBlockAccess world, BlockPos pos) {
|
||||
return world.getBlockState(pos).getBlock() == RefinedStorageBlocks.CONTROLLER || world.getTileEntity(pos) instanceof INetworkNode;
|
||||
public static boolean hasConnectionWith(IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
return tile instanceof INetworkMaster || tile instanceof INetworkNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,15 +2,9 @@ package refinedstorage.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.externalstorage.TileExternalStorage;
|
||||
|
||||
public class BlockExternalStorage extends BlockNode {
|
||||
@@ -23,15 +17,6 @@ public class BlockExternalStorage extends BlockNode {
|
||||
return new TileExternalStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
||||
super.neighborChanged(state, world, pos, block);
|
||||
|
||||
@@ -12,7 +12,7 @@ import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileImporter;
|
||||
|
||||
public class BlockImporter extends BlockNode {
|
||||
public class BlockImporter extends BlockCable {
|
||||
public BlockImporter() {
|
||||
super("importer");
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.tile.TileNode;
|
||||
import refinedstorage.tile.TileWirelessTransmitter;
|
||||
|
||||
public class BlockWirelessTransmitter extends BlockNode {
|
||||
@@ -67,7 +68,7 @@ public class BlockWirelessTransmitter extends BlockNode {
|
||||
BlockPos downPos = pos.offset(EnumFacing.DOWN);
|
||||
IBlockState down = world.getBlockState(downPos);
|
||||
|
||||
return down.getBlock().canPlaceTorchOnTop(down, world, downPos);
|
||||
return down.getBlock().canPlaceTorchOnTop(down, world, downPos) || (world.getTileEntity(downPos) instanceof TileNode && !(world.getTileEntity(downPos) instanceof TileWirelessTransmitter));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user