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