geforkt von Mirrors/Paper
Remap fixes
Dieser Commit ist enthalten in:
Ursprung
94c4e1cbc0
Commit
f161aac557
35
paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch
Normale Datei
35
paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch
Normale Datei
@ -0,0 +1,35 @@
|
||||
--- a/net/minecraft/core/BlockPos.java
|
||||
+++ b/net/minecraft/core/BlockPos.java
|
||||
@@ -324,9 +324,11 @@
|
||||
|
||||
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;
|
||||
@@ -340,7 +342,7 @@
|
||||
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;
|
||||
@@ -366,7 +368,7 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -49,3 +49,16 @@
|
||||
return world.sectionsToVillage(sectionposition1) < j;
|
||||
});
|
||||
|
||||
@@ -161,10 +169,10 @@
|
||||
|
||||
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;
|
||||
|
@ -60,3 +60,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,8 +259,8 @@
|
||||
|
||||
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 ContextKeySet paramSet;
|
||||
private Optional<ResourceLocation> randomSequence;
|
||||
|
||||
|
@ -133,7 +133,7 @@ public abstract class CraftBoat extends CraftVehicle implements Boat {
|
||||
throw new EnumConstantNotPresentException(Type.class, boatType.toString());
|
||||
}
|
||||
|
||||
public static Status boatStatusFromNms(net.minecraft.world.entity.vehicle.Boat.EnumStatus enumStatus) {
|
||||
public static Status boatStatusFromNms(net.minecraft.world.entity.vehicle.AbstractBoat.Status enumStatus) { // Paper - remap fixes
|
||||
return switch (enumStatus) {
|
||||
default -> throw new EnumConstantNotPresentException(Status.class, enumStatus.name());
|
||||
case IN_AIR -> Status.IN_AIR;
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()) {
|
||||
|
@ -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(
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren