Skip to content

Commit

Permalink
Merge pull request #86 from BentoBoxWorld/develop
Browse files Browse the repository at this point in the history
Release 2.6.1
  • Loading branch information
tastybento authored Jul 23, 2024
2 parents e4d6a1a + 445964b commit 93ce4b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
20 changes: 11 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.6.0</build.version>
<build.version>2.6.1</build.version>

<sonar.projectKey>BentoBoxWorld_Boxed</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -172,28 +172,30 @@
<scope>provided</scope>
</dependency>
<!-- Spigot NMS. Used for chunk deletion and pasting. -->

<dependency>
<groupId>org.spigotmc....</groupId>
<artifactId>spigot</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.spigotmc.....</groupId>
<artifactId>spigot</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc....</groupId>
<artifactId>spigot</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.spigotmc.</groupId>
<artifactId>spigot</artifactId>
<version>1.20.3-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/world/bentobox/boxed/nms/AbstractMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ protected String getData(TileEntity te, String method, String field) {
if (updatePacketMethod != null) {
// Invoke the method to get the PacketPlayOutTileEntityData object
updatePacketMethod.setAccessible(true);
PacketPlayOutTileEntityData packet = (PacketPlayOutTileEntityData) updatePacketMethod.invoke(te);

// Access the private field for the NBTTagCompound getter in PacketPlayOutTileEntityData
Field fieldC = packet.getClass().getDeclaredField(field);
fieldC.setAccessible(true);
NBTTagCompound nbtTag = (NBTTagCompound) fieldC.get(packet);

return nbtTag.toString(); // This will show what you want
Object object = updatePacketMethod.invoke(te);
PacketPlayOutTileEntityData packet = (PacketPlayOutTileEntityData) object;
//if (object instanceof PacketPlayOutTileEntityData packet) {
// Access the private field for the NBTTagCompound getter in PacketPlayOutTileEntityData
Field fieldC = packet.getClass().getDeclaredField(field);
fieldC.setAccessible(true);
NBTTagCompound nbtTag = (NBTTagCompound) fieldC.get(packet);

return nbtTag.toString(); // This will show what you want
//} else {
// throw new ClassNotFoundException(
// object.getClass().getCanonicalName() + " is not a PacketPlayOutTileEntityData");
//}
}
} catch (NoSuchMethodException e) {
System.out.println("The method '" + method + "' does not exist in the TileEntity class.");
} catch (Exception e) {
System.out.println("The method '" + method + "' does not exist in the TileEntity class.");
e.printStackTrace();
}
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public String nmsData(Block block) {
Location w = block.getLocation();
CraftWorld cw = (CraftWorld) w.getWorld(); // CraftWorld is NMS one
TileEntity te = cw.getHandle().c_(new BlockPosition(w.getBlockX(), w.getBlockY(), w.getBlockZ()));

return getData(te, "j", "c");
return getData(te, "au_", "tag");
}
}

0 comments on commit 93ce4b5

Please sign in to comment.