mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Fix VanillaGoals when in reobfuscated environment (#6580)
This commit is contained in:
parent
36e77c4c63
commit
df51228b73
5 changed files with 15 additions and 118 deletions
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
config.set("settings.unsupported-settings.allow-permanent-block-break-exploits-readme", "This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks.");
|
||||
allowBlockPermanentBreakingExploits = getBoolean("settings.unsupported-settings.allow-permanent-block-break-exploits", allowBlockPermanentBreakingExploits);
|
||||
|
||||
}
|
||||
+
|
||||
+ public static boolean consoleHasAllPermissions = false;
|
||||
|
|
|
@ -43,9 +43,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
+ implementation("org.quiltmc:tiny-mappings-parser:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
|
||||
+
|
||||
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
||||
testImplementation("junit:junit:4.13.1")
|
||||
testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||
}
|
||||
@@ -0,0 +0,0 @@ tasks.shadowJar {
|
||||
transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)
|
||||
}
|
||||
|
@ -96,17 +96,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
enableBrigadierConsoleCompletions = getBoolean("settings.console.enable-brigadier-completions", enableBrigadierConsoleCompletions);
|
||||
log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag.");
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
+ public static boolean deobfuscateStacktraces = true;
|
||||
+ private static void loggerSettings() {
|
||||
+ deobfuscateStacktraces = getBoolean("settings.loggers.deobfuscate-stacktraces", deobfuscateStacktraces);
|
||||
+ }
|
||||
+
|
||||
public static int itemValidationDisplayNameLength = 8192;
|
||||
public static int itemValidationLocNameLength = 8192;
|
||||
public static int itemValidationLoreLineLength = 8192;
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
|
@ -253,7 +251,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ private static @Nullable Set<ClassMapping> loadMappingsIfPresent() {
|
||||
+ try (final @Nullable InputStream mappingsInputStream = StacktraceDeobfuscator.class.getClassLoader().getResourceAsStream("META-INF/mappings/reobf.tiny")) {
|
||||
+ try (final @Nullable InputStream mappingsInputStream = ObfHelper.class.getClassLoader().getResourceAsStream("META-INF/mappings/reobf.tiny")) {
|
||||
+ if (mappingsInputStream == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
|
@ -517,9 +515,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
}
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands();
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
+ io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
||||
// Paper end
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -0,0 +0,0 @@ dependencies {
|
||||
implementation("co.aikar:cleaner:1.0-SNAPSHOT") // Paper
|
||||
implementation("io.netty:netty-all:4.1.65.Final") // Paper
|
||||
|
||||
implementation("org.quiltmc:tiny-mappings-parser:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
|
||||
|
||||
+ testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
||||
testImplementation("junit:junit:4.13.1")
|
||||
|
@ -28,6 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet;
|
||||
+import com.google.common.collect.BiMap;
|
||||
+import com.google.common.collect.HashBiMap;
|
||||
+import io.papermc.paper.util.ObfHelper;
|
||||
+import java.lang.reflect.Constructor;
|
||||
+import java.util.EnumSet;
|
||||
+import java.util.HashMap;
|
||||
|
@ -157,107 +158,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ static {
|
||||
+ // TODO these kinda should be checked on each release, in case obfuscation changes
|
||||
+ deobfuscationMap.put("bee_b", "bee_attack");
|
||||
+ deobfuscationMap.put("bee_c", "bee_become_angry");
|
||||
+ deobfuscationMap.put("bee_d", "bee_enter_hive");
|
||||
+ deobfuscationMap.put("bee_e", "bee_go_to_hive");
|
||||
+ deobfuscationMap.put("bee_f", "bee_go_to_known_flower");
|
||||
+ deobfuscationMap.put("bee_g", "bee_grow_crop");
|
||||
+ deobfuscationMap.put("bee_h", "bee_hurt_by_other");
|
||||
+ deobfuscationMap.put("bee_i", "bee_locate_hive");
|
||||
+ deobfuscationMap.put("bee_k", "bee_pollinate");
|
||||
+ deobfuscationMap.put("bee_l", "bee_wander");
|
||||
+ deobfuscationMap.put("cat_a", "cat_avoid_entity");
|
||||
+ deobfuscationMap.put("cat_b", "cat_relax_on_owner");
|
||||
+ deobfuscationMap.put("dolphin_b", "dolphin_swim_to_treasure");
|
||||
+ deobfuscationMap.put("dolphin_c", "dolphin_swim_with_player");
|
||||
+ deobfuscationMap.put("dolphin_d", "dolphin_play_with_items");
|
||||
+ deobfuscationMap.put("drowned_a", "drowned_attack");
|
||||
+ deobfuscationMap.put("drowned_b", "drowned_goto_beach");
|
||||
+ deobfuscationMap.put("drowned_c", "drowned_goto_water");
|
||||
+ deobfuscationMap.put("drowned_e", "drowned_swim_up");
|
||||
+ deobfuscationMap.put("drowned_f", "drowned_trident_attack");
|
||||
+ deobfuscationMap.put("enderman_a", "enderman_freeze_when_looked_at");
|
||||
+ deobfuscationMap.put("evoker_a", "evoker_attack_spell");
|
||||
+ deobfuscationMap.put("evoker_b", "evoker_cast_spell");
|
||||
+ deobfuscationMap.put("evoker_c", "evoker_summon_spell");
|
||||
+ deobfuscationMap.put("evoker_d", "evoker_wololo_spell");
|
||||
+ deobfuscationMap.put("fish_b", "fish_swim");
|
||||
+ deobfuscationMap.put("fox_a", "fox_defend_trusted");
|
||||
+ deobfuscationMap.put("fox_b", "fox_faceplant");
|
||||
+ deobfuscationMap.put("fox_e", "fox_breed");
|
||||
+ deobfuscationMap.put("fox_f", "fox_eat_berries");
|
||||
+ deobfuscationMap.put("fox_g", "fox_float");
|
||||
+ deobfuscationMap.put("fox_h", "fox_follow_parent");
|
||||
+ deobfuscationMap.put("fox_j", "fox_look_at_player");
|
||||
+ deobfuscationMap.put("fox_l", "fox_melee_attack");
|
||||
+ deobfuscationMap.put("fox_n", "fox_panic");
|
||||
+ deobfuscationMap.put("fox_o", "fox_pounce");
|
||||
+ deobfuscationMap.put("fox_p", "fox_search_for_items");
|
||||
+ deobfuscationMap.put("fox_q", "fox_stroll_through_village");
|
||||
+ deobfuscationMap.put("fox_r", "fox_perch_and_search");
|
||||
+ deobfuscationMap.put("fox_s", "fox_seek_shelter");
|
||||
+ deobfuscationMap.put("fox_t", "fox_sleep");
|
||||
+ deobfuscationMap.put("fox_u", "fox_stalk_prey");
|
||||
+ deobfuscationMap.put("illager_abstract_b", "raider_open_door");
|
||||
+ deobfuscationMap.put("illager_illusioner_a", "illusioner_blindness_spell");
|
||||
+ deobfuscationMap.put("illager_illusioner_b", "illusioner_mirror_spell");
|
||||
+ deobfuscationMap.put("illager_wizard_b", "spellcaster_cast_spell");
|
||||
+ deobfuscationMap.put("llama_a", "llama_attack_wolf");
|
||||
+ deobfuscationMap.put("llama_c", "llama_hurt_by");
|
||||
+ deobfuscationMap.put("llama_trader_a", "llamatrader_defended_wandering_trader");
|
||||
+ deobfuscationMap.put("monster_patrolling_a", "long_distance_patrol");
|
||||
+ deobfuscationMap.put("ocelot_a", "ocelot_avoid_entity");
|
||||
+ deobfuscationMap.put("ocelot_b", "ocelot_tempt");
|
||||
+ deobfuscationMap.put("panda_b", "panda_attack");
|
||||
+ deobfuscationMap.put("panda_c", "panda_avoid");
|
||||
+ deobfuscationMap.put("panda_d", "panda_breed");
|
||||
+ deobfuscationMap.put("panda_e", "panda_hurt_by_target");
|
||||
+ deobfuscationMap.put("panda_f", "panda_lie_on_back");
|
||||
+ deobfuscationMap.put("panda_g", "panda_look_at_player");
|
||||
+ deobfuscationMap.put("panda_i", "panda_panic");
|
||||
+ deobfuscationMap.put("panda_j", "panda_roll");
|
||||
+ deobfuscationMap.put("panda_k", "panda_sit");
|
||||
+ deobfuscationMap.put("panda_l", "panda_sneeze");
|
||||
+ deobfuscationMap.put("phantom_b", "phantom_attack_player");
|
||||
+ deobfuscationMap.put("phantom_c", "phantom_attack_strategy");
|
||||
+ deobfuscationMap.put("phantom_e", "phantom_circle_around_anchor");
|
||||
+ deobfuscationMap.put("phantom_i", "phantom_sweep_attack");
|
||||
+ deobfuscationMap.put("polar_bear_a", "polarbear_attack_players");
|
||||
+ deobfuscationMap.put("polar_bear_b", "polarbear_hurt_by");
|
||||
+ deobfuscationMap.put("polar_bear_c", "polarbear_melee");
|
||||
+ deobfuscationMap.put("polar_bear_d", "polarbear_panic");
|
||||
+ deobfuscationMap.put("puffer_fish_a", "pufferfish_puff");
|
||||
+ deobfuscationMap.put("raider_a", "raider_hold_ground");
|
||||
+ deobfuscationMap.put("raider_b", "raider_obtain_banner");
|
||||
+ deobfuscationMap.put("raider_c", "raider_celebration");
|
||||
+ deobfuscationMap.put("raider_d", "raider_move_through_village");
|
||||
+ deobfuscationMap.put("ravager_a", "ravager_melee_attack");
|
||||
+ deobfuscationMap.put("shulker_a", "shulker_attack");
|
||||
+ deobfuscationMap.put("shulker_c", "shulker_defense");
|
||||
+ deobfuscationMap.put("shulker_d", "shulker_nearest");
|
||||
+ deobfuscationMap.put("shulker_e", "shulker_peek");
|
||||
+ deobfuscationMap.put("squid_a", "squid_flee");
|
||||
+ deobfuscationMap.put("abstract_skeleton_1", "abstract_skeleton_melee");
|
||||
+ deobfuscationMap.put("strider_a", "strider_go_to_lava");
|
||||
+ deobfuscationMap.put("turtle_a", "turtle_breed");
|
||||
+ deobfuscationMap.put("turtle_b", "turtle_go_home");
|
||||
+ deobfuscationMap.put("turtle_c", "turtle_goto_water");
|
||||
+ deobfuscationMap.put("turtle_d", "turtle_lay_egg");
|
||||
+ deobfuscationMap.put("turtle_f", "turtle_panic");
|
||||
+ deobfuscationMap.put("turtle_h", "turtle_random_stroll");
|
||||
+ deobfuscationMap.put("turtle_i", "turtle_tempt");
|
||||
+ deobfuscationMap.put("turtle_j", "turtle_travel");
|
||||
+ deobfuscationMap.put("vex_a", "vex_charge_attack");
|
||||
+ deobfuscationMap.put("vex_b", "vex_copy_target_of_owner");
|
||||
+ deobfuscationMap.put("vex_d", "vex_random_move");
|
||||
+ deobfuscationMap.put("villager_trader_a", "villagertrader_wander_to_position");
|
||||
+ deobfuscationMap.put("vindicator_a", "vindicator_break_door");
|
||||
+ deobfuscationMap.put("vindicator_b", "vindicator_johnny_attack");
|
||||
+ deobfuscationMap.put("vindicator_c", "vindicator_melee_attack");
|
||||
+ deobfuscationMap.put("wither_a", "wither_do_nothing");
|
||||
+ deobfuscationMap.put("wolf_a", "wolf_avoid_entity");
|
||||
+ deobfuscationMap.put("zombie_a", "zombie_attack_turtle_egg");
|
||||
+
|
||||
+ ignored.add("goal_selector_1");
|
||||
+ ignored.add("goal_selector_2");
|
||||
|
@ -362,9 +263,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ bukkitMap.put(net.minecraft.world.entity.animal.goat.Goat.class, org.bukkit.entity.Goat.class);
|
||||
+ }
|
||||
+
|
||||
+ // TODO: FIX THIS
|
||||
+ public static String getUsableName(Class<?> clazz) {
|
||||
+ String name = clazz.getName();
|
||||
+ String name = ObfHelper.INSTANCE.deobfClassName(clazz.getName());
|
||||
+ name = name.substring(name.lastIndexOf(".") + 1);
|
||||
+ boolean flag = false;
|
||||
+ // inner classes
|
||||
|
|
|
@ -46,9 +46,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
}
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands();
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
||||
+ io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag.");
|
||||
}
|
||||
private static void loggerSettings() {
|
||||
deobfuscateStacktraces = getBoolean("settings.loggers.deobfuscate-stacktraces", deobfuscateStacktraces);
|
||||
}
|
||||
+
|
||||
+ public static boolean allowBlockPermanentBreakingExploits = false;
|
||||
|
@ -30,7 +30,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ config.set("settings.unsupported-settings.allow-permanent-block-break-exploits-readme", "This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks.");
|
||||
+ allowBlockPermanentBreakingExploits = getBoolean("settings.unsupported-settings.allow-permanent-block-break-exploits", allowBlockPermanentBreakingExploits);
|
||||
+
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
|
|
Loading…
Reference in a new issue