Remap fixes

This commit is contained in:
Kyle Wood
2021-06-11 05:25:03 -05:00
parent 94c4e1cbc0
commit f161aac557
10 changed files with 72 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ package org.bukkit;
import static org.bukkit.support.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import net.minecraft.world.item.DyeColor;
import org.bukkit.support.environment.Normal;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
@@ -15,7 +14,7 @@ public class DyeColorsTest {
@EnumSource(DyeColor.class)
public void checkColor(DyeColor dye) {
Color color = dye.getColor();
int nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColor();
int nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColor(); // Paper - remap fix
Color nmsColor = Color.fromARGB(nmsColorArray);
assertThat(color, is(nmsColor));
}
@@ -24,7 +23,7 @@ public class DyeColorsTest {
@EnumSource(org.bukkit.DyeColor.class)
public void checkFireworkColor(org.bukkit.DyeColor dye) {
Color color = dye.getFireworkColor();
int nmsColor = DyeColor.byId(dye.getWoolData()).getFireworkColor();
int nmsColor = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getFireworkColor(); // Paper - remap fix
assertThat(color, is(Color.fromRGB(nmsColor)));
}
}

View File

@@ -279,7 +279,7 @@ public class ParticleTest {
Check in CraftParticle if the conversion is still correct.
""", bukkit.getKey()));
DataResult<Tag> encoded = assertDoesNotThrow(() -> minecraft.codec().codec().encodeStart(DynamicOpsNBT.INSTANCE, particleParam),
DataResult<Tag> encoded = assertDoesNotThrow(() -> minecraft.codec().codec().encodeStart(NbtOps.INSTANCE, particleParam), // Paper - remap fix
String.format("""
Could not encoded particle param for particle %s.
This can indicated, that the wrong particle param is created in CraftParticle.

View File

@@ -6,7 +6,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import org.bukkit.support.environment.AllFeatures;
import org.junit.jupiter.api.Test;
@@ -17,8 +16,8 @@ public class EntityTypesTest {
public void testMaps() {
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
for (EntityType<?> nms : BuiltInRegistries.ENTITY_TYPE) {
ResourceLocation key = EntityType.getKey(nms);
for (net.minecraft.world.entity.EntityType<?> nms : BuiltInRegistries.ENTITY_TYPE) { // Paper - remap fix
ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); // Paper - remap fix
org.bukkit.entity.EntityType bukkit = org.bukkit.entity.EntityType.fromName(key.getPath());
assertNotNull(bukkit, "Missing nms->bukkit " + key);

View File

@@ -2,7 +2,6 @@ package org.bukkit.entity;
import static org.junit.jupiter.api.Assertions.*;
import net.minecraft.world.entity.animal.Panda;
import org.bukkit.craftbukkit.entity.CraftPanda;
import org.bukkit.support.environment.Normal;
import org.junit.jupiter.api.Test;
@@ -12,8 +11,8 @@ public class PandaGeneTest {
@Test
public void testBukkit() {
for (Panda.Gene gene : Panda.Gene.values()) {
Panda.Gene nms = CraftPanda.toNms(gene);
for (Panda.Gene gene : Panda.Gene.values()) { // Paper - remap fix
net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene); // Paper - remap fix
assertNotNull(nms, "NMS gene null for " + gene);
assertEquals(gene.isRecessive(), nms.isRecessive(), "Recessive status did not match " + gene);
@@ -23,7 +22,7 @@ public class PandaGeneTest {
@Test
public void testNMS() {
for (Panda.Gene gene : Panda.Gene.values()) {
for (net.minecraft.world.entity.animal.Panda.Gene gene : net.minecraft.world.entity.animal.Panda.Gene.values()) { // Paper - remap fix
org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
assertNotNull(bukkit, "Bukkit gene null for " + gene);

View File

@@ -31,17 +31,17 @@ public class RegistryConstantsTest {
@Test
public void testTrimMaterial() {
this.testExcessConstants(TrimMaterial.class, Registry.TRIM_MATERIAL);
this.testExcessConstants(TrimMaterial.class, org.bukkit.Registry.TRIM_MATERIAL); // Paper - remap fix
this.testMissingConstants(TrimMaterial.class, Registries.TRIM_MATERIAL);
}
@Test
public void testTrimPattern() {
this.testExcessConstants(TrimPattern.class, Registry.TRIM_PATTERN);
this.testExcessConstants(TrimPattern.class, org.bukkit.Registry.TRIM_PATTERN); // Paper - remap fix
this.testMissingConstants(TrimPattern.class, Registries.TRIM_PATTERN);
}
private <T extends Keyed> void testExcessConstants(Class<T> clazz, Registry<T> registry) {
private <T extends Keyed> void testExcessConstants(Class<T> clazz, org.bukkit.Registry<T> registry) { // Paper - remap fix
List<NamespacedKey> excessKeys = new ArrayList<>();
for (Field field : clazz.getFields()) {

View File

@@ -25,7 +25,7 @@ public class RegistryLoadOrderTest {
private static boolean initInterface = false;
private static boolean initAbstract = false;
private static Registry<Keyed> registry;
private static org.bukkit.Registry<Keyed> registry; // Paper - remap fix
public static Stream<Arguments> data() {
return Stream.of(