remove some more obf helpers

This commit is contained in:
Jake Potrebic 2021-06-16 10:48:25 -07:00
parent 15c337032b
commit 4d67d89033
23 changed files with 45 additions and 268 deletions

View File

@ -183,3 +183,11 @@ public net.minecraft.Util$IdentityStrategy
# Chunk priority urgency system
public net.minecraft.server.level.ChunkMap$ChunkDistanceManager
# Here's Johnny
public net.minecraft.world.entity.monster.Vindicator isJohnny
# Chunk debug command
public net.minecraft.server.level.Ticket createdTick
public net.minecraft.server.level.ServerChunkCache CHUNK_STATUSES
public net.minecraft.server.level.ChunkHolder pos

View File

@ -77,23 +77,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ResourceLocation minecraftkey = EntityType.getKey(entitytypes);
- return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
+ return entitytypes != null && entitytypes.isPersistable() ? getMinecraftKeyString() : null;
+ return entitytypes != null && entitytypes.canSerialize() ? getMinecraftKeyString() : null;
+ // Paper end
}
protected abstract void readAdditionalSaveData(CompoundTag nbt);
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
}
}
+ public boolean isPersistable() { return canSerialize(); } // Paper - OBFHELPER
public boolean canSerialize() {
return this.serialize;
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java

View File

@ -637,7 +637,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public static net.minecraft.network.chat.Component asVanilla(final Component component) {
+ if (true) return new AdventureComponent(component);
+ return net.minecraft.network.chat.Component.Serializer.fromJsonTree(GSON.serializer().toJsonTree(component));
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GSON.serializer().toJsonTree(component));
+ }
+
+ public static List<net.minecraft.network.chat.Component> asVanilla(final List<Component> adventures) {
@ -664,7 +664,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (component instanceof AdventureComponent) {
+ return asJsonString(((AdventureComponent) component).wrapped, locale);
+ }
+ return net.minecraft.network.chat.Component.Serializer.componentToJson(component);
+ return net.minecraft.network.chat.Component.Serializer.toJson(component);
+ }
+
+ // thank you for being worse than wet socks, Bukkit
@ -759,7 +759,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ tag.putString("author", asJsonString(book.author(), locale));
+ final ListTag pages = new ListTag();
+ for (final Component page : book.pages()) {
+ pages.add(StringTag.create(asJsonString(page, locale)));
+ pages.add(StringTag.valueOf(asJsonString(page, locale)));
+ }
+ tag.put("pages", pages);
+ return item;
@ -897,7 +897,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public net.minecraft.network.chat.Component serialize(final Component component) {
+ return net.minecraft.network.chat.Component.Serializer.fromJsonTree(PaperAdventure.GSON.serializer().toJsonTree(component));
+ return net.minecraft.network.chat.Component.Serializer.fromJson(PaperAdventure.GSON.serializer().toJsonTree(component));
+ }
+}
diff --git a/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java b/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java
@ -946,14 +946,6 @@ diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/ChatFormatting.java
+++ b/src/main/java/net/minecraft/ChatFormatting.java
@@ -0,0 +0,0 @@ public enum ChatFormatting {
return !this.isFormat && this != RESET;
}
+ @Nullable public Integer getHexValue() { return this.getColor(); } // Paper - OBFHELPER
@Nullable
public Integer getColor() {
return this.color;
@@ -0,0 +0,0 @@ public enum ChatFormatting {
return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name));
}
@ -961,7 +953,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Nullable public static ChatFormatting getByHexValue(int i) {
+ for (ChatFormatting value : values()) {
+ if (value.getHexValue() != null && value.getHexValue() == i) {
+ if (value.getColor() != null && value.getColor() == i) {
+ return value;
+ }
+ }
@ -973,18 +965,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable
public static ChatFormatting getById(int colorIndex) {
if (colorIndex < 0) {
diff --git a/src/main/java/net/minecraft/nbt/StringTag.java b/src/main/java/net/minecraft/nbt/StringTag.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/nbt/StringTag.java
+++ b/src/main/java/net/minecraft/nbt/StringTag.java
@@ -0,0 +0,0 @@ public class StringTag implements Tag {
this.data = value;
}
+ public static StringTag create(final String value) { return valueOf(value); } // Paper - OBFHELPER
public static StringTag valueOf(String value) {
return value.isEmpty() ? EMPTY : new StringTag(value);
}
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@ -1070,22 +1050,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
JsonObject jsonobject = new JsonObject();
if (!ichatbasecomponent.getStyle().isEmpty()) {
@@ -0,0 +0,0 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
});
}
+ public static String componentToJson(final Component component) { return toJson(component); } // Paper - OBFHELPER
public static String toJson(Component text) {
return Component.Serializer.GSON.toJson(text);
}
@@ -0,0 +0,0 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
return (MutableComponent) GsonHelper.fromJson(Component.Serializer.GSON, json, MutableComponent.class, false);
}
+ public static @Nullable Component fromJsonTree(final JsonElement json) { return fromJson(json); } // Paper - OBFHELPER
@Nullable
public static MutableComponent fromJson(JsonElement json) {
return (MutableComponent) Component.Serializer.GSON.fromJson(json, MutableComponent.class);
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
@ -1601,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/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack {
}
// CraftBukkit end
+ public Component displayName() { return this.getDisplayName(); } // Paper - OBFHELPER
public Component getDisplayName() {
MutableComponent ichatmutablecomponent = (new TextComponent("")).append(this.getHoverName());
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
@ -2575,7 +2527,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component displayName(@org.jetbrains.annotations.NotNull ItemStack itemStack) {
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).displayName());
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName());
+ }
+ // Paper end
}
@ -3120,8 +3072,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public net.kyori.adventure.text.format.TextColor color() throws IllegalStateException {
+ CraftScoreboard scoreboard = checkState();
+ if (team.getColor().getHexValue() == null) throw new IllegalStateException("Team colors must have hex values");
+ net.kyori.adventure.text.format.TextColor color = net.kyori.adventure.text.format.TextColor.color(team.getColor().getHexValue());
+ if (team.getColor().getColor() == null) throw new IllegalStateException("Team colors must have hex values");
+ net.kyori.adventure.text.format.TextColor color = net.kyori.adventure.text.format.TextColor.color(team.getColor().getColor());
+ if (!(color instanceof net.kyori.adventure.text.format.NamedTextColor)) throw new IllegalStateException("Team doesn't have a NamedTextColor");
+ return (net.kyori.adventure.text.format.NamedTextColor) color;
+ }

