13
0
geforkt von Mirrors/Paper

nuke a few more obfhelpers

Dieser Commit ist enthalten in:
MiniDigger | Martin 2021-06-17 21:37:37 +02:00
Ursprung 8d5fa8c53b
Commit a486d2eccf
9 geänderte Dateien mit 16 neuen und 105 gelöschten Zeilen

Datei anzeigen

@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@ -156,7 +144,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ event.callEvent();
+ event.getInventory().setItem(resultSlot, event.getResult());
+ container.notifyListeners();
+ container.broadcastChanges();;
+ }
+ // Paper end

Datei anzeigen

@ -17,18 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@ -64,14 +52,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @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

Datei anzeigen

@ -1565,18 +1565,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
+++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@ -1973,7 +1961,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // 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

Datei anzeigen

@ -54,21 +54,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.teleport();
}
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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();
}

Datei anzeigen

@ -3850,18 +3850,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@ -4218,18 +4206,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java

Datei anzeigen

@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
@@ -0,0 +0,0 @@ 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

Datei anzeigen

@ -55,23 +55,6 @@ diff --git a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
+++ b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public class CollisionSpliterator extends AbstractSpliterator<VoxelShape> {
boolean collisionCheck(Consumer<? super VoxelShape> action) {
while(true) {
@ -90,20 +73,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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;
+ }

Datei anzeigen

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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

Datei anzeigen

@ -95,8 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- @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;