79e2cb620e
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: 376e37db SPIGOT-7677: Update which entities are marked as spawnable 06c4add3 SPIGOT-7737: Add separate TreeType.MEGA_PINE 19b7caaa SPIGOT-7731: Spawn eggs cannot have damage e585297e PR-1022: Add force option to Player#spawnParticle d26e0094 PR-1018: Add methods to get players seeing specific chunks 8df1ed18 PR-978: Add Material#isCompostable and Material#getCompostChance 4b9b59c7 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale 8d1e700a PR-1020: Cast instead of using #typed when getting BlockType and ItemType to better work with testing / mocks fa28607a PR-1016: Fix incorrect assumption of Fireball having constant speed 4c6c8586 PR-1015: Add a tool component to ItemMeta 6f6b2123 PR-1014: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects f511cfe1 PR-1013, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType def44cbf SPIGOT-7669: Fix typo in ProjectileHitEvent#getHitBlockFace documentation 53fa4f72 PR-1011: Throw an exception if a RecipeChoice is ever supplied air CraftBukkit Changes: ee95e171a SPIGOT-7737: Add separate TreeType.MEGA_PINE 0dae4c62c Fix spawn egg equality check and copy constructor ab59e847c Fix spawn eggs with no entity creating invalid stacks and disconnect creative clients 3b6093b28 SPIGOT-7736: Creative spawn egg use loses components c6b4d5a87 SPIGOT-7731: Spawn eggs cannot have damage 340ccd57f SPIGOT-7735: Fix serialization of player heads with note block sound fd2f41834 SPIGOT-7734: Can't register a custom advancement using unsafe() 02456e2a5 PR-1413: Add force option to Player#spawnParticle 6a61f38b2 SPIGOT-7680: Per-world weather command 58c41cebb PR-1409: Add methods to get players seeing specific chunks 16c976797 PR-1412: Fix shipwreck loot tables not being set for BlockTransformers 7189ba636 PR-1360: Add Material#isCompostable and Material#getCompostChance 900384556 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale bdb40c5f1 Increase outdated build delay d6607c7dd SPIGOT-7675: Fix FoodComponent config deserialization b148ed332 PR-1406: Fix incorrect assumption of Fireball having constant speed 3ec31ca75 PR-1405: Add a tool component to ItemMeta 5d7d675b9 PR-1404: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects 960827981 PR-1403, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType 94e44ec93 PR-1401: Add a config option to accept old keys in registry get calls a43701920 PR-1402: Fix ChunkSnapshot#isSectionEmpty() is always false 87d0a3368 SPIGOT-7668: Move NONE Registry updater to FieldRename to avoid some class loader issues 2ea1e7ac2 PR-1399: Fix regression preventing positive .setDamage value from causing knockback for 0 damage events ba2d49d21 Increase outdated build delay Spigot Changes: fcd94e21 Rebuild patches 342f4939 SPIGOT-7661: Add experimental unload-frozen-chunks option
212 Zeilen
12 KiB
Diff
212 Zeilen
12 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 f0a764d3e1a756537b8188e9f5361d0dbaca25a9..478d2114fbd5c499a8adbf8b6cefcc8335e830dc 100644
|
|
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
|
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
|
@@ -311,9 +311,11 @@ 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 () -> new AbstractIterator<BlockPos>() {
|
|
private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
|
private int currentDepth;
|
|
@@ -327,7 +329,7 @@ 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;
|
|
@@ -353,7 +355,7 @@ 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 7344cff32fa6fe3dedb74ed98126072c55b0abd2..d98b28e9488a5a7736719cf656736bb026ec8c7e 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
|
|
@@ -169,10 +169,10 @@ 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 entityliving2) {
|
|
+ if (entity1 instanceof LivingEntity entityliving2) { // Paper - remap fix
|
|
entityliving1 = entityliving2;
|
|
} else {
|
|
entityliving1 = null;
|
|
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 61592d57c26c359abda266f4ac8c58419e9beb02..83fce6746aaa3b378da6c5573ec9991d8438b071 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
|
|
@@ -255,8 +255,8 @@ 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 b70450722da13bc4d358a70d3d1d2f30a2cca2b9..86d86c292bdeeb7f42685691287c3b4bd476ea14 100644
|
|
--- a/src/test/java/org/bukkit/DyeColorsTest.java
|
|
+++ b/src/test/java/org/bukkit/DyeColorsTest.java
|
|
@@ -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.AbstractTestingBase;
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
import org.junit.jupiter.params.provider.EnumSource;
|
|
@@ -14,7 +13,7 @@ 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));
|
|
}
|
|
@@ -23,7 +22,7 @@ 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 9c9f5dd2351b3067b54d6cc5bdb572c46b12aaa8..307e8a3694c6f0b48d2df9792c3e5fdbaae1fd8e 100644
|
|
--- a/src/test/java/org/bukkit/ParticleTest.java
|
|
+++ b/src/test/java/org/bukkit/ParticleTest.java
|
|
@@ -250,7 +250,7 @@ public class ParticleTest extends AbstractTestingBase {
|
|
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.
|
|
diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
|
index 32df0090aab65b551b524603cce0b96e461cc358..952924abae79cc504342bbdb6f6953ab8a6cc295 100644
|
|
--- a/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
|
+++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
|
@@ -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.AbstractTestingBase;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
@@ -16,8 +15,8 @@ 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 5818bfa69a8573a2a8f350066f829d587cbc546b..8e421a1bee0c526e3024eab9ba4cc0b320842de2 100644
|
|
--- a/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
|
+++ b/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
|
@@ -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.junit.jupiter.api.Test;
|
|
|
|
@@ -10,8 +9,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);
|
|
@@ -21,7 +20,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);
|
|
diff --git a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
|
index 6c84f1289c84d0aca1935c473ffa63dae1b52598..ebcb65cb74acdb9d1bcf2b4b3551a2dc6d809bc9 100644
|
|
--- a/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
|
+++ b/src/test/java/org/bukkit/registry/RegistryConstantsTest.java
|
|
@@ -29,17 +29,17 @@ 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 31062b6d9ad685ea3750c6b5ddc6b295bb263e0a..5842cb5a6f3da42b8c40e6cbd5c5366572bf7684 100644
|
|
--- a/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
|
+++ b/src/test/java/org/bukkit/registry/RegistryLoadOrderTest.java
|
|
@@ -24,7 +24,7 @@ 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(
|