Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pog5/598705b3572c04d24f68760ab03494e5 to your computer and use it in GitHub Desktop.
Save pog5/598705b3572c04d24f68760ab03494e5 to your computer and use it in GitHub Desktop.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: pog5 <pixelnightly@proton.me>
Date: Thu, 14 Mar 2024 20:23:00 +0200
Subject: [PATCH] HOLY COW I'M TOTALLY GOING SO FAST OH F***
diff --git a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
index be10a534a8e58e0f96c3b28dc74513e4cfff2464..c4b6092651d2abcfcc99cb9d8c47e90187330da6 100644
--- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
+++ b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
@@ -514,7 +514,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
*/
public static void scheduleSave(final ServerLevel world, final int chunkX, final int chunkZ, final CompoundTag data,
final RegionFileType type) {
- RegionFileIOThread.scheduleSave(world, chunkX, chunkZ, data, type, PrioritisedExecutor.Priority.NORMAL);
+ //RegionFileIOThread.scheduleSave(world, chunkX, chunkZ, data, type, PrioritisedExecutor.Priority.NORMAL);
}
/**
@@ -542,8 +542,8 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
*/
public static void scheduleSave(final ServerLevel world, final int chunkX, final int chunkZ, final CompoundTag data,
final RegionFileType type, final PrioritisedExecutor.Priority priority) {
- final RegionFileIOThread thread = RegionFileIOThread.selectThread(world, chunkX, chunkZ, type);
- thread.scheduleSaveInternal(world, chunkX, chunkZ, data, type, priority);
+ //final RegionFileIOThread thread = RegionFileIOThread.selectThread(world, chunkX, chunkZ, type);
+ //thread.scheduleSaveInternal(world, chunkX, chunkZ, data, type, priority);
}
void scheduleSaveInternal(final ServerLevel world, final int chunkX, final int chunkZ, final CompoundTag data,
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 121651717b13d90751c20947ea46bdeb0d8da587..e5a2153df4fc45df322e0480b1ffa1acb1ffb9e6 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -804,7 +804,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) {
if (compressionThreshold >= 0) {
- com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(io.papermc.paper.configuration.GlobalConfiguration.get().misc.compressionLevel.or(-1)); // Paper - Use Velocity cipher
+ com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(io.papermc.paper.configuration.GlobalConfiguration.get().misc.compressionLevel.or(1)); // Paper - Use Velocity cipher
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
((CompressionDecoder) this.channel.pipeline().get("decompress")).setThreshold(compressionThreshold, rejectsBadPackets);
} else {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 754fff2c0305f2bf5ce1d080f0f0d9128a0fbb2e..06f4c5ac93e8856648337b71f224d8ef95081909 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -780,6 +780,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// WorldServer worldserver = this.overworld();
this.forceTicks = true;
// CraftBukkit end
+ /*
if (worldserver.getWorld().getKeepSpawnInMemory()) { // Paper - Configurable Keep Spawn Loaded range per world
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
@@ -804,6 +805,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Iterator iterator = this.levels.values().iterator();
} // Paper - Configurable Keep Spawn Loaded range per world
+ */
+
if (true) {
ServerLevel worldserver1 = worldserver;
// CraftBukkit end
@@ -825,7 +828,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
this.executeModerately();
// CraftBukkit end
- if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper - Configurable Keep Spawn Loaded range per world
+ // if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper - Configurable Keep Spawn Loaded range per world
// CraftBukkit start
// this.updateMobSpawningFlags();
worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters, this.isSpawningAnimals()); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean))
@@ -855,6 +858,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force, boolean close) {
// Paper end - rewrite chunk system - add close param
+ /*
boolean flag3 = false;
for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) {
@@ -864,7 +868,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location());
}
// Paper start - rewrite chunk system
- worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
+ // worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
if (flush) {
MinecraftServer.LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", worldserver.getChunkSource().chunkMap.getStorageName()); // LinearPurpur
}
@@ -879,7 +883,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
iworlddataserver.setWorldBorder(worldserver1.getWorldBorder().createSettings());
this.worldData.setCustomBossEvents(this.getCustomBossEvents().save());
this.storageSource.saveDataTag(this.registryAccess(), this.worldData, this.getPlayerList().getSingleplayerData());
- */
// CraftBukkit end
if (flush) {
Iterator iterator1 = this.getAllLevels().iterator();
@@ -894,6 +897,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
return flag3;
+
+ */
+ return false;
}
public boolean saveEverything(boolean suppressLogs, boolean flush, boolean force) {
@@ -980,7 +986,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.playerList.removeAll(this.isRestarting); // Paper
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
-
+ /*
MinecraftServer.LOGGER.info("Saving worlds");
Iterator iterator = this.getAllLevels().iterator();
@@ -994,7 +1000,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.saveAllChunks(false, true, false, true); // Paper - rewrite chunk system - move closing into here
-
+ */
this.isSaving = false;
this.resources.close();
@@ -1529,6 +1535,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod;
}
+ /*
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try {
this.isSaving = true;
@@ -1543,6 +1550,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
+ */
// Paper end - Incremental chunk and player saving
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - Server Tick Events
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d6c44f1179688cfee19f9772baaacd22902a91f7..8a0296aca03cb82d8fedf23b13f058828a6e5190 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -528,7 +528,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - rewrite chunk system
protected void saveIncrementally() {
- this.level.chunkTaskScheduler.chunkHolderManager.autoSave(); // Paper - rewrite chunk system
+ //this.level.chunkTaskScheduler.chunkHolderManager.autoSave(); // Paper - rewrite chunk system
}
// Paper end - - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index caef142261734aab264d1da420ff5e6d7117ea1c..90ade6d8135ee1b598a934a7698d26c7d63ec921 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -432,8 +432,11 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - Incremental chunk and player saving; duplicate save, but call incremental
public void saveIncrementally() {
+ /*
this.runDistanceManagerUpdates();
this.chunkMap.saveIncrementally();
+
+ */
}
// Paper end - Incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 005549acdd30c88d14df9051cbb732baf38282e5..ec928655479d55e181160e957de6b67e05dee3ea 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -827,7 +827,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.handlingTick = true;
TickRateManager tickratemanager = this.tickRateManager();
boolean flag = tickratemanager.runsNormally();
-
+ /*
if (flag) {
this.getWorldBorder().tick();
this.advanceWeatherCycle();
@@ -861,16 +861,20 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickTime();
}
+ */
+
if (!this.isDebug() && flag) {
- j = this.getGameTime();
+ long j = this.getGameTime();
this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks
this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
}
-
+ /*
if (flag) {
this.raids.tick();
}
+ */
+
this.getChunkSource().tick(shouldKeepTicking, true);
if (flag) {
this.runBlockEvents();
@@ -1011,7 +1015,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
int k = chunkcoordintpair.getMinBlockZ();
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
- if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - Option to disable thunder // Gale - Airplane - optimize random calls in chunk ticking - replace random with shouldDoLightning
+ /*
+ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 && chunk.shouldDoLightning(this.random)) { // Spigot // Paper - Option to disable thunder // Gale - Airplane - optimize random calls in chunk ticking - replace random with shouldDoLightning
blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper
if (this.isRainingAt(blockposition)) {
@@ -1057,7 +1062,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
} // Paper - Option to disable ice and snow
-
+ */
+ /*
if (randomTickSpeed > 0) {
// Paper start - optimize random block ticking
LevelChunkSection[] sections = chunk.getSections();
@@ -1090,6 +1096,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise random block ticking
+
+ */
}
@VisibleForTesting
@@ -1193,6 +1201,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
private void announceSleepStatus() {
+ /*
if (this.canSleepThroughNights()) {
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -1230,13 +1239,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
+
+ */
}
public void updateSleepingPlayerList() {
+ /*
if (!this.players.isEmpty() && this.sleepStatus.update(this.players)) {
this.announceSleepStatus();
}
+ */
}
@Override
@@ -1488,6 +1501,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start - Incremental chunk and player saving
public void saveIncrementally(boolean doFull) {
+ /*
ServerChunkCache chunkproviderserver = this.getChunkSource();
if (doFull) {
@@ -1510,6 +1524,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
}
// CraftBukkit end
+
+ */
}
// Paper end - Incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9b87e62426f8805247b86eef0fe2939cf76aa1d8..d5c586b0c491aec651826c979cb896bb3d547a43 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -735,7 +735,7 @@ public class ServerPlayer extends Player {
}
// CraftBukkit end
this.gameMode.tick();
- this.wardenSpawnTracker.tick();
+ //this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime;
if (this.invulnerableTime > 0) {
--this.invulnerableTime;
@@ -773,7 +773,7 @@ public class ServerPlayer extends Player {
this.trackStartFallingPosition();
this.trackEnteredOrExitedLavaOnVehicle();
- this.advancements.flushDirty(this);
+ //this.advancements.flushDirty(this);
// Purpur start
if (this.level().purpurConfig.useNightVisionWhenRiding && this.getVehicle() != null && this.getVehicle().getRider() == this && this.level().getGameTime() % 100 == 0) { // 5 seconds
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
index 191ea4a7b4c034c7c370b9b8ef78ddae31b78cbf..f292345f7af2aa71676ebb164a5cfd3be599ee61 100644
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
+++ b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
@@ -118,6 +118,7 @@ public class ServerRecipeBook extends RecipeBook {
}
private void loadRecipes(ListTag list, Consumer<RecipeHolder<?>> handler, RecipeManager recipeManager) {
+ /*
for (int i = 0; i < list.size(); ++i) {
String s = list.getString(i);
@@ -134,7 +135,7 @@ public class ServerRecipeBook extends RecipeBook {
ServerRecipeBook.LOGGER.error("Tried to load improperly formatted recipe: {} removed now.", s);
}
}
-
+ */
}
public void sendInitialRecipeBook(ServerPlayer player) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index caa0052a382196d9a8b9104ca42b1002a8e5c237..0d8d7006acff1fc350deaa9e154523724f29608b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -304,7 +304,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
protected int boardingCooldown;
@Nullable
private Entity vehicle;
- private Level level;
+ protected Level level;
public double xo;
public double yo;
public double zo;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index becdbc814361a7823657759087b2ffcbd778b0e4..aabb9004269c5c6e77467b7acac6b8a51645751f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -436,7 +436,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
}
-
+ /*
if (this.isEyeInFluid(FluidTags.WATER) && !this.level().getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) {
boolean flag1 = !this.canBreatheUnderwater() && !MobEffectUtil.hasWaterBreathing(this) && (!flag || !((net.minecraft.world.entity.player.Player) this).getAbilities().invulnerable);
@@ -473,6 +473,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.onChangedBlock(blockposition);
}
}
+
+ */
}
if (this.isAlive() && (this.isInWaterRainOrBubble() || this.isInPowderSnow)) {
@@ -894,10 +896,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
} // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong
}
+ /*
if (nbt.contains("Brain", 10)) {
this.brain = this.makeBrain(new Dynamic(NbtOps.INSTANCE, nbt.get("Brain")));
}
+ */
+
// Purpur start
if (nbt.contains("Purpur.ShouldBurnInDay")) {
shouldBurnInDay = nbt.getBoolean("Purpur.ShouldBurnInDay");
@@ -976,7 +981,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.effectsDirty = false;
}
-
+ /*
int i = (Integer) this.entityData.get(LivingEntity.DATA_EFFECT_COLOR_ID);
boolean flag = (Boolean) this.entityData.get(LivingEntity.DATA_EFFECT_AMBIENCE_ID);
@@ -1002,6 +1007,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+ */
+
}
protected void updateInvisibilityStatus() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 5ae6c0aa59f577ea4601fc8ba3768ed81bf0bcdb..aaecdc854f3ce615932540ac26afa5d44afcd89f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -362,9 +362,9 @@ public class Zombie extends Monster {
public boolean hurt(DamageSource source, float amount) {
if (!super.hurt(source, amount)) {
return false;
- } else if (!(this.level() instanceof ServerLevel)) {
- return false;
} else {
+ return this.level instanceof ServerLevel;
+ } /* else {
ServerLevel worldserver = (ServerLevel) this.level();
LivingEntity entityliving = this.getTarget();
@@ -402,6 +402,7 @@ public class Zombie extends Monster {
return true;
}
+ */
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index fc840fff5fe2dc33986f8e5d3a60c3c853fe6151..230a5718ffcc5c6a58169400873e57fab296435a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -353,7 +353,7 @@ public abstract class Player extends LivingEntity {
this.lastItemInMainHand = itemstack.copy();
}
- this.turtleHelmetTick();
+ //this.turtleHelmetTick();
this.cooldowns.tick();
this.updatePlayerPose();
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
index 326d1db39e3d3cd46cb5a584e2a7b82dd46ff8fa..0320aa243520ecab5837c7464669372a8f28c842 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -71,6 +71,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
Bukkit.getPluginManager().callEvent(teleEvent);
if (!teleEvent.isCancelled() && entityplayer.connection.isAcceptingMessages()) {
+ /*
if (this.random.nextFloat() < this.level().purpurConfig.enderPearlEndermiteChance && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { // Purpur
Endermite entityendermite = (Endermite) EntityType.ENDERMITE.create(this.level());
@@ -81,6 +82,8 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
}
}
+ */
+
if (entity.isPassenger()) {
entity.stopRiding();
}
diff --git a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
index c3800bdd5096cb06e085e28f6bf0f65586ecf11e..3293f63755fc398b612fbdbdd66608a9e12a6c96 100644
--- a/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CraftingMenu.java
@@ -101,9 +101,11 @@ public class CraftingMenu extends RecipeBookMenu<CraftingContainer> {
@Override
public void slotsChanged(Container inventory) {
+ /*
this.access.execute((world, blockposition) -> {
CraftingMenu.slotChangedCraftingGrid(this, world, this.player, this.craftSlots, this.resultSlots);
});
+ */
}
@Override
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index 800f063f2b9f5803b45ca65f389b3295b27e6f86..3dd973fa061de619d4382f804d4549601c665b07 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -53,6 +53,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
protected void apply(Map<ResourceLocation, JsonElement> prepared, ResourceManager manager, ProfilerFiller profiler) {
this.hasErrors = false;
+ /*
// CraftBukkit start - SPIGOT-5667 make sure all types are populated and mutable
Map<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, RecipeHolder<?>>> map1 = Maps.newHashMap();
for (RecipeType<?> recipeType : BuiltInRegistries.RECIPE_TYPE) {
@@ -85,6 +86,8 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}));
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
RecipeManager.LOGGER.info("Loaded {} recipes", this.byName.size()); // Paper - Improve logging and errors; log correct number of recipes
+
+ */
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 9c4a8b6a4371bf8b1af05fb180b8fee020226e05..bbdc923772a54e99baaf0bad976d15ee251f5d3a 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -132,6 +132,7 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
+ /*
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -183,6 +184,8 @@ public final class NaturalSpawner {
// Paper end - Optional per player mob spawns
}
}
+
+ */
}
// Paper start - Add mobcaps commands
@@ -197,32 +200,39 @@ public final class NaturalSpawner {
public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
// Paper start - Optional per player mob spawns
- spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
+ //spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
}
public static int spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) {
// Paper end - Optional per player mob spawns
+ /*
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
if (blockposition.getY() >= world.getMinBuildHeight() + 1) {
return NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner, maxSpawns, trackEntity); // Paper - Optional per player mob spawns
}
+
+ */
return 0; // Paper - Optional per player mob spawns
}
@VisibleForDebug
public static void spawnCategoryForPosition(MobCategory group, ServerLevel world, BlockPos pos) {
+ /*
NaturalSpawner.spawnCategoryForPosition(group, world, world.getChunk(pos), pos, (entitytypes, blockposition1, ichunkaccess) -> {
return true;
}, (entityinsentient, ichunkaccess) -> {
});
+
+ */
}
// Paper start - Optional per player mob spawns
public static void spawnCategoryForPosition(MobCategory group, ServerLevel world, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
- spawnCategoryForPosition(group, world,chunk, pos, checker, runner, Integer.MAX_VALUE, null);
+ //spawnCategoryForPosition(group, world,chunk, pos, checker, runner, Integer.MAX_VALUE, null);
}
public static int spawnCategoryForPosition(MobCategory group, ServerLevel world, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer<Entity> trackEntity) {
// Paper end - Optional per player mob spawns
+ /*
StructureManager structuremanager = world.structureManager();
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
int i = pos.getY();
@@ -329,6 +339,8 @@ public final class NaturalSpawner {
}
return j; // Paper - Optional per player mob spawns
+ */
+ return 0;
}
private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) {
@@ -461,6 +473,7 @@ public final class NaturalSpawner {
}
public static void spawnMobsForChunkGeneration(ServerLevelAccessor world, Holder<Biome> biomeEntry, ChunkPos chunkPos, RandomSource random) {
+ /*
MobSpawnSettings biomesettingsmobs = ((Biome) biomeEntry.value()).getMobSettings();
WeightedRandomList<MobSpawnSettings.SpawnerData> weightedrandomlist = biomesettingsmobs.getMobs(MobCategory.CREATURE);
@@ -532,6 +545,7 @@ public final class NaturalSpawner {
}
}
+ */
}
private static BlockPos getTopNonCollidingPos(LevelReader world, EntityType<?> entityType, int x, int z) {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index f7b724696151b73343feac1ce406fca9377f2508..f7e2c14772e04c4df84cd2a419379e48693ce551 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -60,6 +60,7 @@ public class NetherPortalBlock extends Block {
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ /*
if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.dimensionType().natural() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && random.nextInt(world.purpurConfig.piglinPortalSpawnModifier) < world.getDifficulty().getId()) { // Spigot // Purpur
while (world.getBlockState(pos).is((Block) this)) {
pos = pos.below();
@@ -77,6 +78,8 @@ public class NetherPortalBlock extends Block {
}
}
+ */
+
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
index a907b79fd8291a0e92db138f37239d17424188a1..827dcf553a1f098d8838078a076ad9dbef73e380 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
@@ -138,10 +138,13 @@ public class ChunkStatus {
return ChunkStatus.lightChunk(lightenginethreaded, ichunkaccess);
});
public static final ChunkStatus SPAWN = ChunkStatus.registerSimple("spawn", ChunkStatus.LIGHT, 0, ChunkStatus.POST_FEATURES, ChunkStatus.ChunkType.PROTOCHUNK, (chunkstatus, worldserver, chunkgenerator, list, ichunkaccess) -> {
+ /*
if (!ichunkaccess.isUpgrading()) {
chunkgenerator.spawnOriginalMobs(new WorldGenRegion(worldserver, list, chunkstatus, -1));
}
+ */
+
});
public static final ChunkStatus FULL = ChunkStatus.register("full", ChunkStatus.SPAWN, 0, false, ChunkStatus.POST_FEATURES, ChunkStatus.ChunkType.LEVELCHUNK, (chunkstatus, executor, worldserver, chunkgenerator, structuretemplatemanager, lightenginethreaded, function, list, ichunkaccess) -> {
return (CompletableFuture) function.apply(ichunkaccess);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 2b2a40a4b33d4cafa521c607c06b13ce9f04acfb..3a53f7010f847591702cd250edc97b7ce21bf9ab 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -845,7 +845,7 @@ public class LevelChunk extends ChunkAccess {
org.bukkit.Server server = this.level.getCraftServer();
this.chunkHolder.getEntityChunk().callEntitiesUnloadEvent(); // Paper - rewrite chunk system
org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
- org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(bukkitChunk, true); // Paper - rewrite chunk system - force save to true so that mustNotSave is correctly set below
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(bukkitChunk, false); // Paper - rewrite chunk system - force save to true so that mustNotSave is correctly set below
server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk();
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index b6059fdc93bcbede66679081c9d1ff564838ac7a..c5b35ddd75f68dc82516460b7ce04481c250ef3b 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -409,6 +409,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
@Override
public void spawnOriginalMobs(WorldGenRegion region) {
+ /*
if (!((NoiseGeneratorSettings) this.settings.value()).disableMobGeneration()) {
ChunkPos chunkcoordintpair = region.getCenter();
Holder<Biome> holder = region.getBiome(chunkcoordintpair.getWorldPosition().atY(region.getMaxBuildHeight() - 1));
@@ -417,5 +418,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
seededrandom.setDecorationSeed(region.getSeed(), chunkcoordintpair.getMinBlockX(), chunkcoordintpair.getMinBlockZ());
NaturalSpawner.spawnMobsForChunkGeneration(region, holder, chunkcoordintpair, seededrandom);
}
+
+ */
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index c6e5d3b7ef3886d0ffa9302d1270c048eaaeb671..62d6e523588a36cd4e8a4c726cbd85a11153275d 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -307,6 +307,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
@Override
public void spawnOriginalMobs(WorldGenRegion region) {
+ /*
WorldgenRandom random = CustomChunkGenerator.getSeededRandom();
int x = region.getCenter().x;
int z = region.getCenter().z;
@@ -315,6 +316,8 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
if (this.generator.shouldGenerateMobs(this.world.getWorld(), new RandomSourceWrapper.RandomWrapper(random), x, z)) {
this.delegate.spawnOriginalMobs(region);
}
+
+ */
}
@Override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment