1.16.1 - 1.16.2 support & some refactoring
This commit is contained in:
parent
450c38e87e
commit
c6675f2b8e
@ -3,8 +3,24 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="72e0643a-ea45-4e93-b5a5-734a94c41ff5" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/SkStuff.iml" beforeDir="false" afterPath="$PROJECT_DIR$/SkStuff.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/SkStuff.class" beforeDir="false" afterPath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/SkStuff.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/effects/EffSetPathGoal.class" beforeDir="false" afterPath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/effects/EffSetPathGoal.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/effects/EffShowEntityEffect.class" beforeDir="false" afterPath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/effects/EffShowEntityEffect.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/expressions/ExprInventoryOwner.class" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/expressions/ExprTimespanToNumber.class" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/plugin.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/SkStuff.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/SkStuff.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_9_R1.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_10_R1.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_10_R1.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_11_R1.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_11_R1.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_12_R1.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_12_R1.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_13_R2.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_13_R2.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_14_R1.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_14_R1.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_15_R1.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_15_R1.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_16_R1.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_16_R1.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_8_R3.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_8_R3.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_9_R2.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_9_R2.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -29,15 +45,15 @@
|
||||
<component name="PropertiesComponent">
|
||||
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/plugin.yml" />
|
||||
<property name="project.structure.last.edited" value="Artifacts" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../import/Paper-1.16.3-latest.jar!/" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
<recent name="me.TheBukor.SkStuff.pathfinders" />
|
||||
<recent name="me.TheBukor.SkStuff.util" />
|
||||
<recent name="me.TheBukor.SkStuff.pathfinders" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="SQLPlugin.ProjectConfiguration">
|
||||
@ -69,18 +85,18 @@
|
||||
<servers />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="79" y="101" key="FileChooserDialogImpl" timestamp="1595328182010">
|
||||
<state x="79" y="101" key="FileChooserDialogImpl" timestamp="1599990757268">
|
||||
<screen x="0" y="0" width="1366" height="728" />
|
||||
</state>
|
||||
<state x="79" y="101" key="FileChooserDialogImpl/0.0.1366.728@0.0.1366.728" timestamp="1595328182010" />
|
||||
<state x="79" y="101" key="FileChooserDialogImpl/0.0.1366.728@0.0.1366.728" timestamp="1599990757268" />
|
||||
<state x="348" y="62" key="NewModule_or_Project.wizard" timestamp="1592831160031">
|
||||
<screen x="0" y="0" width="1366" height="728" />
|
||||
</state>
|
||||
<state x="348" y="62" key="NewModule_or_Project.wizard/0.0.1366.728@0.0.1366.728" timestamp="1592831160031" />
|
||||
<state x="163" y="0" key="SettingsEditor" timestamp="1595328184010">
|
||||
<state x="163" y="0" key="SettingsEditor" timestamp="1599990877200">
|
||||
<screen x="0" y="0" width="1366" height="728" />
|
||||
</state>
|
||||
<state x="163" y="0" key="SettingsEditor/0.0.1366.728@0.0.1366.728" timestamp="1595328184010" />
|
||||
<state x="163" y="0" key="SettingsEditor/0.0.1366.728@0.0.1366.728" timestamp="1599990877200" />
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1595662947316">
|
||||
<screen x="0" y="0" width="1366" height="728" />
|
||||
</state>
|
||||
|
22
SkStuff.iml
22
SkStuff.iml
@ -155,5 +155,27 @@
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.2.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../import/Paper-1.16.3-latest.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MODULE_DIR$/../../import/Paper-1.16.3-latest.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
@ -1,6 +1,6 @@
|
||||
name: SkPathfinderGoals
|
||||
name: SkStuff
|
||||
authors: [TheBukor, Govindas]
|
||||
description: A Skript addon which adds extra functionalities such as pathfinder goals.
|
||||
version: "2.0"
|
||||
version: "2.1"
|
||||
main: me.TheBukor.SkStuff.SkStuff
|
||||
softdepend: [Skript]
|
@ -91,6 +91,14 @@ public class SkStuff extends JavaPlugin {
|
||||
nmsMethods = new NMS_v1_15_R1();
|
||||
getLogger().info("It looks like you're running 1.15.1!");
|
||||
break;
|
||||
case "v1_16_R1.":
|
||||
nmsMethods = new NMS_v1_16_R1();
|
||||
getLogger().info("It looks like you're running 1.16.1!");
|
||||
break;
|
||||
case "v1_16_R2.":
|
||||
nmsMethods = new NMS_v1_16_R2();
|
||||
getLogger().info("It looks like you're running 1.16.2!");
|
||||
break;
|
||||
default:
|
||||
getLogger().warning("It looks like you're running an unsupported server version, some features will not be available :(");
|
||||
break;
|
||||
|
@ -539,9 +539,9 @@ public final class EffSetPathGoal extends Effect {
|
||||
}
|
||||
Class<?> nmsClass = ReflectionUtils.getNMSClass("Entity" + className);
|
||||
switch (version) {
|
||||
case "v1.12_R1.":
|
||||
newGoals.add(new PathfinderGoalFollow_v1_12_R1((net.minecraft.server.v1_12_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
|
||||
break;
|
||||
//case "v1.12_R1.":
|
||||
// newGoals.add(new PathfinderGoalFollow_v1_12_R1((net.minecraft.server.v1_12_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
|
||||
// break;
|
||||
case "v1.13_R2.":
|
||||
newGoals.add(new PathfinderGoalFollow_v1_13_R2((net.minecraft.server.v1_13_R2.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
|
||||
break;
|
||||
@ -550,7 +550,6 @@ public final class EffSetPathGoal extends Effect {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mark == 42) {
|
||||
if (!(ent instanceof Skeleton)) {
|
||||
Skript.warning("The pathfinder goal \"Bow Shoot\" can only be applied to skeletons!");
|
||||
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_10_R1.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_10_R1 implements NMSInterface {
|
||||
@ -24,21 +23,9 @@ public class NMS_v1_10_R1 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_11_R1.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_11_R1 implements NMSInterface {
|
||||
@ -24,21 +23,9 @@ public class NMS_v1_11_R1 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_12_R1.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_12_R1 implements NMSInterface {
|
||||
@ -24,21 +23,9 @@ public class NMS_v1_12_R1 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import net.minecraft.server.v1_13_R2.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_13_R2 implements NMSInterface {
|
||||
@ -28,21 +27,9 @@ public class NMS_v1_13_R2 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import net.minecraft.server.v1_14_R1.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_14_R1 implements NMSInterface {
|
||||
@ -28,21 +27,9 @@ public class NMS_v1_14_R1 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import net.minecraft.server.v1_15_R1.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_15_R1 implements NMSInterface {
|
||||
@ -28,21 +27,9 @@ public class NMS_v1_15_R1 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import net.minecraft.server.v1_16_R1.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_16_R1 implements NMSInterface {
|
||||
@ -28,21 +27,9 @@ public class NMS_v1_16_R1 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
80
src/me/TheBukor/SkStuff/util/NMS_v1_16_R2.java
Normal file
80
src/me/TheBukor/SkStuff/util/NMS_v1_16_R2.java
Normal file
@ -0,0 +1,80 @@
|
||||
package me.TheBukor.SkStuff.util;
|
||||
|
||||
|
||||
import net.minecraft.server.v1_16_R2.EntityInsentient;
|
||||
import net.minecraft.server.v1_16_R2.PathfinderGoal;
|
||||
import net.minecraft.server.v1_16_R2.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_16_R2 implements NMSInterface {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void clearPathfinderGoals(Entity entity) {
|
||||
EntityInsentient nmsEnt = (EntityInsentient) ((CraftEntity) entity).getHandle();
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePathfinderGoal(Object entity, Class<?> goalClass, boolean isTargetSelector) {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPathfinderGoal(Object entity, int priority, Object goal, boolean isTargetSelector) {
|
||||
if (entity instanceof EntityInsentient && goal instanceof PathfinderGoal) {
|
||||
if (isTargetSelector)
|
||||
((EntityInsentient) entity).targetSelector.a(priority, (PathfinderGoal) goal);
|
||||
else
|
||||
((EntityInsentient) entity).goalSelector.a(priority, (PathfinderGoal) goal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getNoClip(Entity entity) {
|
||||
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
return nmsEntity.noclip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoClip(Entity entity, boolean noclip) {
|
||||
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
nmsEntity.noclip = noclip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFireProof(Entity entity) {
|
||||
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
return nmsEntity.isFireProof();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFireProof(Entity entity, boolean fireProof) {
|
||||
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
ReflectionUtils.setField("fireProof", nmsEntity.getClass(), nmsEntity, fireProof);
|
||||
}
|
||||
public float getEntityStepLength(Entity entity) {
|
||||
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
return nmsEntity.G;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntityStepLength(Entity entity, float length) {
|
||||
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
nmsEntity.G = length;
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class NMS_v1_8_R3 implements NMSInterface {
|
||||
@ -25,21 +24,9 @@ public class NMS_v1_8_R3 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((List<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((List<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((List<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((List<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import net.minecraft.server.v1_9_R2.PathfinderGoalSelector;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
public class NMS_v1_9_R2 implements NMSInterface {
|
||||
@ -24,21 +23,9 @@ public class NMS_v1_9_R2 implements NMSInterface {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).setGoalTarget(null);
|
||||
if (isTargetSelector) {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
} else {
|
||||
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
|
||||
while (goals.hasNext()) {
|
||||
Object goal = goals.next();
|
||||
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
|
||||
goals.remove();
|
||||
}
|
||||
}
|
||||
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user