mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 04:09:40 +00:00
Fix solegnolia not working on dediserver and threadsafe the collection. Fixes #346
This commit is contained in:
1 file changed
+3
-2
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import com.google.common.collect.MapMaker;
|
||||
import net.minecraft.entity.Entity;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
@@ -25,7 +26,7 @@ public class SubTileSolegnolia extends SubTileFunctional {
|
||||
private static final double RANGE = 5;
|
||||
private static final double RANGE_MINI = 1;
|
||||
|
||||
private static final Set<SubTileSolegnolia> existingFlowers = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
private static final Set<SubTileSolegnolia> existingFlowers = Collections.newSetFromMap(new MapMaker().concurrencyLevel(2).weakKeys().makeMap());
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@@ -44,7 +45,7 @@ public class SubTileSolegnolia extends SubTileFunctional {
|
||||
public static boolean hasSolegnoliaAround(Entity e) {
|
||||
return existingFlowers.stream()
|
||||
.filter(f -> f.redstoneSignal == 0)
|
||||
.filter(f -> f.supertile.getWorld() != e.worldObj)
|
||||
.filter(f -> f.supertile.getWorld() == e.worldObj)
|
||||
.filter(f -> f.supertile.getWorld().getTileEntity(f.supertile.getPos()) == f.supertile)
|
||||
.filter(f -> f.supertile.getDistanceSq(e.posX, e.posY, e.posZ) <= f.getRange() * f.getRange())
|
||||
.findAny().isPresent();
|
||||
|
||||
Reference in new issue
Block a user