Add support for switching bucket model
This commit is contained in:
parent
0065c6da75
commit
9b05786710
14 changed files with 91 additions and 0 deletions
|
@ -31,6 +31,7 @@ public class MiscConfigurationHandler
|
||||||
public static boolean useBoPWorldTypeDefault;
|
public static boolean useBoPWorldTypeDefault;
|
||||||
public static boolean overrideTitlePanorama;
|
public static boolean overrideTitlePanorama;
|
||||||
public static boolean overrideForgeBuckets;
|
public static boolean overrideForgeBuckets;
|
||||||
|
public static boolean useBoPBucketTexture;
|
||||||
|
|
||||||
//Client-side only
|
//Client-side only
|
||||||
public static TrailVisibilityMode trailVisbilityMode;
|
public static TrailVisibilityMode trailVisbilityMode;
|
||||||
|
@ -52,6 +53,7 @@ public class MiscConfigurationHandler
|
||||||
useBoPWorldTypeDefault = config.getBoolean("Default to BoP World Type", guiSettings, false, "Use the Biomes O' Plenty World Type by default when selecting a world.");
|
useBoPWorldTypeDefault = config.getBoolean("Default to BoP World Type", guiSettings, false, "Use the Biomes O' Plenty World Type by default when selecting a world.");
|
||||||
overrideTitlePanorama = config.getBoolean("Enable Biomes O\' Plenty Main Menu Panorama", textureSettings, true, "Override the main menu panorama and use ours instead (It\'s nicer!)");
|
overrideTitlePanorama = config.getBoolean("Enable Biomes O\' Plenty Main Menu Panorama", textureSettings, true, "Override the main menu panorama and use ours instead (It\'s nicer!)");
|
||||||
overrideForgeBuckets = config.getBoolean("Enable Biomes O\' Plenty Bucket Textures", textureSettings, true, "Override the Forge bucket texture and use ours instead (It\'s nicer!)");
|
overrideForgeBuckets = config.getBoolean("Enable Biomes O\' Plenty Bucket Textures", textureSettings, true, "Override the Forge bucket texture and use ours instead (It\'s nicer!)");
|
||||||
|
useBoPBucketTexture = config.getBoolean("Use Biomes O\' Plenty Bucket Textures", textureSettings, false, "Use the Biomes O' Plenty bucket texture (Valid only for BOP fluid.)");
|
||||||
|
|
||||||
//Client-side only options
|
//Client-side only options
|
||||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||||
|
|
|
@ -38,6 +38,7 @@ import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
|
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||||
|
@ -110,6 +111,11 @@ public class BiomesOPlenty
|
||||||
{
|
{
|
||||||
ModCompatibility.postInit();
|
ModCompatibility.postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void loadComplete(FMLLoadCompleteEvent event) {
|
||||||
|
BiomesOPlenty.proxy.replaceBOPBucketTexture();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void serverStarting(FMLServerStartingEvent event)
|
public void serverStarting(FMLServerStartingEvent event)
|
||||||
|
|
|
@ -31,6 +31,11 @@ import biomesoplenty.common.entities.RenderSnail;
|
||||||
import biomesoplenty.common.entities.RenderWasp;
|
import biomesoplenty.common.entities.RenderWasp;
|
||||||
import biomesoplenty.common.entities.projectiles.EntityMudball;
|
import biomesoplenty.common.entities.projectiles.EntityMudball;
|
||||||
import biomesoplenty.common.entities.projectiles.RenderMudball;
|
import biomesoplenty.common.entities.projectiles.RenderMudball;
|
||||||
|
import biomesoplenty.common.fluids.BloodFluid;
|
||||||
|
import biomesoplenty.common.fluids.HoneyFluid;
|
||||||
|
import biomesoplenty.common.fluids.HotSpringWaterFluid;
|
||||||
|
import biomesoplenty.common.fluids.PoisonFluid;
|
||||||
|
import biomesoplenty.common.fluids.QuicksandFluid;
|
||||||
import biomesoplenty.common.item.IColoredItem;
|
import biomesoplenty.common.item.IColoredItem;
|
||||||
import biomesoplenty.common.util.inventory.CreativeTabBOP;
|
import biomesoplenty.common.util.inventory.CreativeTabBOP;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -39,6 +44,8 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
import net.minecraft.client.gui.GuiMainMenu;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
|
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||||
|
import net.minecraft.client.renderer.ItemModelMesher;
|
||||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||||
|
@ -54,8 +61,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraftforge.client.model.ModelDynBucket;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.common.ForgeModContainer;
|
import net.minecraftforge.common.ForgeModContainer;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||||
|
@ -66,6 +76,7 @@ public class ClientProxy extends CommonProxy
|
||||||
{
|
{
|
||||||
public static ResourceLocation[] bopTitlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_0.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_1.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_2.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_3.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_4.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_5.png")};
|
public static ResourceLocation[] bopTitlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_0.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_1.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_2.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_3.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_4.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_5.png")};
|
||||||
public static ResourceLocation particleTexturesLocation = new ResourceLocation("biomesoplenty:textures/particles/particles.png");
|
public static ResourceLocation particleTexturesLocation = new ResourceLocation("biomesoplenty:textures/particles/particles.png");
|
||||||
|
public static ModelResourceLocation[] bucketModelLocations = new ModelResourceLocation[] {new ModelResourceLocation(new ResourceLocation("biomesoplenty", "blood_bucket"), "inventory"), new ModelResourceLocation(new ResourceLocation("biomesoplenty", "honey_bucket"), "inventory"), new ModelResourceLocation(new ResourceLocation("biomesoplenty", "hot_spring_water_bucket"), "inventory"), new ModelResourceLocation(new ResourceLocation("biomesoplenty", "poison_bucket"), "inventory"), new ModelResourceLocation(new ResourceLocation("biomesoplenty", "sand_bucket"), "inventory")};
|
||||||
|
|
||||||
private static List<Block> blocksToColour = Lists.newArrayList();
|
private static List<Block> blocksToColour = Lists.newArrayList();
|
||||||
private static List<Item> itemsToColor = Lists.newArrayList();
|
private static List<Item> itemsToColor = Lists.newArrayList();
|
||||||
|
@ -84,6 +95,8 @@ public class ClientProxy extends CommonProxy
|
||||||
registerEntityRenderer(EntityMudball.class, RenderMudball.class);
|
registerEntityRenderer(EntityMudball.class, RenderMudball.class);
|
||||||
|
|
||||||
replaceForgeResources();
|
replaceForgeResources();
|
||||||
|
|
||||||
|
ModelBakery.registerItemVariants(ForgeModContainer.getInstance().universalBucket, bucketModelLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -209,6 +222,45 @@ public class ClientProxy extends CommonProxy
|
||||||
|
|
||||||
if (entityFx != null) {minecraft.effectRenderer.addEffect(entityFx);}
|
if (entityFx != null) {minecraft.effectRenderer.addEffect(entityFx);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void replaceBOPBucketTexture() {
|
||||||
|
// Use BOP bucket texture
|
||||||
|
Map<Item, ItemMeshDefinition> meshMapping = ReflectionHelper.getPrivateValue(ItemModelMesher.class, Minecraft.getMinecraft().getRenderItem().getItemModelMesher(), "field_178092_c", "shapers");
|
||||||
|
final ItemMeshDefinition meshDefinition = meshMapping.get(ForgeModContainer.getInstance().universalBucket);
|
||||||
|
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ForgeModContainer.getInstance().universalBucket, new ItemMeshDefinition()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||||
|
{
|
||||||
|
FluidStack fluidStack = FluidUtil.getFluidContained(stack);
|
||||||
|
if (fluidStack != null && MiscConfigurationHandler.useBoPBucketTexture)
|
||||||
|
{
|
||||||
|
if (fluidStack.getFluid() == BloodFluid.instance)
|
||||||
|
{
|
||||||
|
return bucketModelLocations[0];
|
||||||
|
}
|
||||||
|
if (fluidStack.getFluid() == HoneyFluid.instance)
|
||||||
|
{
|
||||||
|
return bucketModelLocations[1];
|
||||||
|
}
|
||||||
|
if (fluidStack.getFluid() == HotSpringWaterFluid.instance)
|
||||||
|
{
|
||||||
|
return bucketModelLocations[2];
|
||||||
|
}
|
||||||
|
if (fluidStack.getFluid() == PoisonFluid.instance)
|
||||||
|
{
|
||||||
|
return bucketModelLocations[3];
|
||||||
|
}
|
||||||
|
if (fluidStack.getFluid() == QuicksandFluid.instance)
|
||||||
|
{
|
||||||
|
return bucketModelLocations[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return meshDefinition == null ? ModelDynBucket.LOCATION : meshDefinition.getModelLocation(stack);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static void replaceForgeResources()
|
private static void replaceForgeResources()
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,4 +21,5 @@ public class CommonProxy
|
||||||
public void registerItemSided(Item item) {}
|
public void registerItemSided(Item item) {}
|
||||||
public void registerFluidBlockRendering(Block block, String name) {}
|
public void registerFluidBlockRendering(Block block, String name) {}
|
||||||
public void spawnParticle(BOPParticleTypes type, double x, double y, double z, Object... info) {}
|
public void spawnParticle(BOPParticleTypes type, double x, double y, double z, Object... info) {}
|
||||||
|
public void replaceBOPBucketTexture() {}
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "biomesoplenty:items/blood_bucket"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "biomesoplenty:items/honey_bucket"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "biomesoplenty:items/hot_spring_water_bucket"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "biomesoplenty:items/poison_bucket"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "biomesoplenty:items/sand_bucket"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 321 B |
Binary file not shown.
After Width: | Height: | Size: 325 B |
Binary file not shown.
After Width: | Height: | Size: 336 B |
Binary file not shown.
After Width: | Height: | Size: 324 B |
Binary file not shown.
After Width: | Height: | Size: 321 B |
Loading…
Reference in a new issue