mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
You shouldn't be creating FluidStacks from unregistered Fluids. Warn clearly on failed registrations, and make a useful log message for failed fluidstack
creations. Should help a lot with tracking down broken mods that are doing this wrongly.
This commit is contained in:
1 parent
f7395f517b
commit
4f0e2fb9c4
2 files changed
+10
No files matched your search
@@ -2,7 +2,10 @@
|
||||
package net.minecraftforge.fluids;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -24,6 +27,11 @@ public class FluidStack
|
||||
|
||||
public FluidStack(Fluid fluid, int amount)
|
||||
{
|
||||
if (!FluidRegistry.isFluidRegistered(fluid))
|
||||
{
|
||||
FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName());
|
||||
throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");
|
||||
}
|
||||
this.fluid = fluid;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user