Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/effect/HealOrHarmMobEffect.java
+++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java
@@ -16,7 +16,7 @@
@@ -17,7 +17,7 @@
@Override
public boolean applyEffectTick(EntityLiving entityliving, int i) {
public boolean applyEffectTick(WorldServer worldserver, EntityLiving entityliving, int i) {
if (this.isHarm == entityliving.isInvertedHealAndHarm()) {
- entityliving.heal((float) Math.max(4 << i, 0));
+ entityliving.heal((float) Math.max(4 << i, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
} else {
entityliving.hurt(entityliving.damageSources().magic(), (float) (6 << i));
entityliving.hurtServer(worldserver, entityliving.damageSources().magic(), (float) (6 << i));
}
@@ -30,7 +30,7 @@
@@ -31,7 +31,7 @@
if (this.isHarm == entityliving.isInvertedHealAndHarm()) {
j = (int) (d0 * (double) (4 << i) + 0.5D);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/effect/HungerMobEffect.java
+++ b/net/minecraft/world/effect/HungerMobEffect.java
@@ -12,7 +12,7 @@
@@ -13,7 +13,7 @@
@Override
public boolean applyEffectTick(EntityLiving entityliving, int i) {
public boolean applyEffectTick(WorldServer worldserver, EntityLiving entityliving, int i) {
if (entityliving instanceof EntityHuman entityhuman) {
- entityhuman.causeFoodExhaustion(0.005F * (float) (i + 1));
+ entityhuman.causeFoodExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent

View File

@@ -1,12 +1,12 @@
--- a/net/minecraft/world/effect/InfestedMobEffect.java
+++ b/net/minecraft/world/effect/InfestedMobEffect.java
@@ -47,7 +47,11 @@
@@ -48,7 +48,11 @@
entitysilverfish.moveTo(d0, d1, d2, world.getRandom().nextFloat() * 360.0F, 0.0F);
entitysilverfish.moveTo(d0, d1, d2, worldserver.getRandom().nextFloat() * 360.0F, 0.0F);
entitysilverfish.setDeltaMovement(new Vec3D(vector3f));
- world.addFreshEntity(entitysilverfish);
- worldserver.addFreshEntity(entitysilverfish);
+ // CraftBukkit start
+ if (!world.addFreshEntity(entitysilverfish, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.POTION_EFFECT)) {
+ if (!worldserver.addFreshEntity(entitysilverfish, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.POTION_EFFECT)) {
+ return;
+ }
+ // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/effect/OozingMobEffect.java
+++ b/net/minecraft/world/effect/OozingMobEffect.java
@@ -51,7 +51,7 @@
@@ -52,7 +52,7 @@
if (entityslime != null) {
entityslime.setSize(2, true);
entityslime.moveTo(d0, d1, d2, world.getRandom().nextFloat() * 360.0F, 0.0F);

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/effect/PoisonMobEffect.java
+++ b/net/minecraft/world/effect/PoisonMobEffect.java
@@ -11,7 +11,7 @@
@@ -12,7 +12,7 @@
@Override
public boolean applyEffectTick(EntityLiving entityliving, int i) {
public boolean applyEffectTick(WorldServer worldserver, EntityLiving entityliving, int i) {
if (entityliving.getHealth() > 1.0F) {
- entityliving.hurt(entityliving.damageSources().magic(), 1.0F);
+ entityliving.hurt(entityliving.damageSources().poison(), 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
- entityliving.hurtServer(worldserver, entityliving.damageSources().magic(), 1.0F);
+ entityliving.hurtServer(worldserver, entityliving.damageSources().poison(), 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
}
return true;

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/effect/RegenerationMobEffect.java
+++ b/net/minecraft/world/effect/RegenerationMobEffect.java
@@ -11,7 +11,7 @@
@@ -12,7 +12,7 @@
@Override
public boolean applyEffectTick(EntityLiving entityliving, int i) {
public boolean applyEffectTick(WorldServer worldserver, EntityLiving entityliving, int i) {
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
- entityliving.heal(1.0F);
+ entityliving.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/effect/SaturationMobEffect.java
+++ b/net/minecraft/world/effect/SaturationMobEffect.java
@@ -3,6 +3,11 @@
@@ -4,6 +4,11 @@
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.player.EntityHuman;
@@ -12,10 +12,10 @@
class SaturationMobEffect extends InstantMobEffect {
protected SaturationMobEffect(MobEffectInfo mobeffectinfo, int i) {
@@ -12,7 +17,15 @@
@@ -13,7 +18,15 @@
@Override
public boolean applyEffectTick(EntityLiving entityliving, int i) {
if (!entityliving.level().isClientSide && entityliving instanceof EntityHuman entityhuman) {
public boolean applyEffectTick(WorldServer worldserver, EntityLiving entityliving, int i) {
if (entityliving instanceof EntityHuman entityhuman) {
- entityhuman.getFoodData().eat(i + 1, 1.0F);
+ // CraftBukkit start
+ int oldFoodLevel = entityhuman.getFoodData().foodLevel;