Add TickFreeze Patch
Dieser Commit ist enthalten in:
Ursprung
c9f8b471d0
Commit
0a9b35f004
@ -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
|
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)
|
--- a/src/main/java/net/minecraft/server/WorldServer.java (revision 571772e5fd38f66c11220ce29cd15d70e8da46f6)
|
||||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java (date 1639394168874)
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java (date 1639424761201)
|
||||||
@@ -14,38 +14,28 @@
|
@@ -14,38 +14,28 @@
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||||
@ -58,29 +58,40 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class WorldServer extends World {
|
public class WorldServer extends World {
|
||||||
@@ -303,12 +293,14 @@
|
@@ -161,6 +151,7 @@
|
||||||
}
|
|
||||||
|
|
||||||
this.N();
|
public void doTick(BooleanSupplier booleansupplier) {
|
||||||
- this.a();
|
GameProfilerFiller gameprofilerfiller = this.getMethodProfiler();
|
||||||
+ if (!freezed) {
|
+ currentlyFrozen = freezed; // Do not Change freezed mid tick!
|
||||||
+ this.a();
|
|
||||||
+ }
|
this.ticking = true;
|
||||||
gameprofilerfiller.exitEnter("chunkSource");
|
gameprofilerfiller.enter("world border");
|
||||||
|
@@ -308,7 +299,7 @@
|
||||||
this.getChunkProvider().tick(booleansupplier);
|
this.getChunkProvider().tick(booleansupplier);
|
||||||
gameprofilerfiller.exitEnter("tickPending");
|
gameprofilerfiller.exitEnter("tickPending");
|
||||||
timings.doTickPending.startTiming(); // Spigot
|
timings.doTickPending.startTiming(); // Spigot
|
||||||
- if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
|
- if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||||
+ if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && !freezed) {
|
+ if (!currentlyFrozen && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||||
this.nextTickListBlock.b();
|
this.nextTickListBlock.b();
|
||||||
this.nextTickListFluid.b();
|
this.nextTickListFluid.b();
|
||||||
}
|
}
|
||||||
@@ -332,19 +324,29 @@
|
@@ -322,7 +313,9 @@
|
||||||
|
|
||||||
|
gameprofilerfiller.exitEnter("blockEvents");
|
||||||
|
timings.doSounds.startTiming(); // Spigot
|
||||||
|
- this.ad();
|
||||||
|
+ if (!currentlyFrozen) {
|
||||||
|
+ this.ad();
|
||||||
|
+ }
|
||||||
|
timings.doSounds.stopTiming(); // Spigot
|
||||||
|
this.ticking = false;
|
||||||
|
gameprofilerfiller.exitEnter("entities");
|
||||||
|
@@ -332,18 +325,28 @@
|
||||||
this.resetEmptyTime();
|
this.resetEmptyTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
+ lastFreezed = false;
|
+ lastFreezed = false;
|
||||||
+ if (!freezed && !physicsTick.isEmpty()) {
|
+ if (!currentlyFrozen && !physicsTick.isEmpty()) {
|
||||||
+ Map<BlockPosition, Runnable> physicsTickList = new LinkedHashMap<>(physicsTick);
|
+ Map<BlockPosition, Runnable> physicsTickList = new LinkedHashMap<>(physicsTick);
|
||||||
+ physicsTick.clear();
|
+ physicsTick.clear();
|
||||||
+ physicsTickList.forEach((blockPosition, runnable) -> runnable.run());
|
+ physicsTickList.forEach((blockPosition, runnable) -> runnable.run());
|
||||||
@ -99,55 +110,64 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
|||||||
// CraftBukkit start - Fixed an NPE
|
// CraftBukkit start - Fixed an NPE
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
+ if (freezed && !(entity instanceof EntityPlayer)) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
+ }
|
||||||
|
+ if (currentlyFrozen && !(entity instanceof EntityPlayer)) {
|
||||||
|
+ continue;
|
||||||
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.a((entity1) -> {
|
this.a((entity1) -> {
|
||||||
++entity1.ticksLived;
|
@@ -415,7 +418,9 @@
|
||||||
@@ -428,6 +430,7 @@
|
|
||||||
|
gameprofilerfiller.exit();
|
||||||
|
timings.tickEntities.stopTiming(); // Spigot
|
||||||
|
- this.tickBlockEntities();
|
||||||
|
+ if (!currentlyFrozen) {
|
||||||
|
+ this.tickBlockEntities();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
gameprofilerfiller.exit();
|
||||||
|
@@ -428,6 +433,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Chunk chunk, int i) {
|
public void a(Chunk chunk, int i) {
|
||||||
+ if (freezed) return;
|
+ if (currentlyFrozen) return;
|
||||||
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
|
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
|
||||||
boolean flag = this.isRaining();
|
boolean flag = this.isRaining();
|
||||||
int j = chunkcoordintpair.d();
|
int j = chunkcoordintpair.d();
|
||||||
@@ -584,6 +587,7 @@
|
@@ -584,6 +590,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void a(NextTickListEntry<FluidType> nextticklistentry) {
|
private void a(NextTickListEntry<FluidType> nextticklistentry) {
|
||||||
+ if (freezed) return;
|
+ if (currentlyFrozen) return;
|
||||||
Fluid fluid = this.getFluid(nextticklistentry.a);
|
Fluid fluid = this.getFluid(nextticklistentry.a);
|
||||||
|
|
||||||
if (fluid.getType() == nextticklistentry.b()) {
|
if (fluid.getType() == nextticklistentry.b()) {
|
||||||
@@ -593,6 +597,7 @@
|
@@ -593,6 +600,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void b(NextTickListEntry<Block> nextticklistentry) {
|
private void b(NextTickListEntry<Block> nextticklistentry) {
|
||||||
+ if (freezed) return;
|
+ if (currentlyFrozen) return;
|
||||||
IBlockData iblockdata = this.getType(nextticklistentry.a);
|
IBlockData iblockdata = this.getType(nextticklistentry.a);
|
||||||
|
|
||||||
if (iblockdata.getBlock() == nextticklistentry.b()) {
|
if (iblockdata.getBlock() == nextticklistentry.b()) {
|
||||||
@@ -602,6 +607,37 @@
|
@@ -602,6 +610,36 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void entityJoinedWorld(Entity entity) {
|
public void entityJoinedWorld(Entity entity) {
|
||||||
+ if (freezed && !(entity instanceof EntityPlayer) && !(entity instanceof EntityItem)) {
|
+ if (currentlyFrozen && !(entity instanceof EntityPlayer) && !(entity instanceof EntityItem)) {
|
||||||
+ PacketPlayOutEntityVelocity packetPlayOutEntityVelocity = new PacketPlayOutEntityVelocity(entity.getId(), new Vec3D(0, 0, 0));
|
+ PacketPlayOutEntityVelocity packetPlayOutEntityVelocity = new PacketPlayOutEntityVelocity(entity.getId(), new Vec3D(0, 0, 0));
|
||||||
+ PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(entity);
|
+ PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(entity);
|
||||||
+ entity.setNoGravity(true);
|
+ PacketPlayOutEntityMetadata packetPlayOutEntityMetadata;
|
||||||
+ if (entity instanceof EntityTNTPrimed) {
|
+ if (entity instanceof EntityTNTPrimed) {
|
||||||
+ EntityTNTPrimed entitytntprimed = (EntityTNTPrimed) entity;
|
+ EntityTNTPrimed entityTNTPrimed = new EntityTNTPrimed(EntityTypes.TNT, this);
|
||||||
+ entitytntprimed.setInvisible(true);
|
+ entityTNTPrimed.setNoGravity(true);
|
||||||
|
+ entityTNTPrimed.setPosition(entity.locX(), entity.locY(), entity.locZ());
|
||||||
|
+ entityTNTPrimed.setFuseTicks(((EntityTNTPrimed) entity).getFuseTicks());
|
||||||
|
+ packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getId(), entityTNTPrimed.getDataWatcher(), true);
|
||||||
|
+ } else {
|
||||||
|
+ packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true);
|
||||||
+ }
|
+ }
|
||||||
+ PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true);
|
|
||||||
+ if (entity instanceof EntityTNTPrimed) {
|
|
||||||
+ EntityTNTPrimed entitytntprimed = (EntityTNTPrimed) entity;
|
|
||||||
+ entitytntprimed.setInvisible(false);
|
|
||||||
+ }
|
|
||||||
+ entity.setNoGravity(false);
|
|
||||||
+ players.forEach(entityPlayer -> {
|
+ players.forEach(entityPlayer -> {
|
||||||
+ entityPlayer.playerConnection.sendPacket(packetPlayOutEntityVelocity);
|
+ entityPlayer.playerConnection.sendPacket(packetPlayOutEntityVelocity);
|
||||||
+ entityPlayer.playerConnection.sendPacket(packetPlayOutEntityTeleport);
|
+ entityPlayer.playerConnection.sendPacket(packetPlayOutEntityTeleport);
|
||||||
@ -168,6 +188,19 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
|
|||||||
if (entity instanceof EntityHuman || this.getChunkProvider().a(entity)) {
|
if (entity instanceof EntityHuman || this.getChunkProvider().a(entity)) {
|
||||||
// Spigot start
|
// Spigot start
|
||||||
if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
|
if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
|
||||||
|
@@ -1315,6 +1353,12 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playBlockAction(BlockPosition blockposition, Block block, int i, int j) {
|
||||||
|
+ if (!currentlyFrozen) {
|
||||||
|
+ physicsTick.put(blockposition, () -> {
|
||||||
|
+ this.I.add(new BlockActionData(blockposition, block, i, j));
|
||||||
|
+ });
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
this.I.add(new BlockActionData(blockposition, block, i, j));
|
||||||
|
}
|
||||||
|
|
||||||
Index: src/main/java/net/minecraft/server/World.java
|
Index: src/main/java/net/minecraft/server/World.java
|
||||||
IDEA additional info:
|
IDEA additional info:
|
||||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||||
@ -175,7 +208,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
|
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)
|
--- a/src/main/java/net/minecraft/server/World.java (revision 571772e5fd38f66c11220ce29cd15d70e8da46f6)
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java (date 1639348240863)
|
+++ b/src/main/java/net/minecraft/server/World.java (date 1639417061068)
|
||||||
@@ -1,29 +1,23 @@
|
@@ -1,29 +1,23 @@
|
||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
@ -214,24 +247,25 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||||
@@ -76,6 +70,10 @@
|
@@ -76,6 +70,11 @@
|
||||||
private org.spigotmc.TickLimiter tileLimiter;
|
private org.spigotmc.TickLimiter tileLimiter;
|
||||||
private int tileTickPosition;
|
private int tileTickPosition;
|
||||||
|
|
||||||
+ public boolean freezed = false;
|
+ public boolean freezed = false;
|
||||||
|
+ protected boolean currentlyFrozen = false;
|
||||||
+ protected boolean lastFreezed = false;
|
+ protected boolean lastFreezed = false;
|
||||||
+ protected Map<BlockPosition, Runnable> physicsTick = new LinkedHashMap();
|
+ protected Map<BlockPosition, Runnable> physicsTick = new LinkedHashMap();
|
||||||
+
|
+
|
||||||
public CraftWorld getWorld() {
|
public CraftWorld getWorld() {
|
||||||
return this.world;
|
return this.world;
|
||||||
}
|
}
|
||||||
@@ -322,8 +320,15 @@
|
@@ -322,8 +321,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
- iblockdata.a(this, blockposition, j);
|
- iblockdata.a(this, blockposition, j);
|
||||||
- iblockdata.b(this, blockposition, j);
|
- iblockdata.b(this, blockposition, j);
|
||||||
+ if (!freezed) {
|
+ if (!currentlyFrozen) {
|
||||||
+ iblockdata.a(this, blockposition, j);
|
+ iblockdata.a(this, blockposition, j);
|
||||||
+ iblockdata.b(this, blockposition, j);
|
+ iblockdata.b(this, blockposition, j);
|
||||||
+ } else {
|
+ } else {
|
||||||
@ -243,11 +277,11 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.a(blockposition, iblockdata1, iblockdata2);
|
this.a(blockposition, iblockdata1, iblockdata2);
|
||||||
@@ -418,6 +423,14 @@
|
@@ -418,6 +424,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) {
|
public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) {
|
||||||
+ if (freezed) {
|
+ if (currentlyFrozen) {
|
||||||
+ if (!isClientSide) {
|
+ if (!isClientSide) {
|
||||||
+ physicsTick.put(blockposition, () -> {
|
+ physicsTick.put(blockposition, () -> {
|
||||||
+ this.a(blockposition, block, blockposition1);
|
+ this.a(blockposition, block, blockposition1);
|
||||||
@ -258,3 +292,32 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
|
|||||||
if (!this.isClientSide) {
|
if (!this.isClientSide) {
|
||||||
IBlockData iblockdata = this.getType(blockposition);
|
IBlockData iblockdata = this.getType(blockposition);
|
||||||
|
|
||||||
|
@@ -1193,7 +1207,9 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void a() {
|
||||||
|
- this.a(this.worldData.getTime() + 1L);
|
||||||
|
+ if (!currentlyFrozen) {
|
||||||
|
+ this.a(this.worldData.getTime() + 1L);
|
||||||
|
+ }
|
||||||
|
if (this.worldData.v().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
||||||
|
this.setDayTime(this.worldData.getDayTime() + 1L);
|
||||||
|
}
|
||||||
|
@@ -1226,7 +1242,16 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playBlockAction(BlockPosition blockposition, Block block, int i, int j) {
|
||||||
|
- this.getType(blockposition).a(this, blockposition, i, j);
|
||||||
|
+ /*
|
||||||
|
+ if (!currentlyFrozen) {
|
||||||
|
+ physicsTick.put(blockposition, () -> {
|
||||||
|
+ this.getType(blockposition).a(this, blockposition, i, j);
|
||||||
|
+ });
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ */
|
||||||
|
+ IBlockData iblockdata = this.getType(blockposition); // Block of Position
|
||||||
|
+ iblockdata.a(this, blockposition, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren