Jump to content

[1.7.2] Custom CraftingTable problem


Trese759

Recommended Posts

Hi, I'm trying to make a custom workbench and I encountered two problems: the first is that it fails to take the textures and the second is that when I right click on the workbench minecraft crash. How can I fix these two problems?

 

Workbench

 

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import megakron.Megakron;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

public class WorkSurface extends Block {

@SideOnly(Side.CLIENT)
private IIcon workSurfaceTop;
private IIcon workSurfaceFront;

public WorkSurface() {
	super(Material.wood);

	this.setHardness((float) 3.0);
	this.setResistance((float) 5.0);
	this.setCreativeTab(Megakron.tabMK);
}

@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
        return side == 1 ? this.workSurfaceTop : (side == 0 ? Blocks.obsidian.getBlockTextureFromSide(side) : (side != 2 && side != 4 ? this.blockIcon : this.workSurfaceFront));
}

@SideOnly(Side.CLIENT)
public void registerBlockIcon(IIconRegister iconRegister) {
	this.blockIcon = iconRegister.registerIcon("megakron:workSurfaceSide");
        this.workSurfaceTop = iconRegister.registerIcon("megakron:workSurfaceTap");
        this.workSurfaceFront = iconRegister.registerIcon("megakron:workSurfaceFront");
}

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {

	if(!player.isSneaking()) {
		player.openGui(Megakron.instance, Megakron.guiIDWorkSurface, world, x, y, z);
		return true;
	}
	else {
		return false;
	}
}

}

 

GuiHandler

 

import megakron.Megakron;
import megakron.container.ContainerSuperGlueFurnace;
import megakron.container.ContainerWorkSurface;
import megakron.gui.GuiSuperGlueFurnace;
import megakron.tileentity.TileEntitySuperGlueFurnace;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

	TileEntity entity = world.getTileEntity(x, y, z);

	if(entity != null) {
		switch(ID) {
		case Megakron.guiIDSuperGlueFurnace:
			if(entity instanceof TileEntitySuperGlueFurnace) {
				return new ContainerSuperGlueFurnace(player.inventory, (TileEntitySuperGlueFurnace) entity);
			}
		}
	}

	if(ID == Megakron.guiIDWorkSurface) {
		return ID == Megakron.guiIDWorkSurface && world.getBlock(x, y, z) == Megakron.blockWorkSurface ? new ContainerWorkSurface(player.inventory, world, x, y, z) : null;
	}

	return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

	TileEntity entity = world.getTileEntity(x, y, z);

	if(entity != null) {
		switch(ID) {
		case Megakron.guiIDSuperGlueFurnace:
			if(entity instanceof TileEntitySuperGlueFurnace) {
				return new GuiSuperGlueFurnace(player.inventory, (TileEntitySuperGlueFurnace) entity);
			}
		}
	}

	return null;
}

}

 

WorkbenchContainer

 

import megakron.Megakron;
import megakron.craftign.WorkSurfaceCraftingManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;

public class ContainerWorkSurface extends Container {

public InventoryCrafting craftMatrix;
public IInventory craftResult;
private World worldObj;
private int posX;
private int posY;
private int posZ;

public ContainerWorkSurface(InventoryPlayer invPlayer, World world, int x, int y, int z) {
	craftMatrix = new InventoryCrafting(this, 5, 5);
	craftResult = new InventoryCraftResult();
	worldObj = world;
	posX = x;
	posY = y;
	posZ = z;

	this.addSlotToContainer(new SlotCrafting(invPlayer.player, craftMatrix, craftResult, 0, 131, 36));

	for(int i = 0; i < 5; i++) {
		for(int k = 0; k < 5; k++) {
			this.addSlotToContainer(new Slot(craftMatrix, k + i * 5, 4 + k * 18, 3 + i * 18));
		}
	}

	for(int i = 0; i < 3; i++) {
		for(int k = 0; k < 9; k++) {
			this.addSlotToContainer(new Slot(invPlayer, k + i * 9 + 9, 8 + k * 18, 94 + i * 18));
		}
	}

	for(int i = 0; i < 9; i++) {
		this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 148));
	}

	onCraftMatrixChanged(craftMatrix);
}

