Fix potential threading issue if FluidRegistry.loopupFluidForBlock is called from two threads at the same time before being setup. Closes #936
This commit is contained in:
parent
14b9d639a2
commit
12e8d95e9f
1 changed files with 3 additions and 2 deletions
|
@ -148,14 +148,15 @@ public abstract class FluidRegistry
|
|||
{
|
||||
if (fluidBlocks == null)
|
||||
{
|
||||
fluidBlocks = HashBiMap.create();
|
||||
BiMap<Block, Fluid> tmp = HashBiMap.create();
|
||||
for (Fluid fluid : fluids.values())
|
||||
{
|
||||
if (fluid.canBePlacedInWorld() && fluid.getBlock() != null)
|
||||
{
|
||||
fluidBlocks.put(fluid.getBlock(), fluid);
|
||||
tmp.put(fluid.getBlock(), fluid);
|
||||
}
|
||||
}
|
||||
fluidBlocks = tmp;
|
||||
}
|
||||
return fluidBlocks.get(block);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue