mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-02 15:43:44 +01:00
4da7b3aefc
Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 3e77330 Updated Upstream (Paper) EMC Changes: e45a78e4 Update the API as well - setTargetRange to Double where null is default FOLLOW_RANGE 9fc6891d Default target range to the follow range a1e2e2a3 Fix an issue with players in vehicles in vehicles desyncing b6e2f202 Add a Dead vehicle reason to VehicleExitEvent 72b0da43 Use the correct entity local variable ad32d0d6 Fix bug with entity passengers not executing entity tasks 194aaafb Updated Paper cb3a7bb7 Always convert Lore/Name of an item to ensure consistency 6c63538d Revert "Updated Paper" 8837d5a9 Limit fortress spawns to the nether 005cdda9 Updated Paper 1476d693 Fix Lore comparisons to use legacy format 588f30f9 Quick fix the rcon log issue for now 475e626a Fix World Meta loading 3ad5f8a7 Remove RCON Thread Logs 7f3c4a25 Fix dismounting from vehicle when teleporting cross dimension 595bd307 Prevent NPE for PathfinderGoalMeleeAttack 0a64d9e9 Fix EntityDismountEvent reason c25ef322 Updated Paper Origami Changes: 36c0e05 Fix wrong circular dependency error if plugin depends on own provides 655fa5f Add option to disable legacy plugin support Purpur Changes: 79d304f Updated Upstream (Paper) bef678f [ci-skip] Simpler method of merging metadata files 3b18ff8 Updated Upstream (Paper) 25c7772 Apply the AppendingTransformer for `META-INF/services/java.sql.Driver` faf0db9 Bump config version to 10 3d1926e More base attribute stuff 43d6dab Updated Upstream (Paper) 2fd92fe [ci-skip] Setup repo for api publishing 26b0736 Updated Upstream (Paper) e704540 [ci-skip] Fix the remaining javadoc warnings a541703 [ci-skip] Fix import mc-dev task 64f5f9d Fix dependency relocations d7f1884 [ci-skip] Skip compiling tests as well as running them when using the `-Pfast` flag 3e08321 [ci-skip] Fix javadoc warnings (missing @param and @return) 1bfe697 [ci-skip] Remove paper's unsafe util 63b647c [ci-skip] Make it easier to fork Purpur using our scripts c453170 Fix relocations 7e331c2 Fix #118 Phantom fire time not working 844337c Fix lag from villager lobotomize check 2ec0dba Updated Upstream (Paper) 69c6484 Build using Toothpick scripts (#122) AirplaneLite Changes: ff087b7 Changes from Purpur 7263c2f Fix maven subproject URL 819c731 Switch to Purpur's Toothpick
157 lines
5.5 KiB
Diff
157 lines
5.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: tr7zw <tr7zw@live.de>
|
|
Date: Sat, 1 Aug 2020 15:55:15 -0500
|
|
Subject: [PATCH] Add NBT API as a first-class lib
|
|
|
|
|
|
diff --git a/pom.xml b/pom.xml
|
|
index 31aba885d940acf0a9df5d4e83dfec69030b2a37..afe3477c9a577a5fa1ef6c7dfd5a221fd3ca9f6b 100644
|
|
--- a/pom.xml
|
|
+++ b/pom.xml
|
|
@@ -56,6 +56,11 @@
|
|
<id>mojang</id>
|
|
<url>https://libraries.minecraft.net/</url>
|
|
</repository>
|
|
+ <!-- CodeMC -->
|
|
+ <repository>
|
|
+ <id>codemc-repo</id>
|
|
+ <url>https://repo.codemc.org/repository/maven-public/</url>
|
|
+ </repository>
|
|
</repositories>
|
|
|
|
<pluginRepositories>
|
|
@@ -170,6 +175,11 @@
|
|
<artifactId>asm-commons</artifactId>
|
|
<version>8.0.1</version>
|
|
</dependency>
|
|
+ <dependency>
|
|
+ <groupId>de.tr7zw</groupId>
|
|
+ <artifactId>item-nbt-api</artifactId>
|
|
+ <version>2.6.0</version>
|
|
+ </dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
@@ -245,6 +255,12 @@
|
|
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
|
<!-- when downloading via Maven we can pull depends individually -->
|
|
<shadedArtifactAttached>true</shadedArtifactAttached>
|
|
+ <relocations>
|
|
+ <relocation>
|
|
+ <pattern>de.tr7zw.changeme.nbtapi</pattern>
|
|
+ <shadedPattern>de.tr7zw.nbtapi</shadedPattern>
|
|
+ </relocation>
|
|
+ </relocations>
|
|
</configuration>
|
|
</plugin>
|
|
<plugin>
|
|
diff --git a/src/main/java/org/bukkit/block/TileState.java b/src/main/java/org/bukkit/block/TileState.java
|
|
index 3b10fcc13893403b29f0260b8605144679e89b82..1e9a96d8b08cc396acf73dc42083009354e89d8a 100644
|
|
--- a/src/main/java/org/bukkit/block/TileState.java
|
|
+++ b/src/main/java/org/bukkit/block/TileState.java
|
|
@@ -36,4 +36,26 @@ public interface TileState extends BlockState, PersistentDataHolder {
|
|
@NotNull
|
|
@Override
|
|
PersistentDataContainer getPersistentDataContainer();
|
|
+
|
|
+ // Yatopia start
|
|
+ /**
|
|
+ * Returns NBT representation of this tile entity.
|
|
+ *
|
|
+ * @return vanilla NBT tags container
|
|
+ */
|
|
+ @NotNull
|
|
+ default de.tr7zw.changeme.nbtapi.NBTTileEntity getNBT() {
|
|
+ return new de.tr7zw.changeme.nbtapi.NBTTileEntity(this);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns a custom tag container of this tile entity.
|
|
+ *
|
|
+ * @return custom NBT tags container
|
|
+ */
|
|
+ @NotNull
|
|
+ default de.tr7zw.changeme.nbtapi.NBTCompound getNBTC() {
|
|
+ return getNBT().getPersistentDataContainer();
|
|
+ }
|
|
+ // Yatopia end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
|
index 76e857c364fe79e20cf9bde54b65e5b7108174fd..dc7e9983b89726625acce95026b45695b3f387b6 100644
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
|
@@ -698,4 +698,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|
*/
|
|
public boolean isTicking();
|
|
// Paper end
|
|
+
|
|
+ // Yatopia start
|
|
+ /**
|
|
+ * Returns NBT representation of this entity.
|
|
+ *
|
|
+ * @return vanilla NBT tags container
|
|
+ */
|
|
+ @NotNull
|
|
+ default de.tr7zw.changeme.nbtapi.NBTEntity getNBT() {
|
|
+ return new de.tr7zw.changeme.nbtapi.NBTEntity(this);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns a custom tag container of this entity.
|
|
+ *
|
|
+ * @return custom NBT tags container
|
|
+ */
|
|
+ @NotNull
|
|
+ default de.tr7zw.changeme.nbtapi.NBTCompound getNBTC() {
|
|
+ return getNBT().getPersistentDataContainer();
|
|
+ }
|
|
+ // Yatopia end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
index ccd81fca25233c2a9c2a8c3f4dda3053d7b2e723..5ad9dfb7856b2f86947b12b5444b2f8147f72bbf 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -791,4 +791,42 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|
return itemMeta.hasItemFlag(flag);
|
|
}
|
|
// Paper end
|
|
+
|
|
+ // Yatopia start
|
|
+ /**
|
|
+ * Returns NBT representation of this item. The ItemStack will be cloned!
|
|
+ *
|
|
+ * @return item's NBT tags container
|
|
+ */
|
|
+ @NotNull
|
|
+ public de.tr7zw.changeme.nbtapi.NBTItem getNBT() {
|
|
+ return getNBT(false);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns NBT representation of this item. If directApply is true,
|
|
+ * all changes will be mapped to the original item. Changes to the NBTItem will
|
|
+ * overwrite changes done to the original item in that case.
|
|
+ *
|
|
+ * @param directApply if true, changes to NBTItem will affect this ItemStack
|
|
+ * @return item's NBT tags container
|
|
+ */
|
|
+ @NotNull
|
|
+ public de.tr7zw.changeme.nbtapi.NBTItem getNBT(boolean directApply) {
|
|
+ return new de.tr7zw.changeme.nbtapi.NBTItem(this, directApply);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Applies NBT data from the provided NBT item.
|
|
+ *
|
|
+ * @param nbt ItemStack's NBT container
|
|
+ */
|
|
+ public void setNBT(@NotNull de.tr7zw.changeme.nbtapi.NBTItem nbt) {
|
|
+ ItemStack nbtItem = nbt.getItem();
|
|
+ setType(nbtItem.getType());
|
|
+ setAmount(nbtItem.getAmount());
|
|
+ setData(nbtItem.getData());
|
|
+ setItemMeta(nbtItem.getItemMeta());
|
|
+ }
|
|
+ // Yatopia end
|
|
}
|