Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved UpdateSuppressionCrashFix #143

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update suppression crash fix will now prevent all crashes while updat…
…ing entities or during world tick.
  • Loading branch information
Lyra38 committed Jan 11, 2021
commit bcac2a169b8536750d749fca4b6d580e42f38465
4 changes: 2 additions & 2 deletions patches/net/minecraft/server/MinecraftServer.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
CrashReport crashreport = CrashReport.func_85055_a(throwable1, "Exception ticking world");
worldserver.func_72914_a(crashreport);
- throw new ReportedException(crashreport);
+ if(!CarpetSettings.updateSuppressionCrashFix || !(crashreport.func_71505_b() instanceof ThrowableSuppression) ) {
+ if(!CarpetSettings.updateSuppressionCrashFix) {
+ throw new ReportedException(crashreport);
+ } else {
+ Messenger.print_server_message(this, "You just caused a server crash in world tick.");
Expand All @@ -313,7 +313,7 @@
CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Exception ticking world entities");
worldserver.func_72914_a(crashreport1);
- throw new ReportedException(crashreport1);
+ if(!CarpetSettings.updateSuppressionCrashFix || !(crashreport1.func_71505_b() instanceof ThrowableSuppression) ) {
+ if(!CarpetSettings.updateSuppressionCrashFix) {
+ throw new ReportedException(crashreport1);
+ } else {
+ Messenger.print_server_message(this, "You just caused a server crash in update entities.");
Expand Down
89 changes: 45 additions & 44 deletions patches/net/minecraft/world/WorldServer.java.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
--- ../src-base/minecraft/net/minecraft/world/WorldServer.java
+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java
@@ -1,5 +1,7 @@
@@ -1,20 +1,13 @@
package net.minecraft.world;

+import carpet.helpers.NextTickListEntryFix;
+import carpet.helpers.ScheduledBlockEventSerializer;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -14,7 +16,6 @@
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.function.Predicate;
+import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import net.minecraft.advancements.AdvancementManager;
@@ -60,6 +61,7 @@
@@ -60,6 +53,7 @@
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
+import net.minecraft.util.text.ITextComponent;
import net.minecraft.village.VillageCollection;
import net.minecraft.village.VillageSiege;
import net.minecraft.world.biome.Biome;
@@ -80,14 +82,23 @@
@@ -80,14 +74,24 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -36,6 +44,7 @@
+import carpet.utils.CarpetProfiler;
+import carpet.utils.Messenger;
+import carpet.utils.Waypoint;
+import org.lwjgl.Sys;
+
public class WorldServer extends World implements IThreadListener
{
Expand All @@ -51,7 +60,7 @@
private final Map<UUID, Entity> field_175741_N = Maps.<UUID, Entity>newHashMap();
public boolean field_73058_d;
private boolean field_73068_P;
@@ -99,6 +110,13 @@
@@ -99,6 +103,13 @@
private int field_147489_T;
private final List<NextTickListEntry> field_94579_S = Lists.<NextTickListEntry>newArrayList();

Expand All @@ -65,7 +74,7 @@
public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_)
{
super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false);
@@ -159,11 +177,24 @@
@@ -159,11 +170,24 @@
this.func_175723_af().func_177750_a(this.field_72986_A.func_176137_E());
}

Expand All @@ -90,7 +99,7 @@
super.func_72835_b();

if (this.func_72912_H().func_76093_s() && this.func_175659_aa() != EnumDifficulty.HARD)
@@ -184,15 +215,26 @@
@@ -184,15 +208,26 @@
this.func_73053_d();
}

Expand All @@ -117,7 +126,7 @@
int j = this.func_72967_a(1.0F);

if (j != this.func_175657_ab())
@@ -200,26 +242,76 @@
@@ -200,26 +235,76 @@
this.func_175692_b(j);
}

Expand Down Expand Up @@ -196,7 +205,7 @@
}

@Nullable
@@ -255,8 +347,15 @@
@@ -255,8 +340,15 @@
++j;
}
}
Expand All @@ -214,7 +223,7 @@
}
}

