1.21.6 dev

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Bjarne Koll
2025-05-28 13:23:32 +02:00
committed by Nassim Jahnke
parent 39203a65e0
commit a24f9b204c
788 changed files with 41006 additions and 6324 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -69,6 +_,7 @@
@@ -72,6 +_,7 @@
public CompoundTag blockData;
public boolean forceTickAfterTeleportToDuplicate;
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
@@ -8,7 +8,7 @@
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level);
@@ -94,6 +_,7 @@
@@ -97,6 +_,7 @@
pos.getZ() + 0.5,
blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState
);
@@ -16,7 +16,7 @@
level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3);
level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity;
@@ -144,13 +_,22 @@
@@ -147,13 +_,22 @@
@Override
public void tick() {
if (this.blockState.isAir()) {
@@ -40,7 +40,7 @@
this.handlePortal();
if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
BlockPos blockPos = this.blockPosition();
@@ -171,12 +_,12 @@
@@ -174,12 +_,12 @@
}
if (!this.onGround() && !flag1) {
@@ -55,7 +55,7 @@
}
} else {
BlockState blockState = this.level().getBlockState(blockPos);
@@ -194,12 +_,18 @@
@@ -197,12 +_,18 @@
this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
}
@@ -75,7 +75,7 @@
if (block instanceof Fallable) {
((Fallable)block).onLand(this.level(), blockPos, this.blockState, blockState, this);
}
@@ -220,19 +_,19 @@
@@ -227,19 +_,19 @@
}
}
} else if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
@@ -98,26 +98,26 @@
this.callOnBrokenAfterFall(block, blockPos);
}
}
@@ -293,6 +_,7 @@
@@ -299,6 +_,7 @@
}
compound.putBoolean("CancelDrop", this.cancelDrop);
+ if (!this.autoExpire) compound.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API
output.putBoolean("CancelDrop", this.cancelDrop);
+ if (!this.autoExpire) output.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API
}
@Override
@@ -305,8 +_,9 @@
this.fallDamagePerDistance = compound.getFloatOr("FallHurtAmount", 0.0F);
this.fallDamageMax = compound.getIntOr("FallHurtMax", 40);
this.dropItem = compound.getBooleanOr("DropItem", true);
- this.blockData = compound.getCompound("TileEntityData").map(CompoundTag::copy).orElse(null);
+ this.blockData = compound.getCompound("TileEntityData").map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks
this.cancelDrop = compound.getBooleanOr("CancelDrop", false);
+ this.autoExpire = compound.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API
@@ -310,8 +_,9 @@
this.fallDamagePerDistance = input.getFloatOr("FallHurtAmount", 0.0F);
this.fallDamageMax = input.getIntOr("FallHurtMax", 40);
this.dropItem = input.getBooleanOr("DropItem", true);
- this.blockData = input.read("TileEntityData", CompoundTag.CODEC).orElse(null);
+ this.blockData = input.read("TileEntityData", CompoundTag.CODEC).map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks
this.cancelDrop = input.getBooleanOr("CancelDrop", false);
+ this.autoExpire = input.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API
}
public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) {
@@ -363,7 +_,7 @@
@@ -368,7 +_,7 @@
ResourceKey<Level> resourceKey1 = this.level().dimension();
boolean flag = (resourceKey1 == Level.END || resourceKey == Level.END) && resourceKey1 != resourceKey;
Entity entity = super.teleport(teleportTransition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -56,6 +_,9 @@
@@ -53,6 +_,9 @@
@Nullable
public UUID target;
public final float bobOffs;
@@ -10,7 +10,7 @@
public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) {
super(entityType, level);
@@ -64,7 +_,12 @@
@@ -61,7 +_,12 @@
}
public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack) {
@@ -24,7 +24,7 @@
}
public ItemEntity(Level level, double posX, double posY, double posZ, ItemStack itemStack, double deltaX, double deltaY, double deltaZ) {
@@ -126,7 +_,7 @@
@@ -116,7 +_,7 @@
@Override
public void tick() {
if (this.getItem().isEmpty()) {
@@ -33,7 +33,7 @@
} else {
super.tick();
if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
@@ -154,11 +_,15 @@
@@ -144,11 +_,15 @@
}
}
@@ -51,7 +51,7 @@
f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F;
}
@@ -191,8 +_,14 @@
@@ -181,8 +_,14 @@
}
}
@@ -68,7 +68,7 @@
}
}
}
@@ -217,9 +_,18 @@
@@ -207,9 +_,18 @@
private void mergeWithNeighbours() {
if (this.isMergable()) {
@@ -88,7 +88,7 @@
this.tryToMerge(itemEntity);
if (this.isRemoved()) {
break;
@@ -231,7 +_,7 @@
@@ -221,7 +_,7 @@
private boolean isMergable() {
ItemStack item = this.getItem();
@@ -97,7 +97,7 @@
}
private void tryToMerge(ItemEntity itemEntity) {
@@ -264,11 +_,16 @@
@@ -254,11 +_,16 @@
}
private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) {
@@ -115,7 +115,7 @@
}
}
@@ -296,12 +_,17 @@
@@ -286,12 +_,17 @@
} else if (!this.getItem().canBeHurtBy(damageSource)) {
return false;
} else {
@@ -134,25 +134,24 @@
}
return true;
@@ -324,6 +_,11 @@
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
compound.store("Item", ItemStack.CODEC, registryOps, this.getItem());
@@ -313,6 +_,11 @@
if (!this.getItem().isEmpty()) {
output.store("Item", ItemStack.CODEC, this.getItem());
}
+ // Paper start - Friction API
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
+ compound.putString("Paper.FrictionState", this.frictionState.toString());
+ output.putString("Paper.FrictionState", this.frictionState.toString());
+ }
+ // Paper end - Friction API
}
@Override
@@ -336,8 +_,19 @@
this.cachedThrower = null;
RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
this.setItem(compound.read("Item", ItemStack.CODEC, registryOps).orElse(ItemStack.EMPTY));
+
@@ -323,8 +_,17 @@
this.target = input.read("Owner", UUIDUtil.CODEC).orElse(null);
this.thrower = EntityReference.read(input, "Thrower");
this.setItem(input.read("Item", ItemStack.CODEC).orElse(ItemStack.EMPTY));
+ // Paper start - Friction API
+ compound.getString("Paper.FrictionState").ifPresent(frictionState -> {
+ input.getString("Paper.FrictionState").ifPresent(frictionState -> {
+ try {
+ this.frictionState = net.kyori.adventure.util.TriState.valueOf(frictionState);
+ } catch (Exception ignored) {
@@ -160,14 +159,13 @@
+ }
+ });
+ // Paper end - Friction API
+
if (this.getItem().isEmpty()) {
- this.discard();
+ this.discard(null); // CraftBukkit - add Bukkit remove cause
}
}
@@ -347,10 +_,73 @@
@@ -334,10 +_,73 @@
ItemStack item = this.getItem();
Item item1 = item.getItem();
int count = item.getCount();
@@ -242,7 +240,7 @@
item.setCount(count);
}
@@ -388,6 +_,7 @@
@@ -375,6 +_,7 @@
public void setItem(ItemStack stack) {
this.getEntityData().set(DATA_ITEM, stack);
@@ -250,7 +248,7 @@
}
@Override
@@ -441,7 +_,7 @@
@@ -427,7 +_,7 @@
public void makeFakeItem() {
this.setNeverPickUp();

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -29,6 +_,12 @@
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.portal.TeleportTransition;
@@ -28,6 +_,12 @@
import net.minecraft.world.level.storage.ValueInput;
import net.minecraft.world.level.storage.ValueOutput;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -13,15 +13,15 @@
public class PrimedTnt extends Entity implements TraceableEntity {
private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<BlockState> DATA_BLOCK_STATE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.BLOCK_STATE);
@@ -53,6 +_,7 @@
public LivingEntity owner;
@@ -52,6 +_,7 @@
public EntityReference<LivingEntity> owner;
private boolean usedPortal;
public float explosionPower = 4.0F;
+ public boolean isIncendiary = false; // CraftBukkit
public PrimedTnt(EntityType<? extends PrimedTnt> entityType, Level level) {
super(entityType, level);
@@ -62,7 +_,7 @@
@@ -61,7 +_,7 @@
public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) {
this(EntityType.TNT, level);
this.setPos(x, y, z);
@@ -30,7 +30,7 @@
this.setDeltaMovement(-Math.sin(d) * 0.02, 0.2F, -Math.cos(d) * 0.02);
this.setFuse(80);
this.xo = x;
@@ -94,10 +_,17 @@
@@ -93,10 +_,17 @@
@Override
public void tick() {
@@ -48,7 +48,7 @@
this.setDeltaMovement(this.getDeltaMovement().scale(0.98));
if (this.onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7, -0.5, 0.7));
@@ -106,20 +_,50 @@
@@ -105,20 +_,50 @@
int i = this.getFuse() - 1;
this.setFuse(i);
if (i <= 0) {
@@ -100,7 +100,7 @@
this.level()
.explode(
this,
@@ -128,8 +_,8 @@
@@ -127,8 +_,8 @@
this.getX(),
this.getY(0.0625),
this.getZ(),