Fix failing to load a world with missing mod blocks and items. There will be a way to force worlds to load
when stuff is missing, but for right now, it will fail as this is "world safe".
This commit is contained in:
parent
2d1f9f2811
commit
64aa12b7e6
6 changed files with 142 additions and 20 deletions
|
@ -19,7 +19,21 @@
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class Minecraft implements IPlayerUsage
|
||||
{
|
||||
@@ -448,7 +453,7 @@
|
||||
@@ -323,8 +328,11 @@
|
||||
|
||||
public void func_71404_a(CrashReport p_71404_1_)
|
||||
{
|
||||
- this.field_71434_R = true;
|
||||
- this.field_71433_S = p_71404_1_;
|
||||
+ if (!FMLClientHandler.instance().handlingCrash(p_71404_1_))
|
||||
+ {
|
||||
+ this.field_71434_R = true;
|
||||
+ this.field_71433_S = p_71404_1_;
|
||||
+ }
|
||||
}
|
||||
|
||||
public void func_71377_b(CrashReport p_71377_1_)
|
||||
@@ -448,7 +456,7 @@
|
||||
this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
|
||||
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
|
||||
this.field_110451_am.func_110542_a(this.field_135017_as);
|
||||
|
@ -28,7 +42,7 @@
|
|||
this.field_71446_o = new TextureManager(this.field_110451_am);
|
||||
this.field_110451_am.func_110542_a(this.field_71446_o);
|
||||
this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y);
|
||||
@@ -508,12 +513,13 @@
|
||||
@@ -508,12 +516,13 @@
|
||||
this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
|
||||
GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
|
||||
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
|
||||
|
@ -43,7 +57,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -527,6 +533,7 @@
|
||||
@@ -527,6 +536,7 @@
|
||||
this.func_71352_k();
|
||||
}
|
||||
|
||||
|
@ -51,7 +65,7 @@
|
|||
Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
|
||||
}
|
||||
|
||||
@@ -916,9 +923,11 @@
|
||||
@@ -916,9 +926,11 @@
|
||||
|
||||
if (!this.field_71454_w)
|
||||
{
|
||||
|
@ -63,7 +77,7 @@
|
|||
}
|
||||
|
||||
GL11.glFlush();
|
||||
@@ -1496,6 +1505,8 @@
|
||||
@@ -1496,6 +1508,8 @@
|
||||
--this.field_71467_ac;
|
||||
}
|
||||
|
||||
|
@ -72,7 +86,7 @@
|
|||
this.field_71424_I.func_76320_a("gui");
|
||||
|
||||
if (!this.field_71445_n)
|
||||
@@ -1646,6 +1657,7 @@
|
||||
@@ -1646,6 +1660,7 @@
|
||||
this.field_71462_r.func_146274_d();
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +94,7 @@
|
|||
}
|
||||
|
||||
if (this.field_71429_W > 0)
|
||||
@@ -1787,6 +1799,7 @@
|
||||
@@ -1787,6 +1802,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +102,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1978,12 +1991,15 @@
|
||||
@@ -1978,12 +1994,15 @@
|
||||
this.field_71453_ak.func_74428_b();
|
||||
}
|
||||
|
||||
|
@ -104,7 +118,7 @@
|
|||
this.func_71403_a((WorldClient)null);
|
||||
System.gc();
|
||||
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
|
||||
@@ -2094,6 +2110,7 @@
|
||||
@@ -2094,6 +2113,7 @@
|
||||
this.field_110448_aq.func_148529_f();
|
||||
this.func_71351_a((ServerData)null);
|
||||
this.field_71455_al = false;
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java
|
||||
@@ -4,6 +4,8 @@
|
||||
@@ -4,6 +4,10 @@
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
+
|
||||
+import cpw.mods.fml.common.FMLCommonHandler;
|
||||
+import cpw.mods.fml.common.Loader;
|
||||
+import cpw.mods.fml.common.LoaderState;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -385,6 +387,7 @@
|
||||
@@ -385,6 +389,7 @@
|
||||
{
|
||||
if (this.func_71197_b())
|
||||
{
|
||||
|
@ -17,7 +19,7 @@
|
|||
long i = func_130071_aq();
|
||||
long l = 0L;
|
||||
this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C));
|
||||
@@ -429,6 +432,7 @@
|
||||
@@ -429,6 +434,7 @@
|
||||
Thread.sleep(1L);
|
||||
this.field_71296_Q = true;
|
||||
}
|
||||
|
@ -25,7 +27,18 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -475,6 +479,8 @@
|
||||
@@ -466,7 +472,10 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
+ if (Loader.instance().hasReachedState(LoaderState.SERVER_STARTED))
|
||||
+ {
|
||||
this.func_71260_j();
|
||||
+ }
|
||||
this.field_71316_v = true;
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
@@ -475,6 +484,8 @@
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -34,7 +47,7 @@
|
|||
this.func_71240_o();
|
||||
}
|
||||
}
|
||||
@@ -517,6 +523,7 @@
|
||||
@@ -517,6 +528,7 @@
|
||||
{
|
||||
long i = System.nanoTime();
|
||||
AxisAlignedBB.func_72332_a().func_72298_a();
|
||||
|
@ -42,7 +55,7 @@
|
|||
++this.field_71315_w;
|
||||
|
||||
if (this.field_71295_T)
|
||||
@@ -570,6 +577,7 @@
|
||||
@@ -570,6 +582,7 @@
|
||||
|
||||
this.field_71304_b.func_76319_b();
|
||||
this.field_71304_b.func_76319_b();
|
||||
|
@ -50,7 +63,7 @@
|
|||
}
|
||||
|
||||
public void func_71190_q()
|
||||
@@ -597,6 +605,7 @@
|
||||
@@ -597,6 +610,7 @@
|
||||
}
|
||||
|
||||
this.field_71304_b.func_76320_a("tick");
|
||||
|
@ -58,7 +71,7 @@
|
|||
CrashReport crashreport;
|
||||
|
||||
try
|
||||
@@ -621,6 +630,7 @@
|
||||
@@ -621,6 +635,7 @@
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
|
||||
|
@ -66,7 +79,7 @@
|
|||
this.field_71304_b.func_76319_b();
|
||||
this.field_71304_b.func_76320_a("tracker");
|
||||
worldserver.func_73039_n().func_72788_a();
|
||||
@@ -699,7 +709,7 @@
|
||||
@@ -699,7 +714,7 @@
|
||||
|
||||
public String getServerModName()
|
||||
{
|
||||
|
|
|
@ -21,7 +21,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
|
@ -69,6 +71,7 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
|||
import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.DuplicateModsFoundException;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLContainer;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.IFMLSidedHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
@ -78,6 +81,7 @@ import cpw.mods.fml.common.MissingModsException;
|
|||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.WorldAccessContainer;
|
||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.Action;
|
||||
|
@ -596,16 +600,35 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
}
|
||||
}
|
||||
|
||||
private CountDownLatch gameReleaseLatch;
|
||||
private Thread clientWaiter;
|
||||
private GameRegistryException gre;
|
||||
|
||||
public void launchIntegratedServerCallback(String dirName, String saveName)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.interrupted();
|
||||
gameReleaseLatch = new CountDownLatch(1);
|
||||
clientWaiter = Thread.currentThread();
|
||||
client.func_71371_a(dirName, saveName, (WorldSettings)null);
|
||||
System.out.printf("POKEE %b\n", Thread.currentThread().isInterrupted());
|
||||
gameReleaseLatch.await();
|
||||
}
|
||||
catch (InterruptedException ie)
|
||||
{
|
||||
Thread.interrupted();
|
||||
throw gre;
|
||||
}
|
||||
}
|
||||
catch (GameRegistryException gre)
|
||||
{
|
||||
client.func_71403_a(null);
|
||||
showGuiScreen(new GuiModItemsMissing(gre.getItems(), gre.getMessage()));
|
||||
}
|
||||
Thread.interrupted();
|
||||
}
|
||||
|
||||
public void showInGameModOptions(GuiIngameMenu guiIngameMenu)
|
||||
|
@ -801,4 +824,52 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
{
|
||||
return defaultMissingAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverLoadedSuccessfully()
|
||||
{
|
||||
if (gameReleaseLatch!=null)
|
||||
{
|
||||
gameReleaseLatch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failedServerLoading(RuntimeException ex, WorldAccessContainer wac)
|
||||
{
|
||||
if (wac instanceof FMLContainer && ex instanceof GameRegistryException)
|
||||
{
|
||||
try
|
||||
{
|
||||
gre = (GameRegistryException) ex;
|
||||
Executors.newSingleThreadExecutor().submit(new Callable<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void call() throws Exception
|
||||
{
|
||||
System.err.println("POKE");
|
||||
clientWaiter.interrupt();
|
||||
Thread.sleep(50);
|
||||
System.err.println("POKE");
|
||||
clientWaiter.interrupt();
|
||||
Thread.sleep(50);
|
||||
System.err.println("POKE");
|
||||
clientWaiter.interrupt();
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
FMLLog.log(Level.ERROR, t, "stuff");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handlingCrash(CrashReport report)
|
||||
{
|
||||
return report.func_71505_b() instanceof GameRegistryException;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,6 +266,7 @@ public class FMLCommonHandler
|
|||
|
||||
public boolean handleServerStarting(MinecraftServer server)
|
||||
{
|
||||
sidedDelegate.serverLoadedSuccessfully();
|
||||
return Loader.instance().serverStarting(server);
|
||||
}
|
||||
|
||||
|
@ -379,9 +380,17 @@ public class FMLCommonHandler
|
|||
{
|
||||
WorldAccessContainer wac = ((InjectedModContainer)mc).getWrappedWorldAccessContainer();
|
||||
if (wac != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
wac.readData(handler, worldInfo, additionalProperties, tagCompound.func_74775_l(mc.getModId()));
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
sidedDelegate.failedServerLoading(ex, wac);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,4 +57,8 @@ public interface IFMLSidedHandler
|
|||
void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side);
|
||||
|
||||
FMLMissingMappingsEvent.Action getDefaultMissingAction();
|
||||
|
||||
void serverLoadedSuccessfully();
|
||||
|
||||
void failedServerLoading(RuntimeException ex, WorldAccessContainer wac);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||
import cpw.mods.fml.common.IFMLSidedHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.WorldAccessContainer;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
|
@ -185,4 +186,14 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
{
|
||||
return FMLMissingMappingsEvent.Action.valueOf(System.getProperty("fml.missingBlockAction", "FAIL"));
|
||||
}
|
||||
@Override
|
||||
public void serverLoadedSuccessfully()
|
||||
{
|
||||
|
||||
}
|
||||
@Override
|
||||
public void failedServerLoading(RuntimeException ex, WorldAccessContainer wac)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue