diff --git a/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch index 92994feb..92a22218 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch @@ -102,6 +102,41 @@ } @Override +@@ -957,7 +_,13 @@ + + private void wakeUpAllPlayers() { + this.sleepStatus.removeAllSleepers(); +- this.players.stream().filter(LivingEntity::isSleeping).collect(Collectors.toList()).forEach(player -> player.stopSleepInBed(false, false)); ++ // Gale start - Do less work - Avoid stream and list allocation ++ for (ServerPlayer player : this.players) { ++ if (player.isSleeping()) { ++ player.stopSleepInBed(false, false); ++ } ++ } ++ // Gale end - Do less work - Avoid stream and list allocation + } + + // Paper start - optimise random ticking +@@ -1037,13 +_,17 @@ + } + + public void tickThunder(final LevelChunk chunk) { ++ // Gale start - Do less work - Skip the profiler and random calls when thunder cannot happen ++ if (!this.isThundering() || this.paperConfig().environment.disableThunder || !this.isRaining() || this.spigotConfig.thunderChance <= 0) { ++ return; ++ } ++ // Gale end - Do less work - Skip the profiler and random calls when thunder cannot happen + ChunkPos chunkPos = chunk.getPos(); +- boolean raining = this.isRaining(); + int minX = chunkPos.getMinBlockX(); + int minZ = chunkPos.getMinBlockZ(); + ProfilerFiller profiler = Profiler.get(); + profiler.push("thunder"); +- if (!this.paperConfig().environment.disableThunder && raining && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder ++ if (this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder + BlockPos pos = this.findLightningTargetAround(this.getBlockRandomPos(minX, 0, minZ, 15)); + if (this.isRainingAt(pos)) { + DifficultyInstance difficulty = this.getCurrentDifficultyAt(pos); @@ -1396,7 +_,7 @@ // Paper end - log detailed entity tick information entity.setOldPosAndRot(); diff --git a/gale-server/minecraft-patches/sources/net/minecraft/util/SimpleBitStorage.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/util/SimpleBitStorage.java.patch index 7f87c295..5b96c4fe 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/util/SimpleBitStorage.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/util/SimpleBitStorage.java.patch @@ -36,10 +36,11 @@ public SimpleBitStorage(final int bits, final int size) { this(bits, size, (long[])null); } -@@ -399,6 +_,41 @@ +@@ -397,6 +_,41 @@ + @Override public BitStorage copy() { return new SimpleBitStorage(this.bits, this.size, (long[])this.data.clone()); - } ++ } + + // Gale - Chunk serialization + @Override @@ -74,7 +75,6 @@ + bits >>= this.bits; + } + } -+ } + } // Paper start - block counting - @Override diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/entity/npc/villager/Villager.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/entity/npc/villager/Villager.java.patch new file mode 100644 index 00000000..49904bba --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/entity/npc/villager/Villager.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/entity/npc/villager/Villager.java ++++ b/net/minecraft/world/entity/npc/villager/Villager.java +@@ -887,7 +_,11 @@ + if (this.lastGossipDecayTime == 0L) { + this.lastGossipDecayTime = timestamp; + } else if (timestamp >= this.lastGossipDecayTime + 24000L) { ++ // Gale start - Do less work - Skip gossip decay for villagers without any gossip ++ if (!this.gossips.gossips.isEmpty()) { + this.gossips.decay(); ++ } ++ // Gale end - Do less work - Skip gossip decay for villagers without any gossip + this.lastGossipDecayTime = timestamp; + } + } diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch new file mode 100644 index 00000000..9d304bb9 --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/world/level/BaseSpawner.java ++++ b/net/minecraft/world/level/BaseSpawner.java +@@ -107,6 +_,7 @@ + RandomSource random = level.getRandom(); + SpawnData nextSpawnData = this.getOrCreateNextSpawnData(level, random, pos); + ++ AABB nearbyEntitiesBox = new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange); // Gale - Do less work - Hoist nearby entity query box out of the spawn loop + for (int c = 0; c < this.spawnCount; c++) { + try (ProblemReporter.ScopedCollector reporter = new ProblemReporter.ScopedCollector(this::toString, LOGGER)) { + ValueInput input = TagValueInput.create(reporter, level.registryAccess(), nextSpawnData.getEntityToSpawn()); +@@ -165,7 +_,7 @@ + + int nearBy = level.getEntities( + EntityTypeTest.forExactClass(entity.getClass()), +- new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), ++ nearbyEntitiesBox, // Gale - Do less work - Hoist nearby entity query box out of the spawn loop + EntitySelector.NO_SPECTATORS + ) + .size(); diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch index 96f847f7..7a996150 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch @@ -288,6 +288,33 @@ this.tickingBlockEntities = true; if (!this.pendingBlockEntityTickers.isEmpty()) { this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); +@@ -1498,11 +_,13 @@ + // Paper start - Fix MC-117075 use removeAll + final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<@Nullable TickingBlockEntity> toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); + toRemove.add(null); ++ boolean removeAny = false; // Gale - Do less work - Skip the removeAll scan when nothing was removed + for (int tickerIndex = 0; tickerIndex < this.blockEntityTickers.size(); tickerIndex++) { + final TickingBlockEntity ticker = this.blockEntityTickers.get(tickerIndex); + // Paper end - Fix MC-117075 use removeAll + if (ticker.isRemoved()) { + toRemove.add(ticker); // Paper - Fix MC-117075 use removeAll ++ removeAny = true; // Gale - Do less work - Skip the removeAll scan when nothing was removed + } else if (tickBlockEntities && this.shouldTickBlocksAt(ticker.getPos())) { + ticker.tick(); + // Paper start - rewrite chunk system +@@ -1513,7 +_,11 @@ + } + } + +- this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 use removeAll ++ // Gale start - Do less work - Skip the removeAll scan when nothing was removed ++ if (removeAny) { ++ this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 use removeAll ++ } ++ // Gale end - Do less work - Skip the removeAll scan when nothing was removed + this.tickingBlockEntities = false; + } + @@ -2127,6 +_,13 @@ public BiomeManager getBiomeManager() { return this.biomeManager; diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch new file mode 100644 index 00000000..2f2740e6 --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +@@ -335,6 +_,7 @@ + } + + public static void serverTick(final Level level, final BlockPos blockPos, final BlockState state, final BeehiveBlockEntity entity) { ++ if (entity.stored.isEmpty()) return; // Gale - Do less work - Skip bee hive ticking when it holds no bees + tickOccupants(level, blockPos, state, entity.stored, entity.savedFlowerPos); + if (!entity.stored.isEmpty() && level.getRandom().nextDouble() < 0.005) { + double x = blockPos.getX() + 0.5; diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch new file mode 100644 index 00000000..83d3b781 --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java +@@ -38,6 +_,8 @@ + public int cooldownTime = -1; + private long tickedGameTime; + private Direction facing; ++ private @Nullable AABB cachedSuckAabb; // Gale - Do less work - Cache hopper suck AABB ++ private @Nullable BlockPos cachedSuckPos; // Gale - Do less work - Cache hopper suck AABB (invalidate on position change) + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList<>(); +@@ -668,7 +_,9 @@ + } + + public static List getItemsAtAndAbove(final Level level, final Hopper hopper) { +- AABB aabb = hopper.getSuckAabb().move(hopper.getLevelX() - 0.5, hopper.getLevelY() - 0.5, hopper.getLevelZ() - 0.5); ++ AABB aabb = hopper instanceof HopperBlockEntity hopperBlockEntity // Gale - Do less work - Cache hopper suck AABB ++ ? hopperBlockEntity.gale$getCachedSuckAabb() ++ : hopper.getSuckAabb().move(hopper.getLevelX() - 0.5, hopper.getLevelY() - 0.5, hopper.getLevelZ() - 0.5); + return level.getEntitiesOfClass(ItemEntity.class, aabb, EntitySelector.ENTITY_STILL_ALIVE); + } + +@@ -742,6 +_,18 @@ + return true; + } + ++ // Gale start - Do less work - Cache hopper suck AABB ++ public AABB gale$getCachedSuckAabb() { ++ AABB aabb = this.cachedSuckAabb; ++ BlockPos pos = this.getBlockPos(); ++ if (aabb == null || !pos.equals(this.cachedSuckPos)) { ++ this.cachedSuckAabb = aabb = this.getSuckAabb().move(this.getLevelX() - 0.5, this.getLevelY() - 0.5, this.getLevelZ() - 0.5); ++ this.cachedSuckPos = pos; ++ } ++ return aabb; ++ } ++ // Gale end - Do less work - Cache hopper suck AABB ++ + public void setCooldown(final int time) { + this.cooldownTime = time; + } +@@ -767,7 +_,7 @@ + public static void entityInside(final Level level, final BlockPos pos, final BlockState blockState, final Entity entity, final HopperBlockEntity hopper) { + if (entity instanceof ItemEntity itemEntity + && !itemEntity.getItem().isEmpty() +- && entity.getBoundingBox().move(-pos.getX(), -pos.getY(), -pos.getZ()).intersects(hopper.getSuckAabb())) { ++ && entity.getBoundingBox().intersects(hopper.gale$getCachedSuckAabb())) { // Gale - Do less work - Cache hopper suck AABB, avoids AABB allocation per item entity + tryMoveItems(level, pos, blockState, hopper, () -> addItem(hopper, itemEntity)); + } + } diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index 4a2662c0..5760a8d0 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -100,22 +100,7 @@ public boolean isSolidRender() { return this.solidRender; -@@ -996,8 +_,10 @@ - return this.is(tag) && predicate.test(this); - } - -- public boolean hasBlockEntity() { -- return this.getBlock() instanceof EntityBlock; -+ public final boolean hasBlockEntity() { -+ // Gale start - Pre-compute - BlockBehaviour.hasBlockEntity() -+ return this.gale$precompute_hasBlockEntity; -+ // Gale end - Pre-compute - BlockBehaviour.hasBlockEntity() - } - - public boolean shouldChangedStateKeepBlockEntity(final BlockState oldState) { -@@ -1037,7 +_,15 @@ - public VoxelShape getCollisionShape(final BlockGetter level, final BlockPos pos) { - return this.cache != null ? this.cache.collisionShape : this.getCollisionShape(level, pos, CollisionContext.empty()); +@@ -820,7 +_,17 @@ } public VoxelShape getCollisionShape(final BlockGetter level, final BlockPos pos, final CollisionContext context) { @@ -132,6 +117,21 @@ + } + return shape; } + + public VoxelShape getEntityInsideCollisionShape(final BlockGetter level, final BlockPos pos, final Entity entity) { +@@ -996,8 +_,10 @@ + return this.is(tag) && predicate.test(this); + } + +- public boolean hasBlockEntity() { +- return this.getBlock() instanceof EntityBlock; ++ // Gale start - Pre-compute - BlockBehaviour.hasBlockEntity() ++ public final boolean hasBlockEntity() { ++ return this.gale$precompute_hasBlockEntity; ++ // Gale end - Pre-compute - BlockBehaviour.hasBlockEntity() + } + + public boolean shouldChangedStateKeepBlockEntity(final BlockState oldState) { @@ -1447,6 +_,18 @@ public interface StateArgumentPredicate { boolean test(BlockState state, BlockGetter level, BlockPos pos, A a); diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/chunk/PalettedContainer.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/chunk/PalettedContainer.java.patch index 1072cbf5..db540aa8 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/world/level/chunk/PalettedContainer.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/chunk/PalettedContainer.java.patch @@ -42,10 +42,12 @@ private static int[] reencodeContents(final BitStorage storage, final Palette oldPalette, final Palette newPalette) { int[] buffer = new int[storage.getSize()]; storage.unpack(buffer); -@@ -390,6 +_,48 @@ - return buffer; - } +@@ -388,6 +_,48 @@ + } + return buffer; ++ } ++ + // Gale - Chunk serialization + private static Optional asOptional(final long[] values) { + return Optional.of(Arrays.stream(values)); @@ -86,8 +88,6 @@ + } finally { + this.release(); + } -+ } -+ + } + @Override - public int getSerializedSize() { - return this.data.getSerializedSize(this.strategy.globalMap()); diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java.patch new file mode 100644 index 00000000..caf2e4fd --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java.patch @@ -0,0 +1,49 @@ +--- a/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java ++++ b/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +@@ -88,11 +_,13 @@ + if (this.listenersToRemove.remove(listener)) { + iterator.remove(); + } else { +- Optional optionalPosition = getPostableListenerPosition(this.level, sourcePosition, listener); +- if (optionalPosition.isPresent()) { +- action.visit(listener, optionalPosition.get()); ++ // Gale start - Do less work - Inline the range check to avoid Optional allocations per listener per event ++ Vec3 listenerPosition = gale$getPostableListenerPositionNullable(this.level, sourcePosition, listener); ++ if (listenerPosition != null) { ++ action.visit(listener, listenerPosition); + applicable = true; + } ++ // Gale end - Do less work - Inline the range check to avoid Optional allocations per listener per event + } + } + } finally { +@@ -112,16 +_,22 @@ + return applicable; + } + +- private static Optional getPostableListenerPosition(final ServerLevel level, final Vec3 sourcePosition, final GameEventListener listener) { +- Optional position = listener.getListenerSource().getPosition(level); +- if (position.isEmpty()) { +- return Optional.empty(); ++ // Gale start - Do less work - Avoid Optional allocations per listener per event ++ private static @org.jspecify.annotations.Nullable Vec3 gale$getPostableListenerPositionNullable(final ServerLevel level, final Vec3 sourcePosition, final GameEventListener listener) { ++ Vec3 position = listener.getListenerSource().getPosition(level).orElse(null); ++ if (position == null) { ++ return null; + } + +- double distanceFromOrigin = BlockPos.containing(position.get()).distSqr(BlockPos.containing(sourcePosition)); ++ double distanceFromOrigin = BlockPos.containing(position).distSqr(BlockPos.containing(sourcePosition)); + int radiusSqr = listener.getListenerRadius() * listener.getListenerRadius(); +- return distanceFromOrigin > radiusSqr ? Optional.empty() : position; +- } ++ return distanceFromOrigin > radiusSqr ? null : position; ++ } ++ ++ private static Optional getPostableListenerPosition(final ServerLevel level, final Vec3 sourcePosition, final GameEventListener listener) { ++ return Optional.ofNullable(gale$getPostableListenerPositionNullable(level, sourcePosition, listener)); ++ } ++ // Gale end - Do less work - Avoid Optional allocations per listener per event + + @FunctionalInterface + public interface OnEmptyAction { diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch new file mode 100644 index 00000000..e8059a71 --- /dev/null +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch @@ -0,0 +1,102 @@ +--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java ++++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java +@@ -1,5 +_,6 @@ + package net.minecraft.world.level.gameevent; + ++import com.google.common.collect.Lists; + import java.util.ArrayList; + import java.util.Collections; + import java.util.List; +@@ -13,6 +_,13 @@ + import net.minecraft.world.phys.Vec3; + + public class GameEventDispatcher { ++ // Gale start - Do less work - Reuse a single visitor instance and dispatch list across event posts ++ private List eventsToDispatch = Lists.newArrayList(); ++ private final GameEventListenerRegistry.ListenerVisitor visitor = this::visitListener; ++ private Holder gameEvent; ++ private Vec3 position; ++ private GameEvent.Context context; ++ // Gale end - Do less work - Reuse a single visitor instance and dispatch list across event posts + private final ServerLevel level; + + public GameEventDispatcher(final ServerLevel level) { +@@ -37,14 +_,15 @@ + int sectionMaxX = SectionPos.blockToSectionCoord(center.getX() + radius); + int sectionMaxY = SectionPos.blockToSectionCoord(center.getY() + radius); + int sectionMaxZ = SectionPos.blockToSectionCoord(center.getZ() + radius); +- List toHandleByDistance = new ArrayList<>(); +- GameEventListenerRegistry.ListenerVisitor visitListeners = (listener, pos) -> { +- if (listener.getDeliveryMode() == GameEventListener.DeliveryMode.BY_DISTANCE) { +- toHandleByDistance.add(new GameEvent.ListenerInfo(gameEvent, position, context, listener, pos)); +- } else { +- listener.handleGameEvent(this.level, gameEvent, context, position); +- } +- }; ++ // Gale start - Do less work - Reuse the visitor and dispatch list instead of allocating per post ++ this.eventsToDispatch.clear(); // Gale - clear stale entries if a previous post was interrupted by an exception ++ Holder prevGameEvent = this.gameEvent; ++ Vec3 prevPosition = this.position; ++ GameEvent.Context prevContext = this.context; ++ this.gameEvent = gameEvent; ++ this.position = position; ++ this.context = context; ++ // Gale end - Do less work - Reuse the visitor and dispatch list instead of allocating per post + boolean applicable = false; + + for (int chunkX = sectionMinX; chunkX <= sectionMaxX; chunkX++) { +@@ -52,15 +_,18 @@ + ChunkAccess chunk = this.level.getChunkIfLoadedImmediately(chunkX, chunkZ); // Paper - Use getChunkIfLoadedImmediately + if (chunk != null) { + for (int section = sectionMinY; section <= sectionMaxY; section++) { +- applicable |= chunk.getListenerRegistry(section).visitInRangeListeners(gameEvent, position, context, visitListeners); ++ applicable |= chunk.getListenerRegistry(section).visitInRangeListeners(gameEvent, position, context, this.visitor); + } + } + } + } + +- if (!toHandleByDistance.isEmpty()) { +- this.handleGameEventMessagesInQueue(toHandleByDistance); +- } ++ // Gale start - Do less work - Reuse the visitor and dispatch list instead of allocating per post ++ this.dispatchPendingEvents(); ++ this.gameEvent = prevGameEvent; ++ this.position = prevPosition; ++ this.context = prevContext; ++ // Gale end - Do less work - Reuse the visitor and dispatch list instead of allocating per post + + if (applicable) { + this.level +@@ -68,6 +_,31 @@ + .broadcastEventToTracking(BlockPos.containing(position), DebugSubscriptions.GAME_EVENTS, new DebugGameEventInfo(gameEvent, position)); + } + } ++ ++ // Gale start - Do less work - Reusable visitor entry point ++ private void visitListener(final GameEventListener listener, final Vec3 pos) { ++ if (listener.getDeliveryMode() == GameEventListener.DeliveryMode.BY_DISTANCE) { ++ this.eventsToDispatch.add(new GameEvent.ListenerInfo(this.gameEvent, this.position, this.context, listener, pos)); ++ } else { ++ listener.handleGameEvent(this.level, this.gameEvent, this.context, this.position); ++ } ++ } ++ ++ private void dispatchPendingEvents() { ++ if (this.eventsToDispatch.isEmpty()) { ++ return; ++ } ++ ++ List toHandle = this.eventsToDispatch; ++ this.eventsToDispatch = new ArrayList<>(); ++ try { ++ this.handleGameEventMessagesInQueue(toHandle); ++ } finally { ++ toHandle.clear(); ++ this.eventsToDispatch = toHandle; ++ } ++ } ++ // Gale end - Do less work - Reusable visitor entry point + + private void handleGameEventMessagesInQueue(final List listenerInfos) { + Collections.sort(listenerInfos); diff --git a/gale-server/minecraft-patches/sources/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch b/gale-server/minecraft-patches/sources/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch index 19833113..aa2aeada 100644 --- a/gale-server/minecraft-patches/sources/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch +++ b/gale-server/minecraft-patches/sources/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch @@ -1,13 +1,12 @@ --- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -58,3 +_,5 @@ +@@ -58,11 +_,18 @@ private static final BlockState AIR = Blocks.AIR.defaultBlockState(); private final Holder settings; private final Supplier globalFluidPicker; + private final org.galemc.gale.util.function.MemoizedBooleanSupplier hasCarvers; // Gale - Cache - NoiseBasedChunkGenerator.applyCarvers() + private int cachedSeaLevel = Integer.MIN_VALUE; // Gale - Cache - NoiseBasedChunkGenerator.getSeaLevel() - -@@ -62,5 +_,10 @@ + public NoiseBasedChunkGenerator(final BiomeSource biomeSource, final Holder settings) { super(biomeSource); this.settings = settings; @@ -18,6 +17,8 @@ + ); + // Gale end - Cache - NoiseBasedChunkGenerator.applyCarvers() } + + private static Aquifer.FluidPicker createFluidPicker(final NoiseGeneratorSettings settings) { @@ -310,6 +_,13 @@ final ChunkAccess chunk ) {