Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1.     @Override
  2.     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
  3.         if(world.isRemote)
  4.             return true;
  5.        
  6.         TESword te = (TESword)world.getTileEntity(pos);
  7.         EnumSword modelState = te.getModel();
  8.  
  9.         modelState = modelState.next();
  10.  
  11.         IBlockState newState = state.withProperty(MODEL, modelState);
  12.         world.setBlockState(pos, newState); // this creates a new TE for some reason
  13.         te = (TESword)world.getTileEntity(pos);
  14.         te.setModel(modelState);
  15.         world.notifyBlockUpdate(pos, state, newState, 2);
  16.         te.markDirty();
  17.         return true;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement