From 9a8713968363a8f23e51ac2385fdbcd67004c7e7 Mon Sep 17 00:00:00 2001
From: MiniDigger | Martin <admin@minidigger.dev>
Date: Mon, 14 Jun 2021 02:19:51 +0200
Subject: [PATCH] fix tests

---
 patches/server/Decompile-fixes.patch | 95 ++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/patches/server/Decompile-fixes.patch b/patches/server/Decompile-fixes.patch
index 52f9bb43ff..e77ffaf403 100644
--- a/patches/server/Decompile-fixes.patch
+++ b/patches/server/Decompile-fixes.patch
@@ -75,3 +75,98 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
              });
              Recipe<?> irecipe1 = (Recipe) map1.put(irecipe.getId(), irecipe);
+diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/test/java/org/bukkit/DyeColorsTest.java
++++ b/src/test/java/org/bukkit/DyeColorsTest.java
+@@ -0,0 +0,0 @@ import static org.hamcrest.Matchers.*;
+ import static org.junit.Assert.*;
+ import java.util.ArrayList;
+ import java.util.List;
+-import net.minecraft.world.item.DyeColor;
+ import org.bukkit.support.AbstractTestingBase;
+ import org.junit.Test;
+ import org.junit.runner.RunWith;
+@@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase {
+     @Test
+     public void checkColor() {
+         Color color = this.dye.getColor();
+-        float[] nmsColorArray = DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors();
++        float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors();
+         Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
+         assertThat(color, is(nmsColor));
+     }
+@@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase {
+     @Test
+     public void checkFireworkColor() {
+         Color color = this.dye.getFireworkColor();
+-        int nmsColor = DyeColor.byId(this.dye.getWoolData()).getFireworkColor();
++        int nmsColor = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getFireworkColor();
+         assertThat(color, is(Color.fromRGB(nmsColor)));
+     }
+ }
+diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/test/java/org/bukkit/PerMaterialTest.java
++++ b/src/test/java/org/bukkit/PerMaterialTest.java
+@@ -0,0 +0,0 @@ public class PerMaterialTest extends AbstractTestingBase {
+         if (this.material.isBlock()) {
+             assertThat(this.material.isInteractable(),
+                     is(!CraftMagicNumbers.getBlock(material).getClass()
+-                            .getMethod("interact", BlockState.class, net.minecraft.world.level.Level.class, BlockPos.class, Player.class, InteractionHand.class, BlockHitResult.class)
++                            .getMethod("use", BlockState.class, net.minecraft.world.level.Level.class, BlockPos.class, Player.class, InteractionHand.class, BlockHitResult.class)
+                             .getDeclaringClass().equals(BlockBehaviour.class)));
+         } else {
+             assertFalse(this.material.isInteractable());
+diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/test/java/org/bukkit/entity/EntityTypesTest.java
++++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java
+@@ -0,0 +0,0 @@ import java.util.Set;
+ import java.util.stream.Collectors;
+ import net.minecraft.core.Registry;
+ import net.minecraft.resources.ResourceLocation;
+-import net.minecraft.world.entity.EntityType;
+ import org.bukkit.support.AbstractTestingBase;
+ import org.junit.Assert;
+ import org.junit.Test;
+@@ -0,0 +0,0 @@ public class EntityTypesTest extends AbstractTestingBase {
+     public void testMaps() {
+         Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
+ 
+-        for (EntityType<?> nms : Registry.ENTITY_TYPE) {
+-            ResourceLocation key = EntityType.getKey(nms);
++        for (net.minecraft.world.entity.EntityType<?> nms : Registry.ENTITY_TYPE) {
++            ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms);
+ 
+             org.bukkit.entity.EntityType bukkit = org.bukkit.entity.EntityType.fromName(key.getPath());
+             Assert.assertNotNull("Missing nms->bukkit " + key, bukkit);
+diff --git a/src/test/java/org/bukkit/entity/PandaGeneTest.java b/src/test/java/org/bukkit/entity/PandaGeneTest.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/test/java/org/bukkit/entity/PandaGeneTest.java
++++ b/src/test/java/org/bukkit/entity/PandaGeneTest.java
+@@ -0,0 +0,0 @@
+ package org.bukkit.entity;
+ 
+-import net.minecraft.world.entity.animal.Panda;
+ import org.bukkit.craftbukkit.entity.CraftPanda;
+ import org.junit.Assert;
+ import org.junit.Test;
+@@ -0,0 +0,0 @@ public class PandaGeneTest {
+     @Test
+     public void testBukkit() {
+         for (Panda.Gene gene : Panda.Gene.values()) {
+-            Panda.Gene nms = CraftPanda.toNms(gene);
++            net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene);
+ 
+             Assert.assertNotNull("NMS gene null for " + gene, nms);
+             Assert.assertEquals("Recessive status did not match " + gene, gene.isRecessive(), nms.isRecessive());
+@@ -0,0 +0,0 @@ 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()) {
+             org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
+ 
+             Assert.assertNotNull("Bukkit gene null for " + gene, bukkit);