13
0
geforkt von Mirrors/Paper

Clean up a lot of obfuscation helpers and impls

This fixes a bug with obfuscation helpers for attack cooldown
But every other change should stay the same.

Cleaning up a lot of helpers that pointed to already unobfuscated items.
Also adds final to many of the obfhelpers to assist with inlining.

This is pretty much a patch maintenance
Dieser Commit ist enthalten in:
Aikar 2020-08-02 01:39:36 -04:00
Ursprung e5c86b8f4f
Commit 305390ec83
48 geänderte Dateien mit 174 neuen und 270 gelöschten Zeilen

Datei anzeigen

@ -17,14 +17,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0;
}
+ // Paper - OBFHELPER
+ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) {
+ Entry<EnumItemSlot, ItemStack> entry = b(enchantment, entityliving);
+ return entry != null ? entry.getValue() : ItemStack.NULL_ITEM;
+ }
@Nullable
public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) {
- @Nullable
- public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) {
+ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { Entry<EnumItemSlot, ItemStack> entry = b(enchantment, entityliving); return entry != null ? entry.getValue() : ItemStack.NULL_ITEM; } // Paper - OBFHELPER
+ @Nullable public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) {
return a(enchantment, entityliving, (itemstack) -> {
return true;
});
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@ -33,12 +32,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+ public int durToXp(int i) { return b(i); } // Paper OBFHELPER
+ public final int durToXp(int i) { return b(i); } // Paper OBFHELPER
private int b(int i) {
return i / 2;
}
+ public int xpToDur(int i) { return c(i); } // Paper OBFHELPER
+ public final int xpToDur(int i) { return c(i); } // Paper OBFHELPER
private int c(int i) {
return i * 2;
}

Datei anzeigen

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ MinecraftKey key = e.getMinecraftKey();
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java

Datei anzeigen

@ -16,11 +16,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - PlayerAttackEntityCooldownResetEvent
+ if (damagesource.getEntity() instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) damagesource.getEntity();
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getCooledAttackStrength(0F)).callEvent()) {
+ player.resetCooldown();
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getAttackCooldown(0F)).callEvent()) {
+ player.resetAttackCooldown();
+ }
+ } else {
+ ((EntityHuman) damagesource.getEntity()).resetCooldown();
+ ((EntityHuman) damagesource.getEntity()).resetAttackCooldown();
+ }
+ // Paper end
}

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return nonnulllist;
}
+ public void notifyListeners() { this.c(); } // Paper - OBFHELPER
+ public final void notifyListeners() { this.c(); } // Paper - OBFHELPER
public void c() {
int i;

Datei anzeigen

@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return;
+ }
+
+ this.networkManager.setSpoofedRemoteAddress(new java.net.InetSocketAddress(com.destroystokyo.paper.proxy.VelocityProxy.readAddress(buf), ((java.net.InetSocketAddress) this.networkManager.getSocketAddress()).getPort()));
+ this.networkManager.socketAddress = new java.net.InetSocketAddress(com.destroystokyo.paper.proxy.VelocityProxy.readAddress(buf), ((java.net.InetSocketAddress) this.networkManager.getSocketAddress()).getPort());
+
+ this.setGameProfile(com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf));
+
@ -213,19 +213,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response"));
}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
private final EnumProtocolDirection h;
private final Queue<NetworkManager.QueuedPacket> packetQueue = Queues.newConcurrentLinkedQueue();
public Channel channel;
- public SocketAddress socketAddress;
+ public SocketAddress socketAddress; public void setSpoofedRemoteAddress(SocketAddress address) { this.socketAddress = address; } // Paper - OBFHELPER
// Spigot Start
public java.util.UUID spoofedUUID;
public com.mojang.authlib.properties.Property[] spoofedProfile;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java

Datei anzeigen

@ -23,11 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
@@ -0,0 +0,0 @@ public class EnderDragonBattle {
private int h;
private int i;
private int j;
- private boolean dragonKilled;
+ private boolean dragonKilled; private void setDragonKilled(boolean dragonKilled) { this.dragonKilled = dragonKilled; } // Paper - OBFHELPER
private boolean dragonKilled;
private boolean previouslyKilled;
public UUID dragonUUID;
- private boolean n;
@ -41,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.n = true;
+ // Paper start
+ setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon);
+ if (!scanForLegacyFight()) setDragonKilled(true);
+ if (!scanForLegacyFight()) dragonKilled = true;
+ // Paper end
this.world = worldserver;
if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) {

Datei anzeigen

@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.world.isRainingAt(blockposition) || this.world.isRainingAt(blockposition.a(0.0D, (double) this.size.height, 0.0D));
}
+ public boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
+ public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
private boolean k() {
return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
}
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.isInWater() || this.isInRain() || this.k();
}
+ public boolean isInWaterOrBubbleColumn() { return aD(); } // Paper - OBFHELPER
+ public final boolean isInWaterOrBubbleColumn() { return aD(); } // Paper - OBFHELPER
public boolean aD() {
return this.isInWater() || this.k();
}
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.inLava = true;
}
+ public boolean isInLava() { return aN(); } // Paper - OBFHELPER
+ public final boolean isInLava() { return aN(); } // Paper - OBFHELPER
public boolean aN() {
return this.inLava;
}

Datei anzeigen

