Fix server crash, fixes #392
This commit is contained in:
@@ -19,7 +19,7 @@ import refinedstorage.proxy.CommonProxy;
|
|||||||
public final class RefinedStorage {
|
public final class RefinedStorage {
|
||||||
public static final String ID = "refinedstorage";
|
public static final String ID = "refinedstorage";
|
||||||
public static final String VERSION = "1.1.1";
|
public static final String VERSION = "1.1.1";
|
||||||
public static final String DEPENDENCIES = "required-after:Forge@[12.18.1.2088,);required-after:mcmultipart@[1.2.1,);";
|
public static final String DEPENDENCIES = "required-after:Forge@[12.18.1.2088,);required-after:mcmultipart@[1.2.1,);after:JEI@[3.11.0,);";
|
||||||
public static final String GUI_FACTORY = "refinedstorage.gui.config.ModGuiFactory";
|
public static final String GUI_FACTORY = "refinedstorage.gui.config.ModGuiFactory";
|
||||||
|
|
||||||
@SidedProxy(clientSide = "refinedstorage.proxy.ClientProxy", serverSide = "refinedstorage.proxy.ServerProxy")
|
@SidedProxy(clientSide = "refinedstorage.proxy.ClientProxy", serverSide = "refinedstorage.proxy.ServerProxy")
|
||||||
|
|||||||
@@ -1,23 +1,19 @@
|
|||||||
package refinedstorage.network;
|
package refinedstorage.network;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewStack;
|
import refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewStack;
|
||||||
import refinedstorage.gui.GuiCraftingPreview;
|
import refinedstorage.proxy.ClientProxy;
|
||||||
import refinedstorage.gui.grid.GuiCraftingStart;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class MessageGridCraftingPreviewResponse implements IMessage, IMessageHandler<MessageGridCraftingPreviewResponse, IMessage> {
|
public class MessageGridCraftingPreviewResponse implements IMessage, IMessageHandler<MessageGridCraftingPreviewResponse, IMessage> {
|
||||||
private Collection<CraftingPreviewStack> stacks;
|
public Collection<CraftingPreviewStack> stacks;
|
||||||
private int hash;
|
public int hash;
|
||||||
private int quantity;
|
public int quantity;
|
||||||
|
|
||||||
public MessageGridCraftingPreviewResponse() {
|
public MessageGridCraftingPreviewResponse() {
|
||||||
}
|
}
|
||||||
@@ -56,14 +52,8 @@ public class MessageGridCraftingPreviewResponse implements IMessage, IMessageHan
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(MessageGridCraftingPreviewResponse message, MessageContext ctx) {
|
public IMessage onMessage(MessageGridCraftingPreviewResponse message, MessageContext ctx) {
|
||||||
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
ClientProxy.onReceiveCraftingPreviewResponse(message);
|
||||||
|
|
||||||
if (screen instanceof GuiCraftingStart) {
|
|
||||||
screen = ((GuiCraftingStart) screen).getParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
FMLCommonHandler.instance().showGuiScreen(new GuiCraftingPreview(screen, message.stacks, message.hash, message.quantity));
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import mcmultipart.client.multipart.ModelMultipartContainer;
|
|||||||
import mcmultipart.raytrace.PartMOP;
|
import mcmultipart.raytrace.PartMOP;
|
||||||
import mcmultipart.raytrace.RayTraceUtils;
|
import mcmultipart.raytrace.RayTraceUtils;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.VertexBuffer;
|
import net.minecraft.client.renderer.VertexBuffer;
|
||||||
@@ -20,6 +22,7 @@ import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
|||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
@@ -28,7 +31,10 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageBlocks;
|
import refinedstorage.RefinedStorageBlocks;
|
||||||
import refinedstorage.RefinedStorageItems;
|
import refinedstorage.RefinedStorageItems;
|
||||||
import refinedstorage.block.*;
|
import refinedstorage.block.*;
|
||||||
|
import refinedstorage.gui.GuiCraftingPreview;
|
||||||
|
import refinedstorage.gui.grid.GuiCraftingStart;
|
||||||
import refinedstorage.item.*;
|
import refinedstorage.item.*;
|
||||||
|
import refinedstorage.network.MessageGridCraftingPreviewResponse;
|
||||||
import refinedstorage.tile.TileController;
|
import refinedstorage.tile.TileController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -294,4 +300,14 @@ public class ClientProxy extends CommonProxy {
|
|||||||
return new ModelResourceLocation("refinedstorage:controller", "direction=north,energy=" + energy);
|
return new ModelResourceLocation("refinedstorage:controller", "direction=north,energy=" + energy);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onReceiveCraftingPreviewResponse(MessageGridCraftingPreviewResponse message) {
|
||||||
|
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||||
|
|
||||||
|
if (screen instanceof GuiCraftingStart) {
|
||||||
|
screen = ((GuiCraftingStart) screen).getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
FMLCommonHandler.instance().showGuiScreen(new GuiCraftingPreview(screen, message.stacks, message.hash, message.quantity));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user