Fixes FluidContainerRegistry properly - no more corner case where client/server mods disagree.
Also clarifies the 2x Fluid registration error message somewhat. Signed-off-by: King Lemming <kinglemming@gmail.com>
This commit is contained in:
parent
7e9dfb1a11
commit
186f92479d
2 changed files with 4 additions and 3 deletions
|
@ -51,7 +51,7 @@ public abstract class FluidContainerRegistry
|
||||||
code = 31*code + container.getItem().hashCode();
|
code = 31*code + container.getItem().hashCode();
|
||||||
code = 31*code + container.getItemDamage();
|
code = 31*code + container.getItemDamage();
|
||||||
if (stack != null)
|
if (stack != null)
|
||||||
code = 31*code + stack.getFluidID();
|
code = 31*code + stack.fluid.hashCode();
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -81,11 +81,12 @@ public abstract class FluidRegistry
|
||||||
{
|
{
|
||||||
if (fluids.containsKey(fluid.getName()))
|
if (fluids.containsKey(fluid.getName()))
|
||||||
{
|
{
|
||||||
FMLLog.bigWarning("Duplicate registration attempt for fluid %s (type %s) has occurred. This is not a problem itself, but subsequent failed FluidStacks might be a result if not handled properly", fluid.getName(), fluid.getClass().getName());
|
FMLLog.bigWarning("Duplicate registration attempt for fluid %s (type %s) has occurred. This is not a problem itself, but subsequent failed FluidStacks result if this is not handled properly", fluid.getName(), fluid.getClass().getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fluids.put(fluid.getName(), fluid);
|
fluids.put(fluid.getName(), fluid);
|
||||||
fluidIDs.put(fluid, ++maxID);
|
maxID++;
|
||||||
|
fluidIDs.put(fluid, maxID);
|
||||||
fluidNames.put(maxID, fluid.getName());
|
fluidNames.put(maxID, fluid.getName());
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.post(new FluidRegisterEvent(fluid.getName(), maxID));
|
MinecraftForge.EVENT_BUS.post(new FluidRegisterEvent(fluid.getName(), maxID));
|
||||||
|
|
Loading…
Reference in a new issue