BloodMagic/src/main/java/WayofTime/bloodmagic/block/BlockInputRoutingNode.java
Nicholas Ignoffo ddaadfbe52 Swap the API packages
The new one is now built for the api jar and the old one is now internal.
It will slowly be moved around to sane places within the internal code. Most
of the features provided in the old "api" are addon specific features which
will generally rely on the main jar anyways. The new API will be specific
to compatibility features, such as blacklists, recipes, and value modification.
2018-02-05 17:04:46 -08:00

53 lines
1.8 KiB
Java

package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
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 javax.annotation.Nullable;
public class BlockInputRoutingNode extends BlockRoutingNode {
public BlockInputRoutingNode() {
super();
setUnlocalizedName(BloodMagic.MODID + ".inputRouting");
}
@Override
//TODO: Combine BlockInputRoutingNode and BlockInputRoutingNode so they have the same superclass
public void breakBlock(World world, BlockPos pos, IBlockState state) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileInputRoutingNode) {
((TileInputRoutingNode) tile).removeAllConnections();
((TileInputRoutingNode) tile).dropItems();
}
super.breakBlock(world, pos, state);
}
@Override
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 TileInputRoutingNode) {
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
return new TileInputRoutingNode();
}
}