mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 02:25:57 +01:00
Initial update to 1.21.2
This commit is contained in:
parent
4d1b5a79b7
commit
ff2cecf6f2
8
dist/pom.xml
vendored
8
dist/pom.xml
vendored
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens</artifactId>
|
<artifactId>citizens</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>citizens-v1_21_R1</artifactId>
|
<artifactId>citizens-v1_21_R2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
@ -187,7 +187,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>citizens-v1_21_R1</artifactId>
|
<artifactId>citizens-v1_21_R2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
@ -206,7 +206,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>citizens-v1_21_R1</artifactId>
|
<artifactId>citizens-v1_21_R2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-main</artifactId>
|
<artifactId>citizens-main</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<craftbukkit.version>1.21.1-R0.1-SNAPSHOT</craftbukkit.version>
|
<craftbukkit.version>1.21.2-R0.1-SNAPSHOT</craftbukkit.version>
|
||||||
<placeholderapi.version>2.11.5</placeholderapi.version>
|
<placeholderapi.version>2.11.5</placeholderapi.version>
|
||||||
<citizensapi.version>${project.version}</citizensapi.version>
|
<citizensapi.version>${project.version}</citizensapi.version>
|
||||||
<worldguard.version>7.1.0-SNAPSHOT</worldguard.version>
|
<worldguard.version>7.1.0-SNAPSHOT</worldguard.version>
|
||||||
|
@ -453,7 +453,7 @@ public class EventListen implements Listener {
|
|||||||
targetNPCEvent.setCancelled(!npc.data().get(NPC.Metadata.TARGETABLE, !npc.isProtected()));
|
targetNPCEvent.setCancelled(!npc.data().get(NPC.Metadata.TARGETABLE, !npc.isProtected()));
|
||||||
Bukkit.getPluginManager().callEvent(targetNPCEvent);
|
Bukkit.getPluginManager().callEvent(targetNPCEvent);
|
||||||
if (targetNPCEvent.isCancelled()) {
|
if (targetNPCEvent.isCancelled()) {
|
||||||
targetNPCEvent.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Boat;
|
|
||||||
import org.bukkit.entity.Damageable;
|
import org.bukkit.entity.Damageable;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -123,7 +122,6 @@ import net.citizensnpcs.trait.Anchors;
|
|||||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||||
import net.citizensnpcs.trait.AttributeTrait;
|
import net.citizensnpcs.trait.AttributeTrait;
|
||||||
import net.citizensnpcs.trait.BatTrait;
|
import net.citizensnpcs.trait.BatTrait;
|
||||||
import net.citizensnpcs.trait.BoatTrait;
|
|
||||||
import net.citizensnpcs.trait.BoundingBoxTrait;
|
import net.citizensnpcs.trait.BoundingBoxTrait;
|
||||||
import net.citizensnpcs.trait.ClickRedirectTrait;
|
import net.citizensnpcs.trait.ClickRedirectTrait;
|
||||||
import net.citizensnpcs.trait.CommandTrait;
|
import net.citizensnpcs.trait.CommandTrait;
|
||||||
@ -449,24 +447,6 @@ public class NPCCommands {
|
|||||||
Messaging.sendTr(sender, awake ? Messages.BAT_AWAKE_SET : Messages.BAT_AWAKE_UNSET, npc.getName());
|
Messaging.sendTr(sender, awake ? Messages.BAT_AWAKE_SET : Messages.BAT_AWAKE_UNSET, npc.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
|
||||||
aliases = { "npc" },
|
|
||||||
usage = "boat --type [type]",
|
|
||||||
desc = "",
|
|
||||||
modifiers = { "boat" },
|
|
||||||
min = 1,
|
|
||||||
max = 1,
|
|
||||||
permission = "citizens.npc.boat")
|
|
||||||
public void boat(CommandContext args, CommandSender sender, NPC npc,
|
|
||||||
@Flag(value = "type", completionsProvider = OptionalBoatTypeCompletions.class) String stype)
|
|
||||||
throws CommandException {
|
|
||||||
if (stype == null)
|
|
||||||
throw new CommandUsageException();
|
|
||||||
Boat.Type type = Boat.Type.valueOf(stype);
|
|
||||||
npc.getOrAddTrait(BoatTrait.class).setType(type);
|
|
||||||
Messaging.sendTr(sender, Messages.BOAT_TYPE_SET, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "npc" },
|
aliases = { "npc" },
|
||||||
usage = "breakblock --location [x,y,z] --radius [radius]",
|
usage = "breakblock --location [x,y,z] --radius [radius]",
|
||||||
@ -2479,8 +2459,7 @@ public class NPCCommands {
|
|||||||
permission = "citizens.npc.playerlist")
|
permission = "citizens.npc.playerlist")
|
||||||
@Requirements(selected = true, ownership = true, types = EntityType.PLAYER)
|
@Requirements(selected = true, ownership = true, types = EntityType.PLAYER)
|
||||||
public void playerlist(CommandContext args, CommandSender sender, NPC npc) {
|
public void playerlist(CommandContext args, CommandSender sender, NPC npc) {
|
||||||
boolean remove = !npc.data().get(NPC.Metadata.REMOVE_FROM_PLAYERLIST,
|
boolean remove = !npc.shouldRemoveFromPlayerList();
|
||||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
|
||||||
if (args.hasFlag('a')) {
|
if (args.hasFlag('a')) {
|
||||||
remove = false;
|
remove = false;
|
||||||
} else if (args.hasFlag('r')) {
|
} else if (args.hasFlag('r')) {
|
||||||
@ -3415,7 +3394,7 @@ public class NPCCommands {
|
|||||||
npc.data().setPersistent(NPC.Metadata.TARGETABLE, targetable);
|
npc.data().setPersistent(NPC.Metadata.TARGETABLE, targetable);
|
||||||
}
|
}
|
||||||
if (targetable && npc.getOrAddTrait(MobType.class).getType() == EntityType.PLAYER
|
if (targetable && npc.getOrAddTrait(MobType.class).getType() == EntityType.PLAYER
|
||||||
&& npc.data().get(NPC.Metadata.REMOVE_FROM_PLAYERLIST, true)) {
|
&& npc.shouldRemoveFromPlayerList()) {
|
||||||
Messaging.sendTr(sender, Messages.TARGETABLE_PLAYERLIST_WARNING);
|
Messaging.sendTr(sender, Messages.TARGETABLE_PLAYERLIST_WARNING);
|
||||||
if (args.hasFlag('t')) {
|
if (args.hasFlag('t')) {
|
||||||
npc.data().set(NPC.Metadata.REMOVE_FROM_PLAYERLIST, false);
|
npc.data().set(NPC.Metadata.REMOVE_FROM_PLAYERLIST, false);
|
||||||
|
@ -15,10 +15,6 @@ public abstract class AbstractEntityController implements EntityController {
|
|||||||
public AbstractEntityController() {
|
public AbstractEntityController() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractEntityController(Class<?> clazz) {
|
|
||||||
NMS.registerEntityClass(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(Location at, NPC npc) {
|
public void create(Location at, NPC npc) {
|
||||||
bukkitEntity = createEntity(at, npc);
|
bukkitEntity = createEntity(at, npc);
|
||||||
|
@ -25,7 +25,6 @@ import net.citizensnpcs.trait.Anchors;
|
|||||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||||
import net.citizensnpcs.trait.AttributeTrait;
|
import net.citizensnpcs.trait.AttributeTrait;
|
||||||
import net.citizensnpcs.trait.BatTrait;
|
import net.citizensnpcs.trait.BatTrait;
|
||||||
import net.citizensnpcs.trait.BoatTrait;
|
|
||||||
import net.citizensnpcs.trait.BoundingBoxTrait;
|
import net.citizensnpcs.trait.BoundingBoxTrait;
|
||||||
import net.citizensnpcs.trait.ClickRedirectTrait;
|
import net.citizensnpcs.trait.ClickRedirectTrait;
|
||||||
import net.citizensnpcs.trait.CommandTrait;
|
import net.citizensnpcs.trait.CommandTrait;
|
||||||
@ -83,7 +82,6 @@ public class CitizensTraitFactory implements TraitFactory {
|
|||||||
registerTrait(TraitInfo.create(AttributeTrait.class));
|
registerTrait(TraitInfo.create(AttributeTrait.class));
|
||||||
registerTrait(TraitInfo.create(Anchors.class));
|
registerTrait(TraitInfo.create(Anchors.class));
|
||||||
registerTrait(TraitInfo.create(BatTrait.class));
|
registerTrait(TraitInfo.create(BatTrait.class));
|
||||||
registerTrait(TraitInfo.create(BoatTrait.class));
|
|
||||||
registerTrait(TraitInfo.create(BoundingBoxTrait.class));
|
registerTrait(TraitInfo.create(BoundingBoxTrait.class));
|
||||||
registerTrait(TraitInfo.create(ClickRedirectTrait.class));
|
registerTrait(TraitInfo.create(ClickRedirectTrait.class));
|
||||||
registerTrait(TraitInfo.create(CommandTrait.class).optInToStats());
|
registerTrait(TraitInfo.create(CommandTrait.class).optInToStats());
|
||||||
|
@ -37,5 +37,6 @@ public class EntityControllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<EntityType, Constructor<? extends EntityController>> TYPES = Maps.newEnumMap(EntityType.class);
|
private static final Map<EntityType, Constructor<? extends EntityController>> TYPES = Maps
|
||||||
|
.newEnumMap(EntityType.class);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package net.citizensnpcs.trait.versioned;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.command.Command;
|
||||||
|
import net.citizensnpcs.api.command.CommandContext;
|
||||||
|
import net.citizensnpcs.api.command.Flag;
|
||||||
|
import net.citizensnpcs.api.command.exception.CommandException;
|
||||||
|
import net.citizensnpcs.api.command.exception.CommandUsageException;
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import net.citizensnpcs.api.persistence.Persist;
|
||||||
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
|
import net.citizensnpcs.api.trait.TraitName;
|
||||||
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
|
import net.citizensnpcs.api.util.SpigotUtil;
|
||||||
|
import net.citizensnpcs.commands.NPCCommands.OptionalBoatTypeCompletions;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
|
|
||||||
|
@TraitName("boattrait")
|
||||||
|
public class BoatTrait extends Trait {
|
||||||
|
@Persist
|
||||||
|
private Boat.Type type;
|
||||||
|
|
||||||
|
public BoatTrait() {
|
||||||
|
super("boattrait");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = { "npc" },
|
||||||
|
usage = "boat --type [type]",
|
||||||
|
desc = "",
|
||||||
|
modifiers = { "boat" },
|
||||||
|
min = 1,
|
||||||
|
max = 1,
|
||||||
|
permission = "citizens.npc.boat")
|
||||||
|
public void boat(CommandContext args, CommandSender sender, NPC npc,
|
||||||
|
@Flag(value = "type", completionsProvider = OptionalBoatTypeCompletions.class) String stype)
|
||||||
|
throws CommandException {
|
||||||
|
if (stype == null)
|
||||||
|
throw new CommandUsageException();
|
||||||
|
Boat.Type type = Boat.Type.valueOf(stype);
|
||||||
|
npc.getOrAddTrait(BoatTrait.class).setType(type);
|
||||||
|
Messaging.sendTr(sender, Messages.BOAT_TYPE_SET, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boat.Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpawn() {
|
||||||
|
int[] version = SpigotUtil.getVersion();
|
||||||
|
if (version[1] > 21 || (version[1] == 21 && version[2] >= 2))
|
||||||
|
return;
|
||||||
|
if (npc.getEntity() instanceof Boat) {
|
||||||
|
if (type != null) {
|
||||||
|
((Boat) npc.getEntity()).setBoatType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Boat.Type type) {
|
||||||
|
this.type = type;
|
||||||
|
onSpawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -497,6 +497,15 @@ public class NMS {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T getFirstStaticObject(Class<?> clazz, Class<?> type) {
|
||||||
|
try {
|
||||||
|
return (T) getFirstStaticGetter(clazz, type).invoke();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static MethodHandle getGetter(Class<?> clazz, String name) {
|
public static MethodHandle getGetter(Class<?> clazz, String name) {
|
||||||
return getGetter(clazz, name, true);
|
return getGetter(clazz, name, true);
|
||||||
}
|
}
|
||||||
@ -635,6 +644,15 @@ public class NMS {
|
|||||||
return BRIDGE.getSpeedFor(npc);
|
return BRIDGE.getSpeedFor(npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T getStaticObject(Class<?> clazz, String name) {
|
||||||
|
try {
|
||||||
|
return (T) getGetter(clazz, name).invoke();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static float getStepHeight(org.bukkit.entity.Entity entity) {
|
public static float getStepHeight(org.bukkit.entity.Entity entity) {
|
||||||
return BRIDGE.getStepHeight(entity);
|
return BRIDGE.getStepHeight(entity);
|
||||||
}
|
}
|
||||||
@ -770,8 +788,9 @@ public class NMS {
|
|||||||
BRIDGE.positionInteractionText(player, interaction, mount, height);
|
BRIDGE.positionInteractionText(player, interaction, mount, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerEntityClass(Class<?> clazz) {
|
public static void registerEntityClass(Class<?> clazz, Object type) {
|
||||||
BRIDGE.registerEntityClass(clazz);
|
// TODO: is this used outside of Citizens? could remove this abstraction
|
||||||
|
BRIDGE.registerEntityClass(clazz, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void remove(Entity entity) {
|
public static void remove(Entity entity) {
|
||||||
|
@ -179,7 +179,7 @@ public interface NMSBridge {
|
|||||||
public default void positionInteractionText(Player player, Entity interaction, Entity mount, double height) {
|
public default void positionInteractionText(Player player, Entity interaction, Entity mount, double height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerEntityClass(Class<?> clazz);
|
public void registerEntityClass(Class<?> clazz, Object type);
|
||||||
|
|
||||||
public void remove(Entity entity);
|
public void remove(Entity entity);
|
||||||
|
|
||||||
|
10
pom.xml
10
pom.xml
@ -6,10 +6,10 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
<properties>
|
<properties>
|
||||||
<BUILD_NUMBER>Unknown</BUILD_NUMBER>
|
<BUILD_NUMBER>Unknown</BUILD_NUMBER>
|
||||||
<CITIZENS_VERSION>2.0.35</CITIZENS_VERSION>
|
<CITIZENS_VERSION>2.0.36</CITIZENS_VERSION>
|
||||||
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
|
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
|
||||||
<maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
|
<maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
|
||||||
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
|
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<module>main</module>
|
<module>main</module>
|
||||||
<module>v1_19_R3</module>
|
<module>v1_19_R3</module>
|
||||||
<module>v1_20_R4</module>
|
<module>v1_20_R4</module>
|
||||||
<module>v1_21_R1</module>
|
<module>v1_21_R2</module>
|
||||||
<module>dist</module>
|
<module>dist</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
<module>v1_18_R2</module>
|
<module>v1_18_R2</module>
|
||||||
<module>v1_19_R3</module>
|
<module>v1_19_R3</module>
|
||||||
<module>v1_20_R4</module>
|
<module>v1_20_R4</module>
|
||||||
<module>v1_21_R1</module>
|
<module>v1_21_R2</module>
|
||||||
<module>dist</module>
|
<module>dist</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
<id>dev</id>
|
<id>dev</id>
|
||||||
<modules>
|
<modules>
|
||||||
<module>main</module>
|
<module>main</module>
|
||||||
<module>v1_21_R1</module>
|
<module>v1_21_R2</module>
|
||||||
<module>dist</module>
|
<module>dist</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_10_R1</artifactId>
|
<artifactId>citizens-v1_10_R1</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Constructor<?> constructor;
|
private final Constructor<?> constructor;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, null);
|
||||||
this.constructor = getConstructor(clazz);
|
this.constructor = getConstructor(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,7 @@ import net.minecraft.server.v1_10_R1.World;
|
|||||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
import net.minecraft.server.v1_10_R1.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -29,9 +29,7 @@ import net.minecraft.server.v1_10_R1.World;
|
|||||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
import net.minecraft.server.v1_10_R1.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -25,9 +25,6 @@ import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
|||||||
import net.minecraft.server.v1_10_R1.World;
|
import net.minecraft.server.v1_10_R1.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -161,6 +161,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
import net.citizensnpcs.trait.versioned.PolarBearTrait;
|
import net.citizensnpcs.trait.versioned.PolarBearTrait;
|
||||||
@ -722,6 +723,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BossBarTrait.class);
|
registerTraitWithCommand(manager, BossBarTrait.class);
|
||||||
@ -991,7 +993,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_CLASS_TO_INT == null || ENTITY_CLASS_TO_INT.containsKey(clazz))
|
if (ENTITY_CLASS_TO_INT == null || ENTITY_CLASS_TO_INT.containsKey(clazz))
|
||||||
return;
|
return;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_11_R1</artifactId>
|
<artifactId>citizens-v1_11_R1</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Constructor<?> constructor;
|
private final Constructor<?> constructor;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, null);
|
||||||
this.constructor = getConstructor(clazz);
|
this.constructor = getConstructor(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,7 @@ import net.minecraft.server.v1_11_R1.World;
|
|||||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -30,9 +30,7 @@ import net.minecraft.server.v1_11_R1.World;
|
|||||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -25,9 +25,6 @@ import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
|||||||
import net.minecraft.server.v1_11_R1.World;
|
import net.minecraft.server.v1_11_R1.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -26,9 +26,6 @@ import net.minecraft.server.v1_11_R1.World;
|
|||||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -176,6 +176,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
import net.citizensnpcs.trait.versioned.LlamaTrait;
|
import net.citizensnpcs.trait.versioned.LlamaTrait;
|
||||||
@ -758,6 +759,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BossBarTrait.class);
|
registerTraitWithCommand(manager, BossBarTrait.class);
|
||||||
@ -1044,15 +1046,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
MinecraftKey key = ENTITY_REGISTRY.b(search);
|
MinecraftKey key = ENTITY_REGISTRY.b(search);
|
||||||
if (key == null) {
|
if (key == null)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
int code = ENTITY_REGISTRY.a(search);
|
int code = ENTITY_REGISTRY.a(search);
|
||||||
ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
|
ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
|
||||||
return;
|
return;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_12_R1</artifactId>
|
<artifactId>citizens-v1_12_R1</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Constructor<?> constructor;
|
private final Constructor<?> constructor;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, null);
|
||||||
this.constructor = getConstructor(clazz);
|
this.constructor = getConstructor(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ import net.minecraft.server.v1_12_R1.World;
|
|||||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -31,9 +31,7 @@ import net.minecraft.server.v1_12_R1.World;
|
|||||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -26,9 +26,6 @@ import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
|||||||
import net.minecraft.server.v1_12_R1.World;
|
import net.minecraft.server.v1_12_R1.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -27,9 +27,6 @@ import net.minecraft.server.v1_12_R1.World;
|
|||||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -179,6 +179,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
import net.citizensnpcs.trait.versioned.LlamaTrait;
|
import net.citizensnpcs.trait.versioned.LlamaTrait;
|
||||||
@ -760,6 +761,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BossBarTrait.class);
|
registerTraitWithCommand(manager, BossBarTrait.class);
|
||||||
@ -1052,15 +1054,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
MinecraftKey key = ENTITY_REGISTRY.b(search);
|
MinecraftKey key = ENTITY_REGISTRY.b(search);
|
||||||
if (key == null) {
|
if (key == null)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
int code = ENTITY_REGISTRY.a(search);
|
int code = ENTITY_REGISTRY.a(search);
|
||||||
ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
|
ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
|
||||||
return;
|
return;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_13_R2</artifactId>
|
<artifactId>citizens-v1_13_R2</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -23,7 +23,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Constructor<?> constructor;
|
private final Constructor<?> constructor;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, null);
|
||||||
this.constructor = getConstructor(clazz);
|
this.constructor = getConstructor(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +28,7 @@ import net.minecraft.server.v1_13_R2.World;
|
|||||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -33,9 +33,7 @@ import net.minecraft.server.v1_13_R2.World;
|
|||||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -28,9 +28,6 @@ import net.minecraft.server.v1_13_R2.Tag;
|
|||||||
import net.minecraft.server.v1_13_R2.World;
|
import net.minecraft.server.v1_13_R2.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -29,9 +29,6 @@ import net.minecraft.server.v1_13_R2.World;
|
|||||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -189,6 +189,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
import net.citizensnpcs.trait.versioned.LlamaTrait;
|
import net.citizensnpcs.trait.versioned.LlamaTrait;
|
||||||
@ -790,6 +791,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BossBarTrait.class);
|
registerTraitWithCommand(manager, BossBarTrait.class);
|
||||||
@ -1094,12 +1096,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
EntityTypes<?> type = (EntityTypes<?>) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
EntityTypes<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_14_R1</artifactId>
|
<artifactId>citizens-v1_14_R1</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -25,8 +25,7 @@ import net.minecraft.server.v1_14_R1.World;
|
|||||||
public abstract class MobEntityController extends AbstractEntityController {
|
public abstract class MobEntityController extends AbstractEntityController {
|
||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
super(clazz);
|
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,7 @@ import net.minecraft.server.v1_14_R1.World;
|
|||||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -35,9 +35,7 @@ import net.minecraft.server.v1_14_R1.World;
|
|||||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -31,9 +31,6 @@ import net.minecraft.server.v1_14_R1.Vec3D;
|
|||||||
import net.minecraft.server.v1_14_R1.World;
|
import net.minecraft.server.v1_14_R1.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -32,15 +32,11 @@ import net.minecraft.server.v1_14_R1.World;
|
|||||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityTypes.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<EntityLlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,7 @@ import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CatTrait;
|
import net.citizensnpcs.trait.versioned.CatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
@ -848,6 +849,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BossBarTrait.class);
|
registerTraitWithCommand(manager, BossBarTrait.class);
|
||||||
@ -1137,12 +1139,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
EntityTypes<?> type = (EntityTypes<?>) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
EntityTypes<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_15_R1</artifactId>
|
<artifactId>citizens-v1_15_R1</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -25,8 +25,7 @@ import net.minecraft.server.v1_15_R1.World;
|
|||||||
public abstract class MobEntityController extends AbstractEntityController {
|
public abstract class MobEntityController extends AbstractEntityController {
|
||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
super(clazz);
|
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@ import net.minecraft.server.v1_15_R1.World;
|
|||||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -35,9 +35,7 @@ import net.minecraft.server.v1_15_R1.World;
|
|||||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -31,9 +31,6 @@ import net.minecraft.server.v1_15_R1.Vec3D;
|
|||||||
import net.minecraft.server.v1_15_R1.World;
|
import net.minecraft.server.v1_15_R1.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -33,15 +33,11 @@ import net.minecraft.server.v1_15_R1.World;
|
|||||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityTypes.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<EntityLlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -195,6 +195,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CatTrait;
|
import net.citizensnpcs.trait.versioned.CatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
@ -863,6 +864,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BeeTrait.class);
|
registerTraitWithCommand(manager, BeeTrait.class);
|
||||||
@ -1154,12 +1156,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
EntityTypes<?> type = (EntityTypes<?>) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
EntityTypes<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_16_R3</artifactId>
|
<artifactId>citizens-v1_16_R3</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -25,8 +25,7 @@ import net.minecraft.server.v1_16_R3.World;
|
|||||||
public abstract class MobEntityController extends AbstractEntityController {
|
public abstract class MobEntityController extends AbstractEntityController {
|
||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
super(clazz);
|
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@ import net.minecraft.server.v1_16_R3.World;
|
|||||||
import net.minecraft.server.v1_16_R3.WorldServer;
|
import net.minecraft.server.v1_16_R3.WorldServer;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -35,9 +35,7 @@ import net.minecraft.server.v1_16_R3.World;
|
|||||||
import net.minecraft.server.v1_16_R3.WorldServer;
|
import net.minecraft.server.v1_16_R3.WorldServer;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -31,9 +31,6 @@ import net.minecraft.server.v1_16_R3.Vec3D;
|
|||||||
import net.minecraft.server.v1_16_R3.World;
|
import net.minecraft.server.v1_16_R3.World;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -33,15 +33,11 @@ import net.minecraft.server.v1_16_R3.World;
|
|||||||
import net.minecraft.server.v1_16_R3.WorldServer;
|
import net.minecraft.server.v1_16_R3.WorldServer;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entity createEntity(Location at, NPC npc) {
|
protected Entity createEntity(Location at, NPC npc) {
|
||||||
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityTypes.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<EntityLlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -201,6 +201,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.trait.RotationTrait;
|
import net.citizensnpcs.trait.RotationTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CatTrait;
|
import net.citizensnpcs.trait.versioned.CatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
@ -886,6 +887,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, BeeTrait.class);
|
registerTraitWithCommand(manager, BeeTrait.class);
|
||||||
@ -1177,12 +1179,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
EntityTypes<?> type = (EntityTypes<?>) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
EntityTypes<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
MinecraftKey key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -2367,7 +2369,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle NAVIGATION_S = NMS.getFinalSetter(NavigationAbstract.class, "s");
|
private static final MethodHandle NAVIGATION_S = NMS.getFinalSetter(NavigationAbstract.class, "s");
|
||||||
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getSetter(NavigationAbstract.class, "b");
|
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getSetter(NavigationAbstract.class, "b");
|
||||||
public static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
public static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
||||||
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to check for every update.
|
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to
|
||||||
|
// check for every update.
|
||||||
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(EntityPlayer.class, "mobCounts", false);
|
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(EntityPlayer.class, "mobCounts", false);
|
||||||
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getGetter(PlayerChunkMap.class,
|
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getGetter(PlayerChunkMap.class,
|
||||||
"viewDistance");
|
"viewDistance");
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_17_R1</artifactId>
|
<artifactId>citizens-v1_17_R1</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -15,6 +15,7 @@ import net.citizensnpcs.nms.v1_17_R1.util.NMSImpl;
|
|||||||
import net.citizensnpcs.nms.v1_17_R1.util.PitchableLookControl;
|
import net.citizensnpcs.nms.v1_17_R1.util.PitchableLookControl;
|
||||||
import net.citizensnpcs.npc.AbstractEntityController;
|
import net.citizensnpcs.npc.AbstractEntityController;
|
||||||
import net.citizensnpcs.trait.ScoreboardTrait;
|
import net.citizensnpcs.trait.ScoreboardTrait;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.entity.ai.control.LookControl;
|
import net.minecraft.world.entity.ai.control.LookControl;
|
||||||
@ -24,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -35,9 +35,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -32,9 +32,6 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -32,15 +32,11 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityType.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<LlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,7 @@ import net.citizensnpcs.trait.RotationTrait;
|
|||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CatTrait;
|
import net.citizensnpcs.trait.versioned.CatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
@ -889,6 +890,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, AxolotlTrait.class);
|
registerTraitWithCommand(manager, AxolotlTrait.class);
|
||||||
@ -1183,12 +1185,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
net.minecraft.world.entity.EntityType<?> type = (net.minecraft.world.entity.EntityType) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
net.minecraft.world.entity.EntityType<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -2314,11 +2316,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final Map<Class<?>, net.minecraft.world.entity.EntityType<?>> CITIZENS_ENTITY_TYPES = Maps
|
private static final Map<Class<?>, net.minecraft.world.entity.EntityType<?>> CITIZENS_ENTITY_TYPES = Maps
|
||||||
.newHashMap();
|
.newHashMap();
|
||||||
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getSetter(CraftBossBar.class, "handle");
|
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getSetter(CraftBossBar.class, "handle");
|
||||||
private static EntityDataAccessor<Pose> DATA_POSE = null;
|
private static final EntityDataAccessor<Pose> DATA_POSE = NMS.getStaticObject(Entity.class, "ad");
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
public static MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class, true,
|
public static final MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class,
|
||||||
boolean.class, AABB.class);
|
true, boolean.class, AABB.class);
|
||||||
private static EntityDataAccessor<Boolean> ENDERMAN_CREEPY = null;
|
private static final EntityDataAccessor<Boolean> ENDERMAN_CREEPY = NMS.getStaticObject(EnderMan.class, "bV");
|
||||||
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getSetter(AbstractSchoolingFish.class, "c");
|
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getSetter(AbstractSchoolingFish.class, "c");
|
||||||
private static final MethodHandle ENTITY_GET_SOUND_FALL = NMS.getMethodHandle(LivingEntity.class, "getSoundFall",
|
private static final MethodHandle ENTITY_GET_SOUND_FALL = NMS.getMethodHandle(LivingEntity.class, "getSoundFall",
|
||||||
true, int.class);
|
true, int.class);
|
||||||
@ -2341,17 +2343,19 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static MethodHandle MOVE_CONTROLLER_MOVING = NMS.getSetter(MoveControl.class, "k");
|
private static MethodHandle MOVE_CONTROLLER_MOVING = NMS.getSetter(MoveControl.class, "k");
|
||||||
private static final MethodHandle NAVIGATION_CREATE_PATHFINDER = NMS.getMethodHandle(PathNavigation.class, "a",
|
private static final MethodHandle NAVIGATION_CREATE_PATHFINDER = NMS.getMethodHandle(PathNavigation.class, "a",
|
||||||
true, int.class);
|
true, int.class);
|
||||||
private static MethodHandle NAVIGATION_PATH = NMS.getGetter(PathNavigation.class, "c");
|
private static final MethodHandle NAVIGATION_PATH = NMS.getGetter(PathNavigation.class, "c");
|
||||||
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFinalSetter(PathNavigation.class, "t");
|
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFinalSetter(PathNavigation.class, "t");
|
||||||
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
||||||
public static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
public static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
||||||
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to check for every update.
|
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to
|
||||||
|
// check for every update.
|
||||||
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
||||||
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getGetter(ChunkMap.class, "J");
|
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getGetter(ChunkMap.class, "J");
|
||||||
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_SETTER = NMS.getSetter(ChunkMap.class, "J");
|
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_SETTER = NMS.getSetter(ChunkMap.class, "J");
|
||||||
private static final MethodHandle PUFFERFISH_C = NMS.getSetter(Pufferfish.class, "bU");
|
private static final MethodHandle PUFFERFISH_C = NMS.getSetter(Pufferfish.class, "bU");
|
||||||
private static final MethodHandle PUFFERFISH_D = NMS.getSetter(Pufferfish.class, "bT");
|
private static final MethodHandle PUFFERFISH_D = NMS.getSetter(Pufferfish.class, "bT");
|
||||||
private static EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = null;
|
private static final EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = NMS.getFirstStaticObject(Rabbit.class,
|
||||||
|
EntityDataAccessor.class);
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
||||||
ServerEntity.class);
|
ServerEntity.class);
|
||||||
@ -2368,19 +2372,5 @@ public class NMSImpl implements NMSBridge {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
ENDERMAN_CREEPY = (EntityDataAccessor<Boolean>) NMS.getField(EnderMan.class, "bV").get(null);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
RABBIT_TYPE_DATAWATCHER = (EntityDataAccessor<Integer>) NMS
|
|
||||||
.getFirstStaticGetter(Rabbit.class, EntityDataAccessor.class).invoke();
|
|
||||||
DATA_POSE = (EntityDataAccessor<Pose>) NMS.getGetter(Entity.class, "ad").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_18_R2</artifactId>
|
<artifactId>citizens-v1_18_R2</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -15,6 +15,7 @@ import net.citizensnpcs.nms.v1_18_R2.util.NMSImpl;
|
|||||||
import net.citizensnpcs.nms.v1_18_R2.util.PitchableLookControl;
|
import net.citizensnpcs.nms.v1_18_R2.util.PitchableLookControl;
|
||||||
import net.citizensnpcs.npc.AbstractEntityController;
|
import net.citizensnpcs.npc.AbstractEntityController;
|
||||||
import net.citizensnpcs.trait.ScoreboardTrait;
|
import net.citizensnpcs.trait.ScoreboardTrait;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.entity.ai.control.LookControl;
|
import net.minecraft.world.entity.ai.control.LookControl;
|
||||||
@ -24,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -36,9 +36,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -34,9 +34,6 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -33,15 +33,11 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityType.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<LlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,7 @@ import net.citizensnpcs.trait.RotationTrait;
|
|||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CatTrait;
|
import net.citizensnpcs.trait.versioned.CatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
import net.citizensnpcs.trait.versioned.EnderDragonTrait;
|
||||||
@ -896,6 +897,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, AxolotlTrait.class);
|
registerTraitWithCommand(manager, AxolotlTrait.class);
|
||||||
@ -1192,12 +1194,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
net.minecraft.world.entity.EntityType<?> type = (net.minecraft.world.entity.EntityType) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
net.minecraft.world.entity.EntityType<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -2358,11 +2360,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final Map<Class<?>, net.minecraft.world.entity.EntityType<?>> CITIZENS_ENTITY_TYPES = Maps
|
private static final Map<Class<?>, net.minecraft.world.entity.EntityType<?>> CITIZENS_ENTITY_TYPES = Maps
|
||||||
.newHashMap();
|
.newHashMap();
|
||||||
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getSetter(CraftBossBar.class, "handle");
|
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getSetter(CraftBossBar.class, "handle");
|
||||||
private static EntityDataAccessor<Pose> DATA_POSE = null;
|
private static final EntityDataAccessor<Pose> DATA_POSE = NMS.getStaticObject(Entity.class, "ad");
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
public static MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class, true,
|
public static MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class, true,
|
||||||
boolean.class, AABB.class);
|
boolean.class, AABB.class);
|
||||||
private static EntityDataAccessor<Boolean> ENDERMAN_CREEPY = null;
|
private static final EntityDataAccessor<Boolean> ENDERMAN_CREEPY = NMS.getStaticObject(EnderMan.class, "bX");
|
||||||
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getFirstSetter(AbstractSchoolingFish.class,
|
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getFirstSetter(AbstractSchoolingFish.class,
|
||||||
int.class);
|
int.class);
|
||||||
private static final MethodHandle ENTITY_GET_SOUND_FALL = NMS.getMethodHandle(LivingEntity.class, "c", true,
|
private static final MethodHandle ENTITY_GET_SOUND_FALL = NMS.getMethodHandle(LivingEntity.class, "c", true,
|
||||||
@ -2394,7 +2396,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFinalSetter(PathNavigation.class, "t");
|
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFinalSetter(PathNavigation.class, "t");
|
||||||
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
||||||
public static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
public static final Location PACKET_CACHE_LOCATION = new Location(null, 0, 0, 0);
|
||||||
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to check for every update.
|
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to
|
||||||
|
// check for every update.
|
||||||
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
||||||
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getGetter(ChunkMap.class, "N");
|
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getGetter(ChunkMap.class, "N");
|
||||||
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_SETTER = NMS.getSetter(ChunkMap.class, "N");
|
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_SETTER = NMS.getSetter(ChunkMap.class, "N");
|
||||||
@ -2402,7 +2405,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static MethodHandle PORTAL_ENTRANCE_POS_SETTER = NMS.getSetter(Entity.class, "ai");
|
private static MethodHandle PORTAL_ENTRANCE_POS_SETTER = NMS.getSetter(Entity.class, "ai");
|
||||||
private static final MethodHandle PUFFERFISH_C = NMS.getSetter(Pufferfish.class, "bV");
|
private static final MethodHandle PUFFERFISH_C = NMS.getSetter(Pufferfish.class, "bV");
|
||||||
private static final MethodHandle PUFFERFISH_D = NMS.getSetter(Pufferfish.class, "bW");
|
private static final MethodHandle PUFFERFISH_D = NMS.getSetter(Pufferfish.class, "bW");
|
||||||
private static EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = null;
|
private static final EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = NMS.getFirstStaticObject(Rabbit.class,
|
||||||
|
EntityDataAccessor.class);
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
||||||
ServerEntity.class);
|
ServerEntity.class);
|
||||||
@ -2419,19 +2423,5 @@ public class NMSImpl implements NMSBridge {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
ENDERMAN_CREEPY = (EntityDataAccessor<Boolean>) NMS.getField(EnderMan.class, "bX").get(null);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
RABBIT_TYPE_DATAWATCHER = (EntityDataAccessor<Integer>) NMS
|
|
||||||
.getFirstStaticGetter(Rabbit.class, EntityDataAccessor.class).invoke();
|
|
||||||
DATA_POSE = (EntityDataAccessor<Pose>) NMS.getGetter(Entity.class, "ad").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_19_R3</artifactId>
|
<artifactId>citizens-v1_19_R3</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -15,6 +15,7 @@ import net.citizensnpcs.nms.v1_19_R3.util.NMSImpl;
|
|||||||
import net.citizensnpcs.nms.v1_19_R3.util.PitchableLookControl;
|
import net.citizensnpcs.nms.v1_19_R3.util.PitchableLookControl;
|
||||||
import net.citizensnpcs.npc.AbstractEntityController;
|
import net.citizensnpcs.npc.AbstractEntityController;
|
||||||
import net.citizensnpcs.trait.ScoreboardTrait;
|
import net.citizensnpcs.trait.ScoreboardTrait;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.entity.ai.control.LookControl;
|
import net.minecraft.world.entity.ai.control.LookControl;
|
||||||
@ -24,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -35,9 +35,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -34,9 +34,6 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -33,15 +33,11 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityType.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<LlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -224,6 +224,7 @@ import net.citizensnpcs.trait.versioned.AllayTrait;
|
|||||||
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
import net.citizensnpcs.trait.versioned.AreaEffectCloudTrait;
|
||||||
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CamelTrait;
|
import net.citizensnpcs.trait.versioned.CamelTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
||||||
@ -945,6 +946,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, AllayTrait.class);
|
registerTraitWithCommand(manager, AllayTrait.class);
|
||||||
@ -1331,12 +1333,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
net.minecraft.world.entity.EntityType<?> type = (net.minecraft.world.entity.EntityType) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
net.minecraft.world.entity.EntityType<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -2577,7 +2579,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class);
|
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class);
|
||||||
|
|
||||||
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class,
|
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class,
|
||||||
Map.class);
|
Map.class);
|
||||||
private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class,
|
private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class,
|
||||||
@ -2594,15 +2595,15 @@ public class NMSImpl implements NMSBridge {
|
|||||||
.newHashMap();
|
.newHashMap();
|
||||||
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getFirstSetter(CraftBossBar.class,
|
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getFirstSetter(CraftBossBar.class,
|
||||||
ServerBossEvent.class);
|
ServerBossEvent.class);
|
||||||
private static EntityDataAccessor<Boolean> DATA_NAME_VISIBLE = null;
|
private static final EntityDataAccessor<Boolean> DATA_NAME_VISIBLE = NMS.getStaticObject(Entity.class, "aS");
|
||||||
private static EntityDataAccessor<Pose> DATA_POSE = null;
|
private static final EntityDataAccessor<Pose> DATA_POSE = NMS.getStaticObject(Entity.class, "ar");
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
public static MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class, true,
|
public static final MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class,
|
||||||
boolean.class, AABB.class);
|
true, boolean.class, AABB.class);
|
||||||
private static EntityDataAccessor<Boolean> ENDERMAN_CREEPY = null;
|
private static final EntityDataAccessor<Boolean> ENDERMAN_CREEPY = NMS.getStaticObject(EnderMan.class, "bU");
|
||||||
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getFirstSetter(AbstractSchoolingFish.class,
|
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getFirstSetter(AbstractSchoolingFish.class,
|
||||||
int.class);
|
int.class);
|
||||||
private static MethodHandle ENTITY_NAVIGATION = NMS.getFirstSetter(Mob.class, PathNavigation.class);
|
private static final MethodHandle ENTITY_NAVIGATION = NMS.getFirstSetter(Mob.class, PathNavigation.class);
|
||||||
private static CustomEntityRegistry ENTITY_REGISTRY;
|
private static CustomEntityRegistry ENTITY_REGISTRY;
|
||||||
private static MethodHandle ENTITY_REGISTRY_SETTER;
|
private static MethodHandle ENTITY_REGISTRY_SETTER;
|
||||||
private static final MethodHandle FALLING_BLOCK_STATE_SETTER = NMS.getFirstSetter(FallingBlockEntity.class,
|
private static final MethodHandle FALLING_BLOCK_STATE_SETTER = NMS.getFirstSetter(FallingBlockEntity.class,
|
||||||
@ -2619,8 +2620,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle HEAD_HEIGHT = NMS.getSetter(Entity.class, "bf");
|
private static final MethodHandle HEAD_HEIGHT = NMS.getSetter(Entity.class, "bf");
|
||||||
private static final MethodHandle HEAD_HEIGHT_METHOD = NMS.getFirstMethodHandle(Entity.class, true, Pose.class,
|
private static final MethodHandle HEAD_HEIGHT_METHOD = NMS.getFirstMethodHandle(Entity.class, true, Pose.class,
|
||||||
EntityDimensions.class);
|
EntityDimensions.class);
|
||||||
private static EntityDataAccessor<Float> INTERACTION_HEIGHT = null;
|
private static final EntityDataAccessor<Float> INTERACTION_HEIGHT = NMS.getStaticObject(Interaction.class, "d");
|
||||||
private static EntityDataAccessor<Float> INTERACTION_WIDTH = null;
|
private static final EntityDataAccessor<Float> INTERACTION_WIDTH = NMS.getStaticObject(Interaction.class, "c");
|
||||||
private static final MethodHandle JUMP_FIELD = NMS.getGetter(LivingEntity.class, "bi");
|
private static final MethodHandle JUMP_FIELD = NMS.getGetter(LivingEntity.class, "bi");
|
||||||
private static final MethodHandle LOOK_CONTROL_SETTER = NMS.getFirstSetter(Mob.class, LookControl.class);
|
private static final MethodHandle LOOK_CONTROL_SETTER = NMS.getFirstSetter(Mob.class, LookControl.class);
|
||||||
private static final MethodHandle MAKE_REQUEST = NMS.getMethodHandle(YggdrasilAuthenticationService.class,
|
private static final MethodHandle MAKE_REQUEST = NMS.getMethodHandle(YggdrasilAuthenticationService.class,
|
||||||
@ -2632,7 +2633,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFirstFinalSetter(PathNavigation.class,
|
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFirstFinalSetter(PathNavigation.class,
|
||||||
PathFinder.class);
|
PathFinder.class);
|
||||||
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
||||||
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to check for every update.
|
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to
|
||||||
|
// check for every update.
|
||||||
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
||||||
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getFirstGetter(ChunkMap.class,
|
private static final MethodHandle PLAYER_CHUNK_MAP_VIEW_DISTANCE_GETTER = NMS.getFirstGetter(ChunkMap.class,
|
||||||
int.class);
|
int.class);
|
||||||
@ -2641,13 +2643,14 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle PLAYER_INFO_ENTRIES_LIST = NMS
|
private static final MethodHandle PLAYER_INFO_ENTRIES_LIST = NMS
|
||||||
.getFirstFinalSetter(ClientboundPlayerInfoUpdatePacket.class, List.class);
|
.getFirstFinalSetter(ClientboundPlayerInfoUpdatePacket.class, List.class);
|
||||||
private static final MethodHandle PLAYERINFO_ENTRIES = PLAYER_INFO_ENTRIES_LIST;
|
private static final MethodHandle PLAYERINFO_ENTRIES = PLAYER_INFO_ENTRIES_LIST;
|
||||||
private static MethodHandle PORTAL_ENTRANCE_POS_GETTER = NMS.getGetter(Entity.class, "aw");
|
private static final MethodHandle PORTAL_ENTRANCE_POS_GETTER = NMS.getGetter(Entity.class, "aw");
|
||||||
private static MethodHandle PORTAL_ENTRANCE_POS_SETTER = NMS.getSetter(Entity.class, "aw");
|
private static final MethodHandle PORTAL_ENTRANCE_POS_SETTER = NMS.getSetter(Entity.class, "aw");
|
||||||
private static final MethodHandle POSITION_CODEC_GETTER = NMS.getFirstGetter(ServerEntity.class,
|
private static final MethodHandle POSITION_CODEC_GETTER = NMS.getFirstGetter(ServerEntity.class,
|
||||||
VecDeltaCodec.class);
|
VecDeltaCodec.class);
|
||||||
private static final MethodHandle PUFFERFISH_C = NMS.getSetter(Pufferfish.class, "bS");
|
private static final MethodHandle PUFFERFISH_C = NMS.getSetter(Pufferfish.class, "bS");
|
||||||
private static final MethodHandle PUFFERFISH_D = NMS.getSetter(Pufferfish.class, "bT");
|
private static final MethodHandle PUFFERFISH_D = NMS.getSetter(Pufferfish.class, "bT");
|
||||||
private static EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = null;
|
private static final EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = NMS.getFirstStaticObject(Rabbit.class,
|
||||||
|
EntityDataAccessor.class);
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
||||||
ServerEntity.class);
|
ServerEntity.class);
|
||||||
@ -2665,33 +2668,5 @@ public class NMSImpl implements NMSBridge {
|
|||||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
// Middle one
|
|
||||||
ENDERMAN_CREEPY = (EntityDataAccessor<Boolean>) NMS.getField(EnderMan.class, "bU").get(null);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
RABBIT_TYPE_DATAWATCHER = (EntityDataAccessor<Integer>) NMS
|
|
||||||
.getFirstStaticGetter(Rabbit.class, EntityDataAccessor.class).invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
INTERACTION_HEIGHT = (EntityDataAccessor<Float>) NMS.getGetter(Interaction.class, "d").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
INTERACTION_WIDTH = (EntityDataAccessor<Float>) NMS.getGetter(Interaction.class, "c").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
DATA_POSE = (EntityDataAccessor<Pose>) NMS.getGetter(Entity.class, "ar").invoke();
|
|
||||||
DATA_NAME_VISIBLE = (EntityDataAccessor<Boolean>) NMS.getGetter(Entity.class, "aS").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_20_R4</artifactId>
|
<artifactId>citizens-v1_20_R4</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -15,6 +15,7 @@ import net.citizensnpcs.nms.v1_20_R4.util.NMSImpl;
|
|||||||
import net.citizensnpcs.nms.v1_20_R4.util.PitchableLookControl;
|
import net.citizensnpcs.nms.v1_20_R4.util.PitchableLookControl;
|
||||||
import net.citizensnpcs.npc.AbstractEntityController;
|
import net.citizensnpcs.npc.AbstractEntityController;
|
||||||
import net.citizensnpcs.trait.ScoreboardTrait;
|
import net.citizensnpcs.trait.ScoreboardTrait;
|
||||||
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.entity.ai.control.LookControl;
|
import net.minecraft.world.entity.ai.control.LookControl;
|
||||||
@ -24,7 +25,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
|||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
protected MobEntityController(Class<?> clazz) {
|
protected MobEntityController(Class<?> clazz) {
|
||||||
super(clazz);
|
NMS.registerEntityClass(clazz, NMSImpl.getEntityType(clazz));
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +30,6 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class EggController extends AbstractEntityController {
|
public class EggController extends AbstractEntityController {
|
||||||
public EggController() {
|
|
||||||
super(EntityEggNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
|
@ -33,9 +33,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class FallingBlockController extends AbstractEntityController {
|
public class FallingBlockController extends AbstractEntityController {
|
||||||
public FallingBlockController() {
|
|
||||||
super(EntityFallingBlockNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -32,9 +32,6 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ItemController extends AbstractEntityController {
|
public class ItemController extends AbstractEntityController {
|
||||||
public ItemController() {
|
|
||||||
super(EntityItemNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
|
@ -31,15 +31,10 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class LlamaSpitController extends AbstractEntityController {
|
public class LlamaSpitController extends AbstractEntityController {
|
||||||
public LlamaSpitController() {
|
|
||||||
super(EntityLlamaSpitNPC.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
protected org.bukkit.entity.Entity createEntity(Location at, NPC npc) {
|
||||||
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
ServerLevel ws = ((CraftWorld) at.getWorld()).getHandle();
|
||||||
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(
|
final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(EntityType.LLAMA_SPIT, ws, npc);
|
||||||
NMSImpl.<LlamaSpit> getEntityType(EntityLlamaSpitNPC.class), ws, npc);
|
|
||||||
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
handle.absMoveTo(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
|
||||||
return handle.getBukkitEntity();
|
return handle.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,7 @@ import net.citizensnpcs.trait.versioned.ArmadilloTrait;
|
|||||||
import net.citizensnpcs.trait.versioned.ArmadilloTrait.ArmadilloState;
|
import net.citizensnpcs.trait.versioned.ArmadilloTrait.ArmadilloState;
|
||||||
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||||
|
import net.citizensnpcs.trait.versioned.BoatTrait;
|
||||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CamelTrait;
|
import net.citizensnpcs.trait.versioned.CamelTrait;
|
||||||
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
||||||
@ -968,6 +969,7 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
|
registerTraitWithCommand(manager, BoatTrait.class);
|
||||||
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
registerTraitWithCommand(manager, AreaEffectCloudTrait.class);
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
registerTraitWithCommand(manager, AllayTrait.class);
|
registerTraitWithCommand(manager, AllayTrait.class);
|
||||||
@ -1363,16 +1365,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz, Object raw) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
return;
|
return;
|
||||||
|
net.minecraft.world.entity.EntityType<?> type = (net.minecraft.world.entity.EntityType) raw;
|
||||||
Class<?> search = clazz;
|
Class<?> search = clazz;
|
||||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||||
net.minecraft.world.entity.EntityType<?> type = ENTITY_REGISTRY.findType(search);
|
|
||||||
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
ResourceLocation key = ENTITY_REGISTRY.getKey(type);
|
||||||
if (key == null || type == null) {
|
if (key == null || type == null)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
CITIZENS_ENTITY_TYPES.put(clazz, type);
|
CITIZENS_ENTITY_TYPES.put(clazz, type);
|
||||||
int code = ENTITY_REGISTRY.getId(type);
|
int code = ENTITY_REGISTRY.getId(type);
|
||||||
ENTITY_REGISTRY.put(code, key, type);
|
ENTITY_REGISTRY.put(code, key, type);
|
||||||
@ -2661,12 +2663,9 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final MethodHandle ARMADILLO_SCUTE_TIME = NMS.getSetter(Armadillo.class, "cj");
|
private static final MethodHandle ARMADILLO_SCUTE_TIME = NMS.getSetter(Armadillo.class, "cj");
|
||||||
|
|
||||||
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class);
|
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class);
|
||||||
|
|
||||||
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class,
|
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class,
|
||||||
Map.class);
|
Map.class);
|
||||||
|
|
||||||
private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class,
|
private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class,
|
||||||
AttributeSupplier.class);
|
AttributeSupplier.class);
|
||||||
private static final MethodHandle AVAILABLE_BEHAVIORS_BY_PRIORITY = NMS.getGetter(Brain.class, "f");
|
private static final MethodHandle AVAILABLE_BEHAVIORS_BY_PRIORITY = NMS.getGetter(Brain.class, "f");
|
||||||
@ -2683,15 +2682,15 @@ public class NMSImpl implements NMSBridge {
|
|||||||
public static final MethodHandle CONNECTION_PACKET_LISTENER = NMS.getSetter(Connection.class, "q");
|
public static final MethodHandle CONNECTION_PACKET_LISTENER = NMS.getSetter(Connection.class, "q");
|
||||||
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getFirstSetter(CraftBossBar.class,
|
private static final MethodHandle CRAFT_BOSSBAR_HANDLE_FIELD = NMS.getFirstSetter(CraftBossBar.class,
|
||||||
ServerBossEvent.class);
|
ServerBossEvent.class);
|
||||||
private static EntityDataAccessor<Boolean> DATA_NAME_VISIBLE = null;
|
private static final EntityDataAccessor<Boolean> DATA_NAME_VISIBLE = NMS.getStaticObject(Entity.class, "aT");
|
||||||
private static EntityDataAccessor<Pose> DATA_POSE = null;
|
private static final EntityDataAccessor<Pose> DATA_POSE = NMS.getStaticObject(Entity.class, "at");
|
||||||
private static final float DEFAULT_SPEED = 1F;
|
private static final float DEFAULT_SPEED = 1F;
|
||||||
public static final MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class,
|
public static final MethodHandle ENDERDRAGON_CHECK_WALLS = NMS.getFirstMethodHandleWithReturnType(EnderDragon.class,
|
||||||
true, boolean.class, AABB.class);
|
true, boolean.class, AABB.class);
|
||||||
public static final MethodHandle ENDERDRAGON_HURT = NMS.getMethodHandle(EnderDragon.class, "c", true, List.class);
|
public static final MethodHandle ENDERDRAGON_HURT = NMS.getMethodHandle(EnderDragon.class, "c", true, List.class);
|
||||||
public static final MethodHandle ENDERDRAGON_KNOCKBACK = NMS.getMethodHandle(EnderDragon.class, "b", true,
|
public static final MethodHandle ENDERDRAGON_KNOCKBACK = NMS.getMethodHandle(EnderDragon.class, "b", true,
|
||||||
List.class);
|
List.class);
|
||||||
private static EntityDataAccessor<Boolean> ENDERMAN_CREEPY = null;
|
private static final EntityDataAccessor<Boolean> ENDERMAN_CREEPY = NMS.getStaticObject(EnderMan.class, "ca");
|
||||||
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getFirstSetter(AbstractSchoolingFish.class,
|
private static final MethodHandle ENTITY_FISH_NUM_IN_SCHOOL = NMS.getFirstSetter(AbstractSchoolingFish.class,
|
||||||
int.class);
|
int.class);
|
||||||
private static MethodHandle ENTITY_NAVIGATION = NMS.getFirstSetter(Mob.class, PathNavigation.class);
|
private static MethodHandle ENTITY_NAVIGATION = NMS.getFirstSetter(Mob.class, PathNavigation.class);
|
||||||
@ -2709,8 +2708,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
boolean.class);
|
boolean.class);
|
||||||
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
||||||
private static final MethodHandle HEAD_HEIGHT = NMS.getSetter(Entity.class, "bg");
|
private static final MethodHandle HEAD_HEIGHT = NMS.getSetter(Entity.class, "bg");
|
||||||
private static EntityDataAccessor<Float> INTERACTION_HEIGHT = null;
|
private static final EntityDataAccessor<Float> INTERACTION_HEIGHT = NMS.getStaticObject(Interaction.class, "d");
|
||||||
private static EntityDataAccessor<Float> INTERACTION_WIDTH = null;
|
private static final EntityDataAccessor<Float> INTERACTION_WIDTH = NMS.getStaticObject(Interaction.class, "c");
|
||||||
private static final MethodHandle JUMP_FIELD = NMS.getGetter(LivingEntity.class, "bn");
|
private static final MethodHandle JUMP_FIELD = NMS.getGetter(LivingEntity.class, "bn");
|
||||||
private static final MethodHandle LOOK_CONTROL_SETTER = NMS.getFirstSetter(Mob.class, LookControl.class);
|
private static final MethodHandle LOOK_CONTROL_SETTER = NMS.getFirstSetter(Mob.class, LookControl.class);
|
||||||
private static MethodHandle META_COMPOUND_TAG;
|
private static MethodHandle META_COMPOUND_TAG;
|
||||||
@ -2723,7 +2722,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFirstFinalSetter(PathNavigation.class,
|
private static final MethodHandle NAVIGATION_PATHFINDER = NMS.getFirstFinalSetter(PathNavigation.class,
|
||||||
PathFinder.class);
|
PathFinder.class);
|
||||||
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
private static final MethodHandle NAVIGATION_WORLD_FIELD = NMS.getFirstSetter(PathNavigation.class, Level.class);
|
||||||
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to check for every update.
|
// Player.mobCounts: workaround for an issue which suppresses mobs being spawn near NPC players on Paper. Need to
|
||||||
|
// check for every update.
|
||||||
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
public static final MethodHandle PAPER_PLAYER_MOB_COUNTS = NMS.getGetter(ServerPlayer.class, "mobCounts", false);
|
||||||
|
|
||||||
private static final MethodHandle PLAYER_INFO_ENTRIES_LIST = NMS
|
private static final MethodHandle PLAYER_INFO_ENTRIES_LIST = NMS
|
||||||
@ -2735,7 +2735,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
VecDeltaCodec.class);
|
VecDeltaCodec.class);
|
||||||
private static final MethodHandle PUFFERFISH_DEFLATE = NMS.getSetter(Pufferfish.class, "bZ");
|
private static final MethodHandle PUFFERFISH_DEFLATE = NMS.getSetter(Pufferfish.class, "bZ");
|
||||||
private static final MethodHandle PUFFERFISH_INFLATE = NMS.getSetter(Pufferfish.class, "bY");
|
private static final MethodHandle PUFFERFISH_INFLATE = NMS.getSetter(Pufferfish.class, "bY");
|
||||||
public static EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = null;
|
public static EntityDataAccessor<Integer> RABBIT_TYPE_DATAWATCHER = NMS.getFirstStaticObject(Rabbit.class,
|
||||||
|
EntityDataAccessor.class);
|
||||||
private static final Random RANDOM = Util.getFastRandom();
|
private static final Random RANDOM = Util.getFastRandom();
|
||||||
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
private static final MethodHandle SERVER_ENTITY_GETTER = NMS.getFirstGetter(TrackedEntity.class,
|
||||||
ServerEntity.class);
|
ServerEntity.class);
|
||||||
@ -2753,28 +2754,5 @@ public class NMSImpl implements NMSBridge {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
// Middle one
|
|
||||||
ENDERMAN_CREEPY = (EntityDataAccessor<Boolean>) NMS.getField(EnderMan.class, "ca").get(null);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
RABBIT_TYPE_DATAWATCHER = (EntityDataAccessor<Integer>) NMS
|
|
||||||
.getFirstStaticGetter(Rabbit.class, EntityDataAccessor.class).invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
INTERACTION_HEIGHT = (EntityDataAccessor<Float>) NMS.getGetter(Interaction.class, "d").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
INTERACTION_WIDTH = (EntityDataAccessor<Float>) NMS.getGetter(Interaction.class, "c").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
DATA_POSE = (EntityDataAccessor<Pose>) NMS.getGetter(Entity.class, "at").invoke();
|
|
||||||
DATA_NAME_VISIBLE = (EntityDataAccessor<Boolean>) NMS.getGetter(Entity.class, "aT").invoke();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,481 +0,0 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.util;
|
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
|
||||||
import com.google.common.collect.HashBiMap;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.mojang.datafixers.util.Pair;
|
|
||||||
import com.mojang.serialization.Lifecycle;
|
|
||||||
|
|
||||||
import net.citizensnpcs.util.NMS;
|
|
||||||
import net.minecraft.core.DefaultedMappedRegistry;
|
|
||||||
import net.minecraft.core.DefaultedRegistry;
|
|
||||||
import net.minecraft.core.Holder;
|
|
||||||
import net.minecraft.core.Holder.Reference;
|
|
||||||
import net.minecraft.core.HolderGetter;
|
|
||||||
import net.minecraft.core.HolderLookup.RegistryLookup;
|
|
||||||
import net.minecraft.core.HolderOwner;
|
|
||||||
import net.minecraft.core.HolderSet.Named;
|
|
||||||
import net.minecraft.core.MappedRegistry;
|
|
||||||
import net.minecraft.core.Registry;
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.tags.TagKey;
|
|
||||||
import net.minecraft.util.RandomSource;
|
|
||||||
import net.minecraft.world.entity.AreaEffectCloud;
|
|
||||||
import net.minecraft.world.entity.Display;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.ExperienceOrb;
|
|
||||||
import net.minecraft.world.entity.GlowSquid;
|
|
||||||
import net.minecraft.world.entity.Interaction;
|
|
||||||
import net.minecraft.world.entity.LightningBolt;
|
|
||||||
import net.minecraft.world.entity.Marker;
|
|
||||||
import net.minecraft.world.entity.OminousItemSpawner;
|
|
||||||
import net.minecraft.world.entity.ambient.Bat;
|
|
||||||
import net.minecraft.world.entity.animal.Bee;
|
|
||||||
import net.minecraft.world.entity.animal.Cat;
|
|
||||||
import net.minecraft.world.entity.animal.Chicken;
|
|
||||||
import net.minecraft.world.entity.animal.Cod;
|
|
||||||
import net.minecraft.world.entity.animal.Cow;
|
|
||||||
import net.minecraft.world.entity.animal.Dolphin;
|
|
||||||
import net.minecraft.world.entity.animal.Fox;
|
|
||||||
import net.minecraft.world.entity.animal.IronGolem;
|
|
||||||
import net.minecraft.world.entity.animal.MushroomCow;
|
|
||||||
import net.minecraft.world.entity.animal.Ocelot;
|
|
||||||
import net.minecraft.world.entity.animal.Panda;
|
|
||||||
import net.minecraft.world.entity.animal.Parrot;
|
|
||||||
import net.minecraft.world.entity.animal.Pig;
|
|
||||||
import net.minecraft.world.entity.animal.PolarBear;
|
|
||||||
import net.minecraft.world.entity.animal.Pufferfish;
|
|
||||||
import net.minecraft.world.entity.animal.Rabbit;
|
|
||||||
import net.minecraft.world.entity.animal.Salmon;
|
|
||||||
import net.minecraft.world.entity.animal.Sheep;
|
|
||||||
import net.minecraft.world.entity.animal.SnowGolem;
|
|
||||||
import net.minecraft.world.entity.animal.Squid;
|
|
||||||
import net.minecraft.world.entity.animal.TropicalFish;
|
|
||||||
import net.minecraft.world.entity.animal.Turtle;
|
|
||||||
import net.minecraft.world.entity.animal.Wolf;
|
|
||||||
import net.minecraft.world.entity.animal.allay.Allay;
|
|
||||||
import net.minecraft.world.entity.animal.armadillo.Armadillo;
|
|
||||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
|
||||||
import net.minecraft.world.entity.animal.camel.Camel;
|
|
||||||
import net.minecraft.world.entity.animal.frog.Frog;
|
|
||||||
import net.minecraft.world.entity.animal.frog.Tadpole;
|
|
||||||
import net.minecraft.world.entity.animal.goat.Goat;
|
|
||||||
import net.minecraft.world.entity.animal.horse.Donkey;
|
|
||||||
import net.minecraft.world.entity.animal.horse.Horse;
|
|
||||||
import net.minecraft.world.entity.animal.horse.Llama;
|
|
||||||
import net.minecraft.world.entity.animal.horse.Mule;
|
|
||||||
import net.minecraft.world.entity.animal.horse.SkeletonHorse;
|
|
||||||
import net.minecraft.world.entity.animal.horse.TraderLlama;
|
|
||||||
import net.minecraft.world.entity.animal.horse.ZombieHorse;
|
|
||||||
import net.minecraft.world.entity.animal.sniffer.Sniffer;
|
|
||||||
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
|
|
||||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
|
||||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
|
||||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
|
||||||
import net.minecraft.world.entity.decoration.GlowItemFrame;
|
|
||||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
|
||||||
import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
|
|
||||||
import net.minecraft.world.entity.decoration.Painting;
|
|
||||||
import net.minecraft.world.entity.item.FallingBlockEntity;
|
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
|
||||||
import net.minecraft.world.entity.item.PrimedTnt;
|
|
||||||
import net.minecraft.world.entity.monster.Blaze;
|
|
||||||
import net.minecraft.world.entity.monster.Bogged;
|
|
||||||
import net.minecraft.world.entity.monster.CaveSpider;
|
|
||||||
import net.minecraft.world.entity.monster.Creeper;
|
|
||||||
import net.minecraft.world.entity.monster.Drowned;
|
|
||||||
import net.minecraft.world.entity.monster.ElderGuardian;
|
|
||||||
import net.minecraft.world.entity.monster.EnderMan;
|
|
||||||
import net.minecraft.world.entity.monster.Endermite;
|
|
||||||
import net.minecraft.world.entity.monster.Evoker;
|
|
||||||
import net.minecraft.world.entity.monster.Ghast;
|
|
||||||
import net.minecraft.world.entity.monster.Giant;
|
|
||||||
import net.minecraft.world.entity.monster.Guardian;
|
|
||||||
import net.minecraft.world.entity.monster.Husk;
|
|
||||||
import net.minecraft.world.entity.monster.Illusioner;
|
|
||||||
import net.minecraft.world.entity.monster.MagmaCube;
|
|
||||||
import net.minecraft.world.entity.monster.Phantom;
|
|
||||||
import net.minecraft.world.entity.monster.Pillager;
|
|
||||||
import net.minecraft.world.entity.monster.Ravager;
|
|
||||||
import net.minecraft.world.entity.monster.Shulker;
|
|
||||||
import net.minecraft.world.entity.monster.Silverfish;
|
|
||||||
import net.minecraft.world.entity.monster.Skeleton;
|
|
||||||
import net.minecraft.world.entity.monster.Slime;
|
|
||||||
import net.minecraft.world.entity.monster.Spider;
|
|
||||||
import net.minecraft.world.entity.monster.Stray;
|
|
||||||
import net.minecraft.world.entity.monster.Strider;
|
|
||||||
import net.minecraft.world.entity.monster.Vex;
|
|
||||||
import net.minecraft.world.entity.monster.Vindicator;
|
|
||||||
import net.minecraft.world.entity.monster.Witch;
|
|
||||||
import net.minecraft.world.entity.monster.WitherSkeleton;
|
|
||||||
import net.minecraft.world.entity.monster.Zoglin;
|
|
||||||
import net.minecraft.world.entity.monster.Zombie;
|
|
||||||
import net.minecraft.world.entity.monster.ZombieVillager;
|
|
||||||
import net.minecraft.world.entity.monster.ZombifiedPiglin;
|
|
||||||
import net.minecraft.world.entity.monster.breeze.Breeze;
|
|
||||||
import net.minecraft.world.entity.monster.hoglin.Hoglin;
|
|
||||||
import net.minecraft.world.entity.monster.piglin.Piglin;
|
|
||||||
import net.minecraft.world.entity.monster.piglin.PiglinBrute;
|
|
||||||
import net.minecraft.world.entity.monster.warden.Warden;
|
|
||||||
import net.minecraft.world.entity.npc.Villager;
|
|
||||||
import net.minecraft.world.entity.npc.WanderingTrader;
|
|
||||||
import net.minecraft.world.entity.projectile.Arrow;
|
|
||||||
import net.minecraft.world.entity.projectile.DragonFireball;
|
|
||||||
import net.minecraft.world.entity.projectile.EvokerFangs;
|
|
||||||
import net.minecraft.world.entity.projectile.EyeOfEnder;
|
|
||||||
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
|
||||||
import net.minecraft.world.entity.projectile.FishingHook;
|
|
||||||
import net.minecraft.world.entity.projectile.LargeFireball;
|
|
||||||
import net.minecraft.world.entity.projectile.LlamaSpit;
|
|
||||||
import net.minecraft.world.entity.projectile.ShulkerBullet;
|
|
||||||
import net.minecraft.world.entity.projectile.SmallFireball;
|
|
||||||
import net.minecraft.world.entity.projectile.Snowball;
|
|
||||||
import net.minecraft.world.entity.projectile.SpectralArrow;
|
|
||||||
import net.minecraft.world.entity.projectile.ThrownEgg;
|
|
||||||
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
|
|
||||||
import net.minecraft.world.entity.projectile.ThrownExperienceBottle;
|
|
||||||
import net.minecraft.world.entity.projectile.ThrownPotion;
|
|
||||||
import net.minecraft.world.entity.projectile.ThrownTrident;
|
|
||||||
import net.minecraft.world.entity.projectile.WitherSkull;
|
|
||||||
import net.minecraft.world.entity.projectile.windcharge.BreezeWindCharge;
|
|
||||||
import net.minecraft.world.entity.projectile.windcharge.WindCharge;
|
|
||||||
import net.minecraft.world.entity.vehicle.Boat;
|
|
||||||
import net.minecraft.world.entity.vehicle.ChestBoat;
|
|
||||||
import net.minecraft.world.entity.vehicle.Minecart;
|
|
||||||
import net.minecraft.world.entity.vehicle.MinecartChest;
|
|
||||||
import net.minecraft.world.entity.vehicle.MinecartCommandBlock;
|
|
||||||
import net.minecraft.world.entity.vehicle.MinecartFurnace;
|
|
||||||
import net.minecraft.world.entity.vehicle.MinecartHopper;
|
|
||||||
import net.minecraft.world.entity.vehicle.MinecartSpawner;
|
|
||||||
import net.minecraft.world.entity.vehicle.MinecartTNT;
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
public class CustomEntityRegistry extends DefaultedMappedRegistry<EntityType<?>>
|
|
||||||
implements Supplier<MappedRegistry<EntityType<?>>> {
|
|
||||||
private final BiMap<ResourceLocation, EntityType> entities = HashBiMap.create();
|
|
||||||
private final BiMap<EntityType, ResourceLocation> entityClasses = this.entities.inverse();
|
|
||||||
private final Map<EntityType, Integer> entityIds = Maps.newHashMap();
|
|
||||||
private final MappedRegistry<EntityType<?>> wrapped;
|
|
||||||
|
|
||||||
public CustomEntityRegistry(DefaultedRegistry<EntityType<?>> original) throws Throwable {
|
|
||||||
super(original.getDefaultKey().getNamespace(),
|
|
||||||
(ResourceKey<? extends Registry<EntityType<?>>>) IREGISTRY_RESOURCE_KEY.invoke(original),
|
|
||||||
(Lifecycle) IREGISTRY_LIFECYCLE.invoke(original), true);
|
|
||||||
this.wrapped = (MappedRegistry<EntityType<?>>) original;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RegistryLookup<EntityType<?>> asLookup() {
|
|
||||||
return wrapped.asLookup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bindTags(Map<TagKey<EntityType<?>>, List<Holder<EntityType<?>>>> map) {
|
|
||||||
wrapped.bindTags(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityType byId(int var0) {
|
|
||||||
return this.wrapped.byId(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityType byIdOrThrow(int var0) {
|
|
||||||
return this.wrapped.byIdOrThrow(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean containsKey(ResourceKey<EntityType<?>> var0) {
|
|
||||||
return this.wrapped.containsKey(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean containsKey(ResourceLocation var0) {
|
|
||||||
return this.wrapped.containsKey(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HolderGetter<EntityType<?>> createRegistrationLookup() {
|
|
||||||
return wrapped.createRegistrationLookup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Entry<ResourceKey<EntityType<?>>, EntityType<?>>> entrySet() {
|
|
||||||
return wrapped.entrySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityType findType(Class<?> search) {
|
|
||||||
return minecraftClassMap.inverse().get(search);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MappedRegistry<EntityType<?>> get() {
|
|
||||||
return wrapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityType get(ResourceKey<EntityType<?>> key) {
|
|
||||||
return wrapped.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityType get(ResourceLocation key) {
|
|
||||||
if (entities.containsKey(key))
|
|
||||||
return entities.get(key);
|
|
||||||
return wrapped.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Reference<EntityType<?>>> getHolder(int var0) {
|
|
||||||
return this.wrapped.getHolder(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Reference<EntityType<?>>> getHolder(ResourceKey<EntityType<?>> var0) {
|
|
||||||
return this.wrapped.getHolder(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getId(EntityType key) {
|
|
||||||
if (entityIds.containsKey(key))
|
|
||||||
return entityIds.get(key);
|
|
||||||
return wrapped.getId(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getKey(EntityType value) {
|
|
||||||
if (entityClasses.containsKey(value))
|
|
||||||
return entityClasses.get(value);
|
|
||||||
return wrapped.getKey(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<EntityType<?>> getOptional(ResourceKey<EntityType<?>> var0) {
|
|
||||||
return this.wrapped.getOptional(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<EntityType<?>> getOptional(ResourceLocation var0) {
|
|
||||||
if (entities.containsKey(var0))
|
|
||||||
return Optional.of(entities.get(var0));
|
|
||||||
return this.wrapped.getOptional(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Reference<EntityType<?>>> getRandom(RandomSource paramRandom) {
|
|
||||||
return wrapped.getRandom(paramRandom);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<ResourceKey<EntityType<?>>> getResourceKey(EntityType<?> var0) {
|
|
||||||
return wrapped.getResourceKey(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Named<EntityType<?>>> getTag(TagKey<EntityType<?>> var0) {
|
|
||||||
return this.wrapped.getTag(var0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Stream<TagKey<EntityType<?>>> getTagNames() {
|
|
||||||
return wrapped.getTagNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Stream<Pair<TagKey<EntityType<?>>, Named<EntityType<?>>>> getTags() {
|
|
||||||
return wrapped.getTags();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HolderOwner<EntityType<?>> holderOwner() {
|
|
||||||
return wrapped.holderOwner();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Stream<Reference<EntityType<?>>> holders() {
|
|
||||||
return wrapped.holders();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return wrapped.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<EntityType<?>> iterator() {
|
|
||||||
return wrapped.iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<ResourceLocation> keySet() {
|
|
||||||
return wrapped.keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void put(int entityId, ResourceLocation key, EntityType entityClass) {
|
|
||||||
entities.put(key, entityClass);
|
|
||||||
entityIds.put(entityClass, entityId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<ResourceKey<EntityType<?>>> registryKeySet() {
|
|
||||||
return wrapped.registryKeySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resetTags() {
|
|
||||||
wrapped.resetTags();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
return wrapped.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final MethodHandle IREGISTRY_LIFECYCLE = NMS.getFirstGetter(MappedRegistry.class, Lifecycle.class);
|
|
||||||
// replace regex ([A-Z_]+) =.*?of\((.*?)::new.*?$ minecraftClassMap.put(EntityType.\1, \2.class);
|
|
||||||
private static final MethodHandle IREGISTRY_RESOURCE_KEY = NMS.getFirstGetter(MappedRegistry.class,
|
|
||||||
ResourceKey.class);
|
|
||||||
private static final BiMap<EntityType, Class<?>> minecraftClassMap = HashBiMap.create();
|
|
||||||
static {
|
|
||||||
minecraftClassMap.put(EntityType.ALLAY, Allay.class);
|
|
||||||
minecraftClassMap.put(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class);
|
|
||||||
minecraftClassMap.put(EntityType.ARMADILLO, Armadillo.class);
|
|
||||||
minecraftClassMap.put(EntityType.ARMOR_STAND, ArmorStand.class);
|
|
||||||
minecraftClassMap.put(EntityType.ARROW, Arrow.class);
|
|
||||||
minecraftClassMap.put(EntityType.AXOLOTL, Axolotl.class);
|
|
||||||
minecraftClassMap.put(EntityType.BAT, Bat.class);
|
|
||||||
minecraftClassMap.put(EntityType.BEE, Bee.class);
|
|
||||||
minecraftClassMap.put(EntityType.BLAZE, Blaze.class);
|
|
||||||
minecraftClassMap.put(EntityType.BLOCK_DISPLAY, Display.BlockDisplay.class);
|
|
||||||
minecraftClassMap.put(EntityType.BOAT, Boat.class);
|
|
||||||
minecraftClassMap.put(EntityType.BOGGED, Bogged.class);
|
|
||||||
minecraftClassMap.put(EntityType.BREEZE, Breeze.class);
|
|
||||||
minecraftClassMap.put(EntityType.BREEZE_WIND_CHARGE, BreezeWindCharge.class);
|
|
||||||
minecraftClassMap.put(EntityType.CAMEL, Camel.class);
|
|
||||||
minecraftClassMap.put(EntityType.CAT, Cat.class);
|
|
||||||
minecraftClassMap.put(EntityType.CAVE_SPIDER, CaveSpider.class);
|
|
||||||
minecraftClassMap.put(EntityType.CHEST_BOAT, ChestBoat.class);
|
|
||||||
minecraftClassMap.put(EntityType.CHEST_MINECART, MinecartChest.class);
|
|
||||||
minecraftClassMap.put(EntityType.CHICKEN, Chicken.class);
|
|
||||||
minecraftClassMap.put(EntityType.COD, Cod.class);
|
|
||||||
minecraftClassMap.put(EntityType.COMMAND_BLOCK_MINECART, MinecartCommandBlock.class);
|
|
||||||
minecraftClassMap.put(EntityType.COW, Cow.class);
|
|
||||||
minecraftClassMap.put(EntityType.CREEPER, Creeper.class);
|
|
||||||
minecraftClassMap.put(EntityType.DOLPHIN, Dolphin.class);
|
|
||||||
minecraftClassMap.put(EntityType.DONKEY, Donkey.class);
|
|
||||||
minecraftClassMap.put(EntityType.DRAGON_FIREBALL, DragonFireball.class);
|
|
||||||
minecraftClassMap.put(EntityType.DROWNED, Drowned.class);
|
|
||||||
minecraftClassMap.put(EntityType.EGG, ThrownEgg.class);
|
|
||||||
minecraftClassMap.put(EntityType.ELDER_GUARDIAN, ElderGuardian.class);
|
|
||||||
minecraftClassMap.put(EntityType.END_CRYSTAL, EndCrystal.class);
|
|
||||||
minecraftClassMap.put(EntityType.ENDER_DRAGON, EnderDragon.class);
|
|
||||||
minecraftClassMap.put(EntityType.ENDER_PEARL, ThrownEnderpearl.class);
|
|
||||||
minecraftClassMap.put(EntityType.ENDERMAN, EnderMan.class);
|
|
||||||
minecraftClassMap.put(EntityType.ENDERMITE, Endermite.class);
|
|
||||||
minecraftClassMap.put(EntityType.EVOKER, Evoker.class);
|
|
||||||
minecraftClassMap.put(EntityType.EVOKER_FANGS, EvokerFangs.class);
|
|
||||||
minecraftClassMap.put(EntityType.EXPERIENCE_BOTTLE, ThrownExperienceBottle.class);
|
|
||||||
minecraftClassMap.put(EntityType.EXPERIENCE_ORB, ExperienceOrb.class);
|
|
||||||
minecraftClassMap.put(EntityType.EYE_OF_ENDER, EyeOfEnder.class);
|
|
||||||
minecraftClassMap.put(EntityType.FALLING_BLOCK, FallingBlockEntity.class);
|
|
||||||
minecraftClassMap.put(EntityType.FIREWORK_ROCKET, FireworkRocketEntity.class);
|
|
||||||
minecraftClassMap.put(EntityType.FOX, Fox.class);
|
|
||||||
minecraftClassMap.put(EntityType.FROG, Frog.class);
|
|
||||||
minecraftClassMap.put(EntityType.FURNACE_MINECART, MinecartFurnace.class);
|
|
||||||
minecraftClassMap.put(EntityType.GHAST, Ghast.class);
|
|
||||||
minecraftClassMap.put(EntityType.GIANT, Giant.class);
|
|
||||||
minecraftClassMap.put(EntityType.GLOW_ITEM_FRAME, GlowItemFrame.class);
|
|
||||||
minecraftClassMap.put(EntityType.GLOW_SQUID, GlowSquid.class);
|
|
||||||
minecraftClassMap.put(EntityType.GOAT, Goat.class);
|
|
||||||
minecraftClassMap.put(EntityType.GUARDIAN, Guardian.class);
|
|
||||||
minecraftClassMap.put(EntityType.HOGLIN, Hoglin.class);
|
|
||||||
minecraftClassMap.put(EntityType.HOPPER_MINECART, MinecartHopper.class);
|
|
||||||
minecraftClassMap.put(EntityType.HORSE, Horse.class);
|
|
||||||
minecraftClassMap.put(EntityType.HUSK, Husk.class);
|
|
||||||
minecraftClassMap.put(EntityType.ILLUSIONER, Illusioner.class);
|
|
||||||
minecraftClassMap.put(EntityType.INTERACTION, Interaction.class);
|
|
||||||
minecraftClassMap.put(EntityType.IRON_GOLEM, IronGolem.class);
|
|
||||||
minecraftClassMap.put(EntityType.ITEM, ItemEntity.class);
|
|
||||||
minecraftClassMap.put(EntityType.ITEM_DISPLAY, Display.ItemDisplay.class);
|
|
||||||
minecraftClassMap.put(EntityType.ITEM_FRAME, ItemFrame.class);
|
|
||||||
minecraftClassMap.put(EntityType.OMINOUS_ITEM_SPAWNER, OminousItemSpawner.class);
|
|
||||||
minecraftClassMap.put(EntityType.FIREBALL, LargeFireball.class);
|
|
||||||
minecraftClassMap.put(EntityType.LEASH_KNOT, LeashFenceKnotEntity.class);
|
|
||||||
minecraftClassMap.put(EntityType.LIGHTNING_BOLT, LightningBolt.class);
|
|
||||||
minecraftClassMap.put(EntityType.LLAMA, Llama.class);
|
|
||||||
minecraftClassMap.put(EntityType.LLAMA_SPIT, LlamaSpit.class);
|
|
||||||
minecraftClassMap.put(EntityType.MAGMA_CUBE, MagmaCube.class);
|
|
||||||
minecraftClassMap.put(EntityType.MARKER, Marker.class);
|
|
||||||
minecraftClassMap.put(EntityType.MINECART, Minecart.class);
|
|
||||||
minecraftClassMap.put(EntityType.MOOSHROOM, MushroomCow.class);
|
|
||||||
minecraftClassMap.put(EntityType.MULE, Mule.class);
|
|
||||||
minecraftClassMap.put(EntityType.OCELOT, Ocelot.class);
|
|
||||||
minecraftClassMap.put(EntityType.PAINTING, Painting.class);
|
|
||||||
minecraftClassMap.put(EntityType.PANDA, Panda.class);
|
|
||||||
minecraftClassMap.put(EntityType.PARROT, Parrot.class);
|
|
||||||
minecraftClassMap.put(EntityType.PHANTOM, Phantom.class);
|
|
||||||
minecraftClassMap.put(EntityType.PIG, Pig.class);
|
|
||||||
minecraftClassMap.put(EntityType.PIGLIN, Piglin.class);
|
|
||||||
minecraftClassMap.put(EntityType.PIGLIN_BRUTE, PiglinBrute.class);
|
|
||||||
minecraftClassMap.put(EntityType.PILLAGER, Pillager.class);
|
|
||||||
minecraftClassMap.put(EntityType.POLAR_BEAR, PolarBear.class);
|
|
||||||
minecraftClassMap.put(EntityType.POTION, ThrownPotion.class);
|
|
||||||
minecraftClassMap.put(EntityType.PUFFERFISH, Pufferfish.class);
|
|
||||||
minecraftClassMap.put(EntityType.RABBIT, Rabbit.class);
|
|
||||||
minecraftClassMap.put(EntityType.RAVAGER, Ravager.class);
|
|
||||||
minecraftClassMap.put(EntityType.SALMON, Salmon.class);
|
|
||||||
minecraftClassMap.put(EntityType.SHEEP, Sheep.class);
|
|
||||||
minecraftClassMap.put(EntityType.SHULKER, Shulker.class);
|
|
||||||
minecraftClassMap.put(EntityType.SHULKER_BULLET, ShulkerBullet.class);
|
|
||||||
minecraftClassMap.put(EntityType.SILVERFISH, Silverfish.class);
|
|
||||||
minecraftClassMap.put(EntityType.SKELETON, Skeleton.class);
|
|
||||||
minecraftClassMap.put(EntityType.SKELETON_HORSE, SkeletonHorse.class);
|
|
||||||
minecraftClassMap.put(EntityType.SLIME, Slime.class);
|
|
||||||
minecraftClassMap.put(EntityType.SMALL_FIREBALL, SmallFireball.class);
|
|
||||||
minecraftClassMap.put(EntityType.SNIFFER, Sniffer.class);
|
|
||||||
minecraftClassMap.put(EntityType.SNOW_GOLEM, SnowGolem.class);
|
|
||||||
minecraftClassMap.put(EntityType.SNOWBALL, Snowball.class);
|
|
||||||
minecraftClassMap.put(EntityType.SPAWNER_MINECART, MinecartSpawner.class);
|
|
||||||
minecraftClassMap.put(EntityType.SPECTRAL_ARROW, SpectralArrow.class);
|
|
||||||
minecraftClassMap.put(EntityType.SPIDER, Spider.class);
|
|
||||||
minecraftClassMap.put(EntityType.SQUID, Squid.class);
|
|
||||||
minecraftClassMap.put(EntityType.STRAY, Stray.class);
|
|
||||||
minecraftClassMap.put(EntityType.STRIDER, Strider.class);
|
|
||||||
minecraftClassMap.put(EntityType.TADPOLE, Tadpole.class);
|
|
||||||
minecraftClassMap.put(EntityType.TEXT_DISPLAY, Display.TextDisplay.class);
|
|
||||||
minecraftClassMap.put(EntityType.TNT, PrimedTnt.class);
|
|
||||||
minecraftClassMap.put(EntityType.TNT_MINECART, MinecartTNT.class);
|
|
||||||
minecraftClassMap.put(EntityType.TRADER_LLAMA, TraderLlama.class);
|
|
||||||
minecraftClassMap.put(EntityType.TRIDENT, ThrownTrident.class);
|
|
||||||
minecraftClassMap.put(EntityType.TROPICAL_FISH, TropicalFish.class);
|
|
||||||
minecraftClassMap.put(EntityType.TURTLE, Turtle.class);
|
|
||||||
minecraftClassMap.put(EntityType.VEX, Vex.class);
|
|
||||||
minecraftClassMap.put(EntityType.VILLAGER, Villager.class);
|
|
||||||
minecraftClassMap.put(EntityType.VINDICATOR, Vindicator.class);
|
|
||||||
minecraftClassMap.put(EntityType.WANDERING_TRADER, WanderingTrader.class);
|
|
||||||
minecraftClassMap.put(EntityType.WARDEN, Warden.class);
|
|
||||||
minecraftClassMap.put(EntityType.WIND_CHARGE, WindCharge.class);
|
|
||||||
minecraftClassMap.put(EntityType.WITCH, Witch.class);
|
|
||||||
minecraftClassMap.put(EntityType.WITHER, WitherBoss.class);
|
|
||||||
minecraftClassMap.put(EntityType.WITHER_SKELETON, WitherSkeleton.class);
|
|
||||||
minecraftClassMap.put(EntityType.WITHER_SKULL, WitherSkull.class);
|
|
||||||
minecraftClassMap.put(EntityType.WOLF, Wolf.class);
|
|
||||||
minecraftClassMap.put(EntityType.ZOGLIN, Zoglin.class);
|
|
||||||
minecraftClassMap.put(EntityType.ZOMBIE, Zombie.class);
|
|
||||||
minecraftClassMap.put(EntityType.ZOMBIE_HORSE, ZombieHorse.class);
|
|
||||||
minecraftClassMap.put(EntityType.ZOMBIE_VILLAGER, ZombieVillager.class);
|
|
||||||
minecraftClassMap.put(EntityType.ZOMBIFIED_PIGLIN, ZombifiedPiglin.class);
|
|
||||||
minecraftClassMap.put(EntityType.FISHING_BOBBER, FishingHook.class);
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,12 +4,12 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.35-SNAPSHOT</version>
|
<version>2.0.36-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>citizens-v1_21_R1</artifactId>
|
<artifactId>citizens-v1_21_R2</artifactId>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<craftbukkit.version>1.21.1-R0.1-SNAPSHOT</craftbukkit.version>
|
<craftbukkit.version>1.21.2-R0.1-SNAPSHOT</craftbukkit.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
@ -1,18 +1,18 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftAllay;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftAllay;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
|
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -37,13 +38,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class AllayController extends MobEntityController {
|
public class AllayController extends MobEntityController {
|
||||||
public AllayController() {
|
public AllayController() {
|
||||||
super(EntityAllayNPC.class);
|
super(EntityAllayNPC.class, EntityType.ALLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,6 +62,7 @@ public class AllayController extends MobEntityController {
|
|||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
private int taskId = -1;
|
private int taskId = -1;
|
||||||
|
|
||||||
public EntityAllayNPC(EntityType<? extends Allay> types, Level level) {
|
public EntityAllayNPC(EntityType<? extends Allay> types, Level level) {
|
||||||
this(types, level, null);
|
this(types, level, null);
|
||||||
}
|
}
|
||||||
@ -89,13 +91,6 @@ public class AllayController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -111,8 +106,8 @@ public class AllayController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -229,12 +224,19 @@ public class AllayController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 vec3d) {
|
public void travel(Vec3 vec3d) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftArmadillo;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftArmadillo;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -34,13 +35,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ArmadilloController extends MobEntityController {
|
public class ArmadilloController extends MobEntityController {
|
||||||
public ArmadilloController() {
|
public ArmadilloController() {
|
||||||
super(EntityArmadilloNPC.class);
|
super(EntityArmadilloNPC.class, EntityType.ARMADILLO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,13 +86,6 @@ public class ArmadilloController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -107,8 +101,8 @@ public class ArmadilloController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -225,12 +219,19 @@ public class ArmadilloController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 vec3d) {
|
public void travel(Vec3 vec3d) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,17 +1,17 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftArmorStand;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftArmorStand;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.MobAI;
|
import net.citizensnpcs.nms.v1_21_R2.util.MobAI;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.MobAI.ForwardingMobAI;
|
import net.citizensnpcs.nms.v1_21_R2.util.MobAI.ForwardingMobAI;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -27,13 +27,13 @@ import net.minecraft.world.entity.decoration.ArmorStand;
|
|||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ArmorStandController extends MobEntityController {
|
public class ArmorStandController extends MobEntityController {
|
||||||
public ArmorStandController() {
|
public ArmorStandController() {
|
||||||
super(EntityArmorStandNPC.class);
|
super(EntityArmorStandNPC.class, EntityType.ARMOR_STAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,13 +69,6 @@ public class ArmorStandController extends MobEntityController {
|
|||||||
return NMS.shouldBroadcastToPlayer(npc, () -> super.broadcastToPlayer(player));
|
return NMS.shouldBroadcastToPlayer(npc, () -> super.broadcastToPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MobAI getAI() {
|
public MobAI getAI() {
|
||||||
return ai;
|
return ai;
|
||||||
@ -130,6 +123,13 @@ public class ArmorStandController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
@ -1,14 +1,14 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftAxolotl;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftAxolotl;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -35,13 +35,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class AxolotlController extends MobEntityController {
|
public class AxolotlController extends MobEntityController {
|
||||||
public AxolotlController() {
|
public AxolotlController() {
|
||||||
super(EntityAxolotlNPC.class);
|
super(EntityAxolotlNPC.class, EntityType.AXOLOTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -59,6 +59,7 @@ public class AxolotlController extends MobEntityController {
|
|||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
private MoveControl oldMoveController;
|
private MoveControl oldMoveController;
|
||||||
|
|
||||||
public EntityAxolotlNPC(EntityType<? extends Axolotl> types, Level level) {
|
public EntityAxolotlNPC(EntityType<? extends Axolotl> types, Level level) {
|
||||||
this(types, level, null);
|
this(types, level, null);
|
||||||
}
|
}
|
||||||
@ -93,13 +94,6 @@ public class AxolotlController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -212,6 +206,13 @@ public class AxolotlController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
@ -238,7 +239,7 @@ public class AxolotlController extends MobEntityController {
|
|||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,19 +1,20 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftBat;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftBat;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -26,13 +27,13 @@ import net.minecraft.world.entity.vehicle.Boat;
|
|||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BatController extends MobEntityController {
|
public class BatController extends MobEntityController {
|
||||||
public BatController() {
|
public BatController() {
|
||||||
super(EntityBatNPC.class);
|
super(EntityBatNPC.class, EntityType.BAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,13 +74,6 @@ public class BatController extends MobEntityController {
|
|||||||
return super.canRide(entity);
|
return super.canRide(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -88,13 +82,13 @@ public class BatController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
if (npc.useMinecraftAI()) {
|
if (npc.useMinecraftAI()) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
}
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
@ -180,6 +174,13 @@ public class BatController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
||||||
if (npc == null)
|
if (npc == null)
|
@ -1,19 +1,20 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftBee;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftBee;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -26,13 +27,13 @@ import net.minecraft.world.entity.vehicle.Boat;
|
|||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BeeController extends MobEntityController {
|
public class BeeController extends MobEntityController {
|
||||||
public BeeController() {
|
public BeeController() {
|
||||||
super(EntityBeeNPC.class);
|
super(EntityBeeNPC.class, EntityType.BEE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,13 +71,6 @@ public class BeeController extends MobEntityController {
|
|||||||
return super.canRide(entity);
|
return super.canRide(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -85,13 +79,13 @@ public class BeeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
if (npc.useMinecraftAI()) {
|
if (npc.useMinecraftAI()) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
}
|
}
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
@ -177,6 +171,13 @@ public class BeeController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
||||||
if (npc == null)
|
if (npc == null)
|
@ -1,19 +1,20 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftBlaze;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftBlaze;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -26,13 +27,13 @@ import net.minecraft.world.entity.vehicle.Boat;
|
|||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BlazeController extends MobEntityController {
|
public class BlazeController extends MobEntityController {
|
||||||
public BlazeController() {
|
public BlazeController() {
|
||||||
super(EntityBlazeNPC.class);
|
super(EntityBlazeNPC.class, EntityType.BLAZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,13 +71,6 @@ public class BlazeController extends MobEntityController {
|
|||||||
return super.canRide(entity);
|
return super.canRide(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -85,7 +79,7 @@ public class BlazeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -172,6 +166,13 @@ public class BlazeController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tagkey, double d0) {
|
||||||
if (npc == null)
|
if (npc == null)
|
@ -1,14 +1,14 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftBogged;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftBogged;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -29,13 +30,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BoggedController extends MobEntityController {
|
public class BoggedController extends MobEntityController {
|
||||||
public BoggedController() {
|
public BoggedController() {
|
||||||
super(EntityBoggedNPC.class);
|
super(EntityBoggedNPC.class, EntityType.BOGGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -80,13 +81,6 @@ public class BoggedController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -102,8 +96,8 @@ public class BoggedController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -207,12 +201,19 @@ public class BoggedController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 vec3d) {
|
public void travel(Vec3 vec3d) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftBreeze;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftBreeze;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -29,13 +30,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class BreezeController extends MobEntityController {
|
public class BreezeController extends MobEntityController {
|
||||||
public BreezeController() {
|
public BreezeController() {
|
||||||
super(EntityBreezeNPC.class);
|
super(EntityBreezeNPC.class, EntityType.BREEZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -80,13 +81,6 @@ public class BreezeController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -102,8 +96,8 @@ public class BreezeController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -207,12 +201,19 @@ public class BreezeController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 vec3d) {
|
public void travel(Vec3 vec3d) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,15 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftCamel;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftCamel;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.Controllable;
|
import net.citizensnpcs.trait.Controllable;
|
||||||
@ -19,6 +19,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -33,13 +34,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class CamelController extends MobEntityController {
|
public class CamelController extends MobEntityController {
|
||||||
public CamelController() {
|
public CamelController() {
|
||||||
super(EntityCamelNPC.class);
|
super(EntityCamelNPC.class, EntityType.CAMEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,6 +65,7 @@ public class CamelController extends MobEntityController {
|
|||||||
|
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
private boolean riding;
|
private boolean riding;
|
||||||
|
|
||||||
public EntityCamelNPC(EntityType<? extends Camel> types, Level level) {
|
public EntityCamelNPC(EntityType<? extends Camel> types, Level level) {
|
||||||
this(types, level, null);
|
this(types, level, null);
|
||||||
}
|
}
|
||||||
@ -97,13 +99,6 @@ public class CamelController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -119,8 +114,8 @@ public class CamelController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
if (npc.hasTrait(Controllable.class) && npc.getOrAddTrait(Controllable.class).isEnabled()) {
|
if (npc.hasTrait(Controllable.class) && npc.getOrAddTrait(Controllable.class).isEnabled()) {
|
||||||
@ -251,12 +246,19 @@ public class CamelController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 vec3d) {
|
public void travel(Vec3 vec3d) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
package net.citizensnpcs.nms.v1_21_R1.entity;
|
package net.citizensnpcs.nms.v1_21_R2.entity;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_21_R2.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftCat;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftCat;
|
||||||
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftEntity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.ForwardingNPCHolder;
|
import net.citizensnpcs.nms.v1_21_R2.util.ForwardingNPCHolder;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSBoundingBox;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSBoundingBox;
|
||||||
import net.citizensnpcs.nms.v1_21_R1.util.NMSImpl;
|
import net.citizensnpcs.nms.v1_21_R2.util.NMSImpl;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
@ -29,13 +30,13 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.level.portal.DimensionTransition;
|
import net.minecraft.world.level.portal.TeleportTransition;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class CatController extends MobEntityController {
|
public class CatController extends MobEntityController {
|
||||||
public CatController() {
|
public CatController() {
|
||||||
super(EntityCatNPC.class);
|
super(EntityCatNPC.class, EntityType.CAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -80,13 +81,6 @@ public class CatController extends MobEntityController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity changeDimension(DimensionTransition transition) {
|
|
||||||
if (npc == null)
|
|
||||||
return super.changeDimension(transition);
|
|
||||||
return NMSImpl.teleportAcrossWorld(this, transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDespawn() {
|
public void checkDespawn() {
|
||||||
if (npc == null) {
|
if (npc == null) {
|
||||||
@ -102,8 +96,8 @@ public class CatController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep(ServerLevel level) {
|
||||||
super.customServerAiStep();
|
super.customServerAiStep(level);
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
@ -207,12 +201,19 @@ public class CatController extends MobEntityController {
|
|||||||
return npc == null ? super.save(save) : false;
|
return npc == null ? super.save(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity teleport(TeleportTransition transition) {
|
||||||
|
if (npc == null)
|
||||||
|
return super.teleport(transition);
|
||||||
|
return NMSImpl.teleportAcrossWorld(this, transition);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 vec3d) {
|
public void travel(Vec3 vec3d) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
super.travel(vec3d);
|
super.travel(vec3d);
|
||||||
} else {
|
} else {
|
||||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
NMSImpl.moveLogic(this, vec3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user