Update to Minecraft 1.17

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-06-11 15:00:00 +10:00
parent 75faba7fde
commit b3a8254758
619 changed files with 10708 additions and 8451 deletions

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -47,6 +47,13 @@
import net.minecraft.world.level.block.Blocks;
@@ -49,6 +49,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
@@ -13,36 +13,36 @@
+
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
public static final DataWatcherObject<Boolean> CONVERTING = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.i);
@@ -56,6 +63,7 @@
private NBTBase bp;
private NBTTagCompound bq;
private int br;
public static final DataWatcherObject<Boolean> DATA_CONVERTING_ID = DataWatcher.a(EntityZombieVillager.class, DataWatcherRegistry.BOOLEAN);
@@ -62,6 +69,7 @@
private NBTBase gossips;
private NBTTagCompound tradeOffers;
private int villagerXp;
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -72,7 +80,7 @@
@@ -78,7 +86,7 @@
@Override
public void saveData(NBTTagCompound nbttagcompound) {
super.saveData(nbttagcompound);
- DataResult dataresult = VillagerData.a.encodeStart(DynamicOpsNBT.a, this.getVillagerData());
+ DataResult<NBTBase> dataresult = VillagerData.a.encodeStart(DynamicOpsNBT.a, this.getVillagerData()); // CraftBukkit - decompile error
- DataResult dataresult = VillagerData.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.getVillagerData());
+ DataResult<NBTBase> dataresult = VillagerData.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.getVillagerData()); // CraftBukkit - decompile error
Logger logger = EntityZombieVillager.LOGGER;
logger.getClass();
@@ -128,6 +136,10 @@
Objects.requireNonNull(logger);
@@ -134,6 +142,10 @@
public void tick() {
if (!this.world.isClientSide && this.isAlive() && this.isConverting()) {
if (!this.level.isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ i *= elapsedTicks;
+ // CraftBukkit end
this.conversionTime -= i;
if (this.conversionTime <= 0) {
@@ -136,6 +148,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -142,6 +154,7 @@
}
super.tick();
@@ -50,18 +50,21 @@
}
@Override
@@ -179,13 +192,22 @@
this.conversionPlayer = uuid;
this.conversionTime = i;
this.getDataWatcher().set(EntityZombieVillager.CONVERTING, true);
@@ -186,8 +199,11 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getDataWatcher().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
- this.removeEffect(MobEffects.WEAKNESS);
- this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)));
- this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level.getDifficulty().a() - 1, 0)));
+ // CraftBukkit start
+ this.persistent = true; // CraftBukkit - SPIGOT-4684 update persistence
+ this.persistenceRequired = true; // CraftBukkit - SPIGOT-4684 update persistence
+ this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
+ this.addEffect(new MobEffect(MobEffects.INCREASE_DAMAGE, i, Math.min(this.world.getDifficulty().a() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
+ this.addEffect(new MobEffect(MobEffects.DAMAGE_BOOST, i, Math.min(this.level.getDifficulty().a() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
+ // CraftBukkit end
this.world.broadcastEntityEffect(this, (byte) 16);
this.level.broadcastEntityEffect(this, (byte) 16);
}
@@ -204,7 +220,13 @@
}
private void c(WorldServer worldserver) {
@@ -76,17 +79,17 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -200,7 +222,9 @@
@@ -219,7 +241,9 @@
double d0 = (double) this.e(enumitemslot);
if (d0 > 1.0D) {
+ this.forceDrops = true; // CraftBukkit
this.a(itemstack);
this.b(itemstack);
+ this.forceDrops = false; // CraftBukkit
}
}
}
@@ -226,7 +250,7 @@
@@ -245,7 +269,7 @@
}
}