Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. public class DuelField extends Block
  2. {
  3. private int controller;
  4.  
  5. public DuelField(String name)
  6. {
  7. super(Material.ROCK);
  8. this.setHardness(1.0F);
  9. this.setRegistryName("duel_field");
  10. this.setUnlocalizedName(name);
  11. this.setCreativeTab(YugiohMod.CARDS_TAB);
  12. this.createTileEntity(Minecraft.getMinecraft().theWorld, this.getDefaultState());
  13. }
  14.  
  15. @Override
  16. public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
  17. {
  18. super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, placer);
  19.  
  20. if(world.getTileEntity(pos.north(10)) instanceof TileEntityDuelField)
  21. {
  22. this.setController(2);
  23. }
  24. else
  25. {
  26. this.setController(1);
  27. }
  28.  
  29. return this.getDefaultState();
  30. }
  31.  
  32. @Override
  33. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
  34. {
  35. playerIn.openGui(YugiohMod.instance, GuiHandler.DUEL_FIELD_GUI, world, pos.getX(), pos.getY(), pos.getZ());
  36. return true;
  37. }
  38.  
  39. public int getController()
  40. {
  41. return controller;
  42. }
  43.  
  44. public void setController(int controller)
  45. {
  46. this.controller = controller;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement