Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DuelField extends Block
- {
- private int controller;
- public DuelField(String name)
- {
- super(Material.ROCK);
- this.setHardness(1.0F);
- this.setRegistryName("duel_field");
- this.setUnlocalizedName(name);
- this.setCreativeTab(YugiohMod.CARDS_TAB);
- this.createTileEntity(Minecraft.getMinecraft().theWorld, this.getDefaultState());
- }
- @Override
- public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
- {
- super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, placer);
- if(world.getTileEntity(pos.north(10)) instanceof TileEntityDuelField)
- {
- this.setController(2);
- }
- else
- {
- this.setController(1);
- }
- return this.getDefaultState();
- }
- @Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
- {
- playerIn.openGui(YugiohMod.instance, GuiHandler.DUEL_FIELD_GUI, world, pos.getX(), pos.getY(), pos.getZ());
- return true;
- }
- public int getController()
- {
- return controller;
- }
- public void setController(int controller)
- {
- this.controller = controller;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement