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

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Bogged.java
+++ b/net/minecraft/world/entity/monster/Bogged.java
@@ -72,7 +_,20 @@
@@ -72,7 +_,19 @@
ItemStack itemInHand = player.getItemInHand(hand);
if (itemInHand.is(Items.SHEARS) && this.readyForShearing()) {
if (this.level() instanceof ServerLevel serverLevel) {
@@ -11,18 +11,17 @@
+ org.bukkit.event.player.PlayerShearEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemInHand, hand, drops);
+ if (event != null) {
+ if (event.isCancelled()) {
+ // this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients // Paper - no longer needed
+ return InteractionResult.PASS;
+ }
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
+ // Paper end - custom shear drops
+ // Paper end - custom shear drops
+ }
+ // CraftBukkit end
+ this.shear(serverLevel, SoundSource.PLAYERS, itemInHand, drops); // Paper - custom shear drops
this.gameEvent(GameEvent.SHEAR, player);
itemInHand.hurtAndBreak(1, player, getSlotForHand(hand));
}
@@ -125,15 +_,34 @@
@@ -125,15 +_,33 @@
@Override
public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) {
@@ -53,10 +52,9 @@
- level, BuiltInLootTables.BOGGED_SHEAR, stack, (serverLevel, itemStack) -> this.spawnAtLocation(serverLevel, itemStack, this.getBbHeight())
- );
+ // Paper start - custom shear drops
+ private void spawnShearedMushrooms(ServerLevel world, ItemStack shears, java.util.List<ItemStack> drops) {
+ final ServerLevel worldserver1 = world; // Named for lambda consumption
+ private void spawnShearedMushrooms(ServerLevel level, ItemStack stack, java.util.List<ItemStack> drops) {
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
+ drops.forEach(itemstack1 -> this.spawnAtLocation(world, shears, this.getBbHeight()));
+ drops.forEach(itemstack1 -> this.spawnAtLocation(level, stack, this.getBbHeight()));
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
+ // Paper end - custom shear drops
}

View File

@@ -13,7 +13,7 @@
if (compound.getBoolean("ignited")) {
- this.ignite();
+ this.entityData.set(Creeper.DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
+ this.entityData.set(DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
}
}
@@ -66,7 +66,7 @@
+ // CraftBukkit start
+ } else {
+ this.swell = 0;
+ this.entityData.set(DATA_IS_IGNITED, Boolean.valueOf(false)); // Paper
+ this.entityData.set(DATA_IS_IGNITED, false); // Paper
+ }
+ // CraftBukkit end
}
@@ -81,7 +81,7 @@
areaEffectCloud.setRadius(2.5F);
areaEffectCloud.setRadiusOnUse(-0.5F);
areaEffectCloud.setWaitTime(10);
@@ -254,16 +_,26 @@
@@ -254,16 +_,27 @@
areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance));
}
@@ -91,12 +91,13 @@
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
+ }
+ }
+
+ // Paper start - CreeperIgniteEvent
+ public void setIgnited(boolean ignited) {
+ if (isIgnited() != ignited) {
+ com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), ignited);
+ if (event.callEvent()) {
+ this.entityData.set(Creeper.DATA_IS_IGNITED, event.isIgnited());
+ this.entityData.set(DATA_IS_IGNITED, event.isIgnited());
+ }
+ }
+ }

View File

@@ -71,22 +71,23 @@
return flag1;
}
@@ -400,6 +_,15 @@
public void setBeingStaredAt() {
@@ -401,6 +_,16 @@
this.entityData.set(DATA_STARED_AT, true);
}
+ // Paper start
+ public void setCreepy(boolean creepy) {
+ this.entityData.set(EnderMan.DATA_CREEPY, creepy);
+ this.entityData.set(DATA_CREEPY, creepy);
+ }
+
+ public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
+ this.entityData.set(EnderMan.DATA_STARED_AT, hasBeenStaredAt);
+ this.entityData.set(DATA_STARED_AT, hasBeenStaredAt);
+ }
+ // Paper end
+
@Override
public boolean requiresCustomPersistence() {
return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
@@ -460,16 +_,19 @@
int floor1 = Mth.floor(this.enderman.getY() + random.nextDouble() * 2.0);
int floor2 = Mth.floor(this.enderman.getZ() - 1.0 + random.nextDouble() * 2.0);

View File

@@ -17,7 +17,7 @@
}
LargeFireball largeFireball = new LargeFireball(level, this.ghast, vec3.normalize(), this.ghast.getExplosionPower());
+ largeFireball.bukkitYield = largeFireball.explosionPower = this.ghast.getExplosionPower(); // CraftBukkit - set bukkitYield when setting explosionpower
+ largeFireball.bukkitYield = largeFireball.explosionPower = this.ghast.getExplosionPower(); // CraftBukkit - set bukkitYield when setting explosionPower
largeFireball.setPos(this.ghast.getX() + viewVector.x * 4.0, this.ghast.getY(0.5) + 0.5, largeFireball.getZ() + viewVector.z * 4.0);
level.addFreshEntity(largeFireball);
this.chargeTime = -40;

View File

@@ -1,5 +1,17 @@
--- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -47,6 +_,11 @@
Vec3 moveTargetPoint = Vec3.ZERO;
public BlockPos anchorPoint = BlockPos.ZERO;
Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
+ // Paper start
+ @Nullable
+ public java.util.UUID spawningEntity;
+ public boolean shouldBurnInDay = true;
+ // Paper end
public Phantom(EntityType<? extends Phantom> entityType, Level level) {
super(entityType, level);
@@ -141,7 +_,7 @@
@Override
@@ -9,10 +21,11 @@
this.igniteForSeconds(8.0F);
}
@@ -165,6 +_,14 @@
@@ -165,6 +_,15 @@
}
this.setPhantomSize(compound.getInt("Size"));
+
+ // Paper start
+ if (compound.hasUUID("Paper.SpawningEntity")) {
+ this.spawningEntity = compound.getUUID("Paper.SpawningEntity");
@@ -32,31 +45,11 @@
+ if (this.spawningEntity != null) {
+ compound.putUUID("Paper.SpawningEntity", this.spawningEntity);
+ }
+ compound.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
+ compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ // Paper end
}
@Override
@@ -222,6 +_,19 @@
return targetingConditions.test(level, this, entity);
}
+ // Paper start
+ @Nullable
+ java.util.UUID spawningEntity;
+
+ @Nullable
+ public java.util.UUID getSpawningEntity() {
+ return this.spawningEntity;
+ }
+ public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
+ private boolean shouldBurnInDay = true;
+ public boolean shouldBurnInDay() { return shouldBurnInDay; }
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
+ // Paper end
static enum AttackPhase {
CIRCLE,
SWOOP;
@@ -247,7 +_,8 @@
for (Player player : nearbyPlayers) {

View File

@@ -175,10 +175,11 @@
}
@Override
@@ -398,6 +_,12 @@
@@ -398,6 +_,13 @@
slimeMoveControl.setDirection(this.slime.getYRot(), this.slime.isDealsDamage());
}
}
+
+ // Paper start - Slime pathfinder events; clear timer and target when goal resets
+ public void stop() {
+ this.growTiredTimer = 0;