Advertisement
Guest User

Lego_mold Container item class

a guest
Sep 24th, 2021
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package com.glado.legomod.container_items;
  2.  
  3. import com.glado.legomod.core.itemgroup.LegoModItemGroup;
  4. import com.glado.legomod.core.init.ItemInit;
  5. import net.minecraft.item.Item;
  6. import net.minecraft.item.ItemStack;
  7.  
  8. public class lego_mold extends Item
  9. {
  10.     public lego_mold() {
  11.         super(new Properties().group(LegoModItemGroup.LEGO_MOD).defaultMaxDamage(10));
  12.     }
  13.    
  14.    
  15.    
  16.     @Override
  17.     public boolean hasContainerItem(ItemStack stack) {
  18.         return true;
  19.        
  20.     }
  21.    
  22.     @Override
  23.     public ItemStack getContainerItem(ItemStack itemstack) {
  24.        
  25.         final ItemStack copy = itemstack.copy();
  26.         if(copy.attemptDamageItem(1, Item.random, null)) {
  27.             copy.shrink(1);
  28.             copy.setDamage(0);
  29.         }
  30.         return copy;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement