2016-01-12 17:05:56 -05:00
|
|
|
package WayofTime.bloodmagic.block;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
2018-02-05 17:04:38 -08:00
|
|
|
import WayofTime.bloodmagic.apibutnotreally.Constants;
|
2017-08-15 21:30:48 -07:00
|
|
|
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
|
2016-01-12 17:05:56 -05:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.EnumHand;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
2016-01-12 17:05:56 -05:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2017-01-01 21:43:34 -08:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class BlockOutputRoutingNode extends BlockRoutingNode {
|
|
|
|
public BlockOutputRoutingNode() {
|
2016-01-15 21:53:55 -05:00
|
|
|
super();
|
2016-01-12 17:05:56 -05:00
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
setUnlocalizedName(BloodMagic.MODID + ".outputRouting");
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
//TODO: Combine BlockOutputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
2017-08-15 21:30:48 -07:00
|
|
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
2016-01-12 17:05:56 -05:00
|
|
|
TileEntity tile = world.getTileEntity(pos);
|
2017-08-15 21:30:48 -07:00
|
|
|
if (tile instanceof TileOutputRoutingNode) {
|
2016-01-14 11:06:50 -05:00
|
|
|
((TileOutputRoutingNode) tile).removeAllConnections();
|
|
|
|
((TileOutputRoutingNode) tile).dropItems();
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
super.breakBlock(world, pos, state);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
|
|
|
if (world.getTileEntity(pos) instanceof TileOutputRoutingNode) {
|
2016-01-14 08:27:09 -05:00
|
|
|
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
|
2016-01-14 08:27:09 -05:00
|
|
|
return true;
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
2017-01-01 21:43:34 -08:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasTileEntity(IBlockState state) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
|
|
|
return new TileOutputRoutingNode();
|
|
|
|
}
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|