Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  //this was me trying to set the items in the tile entity from the stacks nbt
  2.     @Override
  3.     public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
  4.             ItemStack stack) {
  5.         super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
  6.         TileEntityICSB te = (TileEntityICSB)worldIn.getTileEntity(pos);
  7.        
  8.         stackPlacer = te.itemStackHandler;
  9.          NBTTagCompound data = stack.getTagCompound().getTag("items")
  10.        
  11.         ItemStackHandler handler = new ItemStackHandler(27);
  12.  
  13.         handler.deserializeNBT(data);
  14.         for(int i = 0; i < 27; i++)
  15.         {
  16.            
  17.                 te.itemStackHandler.setStackInSlot(i, handler.getStackInSlot(i));
  18.            
  19.            
  20.         }
  21.        
  22.  
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement