Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public int getMetaFromState(IBlockState state) {
- if (((Boolean) state.getValue(hasTop)).booleanValue()) {
- return 1;
- } else if (((Boolean) state.getValue(hasTop)).booleanValue() && ((Boolean) state.getValue(isShort)).booleanValue()) {
- return 3;
- } else if (((Boolean) state.getValue(isShort)).booleanValue()) {
- return 2;
- }
- return 0;
- }
- @Override
- public IBlockState getStateFromMeta(int meta) {
- if (meta == 1) {
- return this.getDefaultState().withProperty(hasTop, true).withProperty(isShort, false);
- } else if (meta == 2) {
- return this.getDefaultState().withProperty(isShort, true).withProperty(hasTop, false);
- } else if (meta == 0) {
- return this.getDefaultState().withProperty(hasTop, true).withProperty(isShort, true);
- } else {
- return this.getDefaultState().withProperty(hasTop, false).withProperty(isShort, false);
- }
- }
- @Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ) {
- if (world.isRemote) {
- Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null;
- System.out.print("Clicked");
- if (Block.getBlockFromItem(equipped) != null && Block.getBlockFromItem(equipped) instanceof StageBlockTop) {
- if (((Boolean) state.getValue(hasTop)).booleanValue()) {
- System.out.print("Has a Top");
- return false;
- } else {
- System.out.print("No Top");
- world.setBlockState(pos, state.withProperty(hasTop, true));
- world.markBlockForUpdate(pos);
- entityplayer.getCurrentEquippedItem().stackSize--;
- return true;
- }
- }
- if (equipped instanceof ItemHammer) {
- System.out.print("Hammer");
- TileEntity tile = world.getTileEntity(pos);
- if (entityplayer.isSneaking()) {
- } else {
- }
- }
- return true;
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement