В общем я пытался создать свою печку и появились проблемы.
Я думаю что проблема заключается в
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandlerDublicator());
так как this я считаю что это не instance. А если меня this на instance выдаёт лог
Скрытый текст
---- Minecraft Crash Report ----// Who set us up the TNT?Time: 22.08.15 16:16Description: Initializing gamejava.lang.NullPointerException: Initializing gameat cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:219)at com.longres.ExMod.ExMod.Load(ExMod.java:105)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)at com.google.common.eventbus.EventBus.post(EventBus.java:275)at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)at com.google.common.eventbus.EventBus.post(EventBus.java:275)at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)at net.minecraft.client.Minecraft.run(Minecraft.java:942)at net.minecraft.client.main.Main.main(Main.java:164)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)at net.minecraft.launchwrapper.Launch.main(Launch.java:28)at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)at GradleStart.main(Unknown Source)A detailed walkthrough of the error, its code path and all known details is as follows:----------------------------------------------------------------------------------------- Head --Stacktrace:at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:219)at com.longres.ExMod.ExMod.Load(ExMod.java:105)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)at com.google.common.eventbus.EventBus.post(EventBus.java:275)at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)at com.google.common.eventbus.EventBus.post(EventBus.java:275)at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)-- Initialization --Details:Stacktrace:at net.minecraft.client.Minecraft.run(Minecraft.java:942)at net.minecraft.client.main.Main.main(Main.java:164)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)at net.minecraft.launchwrapper.Launch.main(Launch.java:28)at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)at GradleStart.main(Unknown Source)-- System Details --Details:Minecraft Version: 1.7.10Operating System: Windows 8.1 (amd64) version 6.3Java Version: 1.7.0_79, Oracle CorporationJava VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle CorporationMemory: 951620624 bytes (907 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024MAABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) usedIntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 4 mods loaded, 4 mods activeStates: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = ErroredUCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)UCH FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)UCH Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)UCE exmod{1.0} [Experiance Mod] (bin)GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 355.60' Renderer: 'GeForce GT 630/PCIe/SSE2'Launched Version: 1.7.10LWJGL: 2.9.1OpenGL: GeForce GT 630/PCIe/SSE2 GL version 4.5.0 NVIDIA 355.60, NVIDIA CorporationGL Caps: Using GL 1.3 multitexturing.Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.Anisotropic filtering is supported and maximum anisotropy is 16.Shaders are available because OpenGL 2.1 is supported.Is Modded: Definitely; Client brand changed to 'fml,forge'Type: Client (map_client.txt)Resource Packs: []Current Language: Русский (Россия)Profiler Position: N/A (disabled)Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) usedAnisotropic Filtering: Off (1)
Вот исходники
Главный класс
Скрытый текст
package com.longres.ExMod;import cpw.mods.fml.common.Mod;import cpw.mods.fml.common.Mod.EventHandler;import cpw.mods.fml.common.Mod.Instance;import cpw.mods.fml.common.SidedProxy;import cpw.mods.fml.common.event.FMLPreInitializationEvent;import cpw.mods.fml.common.network.NetworkRegistry;import cpw.mods.fml.common.registry.EntityRegistry;import cpw.mods.fml.common.registry.GameRegistry;import net.minecraft.block.Block;import net.minecraft.entity.EntityList;import net.minecraft.init.Blocks;import net.minecraft.init.Items;import net.minecraft.item.Item;import net.minecraft.item.Item.ToolMaterial;import net.minecraft.item.ItemArmor.ArmorMaterial;import net.minecraft.item.ItemPickaxe;import net.minecraft.item.ItemStack;import net.minecraft.item.ItemSword;import net.minecraftforge.common.config.Configuration;import net.minecraftforge.common.util.EnumHelper;@Mod (modid = "exmod", name = "Experiance Mod", version = "1.0")public class ExMod {public static final String MODID = "minecraftbyexample";@SidedProxy(clientSide = "com.longres.ExMod.ClientSide", serverSide = "com.longres.ExMod.ServerSide")public static ServerSide proxy;@Mod.Instance(ExMod.MODID)public static ExMod instance;public static Block CBlock;public static Item MStick;public static Item MIngot;public static Item DMagic;public static Item CMagic;public static Item SwMagic;public static Item PicMagic;public static Block Neth;public static Item NethDust;public static final ToolMaterial MAGIC = EnumHelper.addToolMaterial("MAGIC1", 4, 2000, 10, 8, 30);static ArmorMaterial DURKMAGIC = EnumHelper.addArmorMaterial("DURKMAGIC1", 50, new int[] {5, 8, 6, 2}, 5);public static MGenerate MagGenerate = new MGenerate();public static NGenerate NethGenerate = new NGenerate();public static Item IMN;public static Item Neth0;public static Item Neth1;public static Item Neth2;public static Item Neth3;public static Item INeth;public static Item UnstableMag = new UnstableItem().setUnlocalizedName("UnstableItem");public static Block UnstableBlock = new Unstableb();public static Item DublicateItem = new DItem().setUnlocalizedName("DublicateItem");public static Block Dublicator = new DublicatorBlock();public static int Dublicator_Id=1;@EventHandlerpublic void init(FMLPreInitializationEvent event){proxy.initMod();proxy.registerRenderers();}@EventHandlerpublic void Load(FMLPreInitializationEvent event){EntityList.addMapping(SecuredMagic.class, "SecuredMagic", 111, 0x00008B, 0x006400);NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandlerDublicator());GameRegistry.registerTileEntity(TileEntityDublicator.class, "TileEntityDublicator");GameRegistry.registerBlock(Dublicator, "Dublicator");CBlock = new BlockCBlock();GameRegistry.registerBlock(CBlock, "CBlock");Neth = new NethBlock();GameRegistry.registerBlock(Neth, "NetherBlock");MIngot = new ItMIngot().setUnlocalizedName("MagicIngot");GameRegistry.registerItem(MIngot, "MagicIngot");NethDust = new NDItem().setUnlocalizedName("NetherDust");GameRegistry.registerItem(NethDust, "NetherDust");INeth = new INethBlock().setUnlocalizedName("IngotNetherMagic");GameRegistry.registerItem(INeth, "IngotNetherMagic");MStick = new ItemMStick().setUnlocalizedName("MagicStick");GameRegistry.registerItem(MStick, "MagicStick");DMagic = new ItDMagic().setUnlocalizedName("DustMagic");GameRegistry.registerItem(DMagic, "DustMagic");CMagic = new ItCMagic().setUnlocalizedName("CrystalMagic");GameRegistry.registerItem(CMagic, "CrystalMagic");SwMagic = new ItMSword().setUnlocalizedName("SwordMagic");GameRegistry.registerItem(SwMagic, "SwordMagic");PicMagic = new MagicPickaxe().setUnlocalizedName("PickaxeMagic");GameRegistry.registerItem(PicMagic, "PickaxeMagic");IMN = new ItIMN().setUnlocalizedName("IndontMagicNether");GameRegistry.registerItem(IMN, "IngontMagicNether");Neth0=new NethArmor(0,0).setUnlocalizedName("Helmet").setTextureName("ExMod:Neth0");Neth1=new NethArmor(0,1).setUnlocalizedName("Plate").setTextureName("ExMod:Neth1");Neth2=new NethArmor(0,2).setUnlocalizedName("Pants").setTextureName("ExMod:Neth2");Neth3=new NethArmor(0,3).setUnlocalizedName("Boots").setTextureName("ExMod:Neth3");GameRegistry.registerItem(Neth0, "Helmet");GameRegistry.registerItem(Neth1, "Plate");GameRegistry.registerItem(Neth2, "Pants");GameRegistry.registerItem(Neth3, "Boots");GameRegistry.registerItem(UnstableMag, "UnstableItem");GameRegistry.registerBlock(UnstableBlock, "UnstableBlock");GameRegistry.registerItem(DublicateItem, "DublicateItem");GameRegistry.addRecipe(new ItemStack(ExMod.MStick, 4), new Object[]{"X","X",('X'),ExMod.MIngot});GameRegistry.addSmelting(CBlock, new ItemStack(ExMod.MIngot, 1), 500.0F);GameRegistry.addRecipe(new ItemStack(ExMod.DMagic, 3), new Object[]{"X",('X'),ExMod.MIngot});GameRegistry.addRecipe(new ItemStack(ExMod.MIngot, 1), new Object[]{"XXX",('X'),ExMod.DMagic});GameRegistry.addRecipe(new ItemStack(ExMod.CMagic, 1), new Object[]{"XXX","XYX","XXX",('X'),ExMod.DMagic,('Y'),Items.diamond});GameRegistry.addRecipe(new ItemStack(ExMod.SwMagic, 1), new Object[]{"X","X","Y",('X'),ExMod.CMagic,('Y'),ExMod.MStick});GameRegistry.addRecipe(new ItemStack(ExMod.PicMagic, 1), new Object[]{"XXX"," Y "," Y ",('X'),ExMod.CMagic,('Y'),ExMod.MStick});GameRegistry.addRecipe(new ItemStack(ExMod.IMN, 1), new Object[]{"YX","YX",('X'),ExMod.NethDust,('Y'),ExMod.DMagic});GameRegistry.addSmelting(IMN, new ItemStack(ExMod.INeth, 1), 5000.0F);GameRegistry.addRecipe(new ItemStack(ExMod.Neth0, 1), new Object[]{"XXX","XYX",('X'),ExMod.INeth,('Y'),ExMod.IMN});GameRegistry.addRecipe(new ItemStack(ExMod.Neth1, 1), new Object[]{"X X","XXX","XXX",('X'),ExMod.INeth});GameRegistry.addRecipe(new ItemStack(ExMod.Neth2, 1), new Object[]{"XXX","X X","X X",('X'),ExMod.INeth});GameRegistry.addRecipe(new ItemStack(ExMod.Neth3, 1), new Object[]{"X X","X X",('X'),ExMod.INeth});GameRegistry.addRecipe(new ItemStack(ExMod.UnstableMag, 1), new Object[]{"XY","ZT",('X'),ExMod.DMagic,('Y'),ExMod.NethDust,('Z'),Items.ender_pearl,('T'),Items.redstone});GameRegistry.addRecipe(new ItemStack(ExMod.UnstableBlock, 1), new Object[]{"XXX","XYX","XXX",('X'),ExMod.UnstableMag,('Y'),Blocks.glass});Item item;GameRegistry.registerWorldGenerator(MagGenerate, 0);GameRegistry.registerWorldGenerator(NethGenerate, 0);}}
Handler
Скрытый текст
package com.longres.ExMod;import cpw.mods.fml.common.network.IGuiHandler;import cpw.mods.fml.common.network.NetworkRegistry;import net.minecraft.entity.player.EntityPlayer;import net.minecraft.tileentity.TileEntity;import net.minecraft.world.World;public class GuiHandlerDublicator implements IGuiHandler{@Overridepublic Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {return null;}@Overridepublic Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {System.out.println("qwe");TileEntity entity = world.getTileEntity(x, y, z);if (entity !=null) {switch (ID) {case 1: return new GuiDublicator(player.inventory);}}return null;}}
Gui
Скрытый текст
package com.longres.ExMod;import org.lwjgl.opengl.GL11;import net.minecraft.client.Minecraft;import net.minecraft.client.gui.inventory.GuiContainer;import net.minecraft.entity.player.InventoryPlayer;import net.minecraft.inventory.Container;import net.minecraft.util.ResourceLocation;public class GuiDublicator extends GuiContainer{private final ResourceLocation res = new ResourceLocation("exmod:textures/gui/magjuice.png");private TileEntityDublicator entity;public GuiDublicator(InventoryPlayer inv) {super(new GuiContainerDublicator(inv));this.xSize=176;this.ySize=166;}@Overrideprotected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {GL11.glColor4f(1F, 1F, 1F, 1F);Minecraft.getMinecraft().getTextureManager().bindTexture(res);drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);}}
Container
Скрытый текст
package com.longres.ExMod;import net.minecraft.entity.player.EntityPlayer;import net.minecraft.entity.player.InventoryPlayer;import net.minecraft.inventory.Container;public class GuiContainerDublicator extends Container{private TileEntityDublicator Entity;public GuiContainerDublicator(InventoryPlayer inventory) {}@Overridepublic boolean canInteractWith(EntityPlayer p_75145_1_) {// TODO Auto-generated method stubreturn false;}}
TileEntity
Скрытый текст
package com.longres.ExMod;import net.minecraft.tileentity.TileEntity;public class TileEntityDublicator extends TileEntity{public TileEntityDublicator () {}}
P.S. Извините что код полуголый. Много раз переписывал с начала. Вот оставил таким какой он работает.
P.S.S. Все делал по гайду немца http://www.youtube.c...er/LateinCecker