2021-06-11 12:02:28 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Kyle Wood <kyle@denwav.dev>
|
|
|
|
Date: Fri, 11 Jun 2021 05:25:03 -0500
|
2021-06-17 01:43:30 +00:00
|
|
|
Subject: [PATCH] Remap fixes
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
|
2021-06-15 13:55:25 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
2022-06-07 17:03:07 +00:00
|
|
|
index cdd5d95326c663c1c493c45a28918a12ac6b449f..5311c40d9bf22b423a69bc722a6125493e616eac 100644
|
2021-06-15 13:55:25 +00:00
|
|
|
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
|
|
|
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
|
|
|
@@ -270,9 +270,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();
|
2021-06-17 01:43:30 +00:00
|
|
|
+ // Paper start - rename variables to fix conflict with anonymous class (remap fix)
|
2021-06-15 13:55:25 +00:00
|
|
|
+ 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();
|
|
|
|
@@ -287,7 +289,7 @@ public class BlockPos extends Vec3i {
|
|
|
|
protected BlockPos computeNext() {
|
|
|
|
if (this.zMirror) {
|
|
|
|
this.zMirror = false;
|
|
|
|
- this.cursor.setZ(l - (this.cursor.getZ() - l));
|
2021-06-17 01:43:30 +00:00
|
|
|
+ this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - remap fix
|
2021-06-15 13:55:25 +00:00
|
|
|
return this.cursor;
|
|
|
|
} else {
|
|
|
|
BlockPos blockPos;
|
|
|
|
@@ -313,7 +315,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);
|
2021-06-17 01:43:30 +00:00
|
|
|
+ blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - remap fix
|
2021-06-15 13:55:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-11 12:02:28 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java
|
2021-11-23 08:57:41 +00:00
|
|
|
index bb57dacc71711abfd9fb22a395ff798920564e5a..f6aed91482d9c7bf8b56fb7c53f938a4f37b9605 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
|
2021-11-23 08:57:41 +00:00
|
|
|
@@ -53,9 +53,9 @@ public class SummonCommand {
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
nbttagcompound1.putString("id", entity.toString());
|
|
|
|
ServerLevel worldserver = source.getLevel();
|
|
|
|
- Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> {
|
|
|
|
- entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
|
|
|
|
- return entity1;
|
2021-06-17 01:43:30 +00:00
|
|
|
+ Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (loadedEntity) -> { // Paper - remap fix
|
|
|
|
+ loadedEntity.moveTo(pos.x, pos.y, pos.z, loadedEntity.getYRot(), loadedEntity.getXRot()); // Paper - remap fix
|
|
|
|
+ return loadedEntity; // Paper - remap fix
|
2021-06-11 12:02:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (entity1 == null) {
|
|
|
|
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
|
2021-11-24 22:26:32 +00:00
|
|
|
index 88258cc1971c0764912d2f3cbfcd426d8f26cd62..e51a78e52969ec687956d16566494fc524e50cb8 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
2021-11-23 08:57:41 +00:00
|
|
|
@@ -172,11 +172,11 @@ public class BehaviorUtils {
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
return optional.map((uuid) -> {
|
|
|
|
return ((ServerLevel) entity.level).getEntity(uuid);
|
|
|
|
- }).map((entity) -> {
|
2021-11-23 08:57:41 +00:00
|
|
|
+ }).map((entity1) -> { // Paper - remap fix
|
|
|
|
LivingEntity entityliving1;
|
2021-06-11 12:02:28 +00:00
|
|
|
|
2021-11-23 08:57:41 +00:00
|
|
|
- if (entity instanceof LivingEntity) {
|
|
|
|
- LivingEntity entityliving2 = (LivingEntity) entity;
|
|
|
|
+ if (entity1 instanceof LivingEntity) { // Paper - remap fix
|
|
|
|
+ LivingEntity entityliving2 = (LivingEntity) entity1; // Paper - remap fix
|
2021-06-11 12:02:28 +00:00
|
|
|
|
2021-11-23 08:57:41 +00:00
|
|
|
entityliving1 = entityliving2;
|
|
|
|
} else {
|
2021-06-11 12:02:28 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
2022-03-01 05:43:03 +00:00
|
|
|
index babb59497fcd9b5e20d8b3b13ceb9a7856edbb63..92650d816113a0f1c2b589691895ebba3424d661 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
2022-03-01 05:43:03 +00:00
|
|
|
@@ -174,7 +174,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
2021-11-24 22:26:32 +00:00
|
|
|
Builder<ResourceLocation, Recipe<?>> builder = ImmutableMap.builder();
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
recipes.forEach((irecipe) -> {
|
|
|
|
- Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
2021-06-17 01:43:30 +00:00
|
|
|
+ Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - remap fix
|
2021-06-11 12:02:28 +00:00
|
|
|
return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
|
|
|
|
});
|
2021-11-24 22:26:32 +00:00
|
|
|
ResourceLocation minecraftkey = irecipe.getId();
|
2021-06-14 00:19:51 +00:00
|
|
|
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
|
2021-06-17 01:43:30 +00:00
|
|
|
index ad52c3fc6210939a39ef77a382c640a24ee44838..6b7dd01778f0a5d3a96d2d04af4b525d17efbfba 100644
|
2021-06-14 00:19:51 +00:00
|
|
|
--- a/src/test/java/org/bukkit/DyeColorsTest.java
|
|
|
|
+++ b/src/test/java/org/bukkit/DyeColorsTest.java
|
|
|
|
@@ -4,7 +4,6 @@ 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;
|
|
|
|
@@ -29,7 +28,7 @@ public class DyeColorsTest extends AbstractTestingBase {
|
|
|
|
@Test
|
|
|
|
public void checkColor() {
|
|
|
|
Color color = this.dye.getColor();
|
|
|
|
- float[] nmsColorArray = DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors();
|
2021-06-17 01:43:30 +00:00
|
|
|
+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix
|
2021-06-14 00:19:51 +00:00
|
|
|
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
|
|
|
|
assertThat(color, is(nmsColor));
|
|
|
|
}
|
|
|
|
@@ -37,7 +36,7 @@ public class DyeColorsTest extends AbstractTestingBase {
|
|
|
|
@Test
|
|
|
|
public void checkFireworkColor() {
|
|
|
|
Color color = this.dye.getFireworkColor();
|
|
|
|
- int nmsColor = DyeColor.byId(this.dye.getWoolData()).getFireworkColor();
|
2021-06-17 01:43:30 +00:00
|
|
|
+ int nmsColor = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getFireworkColor(); // Paper - remap fix
|
2021-06-14 00:19:51 +00:00
|
|
|
assertThat(color, is(Color.fromRGB(nmsColor)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
2021-06-17 01:43:30 +00:00
|
|
|
index 8c4ad718e113f24a30fd11b345d34d6ca1ef73b0..1e84f541683ddb619c2a8dfcd2a141fba2bd851d 100644
|
2021-06-14 00:19:51 +00:00
|
|
|
--- a/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
|
|
|
+++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
|
|
|
@@ -5,7 +5,6 @@ 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;
|
|
|
|
@@ -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 : Registry.ENTITY_TYPE) {
|
|
|
|
- ResourceLocation key = EntityType.getKey(nms);
|
2021-06-17 01:43:30 +00:00
|
|
|
+ for (net.minecraft.world.entity.EntityType<?> nms : Registry.ENTITY_TYPE) { // Paper - remap fix
|
|
|
|
+ ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); // Paper - remap fix
|
2021-06-14 00:19:51 +00:00
|
|
|
|
|
|
|
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
|
2021-06-17 01:43:30 +00:00
|
|
|
index 76e2ad676ae68846bdff3c3ef711751445fb0f3c..feee17192bca55a9cf1b2fc5b9609b888db77763 100644
|
2021-06-14 00:19:51 +00:00
|
|
|
--- a/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
|
|
|
+++ b/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
|
|
|
@@ -1,6 +1,5 @@
|
|
|
|
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;
|
|
|
|
@@ -10,7 +9,7 @@ public class PandaGeneTest {
|
|
|
|
@Test
|
|
|
|
public void testBukkit() {
|
|
|
|
for (Panda.Gene gene : Panda.Gene.values()) {
|
|
|
|
- Panda.Gene nms = CraftPanda.toNms(gene);
|
2021-06-17 01:43:30 +00:00
|
|
|
+ net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene); // Paper - remap fix
|
2021-06-14 00:19:51 +00:00
|
|
|
|
|
|
|
Assert.assertNotNull("NMS gene null for " + gene, nms);
|
|
|
|
Assert.assertEquals("Recessive status did not match " + gene, gene.isRecessive(), nms.isRecessive());
|
|
|
|
@@ -20,7 +19,7 @@ public class PandaGeneTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testNMS() {
|
|
|
|
- for (Panda.Gene gene : Panda.Gene.values()) {
|
2021-06-17 01:43:30 +00:00
|
|
|
+ for (net.minecraft.world.entity.animal.Panda.Gene gene : net.minecraft.world.entity.animal.Panda.Gene.values()) { // Paper - remap fix
|
2021-06-14 00:19:51 +00:00
|
|
|
org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
|
|
|
|
|
|
|
|
Assert.assertNotNull("Bukkit gene null for " + gene, bukkit);
|