geforkt von Mirrors/Paper
01a13871de
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
116 Zeilen
4.1 KiB
Diff
116 Zeilen
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sun, 7 Oct 2018 04:29:59 -0500
|
|
Subject: [PATCH] Add more Zombie API
|
|
|
|
|
|
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 1b48576beca178af14bfab297bd427b5f5bdaf42..1ff02c66fcc291b6ccc456673ad4c6c09d47d69e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
@@ -94,6 +94,7 @@ public class Zombie extends Monster {
|
|
private int inWaterTime;
|
|
public int conversionTime;
|
|
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
|
+ private boolean shouldBurnInDay = true; // Paper
|
|
|
|
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
|
super(type, world);
|
|
@@ -262,6 +263,12 @@ public class Zombie extends Monster {
|
|
super.aiStep();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public void stopDrowning() {
|
|
+ this.conversionTime = -1;
|
|
+ this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, false);
|
|
+ }
|
|
+ // Paper end
|
|
public void startUnderWaterConversion(int ticksUntilWaterConversion) {
|
|
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
|
this.conversionTime = ticksUntilWaterConversion;
|
|
@@ -291,9 +298,15 @@ public class Zombie extends Monster {
|
|
}
|
|
|
|
public boolean isSunSensitive() {
|
|
- return true;
|
|
+ return this.shouldBurnInDay; // Paper - use api value instead
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public boolean hurt(DamageSource source, float amount) {
|
|
if (!super.hurt(source, amount)) {
|
|
@@ -413,6 +426,7 @@ public class Zombie extends Monster {
|
|
nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
|
|
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
|
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper
|
|
}
|
|
|
|
@Override
|
|
@@ -424,6 +438,11 @@ public class Zombie extends Monster {
|
|
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
|
|
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
|
|
}
|
|
+ // Paper start
|
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
|
+ }
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
index 9e249a194980796248d07481df2cd04e80f079d8..1e0154f2d06b0cc5bc58ec2de98cbdce1346da35 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
@@ -93,6 +93,42 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
|
@Override
|
|
public void setAgeLock(boolean b) {
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isDrowning() {
|
|
+ return getHandle().isUnderWaterConverting();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void startDrowning(int drownedConversionTime) {
|
|
+ getHandle().startUnderWaterConversion(drownedConversionTime);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void stopDrowning() {
|
|
+ getHandle().stopDrowning();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean shouldBurnInDay() {
|
|
+ return getHandle().isSunSensitive();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isArmsRaised() {
|
|
+ return getHandle().isAggressive();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setArmsRaised(final boolean raised) {
|
|
+ getHandle().setAggressive(raised);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
+ }
|
|
+ // Paper end
|
|
|
|
@Override
|
|
public boolean getAgeLock() {
|