From f492e25bc9b99c9cd899a53e37c35ca6b8745824 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 20 May 2018 11:21:05 -0700 Subject: [PATCH] Copy the Dedicated server's EULA checking to main() function so it can exit earlier. Closes #3659, #3661 --- .../ai/EntityAIHarvestFarmland.java.patch | 18 +++++++++--------- .../server/MinecraftServer.java.patch | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch index 1cd0deab2..5f941f5ab 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java +++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java +@@ -29,7 +29,7 @@ + { + if (this.field_179496_a <= 0) + { +- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c)) + { + return false; + } @@ -94,6 +94,12 @@ world.func_180501_a(blockpos, Blocks.field_185773_cZ.func_176223_P(), 3); flag = true; @@ -13,12 +22,3 @@ } if (flag) -@@ -29,7 +29,7 @@ - { - if (this.field_179496_a <= 0) - { -- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c)) - { - return false; - } diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 0f13b844e..e23c17f32 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -275,7 +275,24 @@ } public CrashReport func_71230_b(CrashReport p_71230_1_) -@@ -1598,4 +1644,9 @@ +@@ -1411,6 +1457,16 @@ + @SideOnly(Side.SERVER) + public static void main(String[] p_main_0_) + { ++ //Forge: Copied from DedicatedServer.init as to run as early as possible, Old code left in place intentionally. ++ //Done in good faith with permission: https://github.com/MinecraftForge/MinecraftForge/issues/3659#issuecomment-390467028 ++ ServerEula eula = new ServerEula(new File("eula.txt")); ++ if (!eula.func_154346_a()) ++ { ++ field_147145_h.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); ++ eula.func_154348_b(); ++ return; ++ } ++ + Bootstrap.func_151354_b(); + + try +@@ -1598,4 +1654,9 @@ { return this.field_175590_aa; }