@ -4,19 +4,6 @@ Date: Sun, 7 Oct 2018 04:29:59 -0500
Subject: [PATCH] Add more Zombie API
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
this.datawatcher.set(EntityInsentient.b, flag ? (byte) (b0 | 2) : (byte) (b0 & -3));
}
+ public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER
+ public void setArmsRaisedZombie(boolean flag) { this.setAggressive(flag); } // Paper - OBFHELPER
public void setAggressive(boolean flag) {
byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b);
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
@ -29,14 +16,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
super(entitytypes, world);
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
this.getDataWatcher().register(EntityZombie.DROWN_CONVERTING, false);
}
+ public boolean isDrowning() { return isDrownConverting(); } // Paper - OBFHELPER
public boolean isDrownConverting() {
return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING);
}
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true);
}
@ -103,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public boolean isDrowning() {
+ return getHandle().isDrowning();
+ return getHandle().isDrownConverting();
+ }
+
+ @Override
@ -123,12 +102,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public boolean isArmsRaised() {
+ return getHandle().isArmsRaisedZombie();
+ return getHandle().isAggressive();
+ }
+
+ @Override
+ public void setArmsRaised(final boolean raised) {
+ getHandle().setArmsRaisedZombie(raised);
+ getHandle().setAggressive(raised);
+ }
+
+ @Override

Datei anzeigen

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.a = true;
}
+ public void jumpIfSet() { this.b(); } // Paper - OBFHELPER
+ public final void jumpIfSet() { this.b(); } // Paper - OBFHELPER
public void b() {
this.b.setJumping(this.a);
this.a = false;
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.isInWater() || this.isInRain();
}
+ public boolean isInWaterOrRainOrBubble() { return aC(); } // Paper - OBFHELPER
+ public final boolean isInWaterOrRainOrBubble() { return aC(); } // Paper - OBFHELPER
public boolean aC() {
return this.isInWater() || this.isInRain() || this.k();
}

Datei anzeigen

