STEENBRINK Posted November 20, 2018 Posted November 20, 2018 So I am updating my mod from 1.7.2 (haven't had time for a while). In that mod I used a crafting fluid for a crafting part of my mod. I rendered the crafting fluid with the mbt tags of the fluids that went in like this: Spoiler @Override public IIcon getIcon(FluidStack stack) { NBTTagCompound nbtTagCompound = stack.tag; if (nbtTagCompound.hasKey("FluidPrimary")) { FluidStack primaryFluid = FluidStack.loadFluidStackFromNBT(nbtTagCompound.getCompoundTag("FluidPrimary")); if (primaryFluid == null) return null; return primaryFluid.getFluid().getIcon(primaryFluid); } return null; } That is not working anymore, obviously, but I can not figure out a way to do this now, since the resourcelocations are set in the constructor and cannot be eddited in any way, as far as I know. Is there a way to accomplish this now? Quote
Cadiboo Posted November 20, 2018 Posted November 20, 2018 IIcon doesn’t exist anymore, it was replaced by the baked model system in 1.8 Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
STEENBRINK Posted November 20, 2018 Author Posted November 20, 2018 13 minutes ago, Cadiboo said: IIcon doesn’t exist anymore, it was replaced by the baked model system in 1.8 I know that... I say that in the post: "That is not working anymore, obviously" Quote
V0idWa1k3r Posted November 22, 2018 Posted November 22, 2018 What are you trying to accomplish exactly? Where do you want to render the fluid? In the item's model? In your GUI? In the world? Quote
STEENBRINK Posted November 23, 2018 Author Posted November 23, 2018 22 hours ago, V0idWa1k3r said: What are you trying to accomplish exactly? Where do you want to render the fluid? In the item's model? In your GUI? In the world? I have a barrel TileEntity, the idea is that you mix two fluids in there and it makes a third. The way that is done, is by having a intermediate fluid, the so called CraftingFluid. Here is the recepe handler for that (from 1.7.10):https://github.com/STEENBRINK/Kaasmod-2-1.7.10/blob/master/src/main/java/nl/steenbrink/kaasmod/init/RecipesBarrel.java The way I render this CraftingFluid in the barrel is by taking the texture from the first added fluid (or primary fluid) by using nbt on the fluidstack. Now there used to be a way to get the IIcon from the FluidStack. Spoiler @Override public IIcon getIcon(FluidStack stack) { NBTTagCompound nbtTagCompound = stack.tag; if (nbtTagCompound.hasKey("FluidPrimary")) { FluidStack primaryFluid = FluidStack.loadFluidStackFromNBT(nbtTagCompound.getCompoundTag("FluidPrimary")); if (primaryFluid == null) return null; return primaryFluid.getFluid().getIcon(primaryFluid); } return null; } (full code here: https://github.com/STEENBRINK/Kaasmod-2-1.7.10/blob/master/src/main/java/nl/steenbrink/kaasmod/fluid/FluidCrafting.java) My question is if there is a way to "set" the texture outside the constructor, because it changes every time I make a new craftingfluid. Otherwise I will have to rewrite the whole crafting thingamagic. I hope this clears it up a bit. Quote
V0idWa1k3r Posted November 23, 2018 Posted November 23, 2018 44 minutes ago, STEENBRINK said: The way I render this CraftingFluid in the barrel is by taking the texture from the first added fluid (or primary fluid) by using nbt on the fluidstack. Why do you need this "crafting fluid" in the first place? Why not just store the first/primary fluid and display it's texture? 44 minutes ago, STEENBRINK said: My question is if there is a way to "set" the texture outside the constructor, because it changes every time I make a new craftingfluid. ...Change what the getter returns? All FluidStack calls route back to the Fluid that it is't, well, fluid. 45 minutes ago, STEENBRINK said: Otherwise I will have to rewrite the whole crafting thingamagic. You have to do it regardless since IIcon no longer exists though. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.