Add a dynamic bucket model that displays the animated liquid contained

Has a config option (default off) that replaces the vanilla buckets with the forge bucket model

New original bucket textures from mr_hazard
This commit is contained in:
Bernhard Bonigl committed 2015-12-21 22:22:40 +01:00
1 parent 80ba13be89
commit 4f6784b733
22 files changed
+958

No files matched your search

@@ -29,6 +29,8 @@ public class ModelFluidDebug
@SidedProxy(serverSide = "net.minecraftforge.debug.ModelFluidDebug$CommonProxy", clientSide = "net.minecraftforge.debug.ModelFluidDebug$ClientProxy")
public static CommonProxy proxy;
public static final Fluid milkFluid = new Fluid("milk", new ResourceLocation("forge", "blocks/milk_still"), new ResourceLocation("forge", "blocks/milk_flow"));
@EventHandler
public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); }
@@ -38,8 +40,10 @@ public class ModelFluidDebug
{
FluidRegistry.registerFluid(TestFluid.instance);
FluidRegistry.registerFluid(TestGas.instance);
FluidRegistry.registerFluid(milkFluid);
GameRegistry.registerBlock(TestFluidBlock.instance, TestFluidBlock.name);
GameRegistry.registerBlock(TestGasBlock.instance, TestGasBlock.name);
GameRegistry.registerBlock(MilkFluidBlock.instance, MilkFluidBlock.name);
}
}
@@ -47,6 +51,7 @@ public class ModelFluidDebug
{
private static ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "fluid");
private static ModelResourceLocation gasLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "gas");
private static ModelResourceLocation milkLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "milk");
@Override
public void preInit(FMLPreInitializationEvent event)
@@ -54,8 +59,10 @@ public class ModelFluidDebug
super.preInit(event);
Item fluid = Item.getItemFromBlock(TestFluidBlock.instance);
Item gas = Item.getItemFromBlock(TestGasBlock.instance);
Item milk = Item.getItemFromBlock(MilkFluidBlock.instance);
ModelBakery.addVariantName(fluid);
ModelBakery.addVariantName(gas);
ModelBakery.addVariantName(milk);
ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition()
{
public ModelResourceLocation getModelLocation(ItemStack stack)
@@ -70,6 +77,13 @@ public class ModelFluidDebug
return gasLocation;
}
});
ModelLoader.setCustomMeshDefinition(milk, new ItemMeshDefinition()
{
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return milkLocation;
}
});
ModelLoader.setCustomStateMapper(TestFluidBlock.instance, new StateMapperBase()
{
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
@@ -84,6 +98,13 @@ public class ModelFluidDebug
return gasLocation;
}
});
ModelLoader.setCustomStateMapper(MilkFluidBlock.instance, new StateMapperBase()
{
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
return milkLocation;
}
});
}
}
@@ -136,6 +157,19 @@ public class ModelFluidDebug
}
}
public static final class MilkFluidBlock extends BlockFluidClassic
{
public static final MilkFluidBlock instance = new MilkFluidBlock();
public static final String name = "MilkFluidBlock";
private MilkFluidBlock()
{
super(milkFluid, Material.water);
setCreativeTab(CreativeTabs.tabBlock);
setUnlocalizedName(MODID + ":" + name);
}
}
public static final class TestGasBlock extends BlockFluidClassic
{
public static final TestGasBlock instance = new TestGasBlock();