circuitdh

ClientProxy.java

Jul 1st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. package net.bleachcraft.Proxy;
  2.  
  3. import net.bleachcraft.Fluids.ChlorineBlock;
  4. import net.minecraft.block.state.IBlockState;
  5. import net.minecraft.client.renderer.ItemMeshDefinition;
  6. import net.minecraft.client.renderer.block.model.ModelBakery;
  7. import net.minecraft.client.renderer.block.model.ModelResourceLocation;
  8. import net.minecraft.client.renderer.block.statemap.StateMapperBase;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.item.ItemStack;
  11. import net.minecraftforge.client.model.ModelLoader;
  12. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  13.  
  14. public class ClientProxy extends CommonProxy
  15. {
  16.      private static ModelResourceLocation gasLocation = new ModelResourceLocation("bleachcraft" + ":" + "ChlorineBlock", "gas");
  17.  
  18.      @Override
  19.     public void preInit(FMLPreInitializationEvent event)
  20.     {
  21.         super.preInit(event);
  22.         Item gas = Item.getItemFromBlock(ChlorineBlock.instance);
  23.         ModelBakery.registerItemVariants(gas);
  24.         ModelLoader.setCustomMeshDefinition(gas, new ItemMeshDefinition()
  25.         {
  26.             public ModelResourceLocation getModelLocation(ItemStack stack)
  27.             {
  28.                 return gasLocation;
  29.             }
  30.         });
  31.         ModelLoader.setCustomStateMapper(ChlorineBlock.instance, new StateMapperBase()
  32.         {
  33.             protected ModelResourceLocation getModelResourceLocation(IBlockState state)
  34.             {
  35.                 return gasLocation;
  36.             }
  37.         });
  38.        
  39.        
  40.     }
  41.    
  42.     public static void registerItemRender(Item item, int meta)
  43.     {
  44.         ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
  45.     }
  46. }
Add Comment
Please, Sign In to add comment