View File

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
+ if (goalFloat != null) {
+ if (goalFloat.validConditions()) goalFloat.update();
+ this.getJumpControl().jumpIfSet();
+ this.getJumpControl().tick();
+ }
+ if ((this instanceof net.minecraft.world.entity.monster.Blaze || this instanceof net.minecraft.world.entity.monster.EnderMan) && isInWaterRainOrBubble()) {
+ hurt(DamageSource.DROWN, 1.0F);
@ -61,18 +61,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.level.getProfiler().push("sensing");
this.sensing.tick();
this.level.getProfiler().pop();
diff --git a/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java b/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java
+++ b/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java
@@ -0,0 +0,0 @@ public class JumpControl implements Control {
this.jump = true;
}
+ public final void jumpIfSet() { this.tick(); } // Paper - OBFHELPER
public void tick() {
this.mob.setJumping(this.jump);
this.jump = false;
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java

View File

@ -1398,7 +1398,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int section = (bottomBlockY >> 4) - chunkPacketInfo.getChunk().getMinSection();
+ chunkPacketInfo.setBitsPerObject(section, this.bits);
+ chunkPacketInfo.setDataPalette(section, this.palette);
+ chunkPacketInfo.setDataBitsIndex(section, buf.writerIndex() + FriendlyByteBuf.getVarIntSize(this.storage.getDataBits().length));
+ chunkPacketInfo.setDataBitsIndex(section, buf.writerIndex() + FriendlyByteBuf.getVarIntSize(this.storage.getRaw().length));
+ chunkPacketInfo.setPredefinedObjects(section, this.predefinedObjects);
+ }
+ // Paper end

View File

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ String string = compound.getString(key);
+ try {
+ return Component.Serializer.jsonToComponent(string);
+ return Component.Serializer.fromJson(string);
+ } catch (com.google.gson.JsonParseException e) {
+ org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage());
+ }

View File

