Fix remapping issue with RangedAttackMob and RangedEntity (#7167)

This commit is contained in:
Jake Potrebic 2021-12-21 16:23:19 -08:00
parent b391c1cb92
commit f9788fc8a1

View File

@ -14,37 +14,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.entity;
+
+import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.monster.RangedAttackMob;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.LivingEntity;
+
+public interface CraftRangedEntity<T extends RangedAttackMob> extends RangedEntity {
+public interface CraftRangedEntity<T extends Mob & RangedAttackMob> extends RangedEntity {
+ T getHandle();
+
+ @Override
+ default void rangedAttack(LivingEntity target, float charge) {
+ getHandle().rangedAttack(((CraftLivingEntity) target).getHandle(), charge);
+ getHandle().performRangedAttack(((CraftLivingEntity) target).getHandle(), charge);
+ }
+
+ @Override
+ default void setChargingAttack(boolean raiseHands) {
+ getHandle().setChargingAttack(raiseHands);
+ getHandle().setAggressive(raiseHands);
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java b/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
+++ b/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
@@ -0,0 +0,0 @@ package net.minecraft.world.entity.monster;
import net.minecraft.world.entity.LivingEntity;
public interface RangedAttackMob {
- void performRangedAttack(LivingEntity target, float pullProgress);
+ void performRangedAttack(LivingEntity target, float pullProgress); @Deprecated default void rangedAttack(LivingEntity entityliving, float f) { performRangedAttack(entityliving, f); } // Paper - OBFHELPER
+
+ // - see EntitySkeletonAbstract melee goal
+ void setAggressive(boolean flag); default void setChargingAttack(boolean charging) { setAggressive(charging); }; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java