SPIGOT-7078: Add EntityPotionEffectEvent.Cause#WARDEN

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2022-06-23 20:34:34 +10:00
parent c6f488dfd5
commit 23815db283
2 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,63 @@
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -370,7 +370,7 @@
@Override
public BehaviorController<Warden> getBrain() {
- return super.getBrain();
+ return (BehaviorController<Warden>) super.getBrain(); // CraftBukkit - decompile error
}
@Override
@@ -421,13 +421,13 @@
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
- MobEffectUtil.addEffectToPlayersAround(worldserver, entity, vec3d, (double) i, mobeffect, 200);
+ MobEffectUtil.addEffectToPlayersAround(worldserver, entity, vec3d, i, mobeffect, 200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WARDEN); // CraftBukkit - Add EntityPotionEffectEvent.Cause
}
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
- DataResult dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(DynamicOpsNBT.INSTANCE, this.angerManagement);
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(DynamicOpsNBT.INSTANCE, this.angerManagement); // CraftBukkit - decompile error
Logger logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -452,7 +452,7 @@
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
- dataresult.resultOrPartial(logger::error).ifPresent((angermanagement) -> {
+ ((DataResult<AngerManagement>) dataresult).resultOrPartial(logger::error).ifPresent((angermanagement) -> { // CraftBukkit - decompile error
this.angerManagement = angermanagement;
});
this.syncClientAngerLevel();
@@ -462,7 +462,7 @@
dataresult = VibrationListener.codec(this).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
- dataresult.resultOrPartial(logger::error).ifPresent((vibrationlistener) -> {
+ ((DataResult<VibrationListener>) dataresult).resultOrPartial(logger::error).ifPresent((vibrationlistener) -> { // CraftBukkit - decompile error
this.dynamicGameEventListener.updateListener(vibrationlistener, this.level);
});
}
@@ -496,7 +496,7 @@
public void increaseAngerAt(@Nullable Entity entity, int i, boolean flag) {
if (!this.isNoAi() && this.canTargetEntity(entity)) {
WardenAi.setDigCooldown(this);
- boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null) instanceof EntityHuman);
+ boolean flag1 = !(this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null) instanceof EntityHuman); // CraftBukkit - decompile error
int j = this.angerManagement.increaseAnger(entity, i);
if (entity instanceof EntityHuman && flag1 && AngerLevel.byAnger(j).isAngry()) {
@@ -517,7 +517,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
- return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
@Override

View file

@ -255,6 +255,13 @@
<version>1.7.3</version>
<scope>runtime</scope>
</dependency>
<!-- annotations -->
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations-java5</artifactId>
<version>23.0.0</version>
<scope>provided</scope>
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>