Update to Minecraft 1.21

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-06-14 01:05:00 +10:00
parent 7c6204e1a9
commit eed041d629
255 changed files with 3585 additions and 3261 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
@@ -49,6 +49,11 @@
@@ -52,6 +52,11 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -12,7 +12,7 @@
public class EntityFallingBlock extends Entity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -83,10 +88,17 @@
@@ -87,10 +92,17 @@
}
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -31,7 +31,7 @@
return entityfallingblock;
}
@@ -126,7 +138,7 @@
@@ -130,7 +142,7 @@
@Override
public void tick() {
if (this.blockState.isAir()) {
@@ -40,7 +40,7 @@
} else {
Block block = this.blockState.getBlock();
@@ -154,7 +166,7 @@
@@ -159,7 +171,7 @@
this.spawnAtLocation((IMaterial) block);
}
@@ -49,7 +49,7 @@
}
} else {
IBlockData iblockdata = this.level().getBlockState(blockposition);
@@ -171,9 +183,15 @@
@@ -176,9 +188,15 @@
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
}
@@ -66,7 +66,7 @@
if (block instanceof Fallable) {
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
}
@@ -201,19 +219,19 @@
@@ -206,19 +224,19 @@
}
}
} else if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/item/EntityItem.java
+++ b/net/minecraft/world/entity/item/EntityItem.java
@@ -33,6 +33,15 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -34,6 +34,15 @@
import net.minecraft.world.level.portal.DimensionTransition;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
@@ -16,7 +16,7 @@
public class EntityItem extends Entity implements TraceableEntity {
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
@@ -51,6 +60,7 @@
@@ -52,6 +61,7 @@
@Nullable
public UUID target;
public final float bobOffs;
@@ -24,7 +24,7 @@
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
@@ -132,12 +142,15 @@
@@ -133,12 +143,15 @@
@Override
public void tick() {
if (this.getItem().isEmpty()) {
@@ -44,7 +44,7 @@
this.xo = this.getX();
this.yo = this.getY();
@@ -186,9 +199,11 @@
@@ -187,9 +200,11 @@
this.mergeWithNeighbours();
}
@@ -56,7 +56,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level().isClientSide) {
@@ -200,7 +215,13 @@
@@ -201,7 +216,13 @@
}
if (!this.level().isClientSide && this.age >= 6000) {
@@ -71,7 +71,7 @@
}
}
@@ -283,11 +304,16 @@
@@ -284,11 +305,16 @@
}
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
@@ -89,7 +89,7 @@
}
}
@@ -308,12 +334,17 @@
@@ -309,12 +335,17 @@
} else if (this.level().isClientSide) {
return true;
} else {
@@ -108,7 +108,7 @@
}
return true;
@@ -365,7 +396,7 @@
@@ -366,7 +397,7 @@
}
if (this.getItem().isEmpty()) {
@@ -117,7 +117,7 @@
}
}
@@ -377,10 +408,50 @@
@@ -378,10 +409,50 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -17,6 +17,12 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -24,6 +24,12 @@
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.portal.DimensionTransition;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,16 +13,16 @@
public class EntityTNTPrimed extends Entity implements TraceableEntity {
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
@@ -26,6 +32,8 @@
public static final String TAG_FUSE = "fuse";
@@ -45,6 +51,8 @@
@Nullable
public EntityLiving owner;
private boolean usedPortal;
+ public float yield = 4; // CraftBukkit - add field
+ public boolean isIncendiary = false; // CraftBukkit - add field
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
super(entitytypes, world);
@@ -79,10 +87,13 @@
@@ -99,10 +107,13 @@
this.setFuse(i);
if (i <= 0) {
@@ -37,7 +37,7 @@
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
@@ -93,9 +104,14 @@
@@ -113,9 +124,14 @@
}
private void explode() {
@@ -46,9 +46,9 @@
+ // float f = 4.0F;
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
- this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
- this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, false, World.a.TNT);
+ if (!event.isCancelled()) {
+ this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
+ this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
+ }
+ // CraftBukkit end
}