diff --git a/src/main/java/com/vinlanx/explosionoverhaul/AsyncCraterManager.java b/src/main/java/com/vinlanx/explosionoverhaul/AsyncCraterManager.java index 195c950..30432ad 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/AsyncCraterManager.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/AsyncCraterManager.java @@ -6,7 +6,6 @@ package com.vinlanx.explosionoverhaul; import com.vinlanx.explosionoverhaul.Config; import com.vinlanx.explosionoverhaul.CraterDeformer; import com.vinlanx.explosionoverhaul.ExplosionOverhaul; -import java.lang.invoke.LambdaMetafactory; import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; @@ -21,7 +20,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; -import java.util.function.Function; import net.minecraft.core.BlockPos; import net.minecraft.core.Position; import net.minecraft.core.SectionPos; @@ -317,15 +315,17 @@ public class AsyncCraterManager { } break block39; } - if (c.core) ** GOTO lbl-1000 - v0 = rayId = Math.max(0, c.rayId); - this.rayEnergy[v0] = this.rayEnergy[v0] - (resistance + 0.3f); - if (this.rayEnergy[rayId] <= 0.0f) { - this.rayDepleted[rayId] = true; - } else lbl-1000: - // 2 sources - - { + boolean shouldDestroy = c.core; + if (!c.core) { + v0 = rayId = Math.max(0, c.rayId); + this.rayEnergy[v0] = this.rayEnergy[v0] - (resistance + 0.3f); + if (this.rayEnergy[rayId] <= 0.0f) { + this.rayDepleted[rayId] = true; + } else { + shouldDestroy = true; + } + } + if (shouldDestroy) { v1 = allowFalling = this.power <= 20.0f && (Boolean)Config.COMMON.enableFallingBlocks.get() != false && spawnedFalling < maxFallingPerTick; if (allowFalling) { inner = c.core != false || c.stepIndex <= 5; @@ -358,13 +358,13 @@ public class AsyncCraterManager { continue; } chunk = this.levelRef.m_46745_(pos); - byChunk.computeIfAbsent(chunk, (Function)LambdaMetafactory.metafactory(null, null, null, (Ljava/lang/Object;)Ljava/lang/Object;, lambda$applyBatch$1(net.minecraft.world.level.chunk.LevelChunk ), (Lnet/minecraft/world/level/chunk/LevelChunk;)Ljava/util/List;)()).add(c); + byChunk.computeIfAbsent(chunk, Job::lambda$applyBatch$1).add(c); ++i; } - for (Map.Entry e : byChunk.entrySet()) { + for (Map.Entry e : byChunk.entrySet()) { chunk = (LevelChunk)e.getKey(); list = (List)e.getValue(); - list.sort((Comparator)LambdaMetafactory.metafactory(null, null, null, (Ljava/lang/Object;Ljava/lang/Object;)I, lambda$applyBatch$2(com.vinlanx.explosionoverhaul.AsyncCraterManager$Job$Candidate com.vinlanx.explosionoverhaul.AsyncCraterManager$Job$Candidate ), (Lcom/vinlanx/explosionoverhaul/AsyncCraterManager$Job$Candidate;Lcom/vinlanx/explosionoverhaul/AsyncCraterManager$Job$Candidate;)I)()); + list.sort((Comparator)Job::lambda$applyBatch$2); modifiedSections = new HashSet(); toRelight = new ArrayList(); relightBudget = Math.min(256, list.size()); diff --git a/src/main/java/com/vinlanx/explosionoverhaul/BlockIndexManager.java b/src/main/java/com/vinlanx/explosionoverhaul/BlockIndexManager.java index ca6a497..6c7dda4 100644 --- a/src/main/java/com/vinlanx/explosionoverhaul/BlockIndexManager.java +++ b/src/main/java/com/vinlanx/explosionoverhaul/BlockIndexManager.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; import java.io.Reader; -import java.lang.invoke.LambdaMetafactory; import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.LinkOption; @@ -491,12 +490,13 @@ public class BlockIndexManager { BlockIndexManager.sendProgressUpdate(); try { currentServer = ServerLifecycleHooks.getCurrentServer(); - if (currentServer == null) ** GOTO lbl24 - for (ServerPlayer serverPlayer : currentServer.m_6846_().m_11314_()) { - if (!BlockIndexManager.isPlayerAuthorized(serverPlayer)) continue; - packet = new ScanLoadPromptPacket(false); - PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with((Supplier)LambdaMetafactory.metafactory(null, null, null, ()Ljava/lang/Object;, lambda$loadExistingData$11(net.minecraft.server.level.ServerPlayer ), ()Lnet/minecraft/server/level/ServerPlayer;)((ServerPlayer)serverPlayer)), (Object)packet); - ExplosionOverhaul.LOGGER.debug("Hidden load prompt for authorized player: {}", (Object)serverPlayer.m_7755_().getString()); + if (currentServer != null) { + for (ServerPlayer serverPlayer : currentServer.m_6846_().m_11314_()) { + if (!BlockIndexManager.isPlayerAuthorized(serverPlayer)) continue; + packet = new ScanLoadPromptPacket(false); + PacketHandler.INSTANCE.send(PacketDistributor.PLAYER.with(() -> serverPlayer), (Object)packet); + ExplosionOverhaul.LOGGER.debug("Hidden load prompt for authorized player: {}", (Object)serverPlayer.m_7755_().getString()); + } } } catch (Exception e) { @@ -506,9 +506,6 @@ public class BlockIndexManager { ExplosionOverhaul.LOGGER.warn("BlockIndexManager: Failed to load existing data, falling back to new scan"); BlockIndexManager.startNewScan(); } -lbl24: - // 4 sources - BlockIndexManager.pendingScanLevel = null; } }