mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
ad30e27e98
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 1d522878 PR-966: Introduce getRespawnLocation as a replacement for getBedSpawnLocation cc01b745 PR-965: Add DragonBattle#setPreviouslyKilled 28e3702f SPIGOT-6921, PR-957: Add methods to remove all enchantments on an ItemStack 8872404e PR-961: Add BlockData#copyTo 4054cc7b PR-956: Add method to get an offline player's location CraftBukkit Changes: 292ec79e0 SPIGOT-7568: Call EntityChangeBlockEvent for DecoratedPot b44bf5aa8 SPIGOT-7575: SuspiciousStewMeta creates invalid PotionEffect data 161784713 PR-1340: Centralize the conversion from and to Minecraft / Bukkit registry items even more and add a test case for them b93c5a30d PR-1338: Introduce getRespawnLocation as a replacement for getBedSpawnLocation fb973486c SPIGOT-7570: PrepareItemCraftEvent#isRepair() always returns false c9c24535e PR-1337: Add DragonBattle#setPreviouslyKilled c8b4da803 SPIGOT-6921, PR-1330: Add methods to remove all enchantments on an ItemStack 95bc1c4f5 PR-1333: Add BlockData#copyTo 36e2f9ce1 PR-1329: Add method to get an offline player's location Spigot Changes: c198da22 SPIGOT-7563: Update to latest release of bungeecord-chat
226 lines
13 KiB
Diff
226 lines
13 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Kyle Wood <kyle@denwav.dev>
|
|
Date: Fri, 11 Jun 2021 05:25:03 -0500
|
|
Subject: [PATCH] Remap fixes
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
|
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
|
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
|
|
|
|
public static Iterable<BlockPos> withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) {
|
|
int i = rangeX + rangeY + rangeZ;
|
|
- int j = center.getX();
|
|
- int k = center.getY();
|
|
- int l = center.getZ();
|
|
+ // Paper start - rename variables to fix conflict with anonymous class (remap fix)
|
|
+ int centerX = center.getX();
|
|
+ int centerY = center.getY();
|
|
+ int centerZ = center.getZ();
|
|
+ // Paper end
|
|
return () -> {
|
|
return new AbstractIterator<BlockPos>() {
|
|
private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
|
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
|
|
protected BlockPos computeNext() {
|
|
if (this.zMirror) {
|
|
this.zMirror = false;
|
|
- this.cursor.setZ(l - (this.cursor.getZ() - l));
|
|
+ this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - remap fix
|
|
return this.cursor;
|
|
} else {
|
|
BlockPos blockPos;
|
|
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
|
|
int k = this.currentDepth - Math.abs(i) - Math.abs(j);
|
|
if (k <= rangeZ) {
|
|
this.zMirror = k != 0;
|
|
- blockPos = this.cursor.set(j + i, k + j, l + k);
|
|
+ blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - remap fix
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
|
@@ -0,0 +0,0 @@ public class BehaviorUtils {
|
|
|
|
return optional.map((uuid) -> {
|
|
return ((ServerLevel) entity.level()).getEntity(uuid);
|
|
- }).map((entity) -> {
|
|
+ }).map((entity1) -> { // Paper - remap fix
|
|
LivingEntity entityliving1;
|
|
|
|
- if (entity instanceof LivingEntity) {
|
|
- LivingEntity entityliving2 = (LivingEntity) entity;
|
|
+ if (entity1 instanceof LivingEntity) { // Paper - remap fix
|
|
+ LivingEntity entityliving2 = (LivingEntity) entity1; // Paper - remap fix
|
|
|
|
entityliving1 = entityliving2;
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
@@ -0,0 +0,0 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
|
Builder<ResourceLocation, RecipeHolder<?>> builder = ImmutableMap.builder();
|
|
|
|
recipes.forEach((recipeholder) -> {
|
|
- Map<ResourceLocation, RecipeHolder<?>> map1 = (Map) map.computeIfAbsent(recipeholder.value().getType(), (recipes) -> {
|
|
+ Map<ResourceLocation, RecipeHolder<?>> map1 = (Map) map.computeIfAbsent(recipeholder.value().getType(), (recipes_) -> { // Paper - remap fix
|
|
return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
|
|
});
|
|
ResourceLocation minecraftkey = recipeholder.id();
|
|
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
|
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
|
@@ -0,0 +0,0 @@ public class LootTable {
|
|
|
|
public static class Builder implements FunctionUserBuilder<LootTable.Builder> {
|
|
|
|
- private final Builder<LootPool> pools = ImmutableList.builder();
|
|
- private final Builder<LootItemFunction> functions = ImmutableList.builder();
|
|
+ private final ImmutableList.Builder<LootPool> pools = ImmutableList.builder();
|
|
+ private final ImmutableList.Builder<LootItemFunction> functions = ImmutableList.builder();
|
|
private LootContextParamSet paramSet;
|
|
private Optional<ResourceLocation> randomSequence;
|
|
|
|
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 @@ package org.bukkit;
|
|
import static org.bukkit.support.MatcherAssert.*;
|
|
import static org.hamcrest.Matchers.*;
|
|
|
|
-import net.minecraft.world.item.DyeColor;
|
|
import org.bukkit.support.AbstractTestingBase;
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
import org.junit.jupiter.params.provider.EnumSource;
|
|
@@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase {
|
|
@EnumSource(DyeColor.class)
|
|
public void checkColor(DyeColor dye) {
|
|
Color color = dye.getColor();
|
|
- float[] nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors();
|
|
+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix
|
|
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 {
|
|
@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)));
|
|
}
|
|
}
|
|
diff --git a/src/test/java/org/bukkit/ParticleTest.java b/src/test/java/org/bukkit/ParticleTest.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/test/java/org/bukkit/ParticleTest.java
|
|
+++ b/src/test/java/org/bukkit/ParticleTest.java
|
|
@@ -0,0 +0,0 @@ public class ParticleTest extends AbstractTestingBase {
|
|
Check in CraftParticle if the conversion is still correct.
|
|
""", bukkit.getKey()));
|
|
|
|
- DataResult<Tag> encoded = assertDoesNotThrow(() -> minecraft.codec().encodeStart(DynamicOpsNBT.INSTANCE, particleParam),
|
|
+ DataResult<Tag> encoded = assertDoesNotThrow(() -> minecraft.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.
|
|
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.registries.BuiltInRegistries;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
-import net.minecraft.world.entity.EntityType;
|
|
import org.bukkit.support.AbstractTestingBase;
|
|
import org.junit.jupiter.api.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 : 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);
|
|
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 static org.junit.jupiter.api.Assertions.*;
|
|
|
|
-import net.minecraft.world.entity.animal.Panda;
|
|
import org.bukkit.craftbukkit.entity.CraftPanda;
|
|
import org.junit.jupiter.api.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);
|
|
+ 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);
|
|
@@ -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()) { // Paper - remap fix
|
|
org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
|
|
|
|
assertNotNull(bukkit, "Bukkit gene null for " + gene);
|
|
diff --git a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
|
+++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
|
@@ -0,0 +0,0 @@ public class RegistryConstantsTest extends AbstractTestingBase {
|
|
|
|
@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()) {
|
|
diff --git a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
|
+++ b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
|
@@ -0,0 +0,0 @@ public class RegistryLoadOrderTest extends AbstractTestingBase {
|
|
|
|
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(
|