@ -1068,9 +1068,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER
- public void b(PacketDataSerializer packetdataserializer) {
+ // Paper start - Anti-Xray - Add chunk packet info
+ @Deprecated public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere
+ @Deprecated public void b(PacketDataSerializer packetdataserializer) { this.writeChunkSection(packetdataserializer, null); } // Notice for updates: Please make sure this method isn't used anywhere
+ public void writeChunkSection(PacketDataSerializer packetDataSerializer, ChunkPacketInfo<IBlockData> chunkPacketInfo) { this.b(packetDataSerializer, chunkPacketInfo); } // OBFHELPER
+ @Deprecated public final void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere
+ @Deprecated public final void b(PacketDataSerializer packetdataserializer) { this.writeChunkSection(packetdataserializer, null); } // Notice for updates: Please make sure this method isn't used anywhere
+ public final void writeChunkSection(PacketDataSerializer packetDataSerializer, ChunkPacketInfo<IBlockData> chunkPacketInfo) { this.b(packetDataSerializer, chunkPacketInfo); } // OBFHELPER
+ public void b(PacketDataSerializer packetdataserializer, ChunkPacketInfo<IBlockData> chunkPacketInfo) {
+ // Paper end
packetdataserializer.writeShort(this.nonEmptyBlockCount);
@ -1096,7 +1096,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Function<T, NBTTagCompound> f;
private final T g;
+ private final T[] predefinedObjects; // Paper - Anti-Xray - Add predefined objects
protected DataBits a; protected DataBits getDataBits() { return this.a; } // Paper - OBFHELPER
protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER
private DataPalette<T> h; private DataPalette<T> getDataPalette() { return this.h; } // Paper - OBFHELPER
private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER
@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {

Datei anzeigen

@ -2771,15 +2771,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.t = chunkstatus == null ? 0 : chunkstatus.c() + 1;
}
+ public int getStatusIndex() { return c(); } // Paper - OBFHELPER
+ public final int getStatusIndex() { return c(); } // Paper - OBFHELPER
public int c() {
return this.t;
}
@@ -0,0 +0,0 @@ public class ChunkStatus {
return this.s;
}
- public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER
+ public final ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER
public ChunkStatus e() {
return this.u;
}
@@ -0,0 +0,0 @@ public class ChunkStatus {
return this.w.doWork(this, worldserver, definedstructuremanager, lightenginethreaded, function, ichunkaccess);
}
+ public int getNeighborRadius() { return this.f(); } // Paper - OBFHELPER
+ public final int getNeighborRadius() { return this.f(); } // Paper - OBFHELPER
public int f() {
return this.x;
}
@ -2787,7 +2796,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.z;
}
+ public boolean isAtLeastStatus(ChunkStatus chunkstatus) { return b(chunkstatus); } // Paper - OBFHELPER
+ public final boolean isAtLeastStatus(ChunkStatus chunkstatus) { return b(chunkstatus); } // Paper - OBFHELPER
public boolean b(ChunkStatus chunkstatus) {
return this.c() >= chunkstatus.c();
}
@ -3060,7 +3069,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private boolean updatingChunksModified;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public final WorldLoadListener worldLoadListener;
public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER
public final PlayerChunkMap.a chunkDistanceManager;
private final AtomicInteger u;
- private final DefinedStructureManager definedStructureManager;
+ public final DefinedStructureManager definedStructureManager; // Paper - private -> public

Datei anzeigen

@ -196,7 +196,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
+ if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
+ GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true);
+ if (result != null) {
+ copyProfileProperties(result, this.profile, true);
+ }
@ -462,18 +462,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.G = i;
}
+ public final MinecraftSessionService getSessionService() { return this.getMinecraftSessionService(); } // Paper - OBFHELPER
public MinecraftSessionService getMinecraftSessionService() {
return this.minecraftSessionService;
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/UserCache.java

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class ControllerMove {
- protected final EntityInsentient a;
+ protected final EntityInsentient a; public EntityInsentient getEntity() { return a; } // Paper - OBFHELPER
+ protected final EntityInsentient a; public final EntityInsentient getEntity() { return a; } // Paper - OBFHELPER
protected double b;
protected double c;
protected double d;

Datei anzeigen

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() {
getHandle().resetCooldown();
getHandle().resetAttackCooldown();
}
+
+ @Override

Datei anzeigen

@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ WorldServer world = ((org.bukkit.craftbukkit.CraftWorld)bukkitWorld).getHandle();
+ PlayerChunkMap chunkMap = world.getChunkProvider().playerChunkMap;
+ Long2ObjectLinkedOpenHashMap<PlayerChunk> visibleChunks = chunkMap.visibleChunks;
+ ChunkMapDistance chunkMapDistance = chunkMap.getChunkMapDistanceManager();
+ ChunkMapDistance chunkMapDistance = chunkMap.chunkDistanceManager;
+ List<PlayerChunk> allChunks = new ArrayList<>(visibleChunks.values());
+ List<EntityPlayer> players = world.players;
+
@ -424,15 +424,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final WorldServer world;
private final LightEngineThreaded lightEngine;
private final IAsyncTaskHandler<Runnable> executor;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxWorldGen;
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain;
public final WorldLoadListener worldLoadListener;
- public final PlayerChunkMap.a chunkDistanceManager;
+ public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER
private final AtomicInteger u;
private final DefinedStructureManager definedStructureManager;
private final File w;
diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Ticket.java

Datei anzeigen

@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.ac();
+
+ // Paper start - These shouldn't be going through portals
+ if (this.inPortal()) {
+ if (this.inPortal) {
+ this.die();
+ }
+ // Paper end

Datei anzeigen

@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
});
}
+ public void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER
+ public final void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER
public void a_(UUID uuid) {
this.uniqueID = uuid;
this.al = this.uniqueID.toString();

Datei anzeigen

@ -24,10 +24,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
++this.c;
}
+ public void removeAreaEffect() { this.e(); } // Paper - OBFHELPER
@Override
public void e() {
- @Override
- public void e() {
+ public final void removeAreaEffect() { this.e(); } // Paper - OBFHELPER
+ @Override public void e() {
if (this.d != null) {
this.d.die();
this.d = null;
diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java

Datei anzeigen

@ -17,6 +17,15 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean ac;
public boolean impulse;
public int portalCooldown;
- protected boolean inPortal; public final boolean inPortal() { return this.inPortal; } // Paper - OBFHELPER
+ public boolean inPortal; // Paper - public
protected int portalTicks;
protected BlockPosition ah;
protected Vec3D ai;
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
@ -51,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.al;
}
+ public boolean isPushedByWater() { return this.bU(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it!
+ public final boolean isPushedByWater() { return this.bU(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it!
public boolean bU() {
// Paper start
return this.pushedByWater();
@ -681,7 +690,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper start - special case always immunities
+ // immunize brand new entities, dead entities, and portal scenarios
+ if (entity.defaultActivationState || entity.ticksLived < 20*10 || !entity.isAlive() || entity.inPortal() || entity.portalCooldown > 0) {
+ if (entity.defaultActivationState || entity.ticksLived < 20*10 || !entity.isAlive() || entity.inPortal || entity.portalCooldown > 0) {
+ return true;
+ }
+ // immunize leashed entities

Datei anzeigen

@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected abstract void saveData(NBTTagCompound nbttagcompound);
+ protected NBTTagList createList(double... adouble) { return a(adouble); } // Paper - OBFHELPER
+ protected final NBTTagList createList(double... adouble) { return a(adouble); } // Paper - OBFHELPER
protected NBTTagList a(double... adouble) {
NBTTagList nbttaglist = new NBTTagList();
double[] adouble1 = adouble;

Datei anzeigen

@ -12,8 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+ public ItemStack getOriginalItemStack() { return getItemStack(); } // Paper - OBFHelper
+
+ public final ItemStack getOriginalItemStack() { return getItemStack(); } // Paper - OBFHELPER - exists purely due to overrides all as protected and dont want to change them all
protected abstract ItemStack getItemStack();
@Override

Datei anzeigen

@ -16,16 +16,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public float eR() {
return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D);
}
+ public float getCooledAttackStrength(float adjustTicks) { return getAttackCooldown(adjustTicks); } // Paper - OBFHELPER
public float getAttackCooldown(float f) {
return MathHelper.a(((float) this.aA + f) / this.eR(), 0.0F, 1.0F);
}
+ public void resetCooldown() { this.ey(); } // Paper - OBFHELPER
public void resetAttackCooldown() {
this.aA = 0;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@ -40,11 +30,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ public float getCooledAttackStrength(float adjustTicks) {
+ return getHandle().getCooledAttackStrength(adjustTicks);
+ return getHandle().getAttackCooldown(adjustTicks);
+ }
+
+ public void resetCooldown() {
+ getHandle().resetCooldown();
+ getHandle().resetAttackCooldown();
+ }
+ // Paper end
+

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int ticksFlown;
public int expectedLifespan;
- private EntityLiving ridingEntity;
+ private EntityLiving ridingEntity; public final EntityLiving getBoostedEntity() { return this.ridingEntity; } // Paper - OBFHELPER
+ public EntityLiving ridingEntity; // Paper - public
+ public java.util.UUID spawningEntity; // Paper
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
@ -109,7 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
+ net.minecraft.server.EntityLiving boostedEntity = getHandle().getBoostedEntity();
+ net.minecraft.server.EntityLiving boostedEntity = getHandle().ridingEntity;
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
+ }
+ // Paper end

Datei anzeigen

@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
public final WorldLoadListener worldLoadListener;
public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER
public final PlayerChunkMap.a chunkDistanceManager;
private final AtomicInteger u;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Mailbox<Runnable> mailbox = Mailbox.a("main", iasynctaskhandler::a);

Datei anzeigen

@ -218,7 +218,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // We've used an invalid region file.
+ throw new IllegalStateException("RegionFile is closed");
+ }
+ this.statuses[this.getChunkLocation(new ChunkCoordIntPair(x, z))] = status;
+ this.statuses[getChunkLocation(x, z)] = status;
+ }
+
+ public ChunkStatus getStatusIfCached(int x, int z) {
@ -226,7 +226,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // We've used an invalid region file.
+ throw new IllegalStateException("RegionFile is closed");
+ }
+ final int location = this.getChunkLocation(new ChunkCoordIntPair(x, z));
+ final int location = getChunkLocation(x, z);
+ return this.statuses[location];
+ }
+ // Paper end
@ -238,7 +238,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.getOffset(chunkcoordintpair) != 0;
}
+ private final int getChunkLocation(ChunkCoordIntPair chunkcoordintpair) { return this.g(chunkcoordintpair); } // Paper - OBFHELPER
+ private static int getChunkLocation(int x, int z) { return (x & 31) + (z & 31) * 32; } // Paper - OBFHELPER - sort of, mirror of logic below
private static int g(ChunkCoordIntPair chunkcoordintpair) {
return chunkcoordintpair.j() + chunkcoordintpair.k() * 32;
}

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ protected void tickDespawnCounter() { this.h(); } // Paper - OBFHELPER
+ protected final void tickDespawnCounter() { this.h(); } // Paper - OBFHELPER
protected void h() {
++this.despawnCounter;
if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?

Datei anzeigen

@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (e.shouldBeRemoved) return; // Paper
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ);
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java

Datei anzeigen

@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> j;
private final Mailbox<ChunkTaskQueueSorter.b> k;
- private final LongSet l = new LongOpenHashSet();
+ private final LongSet l = new LongOpenHashSet(); LongSet getOnPlayerTicketAddQueue() { return l; } // Paper - OBFHELPER
+ private final LongSet l = new LongOpenHashSet(); public final LongSet getOnPlayerTicketAddQueue() { return l; } // Paper - OBFHELPER
private final Executor m;
private long currentTick;
@ -394,7 +394,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ BlockPosition blockPos = chunkPos.asPosition();
+
+ boolean isFront = false;
+ BlockPosition.PooledBlockPosition pos = BlockPosition.PooledBlockPosition.acquire();
+ BlockPosition.MutableBlockPosition pos = new BlockPosition.MutableBlockPosition();
+ for (int index = 0, len = backingSet.length; index < len; ++index) {
+ if (!(backingSet[index] instanceof EntityPlayer)) {
+ continue;
@ -421,7 +421,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ minDist = dist;
+ }
+ }
+ pos.close();
+ if (minDist == Double.MAX_VALUE) {
+ minDist = 15;
+ } else {
@ -997,7 +996,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap priorities = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap();
+
+ int viewDistance = getEffectiveNoTickViewDistance();
+ BlockPosition.PooledBlockPosition pos = BlockPosition.PooledBlockPosition.acquire();
+ BlockPosition.MutableBlockPosition pos = new BlockPosition.MutableBlockPosition();
+
+ // Prioritize circular near
+ double playerChunkX = MathHelper.floor(player.locX()) >> 4;
@ -1053,7 +1052,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ });
+ }
+
+ pos.close();
+ if (priorities.isEmpty()) return;
+ chunkDistanceManager.delayDistanceManagerTick = true;
+ priorities.long2IntEntrySet().fastForEach(entry -> chunkDistanceManager.markHighPriority(new ChunkCoordIntPair(entry.getLongKey()), entry.getIntValue()));

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private boolean armorStandInvisible;
public long bp;
- private int bA;
+ private int bA; public void setDisabledSlots(int i) { bA = i; } public int getDisabledSlots() { return bA; } // Paper - OBFHELPER
+ private int bA; public final void setDisabledSlots(int i) { bA = i; } public final int getDisabledSlots() { return bA; } // Paper - OBFHELPER
public Vector3f headPose;
public Vector3f bodyPose;
public Vector3f leftArmPose;
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return enumitemslot;
}
+ public boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER
+ public final boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER
private boolean d(EnumItemSlot enumitemslot) {
return (this.bA & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms();
}

Datei anzeigen

@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public String locale = null; // CraftBukkit - lowercase // Paper - default to null
public void a(PacketPlayInSettings packetplayinsettings) {
+ new PlayerClientOptionsChangeEvent(getBukkitEntity(), packetplayinsettings.getLocale(), packetplayinsettings.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packetplayinsettings.getChatVisibility().name()), packetplayinsettings.hasChatColorsEnabled(), new com.destroystokyo.paper.PaperSkinParts(packetplayinsettings.getSkinParts()), packetplayinsettings.getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT).callEvent(); // Paper - settings event
+ new PlayerClientOptionsChangeEvent(getBukkitEntity(), packetplayinsettings.locale, packetplayinsettings.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packetplayinsettings.getChatVisibility().name()), packetplayinsettings.hasChatColorsEnabled(), new com.destroystokyo.paper.PaperSkinParts(packetplayinsettings.getSkinParts()), packetplayinsettings.getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT).callEvent(); // Paper - settings event
// CraftBukkit start
if (getMainHand() != packetplayinsettings.getMainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
@ -130,15 +130,6 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java
@@ -0,0 +0,0 @@ import java.io.IOException;
public class PacketPlayInSettings implements Packet<PacketListenerPlayIn> {
- public String locale;
+ public String locale; public String getLocale() { return this.locale; } // Paper - OBFHELPER
public int viewDistance;
private EnumChatVisibility c;
private boolean d;
@@ -0,0 +0,0 @@ public class PacketPlayInSettings implements Packet<PacketListenerPlayIn> {
packetlistenerplayin.a(this);
}

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Map<IBlockState<?>, Comparable<?>> k = Maps.newLinkedHashMap(); // CraftBukkit - stable
private final Map<String, String> l = Maps.newHashMap();
- private MinecraftKey m = new MinecraftKey("");
+ private MinecraftKey m = new MinecraftKey(""); public MinecraftKey getBlockKey() { return this.m; } // Paper - OBFHELPER
+ private MinecraftKey m = new MinecraftKey(""); public final MinecraftKey getBlockKey() { return this.m; } // Paper - OBFHELPER
private BlockStateList<Block, IBlockData> n;
private IBlockData o;
@Nullable
@ -21,13 +21,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.p;
}
+ public @Nullable MinecraftKey getTagKey() { return d(); } // Paper - OBFHELPER
+ public final @Nullable MinecraftKey getTagKey() { return d(); } // Paper - OBFHELPER
@Nullable
public MinecraftKey d() {
return this.q;
}
+ public ArgumentBlock parse(boolean parseTile) throws CommandSyntaxException { return this.a(parseTile); } // Paper - OBFHELPER
+ public final ArgumentBlock parse(boolean parseTile) throws CommandSyntaxException { return this.a(parseTile); } // Paper - OBFHELPER
public ArgumentBlock a(boolean flag) throws CommandSyntaxException {
this.s = this::l;
if (this.i.canRead() && this.i.peek() == '#') {

Datei anzeigen

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.h = null;
}
+ public void reset() { this.g(); } // Paper - OBFHELPER
+ public final void reset() { this.g(); } // Paper - OBFHELPER
public void g() {
int i = this.f ? 300 : 100;
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
+ public void runKillTrigger(Entity entity, int kills, DamageSource damageSource) { this.a(entity, kills, damageSource); } // Paper - OBFHELPER
+ public final void runKillTrigger(Entity entity, int kills, DamageSource damageSource) { this.a(entity, kills, damageSource); } // Paper - OBFHELPER
public void a(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.fallDistance = 0.0F;
}
+ public void onKill(EntityLiving entityLiving) { this.a_(entityLiving); } // Paper - OBFHELPER
+ public final void onKill(EntityLiving entityLiving) { this.a_(entityLiving); } // Paper - OBFHELPER
public void a_(EntityLiving entityliving) {}
protected void k(double d0, double d1, double d2) {
@ -429,7 +429,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ double z = event.getEntity().getLocation().getZ();
+ net.minecraft.server.SoundEffect soundEffect = org.bukkit.craftbukkit.CraftSound.getSoundEffect(event.getDeathSound());
+ net.minecraft.server.SoundCategory soundCategory = net.minecraft.server.SoundCategory.valueOf(event.getDeathSoundCategory().name());
+ victim.world.sendSoundEffect(source, x, y, z, soundEffect, soundCategory, event.getDeathSoundVolume(), event.getDeathSoundPitch());
+ victim.world.playSound(source, x, y, z, soundEffect, soundCategory, event.getDeathSoundVolume(), event.getDeathSoundPitch());
+ }
+ }
+ // Paper end

Datei anzeigen

@ -401,7 +401,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public org.bukkit.loot.LootTable getLootTable() {
+ return entity.getLootTableKey() != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTableKey())) : null;
+ return entity.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null;
+ }
+
+ @Override
@ -422,8 +422,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void setLootTable(org.bukkit.loot.LootTable table) {
+ MinecraftKey newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
+ entity.setLootTable(newKey);
+ entity.lootTable = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
+ }
+
+ @Override
@ -470,7 +469,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public org.bukkit.loot.LootTable getLootTable() {
+ return tileEntityLootable.getLootTableKey() != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.getLootTableKey())) : null;
+ return tileEntityLootable.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null;
+ }
+
+ @Override
@ -481,18 +480,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void setLootTable(org.bukkit.loot.LootTable table) {
+ MinecraftKey newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
+ tileEntityLootable.setLootTable(newKey);
+ tileEntityLootable.lootTable = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
+ }
+
+ @Override
+ public void setSeed(long seed) {
+ tileEntityLootable.setSeed(seed);
+ tileEntityLootable.lootTableSeed = seed;
+ }
+
+ @Override
+ public long getSeed() {
+ return tileEntityLootable.getSeed();
+ return tileEntityLootable.lootTableSeed;
+ }
+
+ @Override
@ -536,11 +534,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
private NonNullList<ItemStack> items;
private boolean c;
@Nullable
- public MinecraftKey lootTable;
+ public MinecraftKey lootTable; public MinecraftKey getLootTableKey() { return this.lootTable; } public void setLootTable(final MinecraftKey key) { this.lootTable = key; } // Paper - OBFHELPER
public long lootTableSeed;
// CraftBukkit start
@ -599,14 +592,10 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityLootable.java
+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
public abstract class TileEntityLootable extends TileEntityContainer {
@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer {
@Nullable
- public MinecraftKey lootTable;
- public long lootTableSeed;
+ public MinecraftKey lootTable; public MinecraftKey getLootTableKey() { return this.lootTable; } public void setLootTable(final MinecraftKey key) { this.lootTable = key; } // Paper - OBFHELPER
+ public long lootTableSeed; public long getSeed() { return this.lootTableSeed; } public void setSeed(final long seed) { this.lootTableSeed = seed; } // Paper - OBFHELPER
public MinecraftKey lootTable;
public long lootTableSeed;
+ public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper
protected TileEntityLootable(TileEntityTypes<?> tileentitytypes) {

Datei anzeigen

@ -2287,6 +2287,19 @@ diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
return IntStream.of(new int[]{baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()});
});
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
- private int a;
- private int b;
- private int e;
+ private int a;public final void setX(final int x) { this.a = x; } // Paper - OBFHELPER
+ private int b;public final void setY(final int y) { this.b = y; } // Paper - OBFHELPER
+ private int e;public final void setZ(final int z) { this.e = z; } // Paper - OBFHELPER
public BaseBlockPosition(int i, int j, int k) {
this.a = i;
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
return this.distanceSquared(iposition.getX(), iposition.getY(), iposition.getZ(), true) < d0 * d0;
}
@ -2326,7 +2339,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.a != null ? this.a.e : Block.a(this.getCollisionShape(iblockaccess, blockposition));
}
+ public IBlockData getBlockData() { return p(); } // Paper - OBFHELPER
+ public final IBlockData getBlockData() { return p(); } // Paper - OBFHELPER
protected abstract IBlockData p();
public boolean isAlwaysDestroyable() {
@ -2338,24 +2351,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2);
}
+ public BlockPosition add(int i, int j, int k) {return b(i, j, k);} // Paper - OBFHELPER
+ public final BlockPosition add(int i, int j, int k) {return b(i, j, k);} // Paper - OBFHELPER
public BlockPosition b(int i, int j, int k) {
return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k);
}
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return new BlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
}
+ @Deprecated // We'll replace this...
+ public BlockPosition asImmutable() { return immutableCopy(); } // Paper - OBFHELPER
public BlockPosition immutableCopy() {
return this;
}
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return super.a(enumblockrotation).immutableCopy();
}
+ public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER
+ public final BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition d(int i, int j, int k) {
this.o(i);
this.p(j);
@ -2363,7 +2367,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this;
}
+ public BlockPosition.MutableBlockPosition setValues(double d0, double d1, double d2) { return c(d0, d1, d2);} // Paper - OBFHELPER
+ public final BlockPosition.MutableBlockPosition setValues(double d0, double d1, double d2) { return c(d0, d1, d2);} // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition c(double d0, double d1, double d2) {
return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
@ -2371,36 +2375,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+ public final void setX(final int x) { super.o(x); } // Paper - OBFHELPER
+ /* // Paper start - comment out useless overrides @Override
@Override
public void o(int i) {
super.o(i);
}
+ public final void setY(final int y) { super.p(y); } // Paper - OBFHELPER
@Override
public void p(int i) {
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
super.p(i);
}
+ public final void setZ(final int z) { super.q(z); } // Paper - OBFHELPER
@Override
- @Override
public void q(int i) {
super.q(i);
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
return new BlockPosition(this);
}
}
+
+ // Paper start
+ public static class PooledBlockPosition extends BlockPosition.MutableBlockPosition implements AutoCloseable {
+ @Deprecated
+ public void close() {}
+ @Deprecated
+ public static BlockPosition.PooledBlockPosition acquire() { return new PooledBlockPosition(); }
+ }
+ // Paper end
}
+ */ // Paper end
@Override
public BlockPosition immutableCopy() {
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
@ -2730,8 +2720,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- public static long pair(int i, int j) {
+ public static long asLong(final BlockPosition pos) { return pair(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER
+ public static long asLong(int x, int z) { return pair(x, z); } // Paper - OBFHELPER
+ public static long pair(final BlockPosition pos) { return pair(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER
+ public static long pair(int i, int j) {
return (long) i & 4294967295L | ((long) j & 4294967295L) << 32;
}
@ -3001,7 +2990,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return (int) (k >> l & this.d);
}
+ public long[] getDataBits() { return this.a(); } // Paper - OBFHELPER
+ public final long[] getDataBits() { return this.a(); } // Paper - OBFHELPER
public long[] a() {
return this.b;
}
@ -3042,7 +3031,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- protected DataBits a;
- private DataPalette<T> h;
- private int i;
+ protected DataBits a; protected DataBits getDataBits() { return this.a; } // Paper - OBFHELPER
+ protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER
+ private DataPalette<T> h; private DataPalette<T> getDataPalette() { return this.h; } // Paper - OBFHELPER
+ private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER
private final ReentrantLock j = new ReentrantLock();
@ -3198,7 +3187,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
+ public void addTask(R r0) { a(r0); }; // Paper - OBFHELPER
+ public final void addTask(R r0) { a(r0); }; // Paper - OBFHELPER
public void a(R r0) {
this.d.add(r0);
LockSupport.unpark(this.getThread());

Datei anzeigen

@ -245,7 +245,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain;
+ final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain; // Paper - private -> package private
public final WorldLoadListener worldLoadListener;
public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER
public final PlayerChunkMap.a chunkDistanceManager;
private final AtomicInteger u;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick

Datei anzeigen

@ -234,14 +234,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
}
public final void setHome(BlockPosition pos) { setHomePos(pos); } // Paper - OBFHELPER
public void setHomePos(BlockPosition blockposition) {
- this.datawatcher.set(EntityTurtle.bw, blockposition);
+ this.datawatcher.set(EntityTurtle.bw, blockposition.immutableCopy()); // Paper - called with mutablepos...
}
// TODO Paper: Obf helpers here can prolly be removed? check that no newer patches use them
public final BlockPosition getHome() { return this.getHomePos(); } // Paper - OBFHELPER
public BlockPosition getHomePos() { // Paper - public
return (BlockPosition) this.datawatcher.get(EntityTurtle.bw);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java

Datei anzeigen

@ -10,6 +10,31 @@ diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
}).stable();
private static final Logger LOGGER = LogManager.getLogger();
public static final BlockPosition ZERO = new BlockPosition(0, 0, 0);
- private static final int f = 1 + MathHelper.f(MathHelper.c(30000000));
- private static final int g = BlockPosition.f;
- private static final int h = 64 - BlockPosition.f - BlockPosition.g;
- private static final long i = (1L << BlockPosition.f) - 1L;
- private static final long j = (1L << BlockPosition.h) - 1L;
- private static final long k = (1L << BlockPosition.g) - 1L;
- private static final int l = BlockPosition.h;
- private static final int m = BlockPosition.h + BlockPosition.g;
+ // Paper start - static constants
+ private static final int f = 26;
+ private static final int g = 26;
+ private static final int h = 12;
+ private static final long i = 67108863;
+ private static final long j = 4095;
+ private static final long k = 67108863;
+ private static final int l = 12;
+ private static final int m = 38;
+ // Paper end
public BlockPosition(int i, int j, int k) {
super(i, j, k);
@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition {
this(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}

Datei anzeigen

@ -1380,7 +1380,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- @Override
+
+ public void queue(T t0) { a(t0); } @Override // Paper - OBFHELPER
+ public final void queue(T t0) { a(t0); } @Override // Paper - OBFHELPER
public void a(T t0) {
this.a.a(t0);
this.f();

Datei anzeigen

@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
PlayerChunkMap chunkMap = world.getChunkProvider().playerChunkMap;
- Long2ObjectLinkedOpenHashMap<PlayerChunk> visibleChunks = chunkMap.visibleChunks;
+ Long2ObjectLinkedOpenHashMap<PlayerChunk> visibleChunks = chunkMap.getVisibleChunks();
ChunkMapDistance chunkMapDistance = chunkMap.getChunkMapDistanceManager();
ChunkMapDistance chunkMapDistance = chunkMap.chunkDistanceManager;
List<PlayerChunk> allChunks = new ArrayList<>(visibleChunks.values());
List<EntityPlayer> players = world.players;
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java

Datei anzeigen

@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
private int b;
private int e;
private int b;public final void setY(final int y) { this.b = y; } // Paper - OBFHELPER
private int e;public final void setZ(final int z) { this.e = z; } // Paper - OBFHELPER
+ // Paper start
+ public boolean isValidLocation() {

Datei anzeigen

@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch
+
+ MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
+ ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
+ ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ);
+ info.left++;
+ info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1);
+ if (!chunkProviderServer.isInEntityTickingChunk(e)) {
@ -575,23 +575,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
private static final DataWatcherObject<Boolean> aA = DataWatcher.a(Entity.class, DataWatcherRegistry.i);
protected static final DataWatcherObject<EntityPose> POSE = DataWatcher.a(Entity.class, DataWatcherRegistry.s);
public boolean inChunk;
- public int chunkX;
- public int chunkY;
- public int chunkZ;
+ public int chunkX; public int getChunkX() { return chunkX; } // Paper - OBFHELPER
+ public int chunkY; public int getChunkY() { return chunkY; } // Paper - OBFHELPER
+ public int chunkZ; public int getChunkZ() { return chunkZ; } // Paper - OBFHELPER
private boolean aB;
public long Z;
public long aa;
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java

Datei anzeigen

@ -55,9 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class MobSpawnerPatrol implements MobSpawner {
+ private int getSpawnDelay() { return a; } // Paper - OBFHELPER
+ private void setSpawnDelay(int spawnDelay) { this.a = spawnDelay; } // Paper - OBFHELPER
private int a;
- private int a;
+ private int a;private int getSpawnDelay() { return a; } private void setSpawnDelay(int spawnDelay) { this.a = spawnDelay; } // Paper - OBFHELPER
public MobSpawnerPatrol() {}
@ -136,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.b.values().iterator();
}
+ public Statistic<T> get(T t) { return this.b(t); }; // Paper - OBFHELPER
+ public final Statistic<T> get(T t) { return this.b(t); }; // Paper - OBFHELPER
public Statistic<T> b(T t0) {
return this.a(t0, Counter.DEFAULT);
}

Datei anzeigen

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ public int getMaxAirTicks() { return bD(); } // Paper - OBFHELPER
+ public final int getMaxAirTicks() { return bD(); } // Paper - OBFHELPER
public int bD() {
return 300;
}

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - send SoundEffect to everyone who can see fromEntity
+ private static void sendSoundEffect(EntityHuman fromEntity, double x, double y, double z, SoundEffect soundEffect, SoundCategory soundCategory, float volume, float pitch) {
+ fromEntity.world.sendSoundEffect(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
+ fromEntity.world.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
+ if (fromEntity instanceof EntityPlayer) {
+ ((EntityPlayer) fromEntity).playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(soundEffect, soundCategory, x, y, z, volume, pitch));
+ }
@ -71,19 +71,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (flag4) {
entity.extinguish();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1);
}
+ // Paper start - OBFHELPER
+ public final void sendSoundEffect(@Nullable EntityHuman fromEntity, double x, double y, double z, SoundEffect soundeffect, SoundCategory soundcategory, float volume, float pitch) {
+ this.playSound(fromEntity, x, y, z, soundeffect, soundcategory, volume, pitch);
+ }
+ // Paper end
public abstract void playSound(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1);
public abstract void playSound(@Nullable EntityHuman entityhuman, Entity entity, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1);

Datei anzeigen

@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
((HeightMap) this.heightMap.get(heightmap_type)).a(along);
}
+ public void removeEntity(Entity entity) { this.b(entity); } // Paper - OBFHELPER
+ public final void removeEntity(Entity entity) { this.b(entity); } // Paper - OBFHELPER
public void b(Entity entity) {
this.a(entity, entity.chunkY);
}
@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return chunk;
+ }
+
+ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(getChunkX(), getChunkZ());
+ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(chunkX, chunkZ);
+ }
+
private MinecraftKey entityKey;

Datei anzeigen

@ -906,7 +906,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.a = acustomfunction_c;
}
+ public MinecraftKey getMinecraftKey() { return this.a(); } // Paper - OBFHELPER
+ public final MinecraftKey getMinecraftKey() { return this.a(); } // Paper - OBFHELPER
public MinecraftKey a() {
return this.b;
}

Datei anzeigen

@ -9,19 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
this.G = 1.0F;
}
+ public final void setHome(BlockPosition pos) { setHomePos(pos); } // Paper - OBFHELPER
public void setHomePos(BlockPosition blockposition) {
this.datawatcher.set(EntityTurtle.bw, blockposition);
}
-
+ // TODO Paper: Obf helpers here can prolly be removed? check that no newer patches use them
+ public final BlockPosition getHome() { return this.getHomePos(); } // Paper - OBFHELPER
private BlockPosition getHomePos() {
- private BlockPosition getHomePos() {
+ public BlockPosition getHomePos() { // Paper - public
return (BlockPosition) this.datawatcher.get(EntityTurtle.bw);
}
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
return (Boolean) this.datawatcher.get(EntityTurtle.bx);
}
@ -112,12 +108,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public Location getHome() {
+ return MCUtil.toLocation(getHandle().world, getHandle().getHome());
+ return MCUtil.toLocation(getHandle().world, getHandle().getHomePos());
+ }
+
+ @Override
+ public void setHome(Location location) {
+ getHandle().setHome(MCUtil.toBlockPosition(location));
+ getHandle().setHomePos(MCUtil.toBlockPosition(location));
+ }
+
+ @Override

Datei anzeigen

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public String toString() {
- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getDisplayName().getString(), this.id, this.world == null ? "~NULL~" : this.world.toString(), this.locX(), this.locY(), this.locZ());
+ return String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cx=%d, cz=%d, tl=%d, v=%b, d=%b]", new Object[] { this.getClass().getSimpleName(), this.getDisplayName().getString(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.toString(), Double.valueOf(this.locX()), Double.valueOf(this.locY()), Double.valueOf(this.locZ()), getChunkX(), getChunkZ(), this.ticksLived, this.valid, this.dead}); // Paper - add more information
+ return String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cx=%d, cz=%d, tl=%d, v=%b, d=%b]", new Object[] { this.getClass().getSimpleName(), this.getDisplayName().getString(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.toString(), Double.valueOf(this.locX()), Double.valueOf(this.locY()), Double.valueOf(this.locZ()), chunkX, chunkZ, this.ticksLived, this.valid, this.dead}); // Paper - add more information
}
public boolean isInvulnerable(DamageSource damagesource) {