Archiviert
13
0

Add TickFreeze Patch

Dieser Commit ist enthalten in:
yoyosource 2021-12-14 18:24:50 +01:00
Ursprung 243a56213c
Commit 1fbba3a5d7

Datei anzeigen

@ -5,7 +5,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
===================================================================
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
--- a/src/main/java/net/minecraft/server/WorldServer.java (revision 571772e5fd38f66c11220ce29cd15d70e8da46f6)
+++ b/src/main/java/net/minecraft/server/WorldServer.java (date 1639429464511)
+++ b/src/main/java/net/minecraft/server/WorldServer.java (date 1639502280606)
@@ -14,38 +14,28 @@
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
@ -100,7 +100,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
+ lastFreezed = false;
+ if (!currentlyFrozen && !physicsTick.isEmpty()) {
+ physicsTick.forEach((blockPosition, runnable) -> runnable.run());
+ physicsTick.forEach((blockPosition, list) -> list.forEach(Runnable::run));
+ physicsTick.clear();
+ lastFreezed = true;
+ }
@ -143,23 +143,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
boolean flag = this.isRaining();
int j = chunkcoordintpair.d();
@@ -584,6 +591,7 @@
}
private void a(NextTickListEntry<FluidType> nextticklistentry) {
+ if (currentlyFrozen) return;
Fluid fluid = this.getFluid(nextticklistentry.a);
if (fluid.getType() == nextticklistentry.b()) {
@@ -593,6 +601,7 @@
}
private void b(NextTickListEntry<Block> nextticklistentry) {
+ if (currentlyFrozen) return;
IBlockData iblockdata = this.getType(nextticklistentry.a);
if (iblockdata.getBlock() == nextticklistentry.b()) {
@@ -602,6 +611,36 @@
@@ -602,6 +609,36 @@
}
public void entityJoinedWorld(Entity entity) {
@ -203,7 +187,7 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
===================================================================
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
--- a/src/main/java/net/minecraft/server/World.java (revision 571772e5fd38f66c11220ce29cd15d70e8da46f6)
+++ b/src/main/java/net/minecraft/server/World.java (date 1639428902021)
+++ b/src/main/java/net/minecraft/server/World.java (date 1639502482332)
@@ -1,29 +1,23 @@
package net.minecraft.server;
@ -249,12 +233,30 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
+ public boolean freezed = false;
+ protected boolean currentlyFrozen = false;
+ protected boolean lastFreezed = false;
+ protected Map<BlockPosition, Runnable> physicsTick = new LinkedHashMap();
+ protected Map<BlockPosition, List<Runnable>> physicsTick = new LinkedHashMap<>();
+
public CraftWorld getWorld() {
return this.world;
}
@@ -322,8 +321,15 @@
@@ -211,6 +210,9 @@
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock();
+ if (block.g().key.equals("minecraft:air")) {
+ physicsTick.remove(blockposition);
+ }
// CraftBukkit start - capture blockstates
boolean captured = false;
@@ -225,6 +227,7 @@
if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed (or the same)
+ physicsTick.remove(blockposition);
if (this.captureBlockStates && captured) {
this.capturedBlockStates.remove(blockposition);
}
@@ -322,8 +325,15 @@
}
}
// CraftBukkit end
@ -264,7 +266,7 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
+ iblockdata.a(this, blockposition, j);
+ iblockdata.b(this, blockposition, j);
+ } else {
+ physicsTick.put(blockposition, () -> {
+ physicsTick.computeIfAbsent(blockposition, (k) -> new ArrayList<>()).add(() -> {
+ iblockdata.a(this, blockposition, j);
+ iblockdata.b(this, blockposition, j);
+ });
@ -272,22 +274,20 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
}
this.a(blockposition, iblockdata1, iblockdata2);
@@ -418,6 +424,14 @@
@@ -418,6 +428,12 @@
}
public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) {
+ if (currentlyFrozen) {
+ if (!isClientSide) {
+ physicsTick.put(blockposition, () -> {
+ this.a(blockposition, block, blockposition1);
+ });
+ }
+ physicsTick.computeIfAbsent(blockposition, (k) -> new ArrayList<>()).add(() -> {
+ this.a(blockposition, block, blockposition1);
+ });
+ return;
+ }
if (!this.isClientSide) {
IBlockData iblockdata = this.getType(blockposition);
@@ -1226,6 +1240,14 @@
@@ -1226,6 +1242,14 @@
}
public void playBlockAction(BlockPosition blockposition, Block block, int i, int j) {