readd removal cause for thrown eggs
This commit is contained in:
@@ -1,17 +1,30 @@
|
||||
--- a/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -64,6 +_,11 @@
|
||||
@@ -64,6 +_,7 @@
|
||||
AbstractSkeleton.this.setAggressive(true);
|
||||
}
|
||||
};
|
||||
+ // Paper start - shouldBurnInDay API
|
||||
+ private boolean shouldBurnInDay = true;
|
||||
+ public boolean shouldBurnInDay() { return shouldBurnInDay; }
|
||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
|
||||
+ // Paper end - shouldBurnInDay API
|
||||
+ private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API
|
||||
|
||||
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -88,6 +_,16 @@
|
||||
return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25);
|
||||
}
|
||||
|
||||
+ // Paper start - shouldBurnInDay API
|
||||
+ public boolean shouldBurnInDay() {
|
||||
+ return this.shouldBurnInDay;
|
||||
+ }
|
||||
+
|
||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
||||
+ this.shouldBurnInDay = shouldBurnInDay;
|
||||
+ }
|
||||
+ // Paper end - shouldBurnInDay API
|
||||
+
|
||||
@Override
|
||||
protected void playStepSound(BlockPos pos, BlockState block) {
|
||||
this.playSound(this.getStepSound(), 0.15F, 1.0F);
|
||||
@@ -97,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
--- a/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -56,6 +_,7 @@
|
||||
public float squish;
|
||||
public float oSquish;
|
||||
private boolean wasOnGround;
|
||||
+ private boolean canWander = true; // Paper - Slime pathfinder events
|
||||
|
||||
public Slime(EntityType<? extends Slime> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -110,6 +_,7 @@
|
||||
super.addAdditionalSaveData(compound);
|
||||
compound.putInt("Size", this.getSize() - 1);
|
||||
@@ -114,6 +122,23 @@
|
||||
return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
|
||||
}
|
||||
}
|
||||
@@ -355,6 +_,16 @@
|
||||
return super.getDefaultDimensions(pose).scale(this.getSize());
|
||||
}
|
||||
|
||||
+ // Paper start - Slime pathfinder events
|
||||
+ public boolean canWander() {
|
||||
+ return this.canWander;
|
||||
+ }
|
||||
+
|
||||
+ public void setWander(boolean canWander) {
|
||||
+ this.canWander = canWander;
|
||||
+ }
|
||||
+ // Paper end - Slime pathfinder events
|
||||
+
|
||||
static class SlimeAttackGoal extends Goal {
|
||||
private final Slime slime;
|
||||
private int growTiredTimer;
|
||||
@@ -367,7 +_,16 @@
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
@@ -202,18 +227,3 @@
|
||||
}
|
||||
|
||||
if (this.slime.getMoveControl() instanceof Slime.SlimeMoveControl slimeMoveControl) {
|
||||
@@ -536,4 +_,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Paper start - Slime pathfinder events
|
||||
+ private boolean canWander = true;
|
||||
+ public boolean canWander() {
|
||||
+ return canWander;
|
||||
+ }
|
||||
+
|
||||
+ public void setWander(boolean canWander) {
|
||||
+ this.canWander = canWander;
|
||||
+ }
|
||||
+ // Paper end - Slime pathfinder events
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance potioneffect) {
|
||||
- return !potioneffect.is(MobEffects.POISON) && super.canBeAffected(potioneffect);
|
||||
+ return potioneffect.is(MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(potioneffect); // Paper - Add config for mobs immune to default effects
|
||||
+ return (!potioneffect.is(MobEffects.POISON) || !this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect) && super.canBeAffected(potioneffect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
|
||||
public boolean isClimbing() {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
PotionContents potionContents = mainHandItem.get(DataComponents.POTION_CONTENTS);
|
||||
+ // Paper start - WitchConsumePotionEvent
|
||||
+ if (mainHandItem.is(Items.POTION)) {
|
||||
+ com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
|
||||
+ com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(mainHandItem));
|
||||
+ potionContents = event.callEvent() ? org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getPotion()).get(DataComponents.POTION_CONTENTS) : null;
|
||||
+ }
|
||||
+ // Paper end - WitchConsumePotionEvent
|
||||
@@ -55,13 +55,13 @@
|
||||
+ this.usingTime = this.getMainHandItem().getUseDuration(this);
|
||||
+ this.setUsingItem(true);
|
||||
+ if (!this.isSilent()) {
|
||||
+ this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
+ this.level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
|
||||
+ }
|
||||
+
|
||||
+ AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
|
||||
+ AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
|
||||
+
|
||||
+ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING_ID);
|
||||
+ attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
|
||||
+ attribute.removeModifier(Witch.SPEED_MODIFIER_DRINKING_ID);
|
||||
+ attribute.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@@ -73,7 +73,7 @@
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
ItemStack itemStack = PotionContents.createItemStack(Items.SPLASH_POTION, holder);
|
||||
+ // Paper start - WitchThrowPotionEvent
|
||||
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
|
||||
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
private static final ResourceLocation REINFORCEMENT_CALLER_CHARGE_ID = ResourceLocation.withDefaultNamespace("reinforcement_caller_charge");
|
||||
private static final AttributeModifier ZOMBIE_REINFORCEMENT_CALLEE_CHARGE = new AttributeModifier(
|
||||
ResourceLocation.withDefaultNamespace("reinforcement_callee_charge"), -0.05F, AttributeModifier.Operation.ADD_VALUE
|
||||
@@ -87,13 +_,16 @@
|
||||
@@ -87,13 +_,15 @@
|
||||
private static final EntityDimensions BABY_DIMENSIONS = EntityType.ZOMBIE.getDimensions().scale(0.5F).withEyeHeight(0.93F);
|
||||
private static final float BREAK_DOOR_CHANCE = 0.1F;
|
||||
public static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = difficulty -> difficulty == Difficulty.HARD;
|
||||
@@ -20,7 +20,6 @@
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
+ // private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field // Paper - remove anti tick skipping measures / wall time
|
||||
+ private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
|
||||
|
||||
public Zombie(EntityType<? extends Zombie> entityType, Level level) {
|
||||
@@ -77,14 +76,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,6 +_,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
+ // this.lastTick = MinecraftServer.currentTick; // CraftBukkit // Paper - remove anti tick skipping measures / wall time
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,7 +_,14 @@
|
||||
super.aiStep();
|
||||
}
|
||||
@@ -111,7 +102,7 @@
|
||||
- zombie -> zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier())
|
||||
- );
|
||||
+ // CraftBukkit start
|
||||
+ zombie -> {zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier());},
|
||||
+ zombie -> { zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier()); },
|
||||
+ org.bukkit.event.entity.EntityTransformEvent.TransformReason.DROWNED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DROWNED);
|
||||
+ if (converted == null) {
|
||||
+ ((org.bukkit.entity.Zombie) this.getBukkitEntity()).setConversionTime(-1); // CraftBukkit - SPIGOT-5208: End conversion to stop event spam
|
||||
@@ -214,7 +205,7 @@
|
||||
public boolean killedEntity(ServerLevel level, LivingEntity entity) {
|
||||
boolean flag = super.killedEntity(level, entity);
|
||||
- if ((level.getDifficulty() == Difficulty.NORMAL || level.getDifficulty() == Difficulty.HARD) && entity instanceof Villager villager) {
|
||||
+ final double fallbackChance = level.getDifficulty() == Difficulty.HARD ? 100d : level.getDifficulty() == Difficulty.NORMAL ? 50d : 0d; // Paper - Configurable chance of villager zombie infection
|
||||
+ final double fallbackChance = level.getDifficulty() == Difficulty.HARD ? 100 : level.getDifficulty() == Difficulty.NORMAL ? 50 : 0; // Paper - Configurable chance of villager zombie infection
|
||||
+ if (this.random.nextDouble() * 100 < level.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && entity instanceof Villager villager) { // Paper - Configurable chance of villager zombie infection
|
||||
if (level.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) {
|
||||
return flag;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0, false));
|
||||
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
- this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
|
||||
+ this.targetSelector.addGoal(1, pathfinderGoalHurtByTarget = (new HurtByTargetGoal(this)).setAlertOthers()); // Paper - fix PigZombieAngerEvent cancellation
|
||||
+ this.targetSelector.addGoal(1, this.pathfinderGoalHurtByTarget = (new HurtByTargetGoal(this)).setAlertOthers()); // Paper - fix PigZombieAngerEvent cancellation
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
|
||||
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.setPersistentAngerTarget(null);
|
||||
+ pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
|
||||
+ this.pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
|
||||
+ return;
|
||||
+ }
|
||||
+ this.setRemainingPersistentAngerTime(event.getNewAnger());
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
- if (itemEntity.getItem().is(Items.GOLD_NUGGET)) {
|
||||
+ // CraftBukkit start
|
||||
+ // Paper start - EntityPickupItemEvent fixes; fix event firing twice
|
||||
+ if (itemEntity.getItem().is(Items.GOLD_NUGGET)/* && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, itemEntity, 0, false).isCancelled()*/) { // Paper
|
||||
+ if (itemEntity.getItem().is(Items.GOLD_NUGGET)) { // Paper
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, itemEntity, 0, false).isCancelled()) return;
|
||||
+ piglin.onItemPickup(itemEntity); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification
|
||||
+ // Paper end
|
||||
|
||||
Reference in New Issue
Block a user