mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Rework item action NBT matching
This commit is contained in:
parent
245d76a78c
commit
73d0698d36
8
dist/pom.xml
vendored
8
dist/pom.xml
vendored
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizens-parent</artifactId>
|
||||
<version>2.0.33-SNAPSHOT</version>
|
||||
<version>2.0.34-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>citizens</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
@ -93,7 +93,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>citizens-v1_20_R3</artifactId>
|
||||
<artifactId>citizens-v1_20_R4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
@ -189,7 +189,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>citizens-v1_20_R3</artifactId>
|
||||
<artifactId>citizens-v1_20_R4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
@ -208,7 +208,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>citizens-v1_20_R3</artifactId>
|
||||
<artifactId>citizens-v1_20_R4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
|
@ -2,6 +2,7 @@ package net.citizensnpcs.trait.shop;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
@ -22,8 +23,6 @@ import net.citizensnpcs.api.gui.InventoryMenuPage;
|
||||
import net.citizensnpcs.api.gui.InventoryMenuSlot;
|
||||
import net.citizensnpcs.api.gui.Menu;
|
||||
import net.citizensnpcs.api.gui.MenuContext;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.util.SpigotUtil;
|
||||
import net.citizensnpcs.util.InventoryMultiplexer;
|
||||
@ -157,28 +156,22 @@ public class ItemAction extends NPCShopAction {
|
||||
}
|
||||
|
||||
private boolean metaMatches(ItemStack needle, ItemStack haystack, List<String> meta) {
|
||||
CompoundTag source = NMS.getNBT(needle);
|
||||
CompoundTag compare = NMS.getNBT(haystack);
|
||||
Map<String, Object> source = NMS.getComponentMap(needle);
|
||||
Map<String, Object> compare = NMS.getComponentMap(haystack);
|
||||
for (String nbt : meta) {
|
||||
String[] parts = nbt.split("\\.");
|
||||
Tag acc = source;
|
||||
Tag cmp = compare;
|
||||
Object acc = source;
|
||||
Object cmp = compare;
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (acc == null || cmp == null)
|
||||
return false;
|
||||
if (i < parts.length - 1) {
|
||||
if (!(acc instanceof CompoundTag) || !(cmp instanceof CompoundTag))
|
||||
return false;
|
||||
|
||||
if (parts[i].equals(acc.getName()) && acc.getName().equals(cmp.getName()))
|
||||
continue;
|
||||
|
||||
acc = ((CompoundTag) acc).getValue().get(parts[i]);
|
||||
cmp = ((CompoundTag) cmp).getValue().get(parts[i]);
|
||||
Map<String, Object> nextAcc = (Map<String, Object>) acc;
|
||||
Map<String, Object> nextCmp = (Map<String, Object>) cmp;
|
||||
if (!nextAcc.containsKey(parts[i]) && !nextCmp.containsKey(parts[i]))
|
||||
continue;
|
||||
}
|
||||
if (!acc.getName().equals(parts[i]) || !cmp.getName().equals(parts[i])
|
||||
|| !acc.getValue().equals(cmp.getValue()))
|
||||
acc = nextAcc.get(parts[i]);
|
||||
cmp = nextCmp.get(parts[i]);
|
||||
if (i == parts.length - 1 && !acc.equals(cmp))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.Paginator;
|
||||
import net.citizensnpcs.api.util.Placeholders;
|
||||
@ -43,7 +44,6 @@ public class Text extends Trait implements Runnable, Listener {
|
||||
private String itemInHandPattern = "default";
|
||||
@Persist(value = "random-talker")
|
||||
private boolean randomTalker = Setting.DEFAULT_RANDOM_TALKER.asBoolean();
|
||||
@Persist
|
||||
private double range = Setting.DEFAULT_TALK_CLOSE_RANGE.asDouble();
|
||||
@Persist(value = "realistic-looking")
|
||||
private boolean realisticLooker = Setting.DEFAULT_REALISTIC_LOOKING.asBoolean();
|
||||
@ -132,6 +132,11 @@ public class Text extends Trait implements Runnable, Listener {
|
||||
return randomTalker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(DataKey key) {
|
||||
range = key.getDouble("range", Setting.DEFAULT_TALK_CLOSE_RANGE.asDouble());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRightClick(NPCRightClickEvent event) {
|
||||
if (!event.getNPC().equals(npc) || text.size() == 0)
|
||||
@ -167,6 +172,14 @@ public class Text extends Trait implements Runnable, Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(DataKey key) {
|
||||
key.removeKey("range");
|
||||
if (range != Setting.DEFAULT_TALK_CLOSE_RANGE.asDouble()) {
|
||||
key.setDouble("range", range);
|
||||
}
|
||||
}
|
||||
|
||||
boolean sendPage(CommandSender player, int page) {
|
||||
Paginator paginator = new Paginator().header("Current Texts").enablePageSwitcher("/npc text page $page");
|
||||
for (int i = 0; i < text.size(); i++) {
|
||||
|
@ -7,6 +7,7 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@ -49,7 +50,6 @@ import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.event.NPCKnockbackEvent;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -216,6 +216,10 @@ public class NMS {
|
||||
return BRIDGE.getCollisionBox(block).add(block.getX(), block.getY(), block.getZ());
|
||||
}
|
||||
|
||||
public static Map<String, Object> getComponentMap(ItemStack item) {
|
||||
return BRIDGE.getComponentMap(item);
|
||||
}
|
||||
|
||||
public static Location getDestination(Entity entity) {
|
||||
return BRIDGE.getDestination(entity);
|
||||
}
|
||||
@ -520,10 +524,6 @@ public class NMS {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CompoundTag getNBT(ItemStack item) {
|
||||
return BRIDGE.getNBT(item);
|
||||
}
|
||||
|
||||
private static Collection<Player> getNearbyPlayers(Entity from) {
|
||||
return getNearbyPlayers(from, from.getLocation(), 64);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.citizensnpcs.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
@ -32,7 +33,6 @@ import com.mojang.authlib.GameProfileRepository;
|
||||
import net.citizensnpcs.api.ai.NavigatorParameters;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -81,6 +81,10 @@ public interface NMSBridge {
|
||||
|
||||
public BoundingBox getCollisionBox(Block block);
|
||||
|
||||
public default Map<String, Object> getComponentMap(ItemStack item) {
|
||||
return item.getItemMeta().serialize();
|
||||
}
|
||||
|
||||
public Location getDestination(Entity entity);
|
||||
|
||||
public GameProfileRepository getGameProfileRepository();
|
||||
@ -89,8 +93,6 @@ public interface NMSBridge {
|
||||
|
||||
public float getHorizontalMovement(Entity entity);
|
||||
|
||||
public CompoundTag getNBT(ItemStack item);
|
||||
|
||||
public NPC getNPC(Entity entity);
|
||||
|
||||
public EntityPacketTracker getPacketTracker(Entity entity);
|
||||
|
@ -8,7 +8,6 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -78,19 +77,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -494,11 +480,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.bg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1604,52 +1585,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_10_R1.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.c()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_10_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_10_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_10_R1.NBTTagInt) base).e());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_10_R1.NBTTagFloat) base).i());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_10_R1.NBTTagDouble) base).h());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_10_R1.NBTTagLong) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_10_R1.NBTTagShort) base).f());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_10_R1.NBTTagByte) base).g());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_10_R1.NBTTagByteArray) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_10_R1.NBTTagIntArray) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagString)
|
||||
return new StringTag(key, base.toString());
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_10_R1.NBTBase> list = (List<net.minecraft.server.v1_10_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_10_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
|
||||
if (entity.ct() || entity.bA()) {
|
||||
if (entity.isInWater()
|
||||
|
@ -8,7 +8,6 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -78,19 +77,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -514,11 +500,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.bf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1664,52 +1645,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_11_R1.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.c()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_11_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_11_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_11_R1.NBTTagInt) base).e());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_11_R1.NBTTagFloat) base).i());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_11_R1.NBTTagDouble) base).asDouble());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_11_R1.NBTTagLong) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_11_R1.NBTTagShort) base).f());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_11_R1.NBTTagByte) base).g());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_11_R1.NBTTagByteArray) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_11_R1.NBTTagIntArray) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagString)
|
||||
return new StringTag(key, base.toString());
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_11_R1.NBTBase> list = (List<net.minecraft.server.v1_11_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_11_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
|
||||
if (entity.cu() || entity.bA()) {
|
||||
if (entity.isInWater()) {
|
||||
|
@ -78,19 +78,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -514,11 +501,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.bg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1671,52 +1653,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_12_R1.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.c()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_12_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_12_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_12_R1.NBTTagInt) base).e());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_12_R1.NBTTagFloat) base).i());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_12_R1.NBTTagDouble) base).asDouble());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_12_R1.NBTTagLong) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_12_R1.NBTTagShort) base).f());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_12_R1.NBTTagByte) base).g());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_12_R1.NBTTagByteArray) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_12_R1.NBTTagIntArray) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagString)
|
||||
return new StringTag(key, base.toString());
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_12_R1.NBTBase> list = (List<net.minecraft.server.v1_12_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_12_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_12_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1, float f2) {
|
||||
if (entity.cC() || entity.bI()) {
|
||||
if (entity.isInWater()) {
|
||||
|
@ -8,7 +8,6 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -79,19 +78,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -537,11 +523,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.bj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1711,52 +1692,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_13_R2.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_13_R2.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_13_R2.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_13_R2.NBTTagInt) base).asInt());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_13_R2.NBTTagFloat) base).asFloat());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_13_R2.NBTTagDouble) base).asDouble());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_13_R2.NBTTagLong) base).asLong());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_13_R2.NBTTagShort) base).asShort());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_13_R2.NBTTagByte) base).asByte());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_13_R2.NBTTagByteArray) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_13_R2.NBTTagIntArray) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagString)
|
||||
return new StringTag(key, base.asString());
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagList) {
|
||||
List<net.minecraft.server.v1_13_R2.NBTBase> list = (List<net.minecraft.server.v1_13_R2.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_13_R2.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_13_R2.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1, float f2) {
|
||||
if (entity.cP() || entity.bT()) {
|
||||
double d0 = 0.08D;
|
||||
|
@ -6,7 +6,6 @@ import java.net.SocketAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -76,19 +75,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -578,11 +564,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.bd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1804,52 +1785,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_14_R1.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_14_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_14_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_14_R1.NBTTagInt) base).asInt());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_14_R1.NBTTagFloat) base).asFloat());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_14_R1.NBTTagDouble) base).asDouble());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_14_R1.NBTTagLong) base).asLong());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_14_R1.NBTTagShort) base).asShort());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_14_R1.NBTTagByte) base).asByte());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_14_R1.NBTTagByteArray) base).getBytes());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_14_R1.NBTTagIntArray) base).getInts());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagString)
|
||||
return new StringTag(key, base.asString());
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_14_R1.NBTBase> list = (List<net.minecraft.server.v1_14_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_14_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_14_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, Vec3D vec3d) {
|
||||
double d0;
|
||||
float f;
|
||||
|
@ -6,7 +6,6 @@ import java.net.SocketAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -76,19 +75,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -593,11 +579,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1858,52 +1839,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_15_R1.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_15_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_15_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_15_R1.NBTTagInt) base).asInt());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_15_R1.NBTTagFloat) base).asFloat());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_15_R1.NBTTagDouble) base).asDouble());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_15_R1.NBTTagLong) base).asLong());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_15_R1.NBTTagShort) base).asShort());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_15_R1.NBTTagByte) base).asByte());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_15_R1.NBTTagByteArray) base).getBytes());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_15_R1.NBTTagIntArray) base).getInts());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagString)
|
||||
return new StringTag(key, base.asString());
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_15_R1.NBTBase> list = (List<net.minecraft.server.v1_15_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_15_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_15_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, Vec3D vec3d) {
|
||||
double d0;
|
||||
float f;
|
||||
|
@ -6,7 +6,6 @@ import java.net.SocketAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -78,19 +77,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -609,11 +595,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.aT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1884,52 +1865,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_16_R3.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_16_R3.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_16_R3.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_16_R3.NBTTagInt) base).asInt());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_16_R3.NBTTagFloat) base).asFloat());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_16_R3.NBTTagDouble) base).asDouble());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_16_R3.NBTTagLong) base).asLong());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_16_R3.NBTTagShort) base).asShort());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_16_R3.NBTTagByte) base).asByte());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_16_R3.NBTTagByteArray) base).getBytes());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_16_R3.NBTTagIntArray) base).getInts());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagString)
|
||||
return new StringTag(key, base.asString());
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagList) {
|
||||
List<net.minecraft.server.v1_16_R3.NBTBase> list = (List<net.minecraft.server.v1_16_R3.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_16_R3.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_16_R3.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, Vec3D vec3d) {
|
||||
if (entity.doAITick() || entity.cs()) {
|
||||
double d0 = 0.08D;
|
||||
|
@ -5,7 +5,6 @@ import java.lang.reflect.Field;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -38,7 +37,6 @@ import org.bukkit.craftbukkit.v1_17_R1.entity.CraftWither;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventoryAnvil;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftInventoryView;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -74,19 +72,6 @@ import net.citizensnpcs.api.astar.pathfinder.DoorExaminer;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -620,11 +605,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.zza;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1879,52 +1859,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.nbt.CompoundTag tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getAllKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.nbt.Tag base) {
|
||||
if (base instanceof net.minecraft.nbt.IntTag)
|
||||
return new IntTag(key, ((net.minecraft.nbt.IntTag) base).getAsInt());
|
||||
else if (base instanceof net.minecraft.nbt.FloatTag)
|
||||
return new FloatTag(key, ((net.minecraft.nbt.FloatTag) base).getAsFloat());
|
||||
else if (base instanceof net.minecraft.nbt.DoubleTag)
|
||||
return new DoubleTag(key, ((net.minecraft.nbt.DoubleTag) base).getAsDouble());
|
||||
else if (base instanceof net.minecraft.nbt.LongTag)
|
||||
return new LongTag(key, ((net.minecraft.nbt.LongTag) base).getAsLong());
|
||||
else if (base instanceof net.minecraft.nbt.ShortTag)
|
||||
return new ShortTag(key, ((net.minecraft.nbt.ShortTag) base).getAsShort());
|
||||
else if (base instanceof net.minecraft.nbt.ByteTag)
|
||||
return new ByteTag(key, ((net.minecraft.nbt.ByteTag) base).getAsByte());
|
||||
else if (base instanceof net.minecraft.nbt.ByteArrayTag)
|
||||
return new ByteArrayTag(key, ((net.minecraft.nbt.ByteArrayTag) base).getAsByteArray());
|
||||
else if (base instanceof net.minecraft.nbt.IntArrayTag)
|
||||
return new IntArrayTag(key, ((net.minecraft.nbt.IntArrayTag) base).getAsIntArray());
|
||||
else if (base instanceof net.minecraft.nbt.StringTag)
|
||||
return new StringTag(key, base.getAsString());
|
||||
else if (base instanceof net.minecraft.nbt.ListTag) {
|
||||
List<net.minecraft.nbt.Tag> list = (List<net.minecraft.nbt.Tag>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.nbt.CompoundTag)
|
||||
return convertNBT((net.minecraft.nbt.CompoundTag) base);
|
||||
else if (base instanceof net.minecraft.nbt.EndTag)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(LivingEntity entity, Vec3 vec3d) {
|
||||
if (entity.isEffectiveAi() || entity.isControlledByLocalInstance()) {
|
||||
double d0 = 0.08D;
|
||||
|
@ -4,7 +4,6 @@ import java.lang.invoke.MethodHandle;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -38,7 +37,6 @@ import org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.event.CraftPortalEvent;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventoryAnvil;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventoryView;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -75,19 +73,6 @@ import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.event.DespawnReason;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -626,11 +611,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.zza;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1886,52 +1866,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.nbt.CompoundTag tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getAllKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.nbt.Tag base) {
|
||||
if (base instanceof net.minecraft.nbt.IntTag)
|
||||
return new IntTag(key, ((net.minecraft.nbt.IntTag) base).getAsInt());
|
||||
else if (base instanceof net.minecraft.nbt.FloatTag)
|
||||
return new FloatTag(key, ((net.minecraft.nbt.FloatTag) base).getAsFloat());
|
||||
else if (base instanceof net.minecraft.nbt.DoubleTag)
|
||||
return new DoubleTag(key, ((net.minecraft.nbt.DoubleTag) base).getAsDouble());
|
||||
else if (base instanceof net.minecraft.nbt.LongTag)
|
||||
return new LongTag(key, ((net.minecraft.nbt.LongTag) base).getAsLong());
|
||||
else if (base instanceof net.minecraft.nbt.ShortTag)
|
||||
return new ShortTag(key, ((net.minecraft.nbt.ShortTag) base).getAsShort());
|
||||
else if (base instanceof net.minecraft.nbt.ByteTag)
|
||||
return new ByteTag(key, ((net.minecraft.nbt.ByteTag) base).getAsByte());
|
||||
else if (base instanceof net.minecraft.nbt.ByteArrayTag)
|
||||
return new ByteArrayTag(key, ((net.minecraft.nbt.ByteArrayTag) base).getAsByteArray());
|
||||
else if (base instanceof net.minecraft.nbt.IntArrayTag)
|
||||
return new IntArrayTag(key, ((net.minecraft.nbt.IntArrayTag) base).getAsIntArray());
|
||||
else if (base instanceof net.minecraft.nbt.StringTag)
|
||||
return new StringTag(key, base.getAsString());
|
||||
else if (base instanceof net.minecraft.nbt.ListTag) {
|
||||
List<net.minecraft.nbt.Tag> list = (List<net.minecraft.nbt.Tag>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.nbt.CompoundTag)
|
||||
return convertNBT((net.minecraft.nbt.CompoundTag) base);
|
||||
else if (base instanceof net.minecraft.nbt.EndTag)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(LivingEntity entity, Vec3 vec3d) {
|
||||
if (entity.isEffectiveAi() || entity.isControlledByLocalInstance()) {
|
||||
double d0 = 0.08D;
|
||||
|
@ -42,7 +42,6 @@ import org.bukkit.craftbukkit.v1_19_R3.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.event.CraftPortalEvent;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryAnvil;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryView;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -81,19 +80,6 @@ import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.event.DespawnReason;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -667,11 +653,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.zza;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -2084,52 +2065,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.nbt.CompoundTag tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getAllKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.nbt.Tag base) {
|
||||
if (base instanceof net.minecraft.nbt.IntTag)
|
||||
return new IntTag(key, ((net.minecraft.nbt.IntTag) base).getAsInt());
|
||||
else if (base instanceof net.minecraft.nbt.FloatTag)
|
||||
return new FloatTag(key, ((net.minecraft.nbt.FloatTag) base).getAsFloat());
|
||||
else if (base instanceof net.minecraft.nbt.DoubleTag)
|
||||
return new DoubleTag(key, ((net.minecraft.nbt.DoubleTag) base).getAsDouble());
|
||||
else if (base instanceof net.minecraft.nbt.LongTag)
|
||||
return new LongTag(key, ((net.minecraft.nbt.LongTag) base).getAsLong());
|
||||
else if (base instanceof net.minecraft.nbt.ShortTag)
|
||||
return new ShortTag(key, ((net.minecraft.nbt.ShortTag) base).getAsShort());
|
||||
else if (base instanceof net.minecraft.nbt.ByteTag)
|
||||
return new ByteTag(key, ((net.minecraft.nbt.ByteTag) base).getAsByte());
|
||||
else if (base instanceof net.minecraft.nbt.ByteArrayTag)
|
||||
return new ByteArrayTag(key, ((net.minecraft.nbt.ByteArrayTag) base).getAsByteArray());
|
||||
else if (base instanceof net.minecraft.nbt.IntArrayTag)
|
||||
return new IntArrayTag(key, ((net.minecraft.nbt.IntArrayTag) base).getAsIntArray());
|
||||
else if (base instanceof net.minecraft.nbt.StringTag)
|
||||
return new StringTag(key, base.getAsString());
|
||||
else if (base instanceof net.minecraft.nbt.ListTag) {
|
||||
List<net.minecraft.nbt.Tag> list = (List<net.minecraft.nbt.Tag>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.nbt.CompoundTag)
|
||||
return convertNBT((net.minecraft.nbt.CompoundTag) base);
|
||||
else if (base instanceof net.minecraft.nbt.EndTag)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(LivingEntity entity, Vec3 vec3d) {
|
||||
if (entity.isEffectiveAi() || entity.isControlledByLocalInstance()) {
|
||||
double d0 = 0.08D;
|
||||
|
@ -70,19 +70,6 @@ import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.event.DespawnReason;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -648,12 +635,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.zza;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
throw new UnsupportedOperationException();
|
||||
// return convertNBT(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -2080,52 +2061,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.nbt.CompoundTag tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.getAllKeys()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.nbt.Tag base) {
|
||||
if (base instanceof net.minecraft.nbt.IntTag)
|
||||
return new IntTag(key, ((net.minecraft.nbt.IntTag) base).getAsInt());
|
||||
else if (base instanceof net.minecraft.nbt.FloatTag)
|
||||
return new FloatTag(key, ((net.minecraft.nbt.FloatTag) base).getAsFloat());
|
||||
else if (base instanceof net.minecraft.nbt.DoubleTag)
|
||||
return new DoubleTag(key, ((net.minecraft.nbt.DoubleTag) base).getAsDouble());
|
||||
else if (base instanceof net.minecraft.nbt.LongTag)
|
||||
return new LongTag(key, ((net.minecraft.nbt.LongTag) base).getAsLong());
|
||||
else if (base instanceof net.minecraft.nbt.ShortTag)
|
||||
return new ShortTag(key, ((net.minecraft.nbt.ShortTag) base).getAsShort());
|
||||
else if (base instanceof net.minecraft.nbt.ByteTag)
|
||||
return new ByteTag(key, ((net.minecraft.nbt.ByteTag) base).getAsByte());
|
||||
else if (base instanceof net.minecraft.nbt.ByteArrayTag)
|
||||
return new ByteArrayTag(key, ((net.minecraft.nbt.ByteArrayTag) base).getAsByteArray());
|
||||
else if (base instanceof net.minecraft.nbt.IntArrayTag)
|
||||
return new IntArrayTag(key, ((net.minecraft.nbt.IntArrayTag) base).getAsIntArray());
|
||||
else if (base instanceof net.minecraft.nbt.StringTag)
|
||||
return new StringTag(key, base.getAsString());
|
||||
else if (base instanceof net.minecraft.nbt.ListTag) {
|
||||
List<net.minecraft.nbt.Tag> list = (List<net.minecraft.nbt.Tag>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.nbt.CompoundTag)
|
||||
return convertNBT((net.minecraft.nbt.CompoundTag) base);
|
||||
else if (base instanceof net.minecraft.nbt.EndTag)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(LivingEntity entity, Vec3 vec3d) {
|
||||
if (entity.isEffectiveAi() || entity.isControlledByLocalInstance()) {
|
||||
double d0 = 0.08D;
|
||||
|
@ -75,19 +75,6 @@ import net.citizensnpcs.api.ai.event.CancelReason;
|
||||
import net.citizensnpcs.api.command.CommandManager;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.gui.ForwardingInventory;
|
||||
import net.citizensnpcs.api.jnbt.ByteArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.ByteTag;
|
||||
import net.citizensnpcs.api.jnbt.CompoundTag;
|
||||
import net.citizensnpcs.api.jnbt.DoubleTag;
|
||||
import net.citizensnpcs.api.jnbt.EndTag;
|
||||
import net.citizensnpcs.api.jnbt.FloatTag;
|
||||
import net.citizensnpcs.api.jnbt.IntArrayTag;
|
||||
import net.citizensnpcs.api.jnbt.IntTag;
|
||||
import net.citizensnpcs.api.jnbt.ListTag;
|
||||
import net.citizensnpcs.api.jnbt.LongTag;
|
||||
import net.citizensnpcs.api.jnbt.ShortTag;
|
||||
import net.citizensnpcs.api.jnbt.StringTag;
|
||||
import net.citizensnpcs.api.jnbt.Tag;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker;
|
||||
import net.citizensnpcs.api.npc.BlockBreaker.BlockBreakerConfiguration;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -446,11 +433,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return handle.ba;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getNBT(org.bukkit.inventory.ItemStack item) {
|
||||
return convertNBT(CraftItemStack.asNMSCopy(item).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
@ -1528,52 +1510,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_8_R3.NBTTagCompound tag) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.c()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
}
|
||||
return new CompoundTag("", tags);
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_8_R3.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_8_R3.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_8_R3.NBTTagInt) base).d());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_8_R3.NBTTagFloat) base).h());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_8_R3.NBTTagDouble) base).g());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_8_R3.NBTTagLong) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_8_R3.NBTTagShort) base).e());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_8_R3.NBTTagByte) base).f());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_8_R3.NBTTagByteArray) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_8_R3.NBTTagIntArray) base).c());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagString)
|
||||
return new StringTag(key, base.toString());
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagList) {
|
||||
List<net.minecraft.server.v1_8_R3.NBTBase> list = (List<net.minecraft.server.v1_8_R3.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
Class<? extends Tag> tagType = convertNBT("", list.get(0)).getClass();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
converted.add(convertNBT("", list.get(i)));
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
} else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_8_R3.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_8_R3.NBTTagEnd)
|
||||
return new EndTag();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
|
||||
if (entity.bM()) {
|
||||
if (entity.V()) {
|
||||
|
Loading…
Reference in New Issue
Block a user