readd beacon effect cause

This commit is contained in:
Lulu13022002
2024-12-18 19:09:46 +01:00
parent dedc6b3394
commit 6126012369
102 changed files with 443 additions and 488 deletions

View File

@@ -4,7 +4,7 @@
import net.minecraft.world.phys.Vec3;
import org.slf4j.Logger;
+// CraftBukkit start;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end
@@ -20,28 +20,14 @@
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level);
@@ -80,6 +_,10 @@
}
public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState) {
+ // CraftBukkit start
+ return FallingBlockEntity.fall(level, pos, blockState, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
+ }
+ public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason) {
FallingBlockEntity fallingBlockEntity = new FallingBlockEntity(
level,
pos.getX() + 0.5,
@@ -89,8 +_,9 @@
@@ -89,6 +_,7 @@
? blockState.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(false))
: blockState
);
+ if (!CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, blockState.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit
level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3);
- level.addFreshEntity(fallingBlockEntity);
+ level.addFreshEntity(fallingBlockEntity, creatureSpawnReason); // CraftBukkit
level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity;
}
@@ -139,13 +_,22 @@
@Override
public void tick() {
@@ -147,9 +133,9 @@
}
+
+ // Paper start - Expand FallingBlock API
+ if (compound.contains("Paper.AutoExpire")) {
+ if (compound.contains("Paper.AutoExpire")) {
+ this.autoExpire = compound.getBoolean("Paper.AutoExpire");
+ }
+ }
+ // Paper end - Expand FallingBlock API
}

View File

@@ -142,18 +142,18 @@
}
return true;
@@ -308,6 +_,11 @@
@Override
public void addAdditionalSaveData(CompoundTag compound) {
@@ -322,6 +_,11 @@
if (!this.getItem().isEmpty()) {
compound.put("Item", this.getItem().save(this.registryAccess()));
}
+ // Paper start - Friction API
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
+ compound.putString("Paper.FrictionState", this.frictionState.toString());
+ }
+ // Paper end - Friction API
compound.putShort("Health", (short)this.health);
compound.putShort("Age", (short)this.age);
compound.putShort("PickupDelay", (short)this.pickupDelay);
}
@Override
@@ -347,9 +_,19 @@
} else {
this.setItem(ItemStack.EMPTY);
@@ -164,7 +164,7 @@
+ try {
+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs);
+ } catch (Exception ignored) {
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this);
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state {} for {}", fs, this);
+ }
+ }
+ // Paper end - Friction API

View File

@@ -4,7 +4,7 @@
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.portal.TeleportTransition;
+// CraftBukkit start;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
@@ -95,7 +95,7 @@
+ if (event.isCancelled()) {
+ return;
+ }
+ // Craftbukkit end
+ // CraftBukkit end
this.level()
.explode(
this,
@@ -118,7 +118,7 @@
+ // Paper start - Option to prevent TNT from moving in water
+ @Override
+ public boolean isPushedByFluid() {
+ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
+ return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
+ }
+ // Paper end - Option to prevent TNT from moving in water
}