public void onCraftMatrixChanged(IInventory iInventory)
    {
        this.craftResult.setInventorySlotContents(0, WorkSurfaceCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
    }

@Override
public boolean canInteractWith(EntityPlayer player) {

	if(worldObj.getBlock(posX, posY, posZ) != Megakron.blockWorkSurface) {
		return false;
	}
	else {
		return player.getDistanceSq((double) posX + 0.5, (double) posY + 0.5, (double) posZ + 0.5) <= 64.0D;
	}
}

 public void onContainerClosed(EntityPlayer par1EntityPlayer) {
        super.onContainerClosed(par1EntityPlayer);

        if (!this.worldObj.isRemote) {
            for (int var2 = 0; var2 < 29; ++var2) {
                ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);

                if (var3 != null) {
                    par1EntityPlayer.dropPlayerItemWithRandomChoice(var3, false);
                }
            }
        }
    }

 public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
        ItemStack var3 = null;
        Slot var4 = (Slot)this.inventorySlots.get(p_82846_2_);

        if (var4 != null && var4.getHasStack()) {
            ItemStack var5 = var4.getStack();
            var3 = var5.copy();

            if (p_82846_2_ == 0) {
                if (!this.mergeItemStack(var5, 10, 46, true)) {
                    return null;
                }

                var4.onSlotChange(var5, var3);
            }
            else if (p_82846_2_ >= 10 && p_82846_2_ < 37) {
                if (!this.mergeItemStack(var5, 37, 46, false)) {
                    return null;
                }
            }
            else if (p_82846_2_ >= 37 && p_82846_2_ < 46) {
                if (!this.mergeItemStack(var5, 10, 37, false)) {
                    return null;
                }
            }
            else if (!this.mergeItemStack(var5, 10, 46, false)) {
                return null;
            }

            if (var5.stackSize == 0) {
                var4.putStack((ItemStack)null);
            }
            else {
                var4.onSlotChanged();
            }

            if (var5.stackSize == var3.stackSize) {
                return null;
            }

            var4.onPickupFromSlot(p_82846_1_, var5);
        }

        return var3;
    }
}

 

Crash Report textures

 

[14:40:24] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/blocks/MISSING_ICON_BLOCK_184_WorkSurface.png
java.io.FileNotFoundException: minecraft:textures/blocks/MISSING_ICON_BLOCK_184_WorkSurface.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:170) [TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:614) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:573) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:880) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
[14:40:25] [Client thread/INFO]: Created: 1024x1024 textures/blocks-atlas

 

Crash Report right click

 

[14:40:36] [Client thread/FATAL]: Unreported exception thrown!
java.lang.NullPointerException
at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:263) ~[NetworkRegistry.class:?]
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]
at megakron.blocks.WorkSurface.onBlockActivated(WorkSurface.java:43) ~[WorkSurface.class:?]
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376) ~[PlayerControllerMP.class:?]
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1486) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1999) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:984) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:900) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
---- Minecraft Crash Report ----
// Why is it breaking 

