Handle tile entity lookup in 1.20.5

This commit is contained in:
Michael Primm 2024-04-28 14:01:07 -05:00
parent e086930133
commit 1d6346b580
18 changed files with 39 additions and 38 deletions

View File

@ -40,7 +40,7 @@ allprojects {
apply plugin: 'java'
group = 'us.dynmap'
version = '3.7-SNAPSHOT'
version = '3.7-beta-5'
}

View File

@ -318,7 +318,7 @@ public class BukkitVersionHelperSpigot117 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = new NBTTagCompound();
tileent.save(nbt); // readNBT

View File

@ -354,7 +354,7 @@ public class BukkitVersionHelperSpigot118_2 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -347,7 +347,7 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -356,7 +356,7 @@ public class BukkitVersionHelperSpigot119_3 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -364,7 +364,7 @@ public class BukkitVersionHelperSpigot119_4 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -354,7 +354,7 @@ public class BukkitVersionHelperSpigot119 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -362,7 +362,7 @@ public class BukkitVersionHelperSpigot120_2 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -362,7 +362,7 @@ public class BukkitVersionHelperSpigot120_4 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.o();
return nbt;

View File

@ -362,9 +362,11 @@ public class BukkitVersionHelperSpigot120_5 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = new NBTTagCompound(); //TODO tileent.o();
CraftWorld cw = (CraftWorld) w;
//NBTTagCompound nbt = tileent.o(world.registrtAccess());
NBTTagCompound nbt = tileent.e(cw.getHandle().H_());
return nbt;
}

View File

@ -362,7 +362,7 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World world) {
TileEntity tileent = (TileEntity) te;
NBTTagCompound nbt = tileent.n();
return nbt;

View File

@ -2,35 +2,32 @@
<projectDescription>
<name>Dynmap(Spigot-Common)</name>
<comment>bukkit-helper</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<projects/>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments/>
</buildCommand>
</buildSpec>
<linkedResources/>
<filteredResources>
<filter>
<id>1</id>
<name></name>
<type>30</type>
<name/>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>

View File

@ -2,7 +2,7 @@ arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
connection.project.dir=../bukkit-helper-120-2
connection.project.dir=../bukkit-helper-120-5
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

View File

@ -1,5 +1,5 @@
#
#Fri Apr 26 17:37:35 CDT 2024
#Sun Apr 28 13:34:57 CDT 2024
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable

View File

@ -900,7 +900,7 @@ public abstract class AbstractMapChunkCache extends MapChunkCache {
String[] te_fields = HDBlockModels.getTileEntityFieldsNeeded(ss.getBlockType(cx, te_y, cz));
if(te_fields != null) {
//Object nbtcompound = BukkitVersionHelper.helper.readTileEntityNBT(t);
Object nbtcompound = BukkitVersionHelper.helper.readTileEntityNBT(t);
Object nbtcompound = BukkitVersionHelper.helper.readTileEntityNBT(t, this.w);
vals.clear();
for(String id: te_fields) {
Object val = BukkitVersionHelper.helper.getFieldValue(nbtcompound, id);

View File

@ -101,7 +101,7 @@ public abstract class BukkitVersionHelper {
/**
* Read tile entity NBT
*/
public abstract Object readTileEntityNBT(Object te);
public abstract Object readTileEntityNBT(Object te, World world);
/**
* Get field value from NBT compound
*/

View File

@ -24,6 +24,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
/**
* Helper for isolation of bukkit version specific issues
*/
@ -456,7 +457,8 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
/**
* Read tile entity NBT
*/
public Object readTileEntityNBT(Object te) {
@Override
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
if(nbttagcompound == null) return null;
Object nbt = null;
try {

View File

@ -127,7 +127,7 @@ public class BukkitVersionHelperGlowstone extends BukkitVersionHelper {
}
@Override
public Object readTileEntityNBT(Object te) {
public Object readTileEntityNBT(Object te, org.bukkit.World w) {
// TODO Auto-generated method stub
return null;
}