nuke a few more obfhelpers

This commit is contained in:
MiniDigger 2021-06-17 21:37:37 +02:00
parent 4104545b11
commit 3cdaf0b8a1
11 changed files with 35 additions and 124 deletions

View File

@ -3850,18 +3850,6 @@ index 00118cc80ebc31e5fac95c31c07634f0e2904263..138b6792bc6ee26e0b9aaaef7bf58fb2
@Nullable
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 505731735126e81a4cc768311dce337385e5503f..549eb8a5f0f20db88abd17136f69f7bb00883011 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -984,6 +984,7 @@ public abstract class BlockBehaviour {
return this.cache != null ? this.cache.isCollisionShapeFullBlock : this.getBlock().isCollisionShapeFullBlock(this.asState(), world, pos);
}
+ public final BlockState getBlockData() { return asState(); } // Paper - OBFHELPER
protected abstract BlockState asState();
public boolean requiresCorrectToolForDrops() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 62417156dd3e7e68e657f322c089fb6f30a11c0e..57f32618d6c95734fa4b45274afaf2319c7608ae 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@ -4218,18 +4206,6 @@ index 1441888430687b9de2a67f21ed426f16d5b30538..2da42f1bc6922adae32d782aac780a7e
@Nullable
public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException {
int i = this.getOffset(pos);
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
index 120498a39b7ca7aee9763084507508d4a1c425aa..4eeb186231551a9df453ec9d6a8a9dc9f8835464 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -243,6 +243,7 @@ public class AABB {
return x >= this.minX && x < this.maxX && y >= this.minY && y < this.maxY && z >= this.minZ && z < this.maxZ;
}
+ public final double getAverageSideLength(){return getSize();} // Paper - OBFHELPER
public double getSize() {
double d = this.getXsize();
double e = this.getYsize();
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
index 5af90e0f7222356cb0e905a9b6e0c4eac5617a41..5d4d953f197afc402248ab73daeb6ef59134f48f 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java

View File

@ -1565,18 +1565,6 @@ index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..658aff27155b32a0323f55152c7315fd
public BossEvent(UUID uuid, Component name, BossEvent.BossBarColor color, BossEvent.BossBarOverlay style) {
this.id = uuid;
diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
index 5a662dd8a05be01cbb232c3dee65d660c9b19a98..07a83fc6f9a83889a0a3b8c714be68302e700a0f 100644
--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
+++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
@@ -95,6 +95,7 @@ public abstract class Enchantment {
return this.getOrCreateDescriptionId();
}
+ public final Component getTranslationComponentForLevel(int level) { return this.getFullname(level); } // Paper - OBFHELPER
public Component getFullname(int level) {
MutableComponent mutableComponent = new TranslatableComponent(this.getDescriptionId());
if (this.isCurse()) {
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 7a0e7961df1e62b311ea2ecc76d7343a8646723b..6859fafa42527d45366018f737c19e6c3777d152 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@ -1963,7 +1951,7 @@ index 8bf9dd8f83c5e17447d8603fa5551e1fea06705d..a885eb537d6475eefe7d06f8312ecf0a
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
index cf69a45f038c2b8336010f5fe277313fd0513b5b..a7966aa0846637efdc43df1ca97cbc5d29616953 100644
index cf69a45f038c2b8336010f5fe277313fd0513b5b..eb99e0c2462a2d1ab4508a5c3f1580b6e31d7465 100644
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -187,6 +187,12 @@ public class CraftEnchantment extends Enchantment {
@ -1973,7 +1961,7 @@ index cf69a45f038c2b8336010f5fe277313fd0513b5b..a7966aa0846637efdc43df1ca97cbc5d
+ // Paper start
+ @Override
+ public net.kyori.adventure.text.Component displayName(int level) {
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getTranslationComponentForLevel(level));
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getFullname(level));
+ }
+ // Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6d7f2db63d586b96939cfc3643ebae3a952a4836..a5e3f27a471bf2396db640685edfc93f77fe2c0c 100644
index c22eb7451aaf142f6c722715dbfda5ee332e068b..a65646832867e62c758eae3ee1359bdd0d810835 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1498,6 +1498,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@ -33,7 +33,7 @@ index 195989667c7d844399a72787819f62a3fd0d9c78..d17b75ad13bbc8a38cdc2f2d77ee5d88
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 697f73cabfe89e716c9fceeb8362237d27ca3d02..b13774873f795b149c15fddb8053d9419f1841ca 100644
index 2b34b4680afd2d0c22fbae798fe1efd5df33a14f..18ea26c8e17da03f35c3fd0788a385cc492ff544 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -766,7 +766,7 @@ public abstract class Mob extends LivingEntity {
@ -59,7 +59,7 @@ index 7d741c2aebbc1c6cf1ff59cca6480325db6ca29c..2459ae800a5f6b234a4f4bb1cd3738e4
return false;
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 24530af0382be01e26516d8fa29f61c912ebb9aa..a76f1cab566a3c8c8d1b0204b5c2c8492312c9f0 100644
index bf51e880b0bb81e36c7ef435e057157adfeaede7..4588d0ac68c56942af6ab59f26c68dc65996c6a1 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -176,6 +176,9 @@ public abstract class Player extends LivingEntity {
@ -86,22 +86,21 @@ index 03bdbb832ff6a86f2dac9c008de45f3bb53aa688..a003e1c0d99a4d4c88269ea5bad250ba
public void clientTick(Level world, BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
index 389985e022b82c675fb21f363422471bd15b84b0..0b6e5ee9872a73823219bff7f642375fdc4ec243 100644
index 389985e022b82c675fb21f363422471bd15b84b0..1a921a7e4ff5a1947559c30116ddb5e0596961e7 100644
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
@@ -71,8 +71,9 @@ public interface EntityGetter {
@@ -71,8 +71,8 @@ public interface EntityGetter {
}
}
- @Nullable
- default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate<Entity> targetPredicate) {
+ default Player findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.findNearbyPlayer(entity.getX(), entity.getY(), entity.getZ(), d0, predicate); } // Paper
+ @Nullable default Player findNearbyPlayer(double d0, double d1, double d2, double d3, @Nullable Predicate<Entity> predicate) { return getNearestPlayer(d0, d1, d2, d3, predicate); } // Paper - OBFHELPER
+ default Player findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.getNearestPlayer(entity.getX(), entity.getY(), entity.getZ(), d0, predicate); } // Paper
+ @Nullable default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate<Entity> targetPredicate) { // Paper
double d = -1.0D;
Player player = null;
@@ -100,6 +101,27 @@ public interface EntityGetter {
@@ -100,6 +100,27 @@ public interface EntityGetter {
return this.getNearestPlayer(x, y, z, maxDistance, predicate);
}
@ -130,7 +129,7 @@ index 389985e022b82c675fb21f363422471bd15b84b0..0b6e5ee9872a73823219bff7f642375f
for(Player player : this.players()) {
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f1f35eeff46f6573b79f1190265a908e5f8855eb..ed5001c84d5be5c6220c97ae93e7277a32e64de6 100644
index bc901793055db9481ec32e668386ba33696bc0a5..f14488b00add3b8209554e670ca2ea2f49e04a95 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1778,8 +1778,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -8,7 +8,7 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index a18765fe0be5a83ee2da3638aa5107e9345f19b6..29e53aebd1dc22d5dd2753cc7acbea425cb0054e 100644
index a18765fe0be5a83ee2da3638aa5107e9345f19b6..8e8eea175e75f2a56a12bf1c23a5d22bf8047bb5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -109,6 +109,12 @@ public class EnderMan extends Monster implements NeutralMob {
@ -54,21 +54,12 @@ index a18765fe0be5a83ee2da3638aa5107e9345f19b6..29e53aebd1dc22d5dd2753cc7acbea42
this.teleport();
}
@@ -516,7 +524,7 @@ public class EnderMan extends Monster implements NeutralMob {
private static class EndermanLookForPlayerGoal extends NearestAttackableTargetGoal<Player> {
- private final EnderMan enderman;
+ private final EnderMan enderman; public final EnderMan getEnderman() { return this.enderman; } // Paper - OBFHELPER
private Player pendingTarget;
private int aggroTime;
private int teleportTime;
@@ -579,7 +587,7 @@ public class EnderMan extends Monster implements NeutralMob {
} else {
if (this.target != null && !this.enderman.isPassenger()) {
if (this.enderman.isLookingAtMe((Player) this.target)) {
- if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D) {
+ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.getEnderman().tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper
+ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper
this.enderman.teleport();
}

View File

@ -32,10 +32,10 @@ index 67afaab789041f49407233ca8a856a3b0131fcf6..1b874f8a72f5b1ac64dd66621b039295
this.horse.setTrap(false);
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
index 0b6e5ee9872a73823219bff7f642375fdc4ec243..b0cafe6e0bdb3f297c13f310fdbe9e3158a6715d 100644
index 1a921a7e4ff5a1947559c30116ddb5e0596961e7..35430db8efc0b5697921f8ef188c61beb628d535 100644
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
@@ -90,6 +90,28 @@ public interface EntityGetter {
@@ -89,6 +89,28 @@ public interface EntityGetter {
return player;
}

View File

@ -7,7 +7,7 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed.
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 549eb8a5f0f20db88abd17136f69f7bb00883011..d99ca942f5885b4d9af054547832c05ddb5634eb 100644
index 505731735126e81a4cc768311dce337385e5503f..6a3b6611954e07760d586e2dc8c2015cfae7c0a5 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -637,6 +637,14 @@ public abstract class BlockBehaviour {
@ -18,7 +18,7 @@ index 549eb8a5f0f20db88abd17136f69f7bb00883011..d99ca942f5885b4d9af054547832c05d
+ private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
+
+ public org.bukkit.craftbukkit.block.data.CraftBlockData createCraftBlockData() {
+ if (cachedCraftBlockData == null) cachedCraftBlockData = org.bukkit.craftbukkit.block.data.CraftBlockData.createData(getBlockData());
+ if (cachedCraftBlockData == null) cachedCraftBlockData = org.bukkit.craftbukkit.block.data.CraftBlockData.createData(asState());
+ return (org.bukkit.craftbukkit.block.data.CraftBlockData) cachedCraftBlockData.clone();
+ }
+ // Paper end

View File

@ -52,27 +52,10 @@ index b980c26ab5cac02e03525177a9dc4fb0b6a2f9f6..2a784a8342e708e0813c7076a2ca8e42
Stream<VoxelShape> getEntityCollisions(@Nullable Entity entity, AABB box, Predicate<Entity> predicate);
diff --git a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
index e6190bfb893de12e87e1da49001ebd963b3d6318..90039d01ef481ba206f2e952c99a755e94201ea3 100644
index e6190bfb893de12e87e1da49001ebd963b3d6318..7f8a914085e3d89668e8f41fd099e3b77867f03e 100644
--- a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
+++ b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
@@ -21,13 +21,13 @@ import net.minecraft.world.phys.shapes.VoxelShape;
public class CollisionSpliterator extends AbstractSpliterator<VoxelShape> {
@Nullable
- private final Entity source;
+ private final Entity source; final Entity getEntity() { return this.source; } // Paper - OBFHELPER
private final AABB box;
private final CollisionContext context;
private final Cursor3D cursor;
- private final BlockPos.MutableBlockPos pos;
+ private final BlockPos.MutableBlockPos pos; final BlockPos.MutableBlockPos getMutablePos() { return this.pos; } // Paper - OBFHELPER
private final VoxelShape entityShape;
- private final CollisionGetter collisionGetter;
+ private final CollisionGetter collisionGetter; final CollisionGetter getCollisionAccess() { return this.collisionGetter; } // Paper - OBFHELPER
private boolean needsBorderCheck;
private final BiPredicate<BlockState, BlockPos> predicate;
@@ -64,21 +64,37 @@ public class CollisionSpliterator extends AbstractSpliterator<VoxelShape> {
@@ -64,21 +64,35 @@ public class CollisionSpliterator extends AbstractSpliterator<VoxelShape> {
boolean collisionCheck(Consumer<? super VoxelShape> action) {
while(true) {
if (this.cursor.advance()) {
@ -90,20 +73,18 @@ index e6190bfb893de12e87e1da49001ebd963b3d6318..90039d01ef481ba206f2e952c99a755e
- BlockGetter blockGetter = this.getChunk(i, k);
- if (blockGetter == null) {
+ // Paper start - ensure we don't load chunks
+ Entity entity = this.getEntity();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = this.getMutablePos();
+ boolean far = entity != null && net.minecraft.server.MCUtil.distanceSq(entity.getX(), y, entity.getZ(), x, y, z) > 14;
+ blockposition_mutableblockposition.setValues(x, y, z);
+ boolean far = this.source != null && net.minecraft.server.MCUtil.distanceSq(this.source.getX(), y, this.source.getZ(), x, y, z) > 14;
+ this.pos.setValues(x, y, z);
+
+ boolean isRegionLimited = this.getCollisionAccess() instanceof net.minecraft.server.level.WorldGenRegion;
+ BlockState blockState = isRegionLimited ? Blocks.VOID_AIR.defaultBlockState() : ((!far && entity instanceof net.minecraft.server.level.ServerPlayer) || (entity != null && entity.collisionLoadChunks)
+ ? this.getCollisionAccess().getBlockState(blockposition_mutableblockposition)
+ : this.getCollisionAccess().getTypeIfLoaded(blockposition_mutableblockposition)
+ boolean isRegionLimited = this.collisionGetter instanceof net.minecraft.server.level.WorldGenRegion;
+ BlockState blockState = isRegionLimited ? Blocks.VOID_AIR.defaultBlockState() : ((!far && this.source instanceof net.minecraft.server.level.ServerPlayer) || (this.source != null && this.source.collisionLoadChunks)
+ ? this.collisionGetter.getBlockState(this.pos)
+ : this.collisionGetter.getTypeIfLoaded(this.pos)
+ );
+
+ if (blockState == null) {
+ if (!(entity instanceof net.minecraft.server.level.ServerPlayer) || entity.level.paperConfig.preventMovingIntoUnloadedChunks) {
+ VoxelShape voxelshape3 = Shapes.create(far ? entity.getBoundingBox() : new AABB(new BlockPos(x, y, z)));
+ if (!(this.source instanceof net.minecraft.server.level.ServerPlayer) || this.source.level.paperConfig.preventMovingIntoUnloadedChunks) {
+ VoxelShape voxelshape3 = Shapes.create(far ? this.source.getBoundingBox() : new AABB(new BlockPos(x, y, z)));
+ action.accept(voxelshape3);
+ return true;
+ }

View File

@ -18,10 +18,10 @@ index 8aeb00440e90f3f72d5c6fde35b4067ebc452f2f..7bfd4d85f5af889f6d6e13087331af12
return true;
});
diff --git a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
index 90039d01ef481ba206f2e952c99a755e94201ea3..61a74f2a53e0f3f6fb33fd213f7738e1d68deb11 100644
index 7f8a914085e3d89668e8f41fd099e3b77867f03e..b7ba467d0a0c59e64cd5c1d562414b1dcc3e7df8 100644
--- a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
+++ b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
@@ -135,9 +135,10 @@ public class CollisionSpliterator extends AbstractSpliterator<VoxelShape> {
@@ -133,9 +133,10 @@ public class CollisionSpliterator extends AbstractSpliterator<VoxelShape> {
WorldBorder worldBorder = this.collisionGetter.getWorldBorder();
AABB aABB = this.source.getBoundingBox();
if (!isBoxFullyWithinWorldBorder(worldBorder, aABB)) {

View File

@ -7,18 +7,6 @@ Adds a new event for all crafting stations that generate a result slot item
Anvil, Grindstone and Smithing now extend this event
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 92681e56cea92a4600ef268b21c1b56e15fe3a03..766c907f92ca8cb19b22cd19185cc92603aeca03 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -214,6 +214,7 @@ public abstract class AbstractContainerMenu {
return nonnulllist;
}
+ public final void notifyListeners() { this.broadcastChanges(); } // Paper - OBFHELPER
public void broadcastChanges() {
int i;
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 1dad9577370bb58b27b32b997a505ce5145a6769..56d3ed1cdafd7904c35be5db568b9975a97418a7 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@ -106,7 +94,7 @@ index ddd34b07f7cf39a8b5ad51bdefb6e9d7cbf8f393..eac9765ecf0b33cab8b04204591de8d5
private void setupRecipeList(Container input, ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1ee76da3b609bf91e9e8529eb402d670b32e4b18..c25586aa8d2e9ddaa7839020ecb499b12d5fe381 100644
index 1ee76da3b609bf91e9e8529eb402d670b32e4b18..7159d63c7708cebda60da33eefc8a492d8de6219 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1529,19 +1529,44 @@ public class CraftEventFactory {
@ -156,7 +144,7 @@ index 1ee76da3b609bf91e9e8529eb402d670b32e4b18..c25586aa8d2e9ddaa7839020ecb499b1
+ }
+ event.callEvent();
+ event.getInventory().setItem(resultSlot, event.getResult());
+ container.notifyListeners();
+ container.broadcastChanges();;
+ }
+ // Paper end

View File

@ -17,18 +17,6 @@ index f38ccdecbade43983358dfbeadca86be7d15a68c..bd51753e3afaa5e025583964b16851df
public static Optional<EntityType<?>> byString(String id) {
return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id));
}
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 878cdfc49253e7916d038495f79fec7cce75aa50..85fa2b26863e2da8f4de93aa10ffd77f7076b682 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -427,6 +427,7 @@ public class Block extends BlockBehaviour implements ItemLike {
return new TranslatableComponent(this.getDescriptionId());
}
+ public String getOrCreateDescriptionId() { return getDescriptionId(); } // Paper - OBFHELPER
public String getDescriptionId() {
if (this.descriptionId == null) {
this.descriptionId = Util.makeDescriptionId("block", Registry.BLOCK.getKey(this));
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 64c304cab8c7c4c9c29f73465f99c11f224a72bd..b31eaa1459690d7f54989ba7a01f96a3f0d8d3b9 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@ -45,7 +33,7 @@ index 64c304cab8c7c4c9c29f73465f99c11f224a72bd..b31eaa1459690d7f54989ba7a01f96a3
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d18f8d7c699893740fa709ef1f0caa4390e7eb20..62b5070f9645fec91d016988f0f2262fd61e2e89 100644
index d18f8d7c699893740fa709ef1f0caa4390e7eb20..91e61e7f5c1b47534408c48a280587ea03ae5a17 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -43,6 +43,7 @@ import org.bukkit.Registry;
@ -64,14 +52,14 @@ index d18f8d7c699893740fa709ef1f0caa4390e7eb20..62b5070f9645fec91d016988f0f2262f
+ @Override
+ public String getTranslationKey(Material mat) {
+ if (mat.isBlock()) {
+ return getBlock(mat).getOrCreateDescriptionId();
+ return getBlock(mat).getDescriptionId();
+ }
+ return getItem(mat).getDescriptionId();
+ }
+
+ @Override
+ public String getTranslationKey(org.bukkit.block.Block block) {
+ return ((org.bukkit.craftbukkit.block.CraftBlock)block).getNMS().getBlock().getOrCreateDescriptionId();
+ return ((org.bukkit.craftbukkit.block.CraftBlock)block).getNMS().getBlock().getDescriptionId();
+ }
+
+ @Override

View File

@ -5,7 +5,7 @@ Subject: [PATCH] More Enchantment API
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
index a7966aa0846637efdc43df1ca97cbc5d29616953..aec59f469b77aa2184a2899e8e8d1c5b823d9263 100644
index eb99e0c2462a2d1ab4508a5c3f1580b6e31d7465..227aeb002d8c23b6dba0af268f0a3297454cb4e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -71,7 +71,7 @@ public class CraftEnchantment extends Enchantment {
@ -19,7 +19,7 @@ index a7966aa0846637efdc43df1ca97cbc5d29616953..aec59f469b77aa2184a2899e8e8d1c5b
@Override
@@ -192,6 +192,45 @@ public class CraftEnchantment extends Enchantment {
public net.kyori.adventure.text.Component displayName(int level) {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getTranslationComponentForLevel(level));
return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getFullname(level));
}
+
+ @Override