@@ -287,6 +386,28 @@
@@ -287,6 +379,28 @@
{
if (this.field_73068_P && !this.field_72995_K)
{
Expand Down Expand Up @@ -243,7 +252,7 @@
for (EntityPlayer entityplayer : this.field_73010_i)
{
if (!entityplayer.func_175149_v() && !entityplayer.func_71026_bH())
@@ -303,7 +424,7 @@
@@ -303,7 +417,7 @@
}
}

Expand All @@ -252,15 +261,15 @@
{
return this.func_72863_F().func_73149_a(p_175680_1_, p_175680_2_);
}
@@ -344,6 +465,7 @@
@@ -344,6 +458,7 @@
boolean flag = this.func_72896_J();
boolean flag1 = this.func_72911_I();
this.field_72984_F.func_76320_a("pollingChunks");
+ boolean overworldIceOnly = !CarpetSettings.enableStableLCGNetherEnd || field_73011_w.func_186058_p().func_186068_a() == 0; // Rule to disable nether and end ice snow and lightning Carpet-XCOM

for (Iterator<Chunk> iterator = this.field_73063_M.func_187300_b(); iterator.hasNext(); this.field_72984_F.func_76319_b())
{
@@ -355,9 +477,14 @@
@@ -355,9 +470,14 @@
chunk.func_76594_o();
this.field_72984_F.func_76318_c("tickChunk");
chunk.func_150804_b(false);
Expand All @@ -276,7 +285,7 @@
{
this.field_73005_l = this.field_73005_l * 3 + 1013904223;
int l = this.field_73005_l >> 2;
@@ -385,7 +512,7 @@
@@ -385,7 +505,7 @@

this.field_72984_F.func_76318_c("iceandsnow");

Expand All @@ -285,7 +294,7 @@
{
this.field_73005_l = this.field_73005_l * 3 + 1013904223;
int j2 = this.field_73005_l >> 2;
@@ -443,7 +570,7 @@
@@ -443,7 +563,7 @@
}
}

Expand All @@ -294,7 +303,7 @@
{
BlockPos blockpos = this.func_175725_q(p_175736_1_);
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockpos, new BlockPos(blockpos.func_177958_n(), this.func_72800_K(), blockpos.func_177952_p()))).func_186662_g(3.0D);
@@ -472,13 +599,25 @@
@@ -472,13 +592,25 @@

public boolean func_175691_a(BlockPos p_175691_1_, Block p_175691_2_)
{
Expand Down Expand Up @@ -322,22 +331,14 @@
return this.field_73064_N.contains(nextticklistentry);
}

@@ -501,17 +640,34 @@

@@ -498,20 +630,26 @@
if (this.func_175707_a(p_175654_1_.func_177982_a(-8, -8, -8), p_175654_1_.func_177982_a(8, 8, 8)))
{
IBlockState iblockstate = this.func_180495_p(p_175654_1_);
-
if (iblockstate.func_185904_a() != Material.field_151579_a && iblockstate.func_177230_c() == p_175654_2_)
{
- iblockstate.func_177230_c().func_180650_b(this, p_175654_1_, iblockstate, this.field_73012_v);
+ try {
+ iblockstate.func_177230_c().func_180650_b(this, p_175654_1_, iblockstate, this.field_73012_v);
+ } catch (Throwable throwable){
+ if(CarpetSettings.updateSuppressionCrashFix){
+ Messenger.print_server_message(this.func_73046_m(), "You just caused a server crash in update block tick.");
+ } else {
+ CrashReport crashreport = CrashReport.func_85055_a(throwable, "Exception updating block tick");
+ this.func_72914_a(crashreport);
+ throw new ReportedException(crashreport);
+ }
+ }
iblockstate.func_177230_c().func_180650_b(this, p_175654_1_, iblockstate, this.field_73012_v);
}
+ if(RandomTickOptimization.needsWorldGenFix) return;
}
Expand All @@ -360,7 +361,7 @@

if (this.func_175667_e(p_175654_1_))
{
@@ -531,7 +687,13 @@
@@ -531,7 +669,13 @@

public void func_180497_b(BlockPos p_180497_1_, Block p_180497_2_, int p_180497_3_, int p_180497_4_)
{
Expand All @@ -375,7 +376,7 @@
nextticklistentry.func_82753_a(p_180497_4_);
Material material = p_180497_2_.func_176223_P().func_185904_a();

@@ -549,7 +711,8 @@
@@ -549,7 +693,8 @@

public void func_72939_s()
{
Expand All @@ -385,7 +386,7 @@
{
if (this.field_80004_Q++ >= 300)
{
@@ -644,9 +807,18 @@
@@ -644,9 +789,18 @@
}
else
{
Expand All @@ -406,7 +407,7 @@
}

this.field_72984_F.func_76320_a("cleaning");
@@ -677,6 +849,8 @@
@@ -677,6 +831,8 @@

if (this.func_175707_a(nextticklistentry1.field_180282_a.func_177982_a(0, 0, 0), nextticklistentry1.field_180282_a.func_177982_a(0, 0, 0)))
{
Expand All @@ -415,15 +416,15 @@
IBlockState iblockstate = this.func_180495_p(nextticklistentry1.field_180282_a);

if (iblockstate.func_185904_a() != Material.field_151579_a && Block.func_149680_a(iblockstate.func_177230_c(), nextticklistentry1.func_151351_a()))
@@ -699,6 +873,7 @@
@@ -699,6 +855,7 @@
this.func_175684_a(nextticklistentry1.field_180282_a, nextticklistentry1.func_151351_a(), 0);
}
}
+ carpet.carpetclient.CarpetClientChunkLogger.resetReason();

this.field_72984_F.func_76319_b();
this.field_94579_S.clear();
@@ -950,11 +1125,18 @@
@@ -950,11 +1107,18 @@

chunkproviderserver.func_186027_a(p_73044_1_);

Expand All @@ -443,7 +444,7 @@
}
}
}
@@ -1033,9 +1215,15 @@
@@ -1033,9 +1197,15 @@
}
else
{
Expand All @@ -459,23 +460,23 @@
return false;
}

@@ -1055,6 +1243,7 @@
@@ -1055,6 +1225,7 @@
this.field_175729_l.func_76038_a(p_72923_1_.func_145782_y(), p_72923_1_);
this.field_175741_N.put(p_72923_1_.func_110124_au(), p_72923_1_);
Entity[] aentity = p_72923_1_.func_70021_al();
+ p_72923_1_.postLoad();

if (aentity != null)
{
@@ -1139,6 +1328,7 @@
@@ -1139,6 +1310,7 @@
}

this.field_147490_S[this.field_147489_T].add(blockeventdata);
+ if(CarpetSettings.blockEventSerializer) blockEventSerializer.func_76185_a();
}

private void func_147488_Z()
@@ -1150,14 +1340,19 @@
@@ -1150,14 +1322,19 @@

for (BlockEventData blockeventdata : this.field_147490_S[i])
{
Expand All @@ -495,7 +496,7 @@
}

private boolean func_147485_a(BlockEventData p_147485_1_)
@@ -1299,4 +1494,19 @@
@@ -1299,4 +1476,19 @@
{
}
}
Expand Down