9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-19 15:09:23 +00:00

Bump Adventure Version

This commit is contained in:
XiaoMoMi
2025-02-21 18:50:29 +08:00
parent 4bf9a00b32
commit fd2c810d21
5 changed files with 68 additions and 35 deletions

View File

@@ -70,31 +70,31 @@ nameplate-text:
background-text: background-text:
location: location:
background: bedrock_1 background: bedrock_1
text: '%np_image_compass% %np_shift_location%' text: '<shadow:#00000000>%np_image_compass%</shadow> %np_shift_location%'
shadow: false shadow: false
left-margin: 1 left-margin: 1
right-margin: 1 right-margin: 1
time: time:
background: bedrock_1 background: bedrock_1
text: '%np_image_clock% %np_shift_time%' text: '<shadow:#00000000>%np_image_clock%</shadow> %np_shift_time%'
shadow: false shadow: false
left-margin: 1 left-margin: 1
right-margin: 1 right-margin: 1
weather: weather:
background: bedrock_1 background: bedrock_1
text: '%np_image_weather% %np_shift_weather%' text: '<shadow:#00000000>%np_image_weather%</shadow> %np_shift_weather%'
shadow: false shadow: false
left-margin: 1 left-margin: 1
right-margin: 1 right-margin: 1
hello: hello:
background: bedrock_1 background: bedrock_1
text: '%np_image_bubble% %np_shift_hello%' text: '<shadow:#00000000>%np_image_bubble%</shadow> %np_shift_hello%'
shadow: false shadow: false
left-margin: 1 left-margin: 1
right-margin: 1 right-margin: 1
update: update:
background: bedrock_1 background: bedrock_1
text: '%np_image_bell% %np_shift_update%' text: '<shadow:#00000000>%np_image_bell%</shadow> %np_shift_update%'
shadow: false shadow: false
left-margin: 1 left-margin: 1
right-margin: 1 right-margin: 1

View File

@@ -18,7 +18,7 @@ asm_commons_version=9.7.1
jar_relocator_version=1.7 jar_relocator_version=1.7
h2_driver_version=2.3.232 h2_driver_version=2.3.232
sqlite_driver_version=3.48.0.0 sqlite_driver_version=3.48.0.0
adventure_bundle_version=4.18.0 adventure_bundle_version=4.19.0
adventure_platform_version=4.3.5-SNAPSHOT adventure_platform_version=4.3.5-SNAPSHOT
cloud_core_version=2.0.0 cloud_core_version=2.0.0
cloud_services_version=2.0.0 cloud_services_version=2.0.0

View File

@@ -36,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;

View File

@@ -20,6 +20,8 @@ package net.momirealms.customnameplates.bukkit.util;
import net.momirealms.customnameplates.api.helper.VersionHelper; import net.momirealms.customnameplates.api.helper.VersionHelper;
import net.momirealms.customnameplates.common.util.ReflectionUtils; import net.momirealms.customnameplates.common.util.ReflectionUtils;
import java.util.Objects;
public class EntityDataValue { public class EntityDataValue {
private static int internalID = 0; private static int internalID = 0;
@@ -103,7 +105,7 @@ public class EntityDataValue {
} }
private static Object initSerializersByName(String name) throws ReflectiveOperationException { private static Object initSerializersByName(String name) throws ReflectiveOperationException {
return ReflectionUtils.getDeclaredField(Reflections.clazz$EntityDataSerializers, new String[]{fieldsObf[internalID++], name}).get(null); return Objects.requireNonNull(ReflectionUtils.getDeclaredField(Reflections.clazz$EntityDataSerializers, new String[]{fieldsObf[internalID++], name}).get(null));
} }
private EntityDataValue() { private EntityDataValue() {

View File

@@ -478,34 +478,6 @@ public class Reflections {
) )
); );
public static final Field field$EntityType$TEXT_DISPLAY;
static {
if (VersionHelper.isVersionNewerThan1_20_5()) {
field$EntityType$TEXT_DISPLAY = ReflectionUtils.getDeclaredField(
clazz$EntityType,
"TEXT_DISPLAY", "bb");
} else if (VersionHelper.isVersionNewerThan1_20_4()) {
field$EntityType$TEXT_DISPLAY = ReflectionUtils.getDeclaredField(
clazz$EntityType,
"TEXT_DISPLAY", "aY");
} else {
field$EntityType$TEXT_DISPLAY = ReflectionUtils.getDeclaredField(
clazz$EntityType,
"TEXT_DISPLAY", "aX");
}
}
public static final Object instance$EntityType$TEXT_DISPLAY;
static {
try {
instance$EntityType$TEXT_DISPLAY = field$EntityType$TEXT_DISPLAY.get(clazz$EntityType);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
}
public static final Constructor<?> constructor$ClientboundAddEntityPacket = requireNonNull( public static final Constructor<?> constructor$ClientboundAddEntityPacket = requireNonNull(
ReflectionUtils.getConstructor(clazz$ClientboundAddEntityPacket, ReflectionUtils.getConstructor(clazz$ClientboundAddEntityPacket,
int.class, UUID.class, int.class, UUID.class,
@@ -1130,4 +1102,62 @@ public class Reflections {
clazz$AttributeModifier, clazz$AttributeModifier$Operation, 0 clazz$AttributeModifier, clazz$AttributeModifier$Operation, 0
) )
); );
public static final Method method$ResourceLocation$fromNamespaceAndPath = requireNonNull(
ReflectionUtils.getStaticMethod(
clazz$ResourceLocation, clazz$ResourceLocation, String.class, String.class
)
);
public static final Object instance$BuiltInRegistries$ENTITY_TYPE;
public static final Object instance$Registries$ENTITY_TYPE;
public static final Object instance$registryAccess;
static {
Field[] fields = clazz$Registries.getDeclaredFields();
try {
Object registries$EntityType = null;
for (Field field : fields) {
Type fieldType = field.getGenericType();
if (fieldType instanceof ParameterizedType paramType) {
if (paramType.getRawType() == clazz$ResourceKey) {
Type[] actualTypeArguments = paramType.getActualTypeArguments();
if (actualTypeArguments.length == 1 && actualTypeArguments[0] instanceof ParameterizedType registryType) {
Type type = registryType.getActualTypeArguments()[0];
if (type instanceof ParameterizedType parameterizedType) {
Type rawType = parameterizedType.getRawType();
if (rawType == clazz$EntityType) {
registries$EntityType = field.get(null);
}
}
}
}
}
}
instance$Registries$ENTITY_TYPE = requireNonNull(registries$EntityType);
Object server = method$MinecraftServer$getServer.invoke(null);
Object registries = field$MinecraftServer$registries.get(server);
instance$registryAccess = field$LayeredRegistryAccess$composite.get(registries);
instance$BuiltInRegistries$ENTITY_TYPE = method$RegistryAccess$registryOrThrow.invoke(instance$registryAccess, registries$EntityType);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
public static final Method method$Registry$get = requireNonNull(
ReflectionUtils.getMethods(
clazz$Registry, Object.class, clazz$ResourceLocation
).stream().filter(m -> m.getReturnType() != Optional.class).findAny().orElse(null)
);
public static final Object instance$EntityType$TEXT_DISPLAY;
static {
try {
Object textDisplay = method$ResourceLocation$fromNamespaceAndPath.invoke(null, "minecraft", "text_display");
instance$EntityType$TEXT_DISPLAY = Reflections.method$Registry$get.invoke(Reflections.instance$BuiltInRegistries$ENTITY_TYPE, textDisplay);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
} }