From 186f92479d2d43ee6e92113d94dd8ab768140494 Mon Sep 17 00:00:00 2001 From: King Lemming Date: Fri, 10 Apr 2015 16:38:45 -0400 Subject: [PATCH] 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 --- .../net/minecraftforge/fluids/FluidContainerRegistry.java | 2 +- src/main/java/net/minecraftforge/fluids/FluidRegistry.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index 552d6eea0..9702c28bf 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -51,7 +51,7 @@ public abstract class FluidContainerRegistry code = 31*code + container.getItem().hashCode(); code = 31*code + container.getItemDamage(); if (stack != null) - code = 31*code + stack.getFluidID(); + code = 31*code + stack.fluid.hashCode(); return code; } @Override diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index cd9ef9292..83f8565ae 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -81,11 +81,12 @@ public abstract class FluidRegistry { 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; } fluids.put(fluid.getName(), fluid); - fluidIDs.put(fluid, ++maxID); + maxID++; + fluidIDs.put(fluid, maxID); fluidNames.put(maxID, fluid.getName()); MinecraftForge.EVENT_BUS.post(new FluidRegisterEvent(fluid.getName(), maxID));