Advertisement
Guest User

Buckets

a guest
Aug 27th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. public class ItemBucketBase extends UniversalBucket implements ItemMeshDefinition {
  2.     protected String name;
  3.     final protected ModelResourceLocation modelLocation;
  4.    
  5.     public ItemBucketBase(String name, CreativeTabs aTab, ModelResourceLocation modelLocation) {
  6.         super(Fluid.BUCKET_VOLUME, new ItemStack(Items.BUCKET), false);
  7.        
  8.         this.name = name;
  9.         this.modelLocation = modelLocation;
  10.        
  11.         SetNamesAndCreativeTabHelper.setNamesAndCreativeTab(this, name, aTab);
  12.        
  13.         //registration must be done last
  14.         GameRegistry.register(this);
  15.         FoundationsMod.proxy.registerCustomModel(this, this, this.modelLocation);
  16.         OreDictionary.registerOre("ore" + Utilities.upperCaseFirstLetter(this.name), this);
  17.     }
  18.  
  19.     @Override
  20.     public ModelResourceLocation getModelLocation(ItemStack stack) {
  21.         return modelLocation;
  22.     }
  23. }
  24.  
  25. // Where the proxy location just ensures that models aren't registered for server-side logic, and the client side proxy does the work of the ModelLoader.setBucketModelDefinition function:
  26.  
  27. public class ClientProxy extends CommonProxy {
  28.     public void registerCustomModel(Item item, ItemMeshDefinition meshDefinition, ModelResourceLocation modelLocation)
  29.     {
  30.         ModelLoader.setCustomMeshDefinition(item, meshDefinition);
  31.         ModelBakery.registerItemVariants(item, modelLocation);
  32.     }
  33. }
  34.  
  35. // Then I've initialized it like so:
  36.  
  37. //hardened stone buckets
  38. hardenedStoneBucket = new ItemBucketBase("hardenedStoneBucket", CreativeTabs.MATERIALS,
  39.     new ModelResourceLocation(new ResourceLocation(FoundationsMod.MODID, "hardenedStoneBucket"), "inventory"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement