(Sorry for my bad english!)
After I learned the basics of Blocks , Items... I wanted to make custom fluids.
After I finished my work I saw a Problem! not the Game Crashes! not the fluid isn't in-game! No! the fluid hasn't his texture!
So I began my search for the Mistake I made but after more than 4 hours I can't find anything!
fluids.json
{
"forge_marker": 1,
"defaults": {
"model": "forge:fluid",
"transform": "forge:default-item"
},
"variants": {
"fluid": [{
"custom": { "fluid": "fluid_test" }
}]
}
}
BlockFluidTest Class
public class BlockFluidTest extends BlockFluidClassic{
public BlockFluidTest(Fluid fluid) {
super(fluid, Material.WATER);
this.setUnlocalizedName("block_test");
this.setRegistryName("block_test");
}
}
FluidTest Class
public class FluidTest extends Fluid{
public FluidTest() {
super("fluid_test", new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/water_flow"));
}
}
Main Class
public static FluidTest fluid = new FluidTest();
public static Block blockfluid;
@EventHandler
public void init(FMLInitializationEvent event)
{
FluidRegistry.registerFluid(fluid);
blockfluid = new BlockFluidTest(fluid);
registerBlock(blockfluid);
}
public static void registerBlock(Block block)
{
GameRegistry.register(block);
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}
Client Proxy
registerFluidModel(TestMod.blockfluid, "fluid");
public void registerFluidModel(Block fluidBlock, final String name)
{
Item item = Item.getItemFromBlock(fluidBlock);
ModelBakery.registerItemVariants(item);
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(TestMod.MODID + ":fluids", name);
}
});
ModelLoader.setCustomStateMapper(fluidBlock, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation(TestMod.MODID + ":fluids", name);
}
});
}
Thanks in Advance! ?