Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 19:40:07 +01:00
173 Zeilen
10 KiB
Diff
173 Zeilen
10 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] Decompile fixes
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 0000a0057ec4ee2db72e4ea1bf421f95d9d9fdc6..729e55535d833f8f6ff65bf226aac5ecdec44990 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1139,7 +1139,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
}
|
|
|
|
- protected void doRunTask(TickTask ticktask) {
|
|
+ public void doRunTask(TickTask ticktask) { // Paper - decomp fix
|
|
this.getProfiler().incrementCounter("runTask");
|
|
super.doRunTask(ticktask);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java
|
|
index 71c22f72b6e7507e85ecb6be3166b809b7409ab2..fb9fca76a42479363c9c9764fdae6adb4b5e703f 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
|
|
@@ -54,9 +54,9 @@ public class SummonCommand {
|
|
|
|
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;
|
|
+ Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (loadedEntity) -> { // Paper - decomp fix
|
|
+ loadedEntity.moveTo(pos.x, pos.y, pos.z, loadedEntity.getYRot(), loadedEntity.getXRot()); // Paper - decomp fix
|
|
+ return loadedEntity; // Paper - decomp fix
|
|
});
|
|
|
|
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
|
|
index 88a8c2bc4aa30f478122a05fd119486a0107db82..5f00e3f4c86196db47bf1007973445d40866afdd 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,8 +169,8 @@ public class BehaviorUtils {
|
|
|
|
return optional.map((uuid) -> {
|
|
return ((ServerLevel) entity.level).getEntity(uuid);
|
|
- }).map((entity) -> {
|
|
- return entity instanceof LivingEntity ? (LivingEntity) entity : null;
|
|
+ }).map((entity2) -> { // Paper - decomp fix
|
|
+ return entity2 instanceof LivingEntity ? (LivingEntity) entity2 : null; // Paper - decomp fix
|
|
});
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
index c88dc823ca0c2f83bc10886208d498ea77523d68..dcfd0b107ac7bd1633f3b681cd5f5e26ce87bd63 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
@@ -522,7 +522,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
List<Player> list = Phantom.this.level.getNearbyPlayers(this.attackTargeting, (LivingEntity) Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
|
|
|
if (!list.isEmpty()) {
|
|
- list.sort(Comparator.comparing(Entity::getY).reversed());
|
|
+ list.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed()); // Paper - decomp fix
|
|
Iterator iterator = list.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
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 b4a5709b03e400d00504f33a9b34019d2b7bf115..2d79d4014770081fcd58a929e5fe0a26ac1b8023 100644
|
|
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
@@ -172,7 +172,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
|
Map<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, Recipe<?>>> map = Maps.newHashMap(); // CraftBukkit
|
|
|
|
recipes.forEach((irecipe) -> {
|
|
- Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
|
+ Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - decomp fix
|
|
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 ad52c3fc6210939a39ef77a382c640a24ee44838..5d811797ce8e14195a23fc71c8a3afbdca7691eb 100644
|
|
--- 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();
|
|
+ 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));
|
|
}
|
|
@@ -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();
|
|
+ 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 90baf6e3329d64495da9edd580d5fbc80df8c165..185fa8bf7308bb2980a0feecf0d7696a59e507ac 100644
|
|
--- a/src/test/java/org/bukkit/PerMaterialTest.java
|
|
+++ b/src/test/java/org/bukkit/PerMaterialTest.java
|
|
@@ -221,7 +221,7 @@ 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 8c4ad718e113f24a30fd11b345d34d6ca1ef73b0..085b0c17fb54fd8229838fee666120d9e59d942b 100644
|
|
--- 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);
|
|
+ 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 76e2ad676ae68846bdff3c3ef711751445fb0f3c..bee1bd015f161a00df1311b6ef272739fcff6834 100644
|
|
--- 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);
|
|
+ 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());
|
|
@@ -20,7 +19,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()) {
|
|
org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
|
|
|
|
Assert.assertNotNull("Bukkit gene null for " + gene, bukkit);
|