@ -260,7 +260,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ public static ChunkStatus getChunkStatus(ChunkHolder chunk) {
+ List<ChunkStatus> statuses = ServerChunkCache.getPossibleChunkStatuses();
+ List<ChunkStatus> statuses = net.minecraft.server.level.ServerChunkCache.CHUNK_STATUSES;
+ for (int i = statuses.size() - 1; i >= 0; --i) {
+ ChunkStatus curr = statuses.get(i);
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = chunk.getFutureIfPresentUnchecked(curr);
@ -394,8 +394,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ ticketData.addProperty("ticket-type", ticket.getType().toString());
+ ticketData.addProperty("ticket-level", ticket.getTicketLevel());
+ ticketData.addProperty("object-reason", String.valueOf(ticket.getObjectReason()));
+ ticketData.addProperty("add-tick", ticket.getCreationTick());
+ ticketData.addProperty("object-reason", String.valueOf(ticket.key));
+ ticketData.addProperty("add-tick", ticket.createdTick);
+
+ ticketsData.add(ticketData);
+ }
@ -428,44 +428,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static int getTicketLevelFor(net.minecraft.world.level.chunk.ChunkStatus status) {
return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.ChunkStatus.getDistance(status);
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -0,0 +0,0 @@ public class ChunkHolder {
public int oldTicketLevel;
private int ticketLevel;
private int queueLevel;
- final ChunkPos pos;
+ public final ChunkPos pos; // Paper - package->public
private boolean hasChangedSections;
private final ShortSet[] changedBlocksPerSection;
private final BitSet blockChangedLightSectionFilter;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper
public class ServerChunkCache extends ChunkSource {
- private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList();
+ private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList(); public static final List<ChunkStatus> getPossibleChunkStatuses() { return ServerChunkCache.CHUNK_STATUSES; } // Paper - OBFHELPER
private final DistanceManager distanceManager;
public final ChunkGenerator generator;
final ServerLevel level;
diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/Ticket.java
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
@@ -0,0 +0,0 @@ import java.util.Objects;
public final class Ticket<T> implements Comparable<Ticket<?>> {
private final TicketType<T> type;
private final int ticketLevel;
- public final T key;
- private long createdTick;
+ public final T key; public final T getObjectReason() { return this.key; } // Paper - OBFHELPER
+ private long createdTick; public final long getCreationTick() { return this.createdTick; } // Paper - OBFHELPER
protected Ticket(TicketType<T> type, int level, T argument) {
this.type = type;

View File

@ -74,8 +74,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
private final int ticketLevel;
public final T key; public final T getObjectReason() { return this.key; } // Paper - OBFHELPER
private long createdTick; public final long getCreationTick() { return this.createdTick; } // Paper - OBFHELPER
public final T key;
public long createdTick;
+ public long delayUnloadBy; // Paper
protected Ticket(TicketType<T> type, int level, T argument) {

View File

@ -39,12 +39,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ UUID uuid = new UUID(most, least);
+ CraftWorld world = (CraftWorld) Bukkit.getWorld(uuid);
+ if (world != null) {
+ dimension = StringTag.create("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
+ dimension = StringTag.valueOf("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
+ } else {
+ dimension = StringTag.create("bukkit:_invalidworld_");
+ dimension = StringTag.valueOf("bukkit:_invalidworld_");
+ }
+ } else {
+ dimension = StringTag.create("bukkit:_invalidworld_");
+ dimension = StringTag.valueOf("bukkit:_invalidworld_");
+ }
+ }
+ DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, dimension)); // CraftBukkit - decompile error

View File

@ -16,15 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
++this.inGroundTime;
} else {
+ if (tickCount > 200) this.tickDespawnCounter(); // Paper - tick despawnCounter regardless after 10 seconds
+ if (tickCount > 200) this.tickDespawn(); // Paper - tick despawnCounter regardless after 10 seconds
this.inGroundTime = 0;
Vec3 vec3d2 = this.position();
@@ -0,0 +0,0 @@ public abstract class AbstractArrow extends Projectile {
}
+ protected final void tickDespawnCounter() { this.tickDespawn(); } // Paper - OBFHELPER
protected void tickDespawn() {
++this.life;
if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? level.paperConfig.creativeArrowDespawnRate : (pickup == Pickup.DISALLOWED ? level.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?

View File

@ -4,19 +4,6 @@ Date: Fri, 12 Oct 2018 01:37:22 -0500
Subject: [PATCH] Here's Johnny!
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -0,0 +0,0 @@ public class Vindicator extends AbstractIllager {
public static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (difficulty) -> {
return difficulty == Difficulty.NORMAL || difficulty == Difficulty.HARD;
};
- boolean isJohnny;
+ private boolean isJohnny; public boolean isJohnny() { return this.isJohnny; } public void setJohnny(boolean johnny) { this.isJohnny = johnny; } // Paper - OBFHELPER
public Vindicator(EntityType<? extends Vindicator> type, Level world) {
super(type, world);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java
@ -28,11 +15,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ // Paper start
+ public boolean isJohnny() {
+ return getHandle().isJohnny();
+ return getHandle().isJohnny;
+ }
+
+ public void setJohnny(boolean johnny) {
+ getHandle().setJohnny(johnny);
+ getHandle().isJohnny = johnny;
+ }
+ // Paper end
}

View File

@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int ticketLevel;
- private int queueLevel;
+ public volatile int queueLevel; // Paper - private->public, make volatile since this is concurrently accessed
public final ChunkPos pos; // Paper - package->public
public final ChunkPos pos;
private boolean hasChangedSections;
private final ShortSet[] changedBlocksPerSection;
@@ -0,0 +0,0 @@ public class ChunkHolder {
@ -1080,8 +1080,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/Ticket.java
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
public final T key; public final T getObjectReason() { return this.key; } // Paper - OBFHELPER
private long createdTick; public final long getCreationTick() { return this.createdTick; } // Paper - OBFHELPER
public final T key;
public long createdTick;
public long delayUnloadBy; // Paper
+ public int priority; // Paper - Chunk priority

View File

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component displayName(@org.jetbrains.annotations.NotNull ItemStack itemStack) {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).displayName());
return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName());
}
+
+ // Paper start

View File

@ -7,18 +7,6 @@ Gets the Display name as seen in the Client.
Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/net/minecraft/locale/Language.java b/src/main/java/net/minecraft/locale/Language.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/locale/Language.java
+++ b/src/main/java/net/minecraft/locale/Language.java
@@ -0,0 +0,0 @@ public abstract class Language {
instance = language;
}
+ @Deprecated public String translateKey(String key) { return getOrDefault(key); } // Paper - OBFHELPER
public abstract String getOrDefault(String key);
public abstract boolean has(String key);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java

View File

@ -3455,18 +3455,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - multithreaded fields
private AtomicInteger chatSpamTickCount = new AtomicInteger();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/util/BitStorage.java
+++ b/src/main/java/net/minecraft/util/BitStorage.java
@@ -0,0 +0,0 @@ public class BitStorage {
return (int)(l >> j & this.mask);
}
+ public final long[] getDataBits() { return this.getRaw(); } // Paper - OBFHELPER
public long[] getRaw() {
return this.data;
}
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
@ -3906,18 +3894,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected abstract BlockState asState();
public boolean requiresCorrectToolForDrops() {
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -0,0 +0,0 @@ public class WorldBorder {
return this.getDistanceToBorder(entity.getX(), entity.getZ());
}
+ public final VoxelShape asVoxelShape(){ return getCollisionShape();} // Paper - OBFHELPER
public VoxelShape getCollisionShape() {
return this.extent.getCollisionShape();
}
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

View File

@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- action.accept(voxelShape);
+ // Paper start
+ if (worldBorder.isWithinBounds(aABB.deflate(1.0E-7D)) && !worldBorder.isWithinBounds(aABB.inflate(1.0E-7D))) {
+ action.accept(worldBorder.asVoxelShape());
+ action.accept(worldBorder.getCollisionShape());
+ // Paper end
return true;
}

View File

@ -20,18 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Paper end
public FriendlyByteBuf writeComponent(Component text) {
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -0,0 +0,0 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
return Component.Serializer.GSON.toJsonTree(text);
}
+ @Nullable public static Component jsonToComponent(String json) { return fromJson(json);} // Paper - OBFHELPER
@Nullable
public static MutableComponent fromJson(String json) {
return (MutableComponent) GsonHelper.fromJson(Component.Serializer.GSON, json, MutableComponent.class, false);
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java

View File

@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int weight = 0;
+ for (Object2IntMap.Entry<GossipType> entry : entries.object2IntEntrySet()) {
+ if (gossipTypeFilter.test(entry.getKey())) {
+ weight += entry.getIntValue() * entry.getKey().getWeight();
+ weight += entry.getIntValue() * entry.getKey().weight;
+ }
+ }
+ return weight;
@ -81,16 +81,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public Stream<GossipContainer.GossipEntry> unpack(UUID target) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
@@ -0,0 +0,0 @@ public enum GossipType {
public static final int REPUTATION_CHANGE_PER_EVERLASTING_MEMORY = 20;
public static final int REPUTATION_CHANGE_PER_TRADE = 2;
public final String id;
- public final int weight;
+ public final int weight; public int getWeight() { return weight; } // Paper - OBFHELPER
public final int max;
public final int decayPerDay;
public final int decayPerTransfer;

View File

@ -12,19 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
this.setHealth(this.getMaxHealth());
+ this.setAirSupply(this.getMaxAirTicks()); // Paper
+ this.setAirSupply(this.getMaxAirSupply()); // Paper
this.remainingFireTicks = 0;
this.fallDistance = 0;
this.foodData = new FoodData(this);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
+ public final int getMaxAirTicks() { return getMaxAirSupply(); } // Paper - OBFHELPER
public int getMaxAirSupply() {
return 300;
}

View File

@ -158,7 +158,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ public static Timing getCommandFunctionTiming(CommandFunction function) {
+ return Timings.ofSafe("Command Function - " + function.getMinecraftKey().toString());
+ return Timings.ofSafe("Command Function - " + function.getId());
+ }
+}
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
@ -739,13 +739,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CommandFunction(ResourceLocation id, CommandFunction.Entry[] elements) {
this.id = id;
this.entries = elements;
}
+ public final ResourceLocation getMinecraftKey() { return this.getId(); } // Paper - OBFHELPER
public ResourceLocation getId() {
return this.id;
}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java

View File

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ try {
+ list.set(index, convert(json));
+ } catch (JsonParseException e) {
+ list.set(index, net.minecraft.nbt.StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent(""))));
+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent(""))));
+ }
+ }
+ }
@ -43,12 +43,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ private net.minecraft.nbt.StringTag convert(String json) {
+ Component component = Component.Serializer.jsonToComponent(json);
+ Component component = Component.Serializer.fromJson(json);
+ if (component instanceof TextComponent && component.getContents().contains("\u00A7") && component.getSiblings().isEmpty()) {
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(component.getContents())[0];
+ }
+ return net.minecraft.nbt.StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
+ return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
+ }
// Paper end

View File

@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ // this.g();
+ // return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
+ return (V) this.getBackingMap().computeIfPresent(this.getMappingKey(key), (k, v) -> {
+ return (V) this.getBackingMap().computeIfPresent(this.getKeyForUser(key), (k, v) -> {
+ return v.hasExpired() ? null : v;
+ });
+ // Paper end
@ -99,15 +99,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.getBackingMap().isEmpty(); // Paper - readability is the goal. As an aside, isEmpty() uses only sumCount() and a comparison. size() uses sumCount(), casts, and boolean logic
}
+ protected final String getMappingKey(K k0) { return getKeyForUser(k0); } // Paper - OBFHELPER
protected String getKeyForUser(K profile) {
return profile.toString();
}
@@ -0,0 +0,0 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
return this.map.containsKey(this.getKeyForUser(k0));
}
+ private void removeStaleEntries() { removeExpired(); } // Paper - OBFHELPER
private void removeExpired() {
- List<K> list = Lists.newArrayList();
- Iterator iterator = this.map.values().iterator();
@ -141,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void save() throws IOException {
+ this.removeStaleEntries(); // Paper - remove expired values before saving
+ this.removeExpired(); // Paper - remove expired values before saving
JsonArray jsonarray = new JsonArray();
Stream<JsonObject> stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error
JsonObject jsonobject = new JsonObject();

View File

@ -185,7 +185,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.level.timings.tracker2.startTiming();
+ try {
+ for (TrackedEntity tracker : this.entityMap.values()) {
+ tracker.serverEntity.tick();
+ tracker.serverEntity.sendChanges();
+ }
+ } finally {
+ this.level.timings.tracker2.stopTiming();
@ -299,18 +299,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
i = j;
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -0,0 +0,0 @@ public class ServerEntity {
this.wasOnGround = entity.isOnGround();
}
+ public final void tick() { this.sendChanges(); } // Paper - OBFHELPER
public void sendChanges() {
List<Entity> list = this.entity.getPassengers();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java