Skip to content

Commit

Permalink
Restore vanilla chunk gc(Try to fix Luohuayu#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luohuayu committed Apr 24, 2022
1 parent 1c5df19 commit 172f465
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions patches/net/minecraft/world/WorldServer.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -668,26 +668,15 @@
if (progressCallback != null)
{
progressCallback.displaySavingString("Saving level");
@@ -979,14 +1217,17 @@
@@ -979,6 +1217,7 @@
}

chunkproviderserver.saveChunks(all);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this));

+ /* //Paper start - disable vanilla chunk GC
for (Chunk chunk : Lists.newArrayList(chunkproviderserver.getLoadedChunks()))
{
if (chunk != null && !this.playerChunkMap.contains(chunk.x, chunk.z))
{
chunkproviderserver.queueUnload(chunk);
}
- }
+ }*/
+ // Paper end
}
}

@@ -1012,6 +1253,12 @@
@@ -1012,6 +1251,12 @@
}
}

Expand All @@ -700,7 +689,7 @@
this.worldInfo.setBorderSize(this.getWorldBorder().getDiameter());
this.worldInfo.getBorderCenterX(this.getWorldBorder().getCenterX());
this.worldInfo.getBorderCenterZ(this.getWorldBorder().getCenterZ());
@@ -1023,18 +1270,20 @@
@@ -1023,18 +1268,20 @@
this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget());
this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getPlayerList().getHostPlayerData());
this.mapStorage.saveAllData();
Expand All @@ -725,7 +714,7 @@
{
this.loadedEntityList.add(entity);
this.onEntityAdded(entity);
@@ -1046,7 +1295,7 @@
@@ -1046,7 +1293,7 @@
{
if (entityIn.isDead)
{
Expand All @@ -734,7 +723,7 @@
return false;
}
else
@@ -1065,7 +1314,7 @@
@@ -1065,7 +1312,7 @@
{
if (!(entityIn instanceof EntityPlayer))
{
Expand All @@ -743,7 +732,7 @@
return false;
}

@@ -1113,9 +1362,18 @@
@@ -1113,9 +1360,18 @@

public boolean addWeatherEffect(Entity entityIn)
{
Expand All @@ -763,7 +752,7 @@
return true;
}
else
@@ -1136,10 +1394,18 @@
@@ -1136,10 +1392,18 @@

public Explosion newExplosion(@Nullable Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking)
{
Expand All @@ -783,7 +772,7 @@
if (!isSmoking)
{
explosion.clearAffectedBlockPositions();
@@ -1182,7 +1448,8 @@
@@ -1182,7 +1446,8 @@
{
if (this.fireBlockEvent(blockeventdata))
{
Expand All @@ -793,7 +782,7 @@
}
}

@@ -1208,27 +1475,31 @@
@@ -1208,27 +1473,31 @@

if (this.prevRainingStrength != this.rainingStrength)
{
Expand Down Expand Up @@ -831,7 +820,7 @@
}
}

@@ -1265,11 +1536,18 @@
@@ -1265,11 +1534,18 @@

public void spawnParticle(EnumParticleTypes particleType, boolean longDistance, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int... particleArguments)
{
Expand All @@ -850,7 +839,7 @@
this.sendPacketWithinDistance(entityplayermp, longDistance, xCoord, yCoord, zCoord, spacketparticles);
}
}
@@ -1323,6 +1601,11 @@
@@ -1323,6 +1599,11 @@
return this.functionManager;
}

Expand Down

0 comments on commit 172f465

Please sign in to comment.