Time: 07/12/14 14.40
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:263)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at megakron.blocks.WorkSurface.onBlockActivated(WorkSurface.java:43)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1486)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1999)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:984)
at net.minecraft.client.Minecraft.run(Minecraft.java:900)
at net.minecraft.client.main.Main.main(Main.java:112)
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:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


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.getLocalGuiContainer(NetworkRegistry.java:263)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at megakron.blocks.WorkSurface.onBlockActivated(WorkSurface.java:43)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1486)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player64'/341, l='MpServer', x=145,73, y=65,62, z=277,96]]
Chunk stats: MultiplayerChunkCache: 225, 225
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-4,64,256), Chunk: (at 12,4,0 in -1,16; contains blocks -16,0,256 to -1,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 41664 game time, 12469 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 108 total; [EntityCreeper['Creeper'/275, l='MpServer', x=149,94, y=32,00, z=286,75], EntityCreeper['Creeper'/274, l='MpServer', x=159,65, y=56,00, z=234,70], EntityCreeper['Creeper'/273, l='MpServer', x=158,59, y=56,00, z=233,96], EntityWitch['Witch'/272, l='MpServer', x=155,50, y=56,00, z=234,50], EntitySkeleton['Skeleton'/279, l='MpServer', x=153,56, y=19,00, z=302,09], EntitySkeleton['Skeleton'/278, l='MpServer', x=159,16, y=60,00, z=287,59], EntityBat['Bat'/277, l='MpServer', x=152,47, y=61,10, z=287,75], EntityBat['Bat'/276, l='MpServer', x=152,25, y=63,10, z=285,75], EntityBat['Bat'/283, l='MpServer', x=147,34, y=60,10, z=306,25], EntityBat['Bat'/282, l='MpServer', x=155,53, y=52,10, z=301,38], EntityBat['Bat'/281, l='MpServer', x=155,75, y=52,10, z=297,41], EntitySkeleton['Skeleton'/280, l='MpServer', x=148,91, y=32,00, z=288,50], EntitySkeleton['Skeleton'/287, l='MpServer', x=150,50, y=44,00, z=342,88], EntityZombie['Zombie'/286, l='MpServer', x=151,41, y=49,00, z=310,41], EntityZombie['Zombie'/285, l='MpServer', x=151,50, y=49,00, z=314,50], EntitySpider['Spider'/284, l='MpServer', x=156,59, y=49,00, z=312,44], EntitySquid['Squid'/258, l='MpServer', x=143,50, y=49,00, z=262,50], EntityZombie['Zombie'/259, l='MpServer', x=133,31, y=46,00, z=296,03], EntitySquid['Squid'/256, l='MpServer', x=141,96, y=55,27, z=244,50], EntitySkeleton['Skeleton'/257, l='MpServer', x=130,38, y=25,00, z=261,30], EntitySpider['Spider'/262, l='MpServer', x=140,00, y=47,00, z=293,25], EntitySkeleton['Skeleton'/263, l='MpServer', x=132,16, y=46,00, z=295,50], EntitySkeleton['Skeleton'/260, l='MpServer', x=136,47, y=46,00, z=296,16], EntityCreeper['Creeper'/261, l='MpServer', x=131,31, y=46,00, z=295,50], EntitySkeleton['Skeleton'/264, l='MpServer', x=128,50, y=48,00, z=299,09], EntitySkeleton['Skeleton'/265, l='MpServer', x=134,88, y=14,00, z=319,47], EntityCreeper['Creeper'/270, l='MpServer', x=153,31, y=17,00, z=225,84], EntitySkeleton['Skeleton'/271, l='MpServer', x=150,50, y=55,00, z=234,91], EntityChicken['Chicken'/269, l='MpServer', x=156,28, y=80,00, z=200,66], EntitySlime['Slime'/305, l='MpServer', x=164,69, y=37,00, z=284,69], EntityCreeper['Creeper'/304, l='MpServer', x=164,25, y=52,00, z=263,84], EntityBat['Bat'/307, l='MpServer', x=175,72, y=42,10, z=280,28], EntitySkeleton['Skeleton'/306, l='MpServer', x=160,94, y=47,00, z=285,47], EntityBat['Bat'/309, l='MpServer', x=162,69, y=59,10, z=295,31], EntityBat['Bat'/308, l='MpServer', x=177,03, y=40,32, z=284,44], EntityZombie['Zombie'/311, l='MpServer', x=174,09, y=20,00, z=314,50], EntityZombie['Zombie'/310, l='MpServer', x=170,59, y=20,00, z=314,06], EntitySkeleton['Skeleton'/313, l='MpServer', x=174,69, y=20,00, z=311,38], EntityCreeper['Creeper'/312, l='MpServer', x=175,16, y=20,00, z=305,78], EntityBat['Bat'/315, l='MpServer', x=171,25, y=26,10, z=356,75], EntityZombie['Zombie'/314, l='MpServer', x=160,59, y=45,00, z=351,00], EntityZombie['Zombie'/317, l='MpServer', x=162,50, y=45,00, z=353,22], EntityZombie['Zombie'/318, l='MpServer', x=164,13, y=52,00, z=356,50], EntityZombie['Zombie'/288, l='MpServer', x=146,50, y=43,00, z=341,50], EntityBat['Bat'/289, l='MpServer', x=142,56, y=42,00, z=343,03], EntityZombie['Zombie'/290, l='MpServer', x=153,56, y=53,00, z=341,00], EntityChicken['Chicken'/298, l='MpServer', x=170,50, y=92,00, z=204,50], EntityChicken['Chicken'/299, l='MpServer', x=161,29, y=84,00, z=197,94], EntityChicken['Chicken'/300, l='MpServer', x=171,53, y=66,00, z=219,47], EntityZombie['Zombie'/301, l='MpServer', x=162,47, y=58,00, z=234,88], EntityChicken['Chicken'/302, l='MpServer', x=169,13, y=68,00, z=227,59], EntityZombie['Zombie'/303, l='MpServer', x=164,97, y=41,00, z=252,47], EntityPig['Pig'/343, l='MpServer', x=216,56, y=67,00, z=276,75], EntitySkeleton['Skeleton'/342, l='MpServer', x=193,50, y=25,00, z=292,88], EntityPig['Pig'/351, l='MpServer', x=213,14, y=68,00, z=329,60], EntityPig['Pig'/348, l='MpServer', x=199,06, y=70,00, z=217,91], EntityPig['Pig'/347, l='MpServer', x=216,56, y=68,00, z=248,38], EntityPig['Pig'/346, l='MpServer', x=201,33, y=71,00, z=225,38], EntityCreeper['Creeper'/345, l='MpServer', x=217,84, y=17,00, z=291,35], EntityPig['Pig'/344, l='MpServer', x=220,69, y=65,00, z=257,50], EntityZombie['Zombie'/326, l='MpServer', x=181,13, y=52,00, z=263,56], EntityBat['Bat'/327, l='MpServer', x=181,53, y=24,07, z=297,53], EntityCreeper['Creeper'/324, l='MpServer', x=176,00, y=42,00, z=255,59], EntityCreeper['Creeper'/325, l='MpServer', x=176,50, y=40,00, z=260,50], EntityPig['Pig'/322, l='MpServer', x=187,91, y=75,00, z=222,13], EntityChicken['Chicken'/323, l='MpServer', x=176,84, y=65,00, z=235,91], EntityChicken['Chicken'/321, l='MpServer', x=177,50, y=69,00, z=218,50], EntitySkeleton['Skeleton'/330, l='MpServer', x=179,09, y=20,00, z=307,56], EntityCreeper['Creeper'/328, l='MpServer', x=182,50, y=32,08, z=286,48], EntitySkeleton['Skeleton'/329, l='MpServer', x=185,09, y=19,00, z=316,63], EntityPig['Pig'/352, l='MpServer', x=215,94, y=66,00, z=327,84], EntityPig['Pig'/353, l='MpServer', x=216,19, y=67,00, z=322,56], EntityChicken['Chicken'/366, l='MpServer', x=213,53, y=72,00, z=206,63], EntityPig['Pig'/360, l='MpServer', x=209,50, y=69,00, z=338,69], EntitySkeleton['Skeleton'/362, l='MpServer', x=192,94, y=38,00, z=356,50], EntitySkeleton['Skeleton'/363, l='MpServer', x=195,32, y=42,00, z=356,69], EntityClientPlayerMP['Player64'/341, l='MpServer', x=145,73, y=65,62, z=277,96], EntityChicken['Chicken'/205, l='MpServer', x=69,59, y=69,00, z=259,38], EntitySkeleton['Skeleton'/204, l='MpServer', x=73,28, y=47,00, z=229,50], EntityCreeper['Creeper'/207, l='MpServer', x=68,50, y=31,00, z=275,00], EntityChicken['Chicken'/206, l='MpServer', x=72,19, y=68,00, z=265,69], EntityPig['Pig'/216, l='MpServer', x=84,72, y=64,00, z=334,66], EntityPig['Pig'/217, l='MpServer', x=92,70, y=66,00, z=353,13], EntityBat['Bat'/212, l='MpServer', x=90,50, y=48,10, z=233,53], EntityCreeper['Creeper'/213, l='MpServer', x=92,09, y=26,00, z=241,25], EntitySkeleton['Skeleton'/214, l='MpServer', x=90,84, y=31,00, z=278,41], EntitySquid['Squid'/215, l='MpServer', x=89,33, y=56,34, z=321,82], EntityChicken['Chicken'/209, l='MpServer', x=67,19, y=67,92, z=323,53], EntityChicken['Chicken'/210, l='MpServer', x=66,47, y=64,00, z=329,47], EntityPig['Pig'/239, l='MpServer', x=98,81, y=64,00, z=340,91], EntityPig['Pig'/238, l='MpServer', x=97,38, y=64,00, z=344,59], EntityPig['Pig'/237, l='MpServer', x=109,44, y=64,00, z=334,53], EntitySquid['Squid'/236, l='MpServer', x=95,96, y=54,28, z=309,63], EntitySquid['Squid'/235, l='MpServer', x=101,50, y=53,00, z=304,50], EntitySquid['Squid'/234, l='MpServer', x=96,50, y=53,21, z=307,60], EntityCreeper['Creeper'/233, l='MpServer', x=110,72, y=17,00, z=282,06], EntityCreeper['Creeper'/232, l='MpServer', x=107,78, y=17,00, z=285,16], EntitySkeleton['Skeleton'/231, l='MpServer', x=97,59, y=15,00, z=266,30], EntityZombie['Zombie'/230, l='MpServer', x=102,09, y=46,00, z=255,38], EntityCreeper['Creeper'/229, l='MpServer', x=97,00, y=46,00, z=254,56], EntityZombie['Zombie'/228, l='MpServer', x=103,01, y=66,00, z=236,56], EntitySkeleton['Skeleton'/254, l='MpServer', x=145,39, y=52,00, z=235,23], EntitySquid['Squid'/255, l='MpServer', x=135,00, y=56,00, z=244,51], EntityZombie['Zombie'/253, l='MpServer', x=128,50, y=16,00, z=213,50], EntitySkeleton['Skeleton'/250, l='MpServer', x=118,13, y=19,00, z=276,44], EntitySlime['Slime'/248, l='MpServer', x=124,31, y=11,57, z=208,31], EntitySkeleton['Skeleton'/249, l='MpServer', x=122,41, y=14,00, z=214,00], EntityPig['Pig'/240, l='MpServer', x=107,13, y=64,00, z=336,19]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:410)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2509)
at net.minecraft.client.Minecraft.run(Minecraft.java:929)
at net.minecraft.client.main.Main.main(Main.java:112)
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:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 869837744 bytes (829 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 15110 (846160 bytes; 0 MB) allocated, 2 (112 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.03 FML v7.2.217.1147 Minecraft Forge 10.12.2.1147 4 mods loaded, 4 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.217.1147} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.2.1147} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
megakron{1.0} [MegaKron] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: GeForce GTX 760/PCIe/SSE2 GL version 4.4.0 NVIDIA 344.60, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: 5202 (291312 bytes; 0 MB) allocated, 19 (1064 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\PC\Desktop\Minecraft mods\1.7.10 MegaKron\eclipse\.\crash-reports\crash-2014-12-07_14.40.36-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed

Link to comment
Share on other sites

registerBlockIcon

should be

registerBlockIcons

(an "s" at the end).

 

NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

this

is allowed only if you're registering the GUI handler in your main mod class. Otherwise, you have to use the instance of your mod:

NetworkRegistry.INSTANCE.registerGuiHandler(Megakron.instance, new GuiHandler());

Link to comment
Share on other sites

This is the Main class:

 

@Mod(modid = Megakron.MODID, name = Megakron.NAME, version = Megakron.VERSION)

public class Megakron {

//Name
public static final String MODID = "megakron";
public static final String NAME = "MegaKron";
public static final String VERSION = "1.0";
public static final String CLIENT_PROXY = "megakron.ClientProxy";
public static final String COMMON_PROXY = "megakron.CommonProxy";

@Instance("Megakron")
public static Megakron instance;

@SidedProxy(clientSide = Megakron.CLIENT_PROXY, serverSide = Megakron.COMMON_PROXY)
public static CommonProxy proxy;

        //Models
public static Block superWorkbench;
public static final int guiIDSuperWorkbench = 0;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {

        //Models
        superWorkbench = new SuperWorkbench(Material.rock).setBlockName("SuperWorkbench").setCreativeTab(tabMK).setBlockTextureName("");
		LanguageRegistry.addName(superWorkbench, "Super Workbench");
		GameRegistry.registerBlock(superWorkbench, "SuperWorkbench");

}

@EventHandler
public void load(FMLInitializationEvent event) {

	//GuiHandller
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hey folks. I am working on a custom "Mecha" entity (extended from LivingEntity) that the player builds up from blocks that should get modular stats depending on the used blocks. e.g. depending on what will be used for the legs, the entity will have a different jump strength. However, something unexpected is happening when trying to override a few of LivingEntity's functions and using my new own "Mecha" specific fields: instead of their actual instance-specific value, the default value is used (0f for a float, null for an object...) This is especially strange as when executing with the same entity from a point in the code specific to the mecha entity, the correct value is used. Here are some code snippets to better illustrate what I mean: protected float jumpMultiplier; //somewhere later during the code when spawning the entity, jumpMultiplier is set to something like 1.5f //changing the access to public didn't help @Override //Overridden from LivingEntity, this function is only used in the jumpFromGround() function, used in the aiStep() function, used in the LivingEntity tick() function protected float getJumpPower() { //something is wrong with this function //for some reason I can't correctly access the fields and methods from the instanciated entity when I am in one of those overridden protected functions. this is very annoying LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 0f return this.jumpMultiplier * super.getJumpPower(); } //The code above does not operate properly. Written as is, the entity will not jump, and adding debug logs shows that when executing the code, the value of this.jumpMultiplier is 0f //in contrast, it will be the correct value when done here: @Override public void tick() { super.tick(); //inherited LivingEntity logic //Custom logic LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 1.5f } My actual code is slightly different, as the jumpMuliplier is stored in another object (so I am calling "this.legModule.getJumpPower()" instead of the float), but even using a simple float exactly like in the code above didn't help. When running my usual code, the object I try to use is found to be null instead, leading to a crash from a nullPointerException. Here is the stacktrace of said crash: The full code can be viewed here. I have found a workaround in the case of jump strength, but have already found the same problem for another parameter I want to do, and I do not understand why the code is behaving as such, and I would very much like to be able to override those methods as intended - they seemed to work just fine like that for vanilla mobs... Any clues as to what may be happening here?
    • Please delete post. Had not noticed the newest edition for 1.20.6 which resolves the issue.
    • https://paste.ee/p/GTgAV Here's my debug log, I'm on 1.18.2 with forge 40.2.4 and I just want to get it to work!! I cant find any mod names in the error part and I would like some help from the pros!! I have 203 mods at the moment.
    • In 1.20.6 any potion brewed in the brewing stand disappears upon completion.
    • My game crashes whenever I click on Singleplayer then it crashes after the "Saving world". I'm playing on fabric 1.20.1 on forge for the easy instance loading. My game is using 12GB of RAM, I tried deleting the options.txt, and also renaming the saves file but neither worked. Here's the crash report link: https://mclo.gs/qByOqVK
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.