Jump to content

Gui not opening


BlueGhast90

Recommended Posts

I have tried for days to get this to work, but I cant seem to make it work. Help would be appreciated I have tried this but It doesnt seem to help http://www.minecraftforge.net/wiki/Containers_and_GUIs

 

Block Class

import java.util.Random;

import AeroMod.Tutorial.AeroMod;
import AeroMod.Tutorial.TileEntity.TileEntityGrinder;

import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.src.ModLoader;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class GUIBlock extends Block {

public GUIBlock(int par1, String texture) {
super(par1, Material.rock);
setCreativeTab(CreativeTabs.tabBlock); 

}

public int idDropped(int par1, Random par2Random, int par3)
{
return AeroMod.GUIBlock.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}

public String getTextureFile(){
return "/textures/blocks/GUIBlock.png";
}

@Override
        public boolean onBlockActivated(World world, int x, int y, int z,
                        EntityPlayer player, int idk, float what, float these, float are) {
                TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
                if (tileEntity == null || player.isSneaking()) {
                        return true;
                }
                
                		player.openGui(AeroMod.instance, 0, world, x, y, z);
                		return true;
        	}

        @Override
        public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
                dropItems(world, x, y, z);
                super.breakBlock(world, x, y, z, par5, par6);
        }
        public TileEntity createNewTileEntity(World world) {
                return new TileEntityGrinder();
        }
        
        private void dropItems(World world, int x, int y, int z){
                Random rand = new Random();

                TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
                if (!(tileEntity instanceof IInventory)) {
                        return;
                }
                IInventory inventory = (IInventory) tileEntity;

                for (int i = 0; i < inventory.getSizeInventory(); i++) {
                        ItemStack item = inventory.getStackInSlot(i);

                        if (item != null && item.stackSize > 0) {
                                float rx = rand.nextFloat() * 0.8F + 0.1F;
                                float ry = rand.nextFloat() * 0.8F + 0.1F;
                                float rz = rand.nextFloat() * 0.8F + 0.1F;

                                EntityItem entityItem = new EntityItem(world,
                                                x + rx, y + ry, z + rz,
                                                new ItemStack(item.itemID, item.stackSize, item.getItemDamage()));

                                if (item.hasTagCompound()) {
                                        entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
                                }

                                float factor = 0.05F;
                                entityItem.motionX = rand.nextGaussian() * factor;
                                entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
                                entityItem.motionZ = rand.nextGaussian() * factor;
                                world.spawnEntityInWorld(entityItem);
                                item.stackSize = 0;
                        }
                }
        }
}

 




Tile Entity Class
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;

public class TileEntityGrinder extends TileEntity implements IInventory {

        private ItemStack[] inv;

        public TileEntityGrinder(){
                inv = new ItemStack[9];
        }
        
        @Override
        public int getSizeInventory() {
                return inv.length;
        }

        @Override
        public ItemStack getStackInSlot(int slot) {
                return inv[slot];
        }
        
        @Override
        public void setInventorySlotContents(int slot, ItemStack stack) {
                inv[slot] = stack;
                if (stack != null && stack.stackSize > getInventoryStackLimit()) {
                        stack.stackSize = getInventoryStackLimit();
                }               
        }

        @Override
        public ItemStack decrStackSize(int slot, int amt) {
                ItemStack stack = getStackInSlot(slot);
                if (stack != null) {
                        if (stack.stackSize <= amt) {
                                setInventorySlotContents(slot, null);
                        } else {
                                stack = stack.splitStack(amt);
                                if (stack.stackSize == 0) {
                                        setInventorySlotContents(slot, null);
                                }
                        }
                }
                return stack;
        }

        @Override
        public ItemStack getStackInSlotOnClosing(int slot) {
                ItemStack stack = getStackInSlot(slot);
                if (stack != null) {
                        setInventorySlotContents(slot, null);
                }
                return stack;
        }
        
        @Override
        public int getInventoryStackLimit() {
                return 64;
        }

        @Override
        public boolean isUseableByPlayer(EntityPlayer player) {
                return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this &&
                player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
        }

        @Override
        public void openChest() {}

        @Override
        public void closeChest() {}
        
        @Override
        public void readFromNBT(NBTTagCompound tagCompound) {
                super.readFromNBT(tagCompound);
                
                NBTTagList tagList = tagCompound.getTagList("Inventory");
                for (int i = 0; i < tagList.tagCount(); i++) {
                        NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
                        byte slot = tag.getByte("Slot");
                        if (slot >= 0 && slot < inv.length) {
                                inv[slot] = ItemStack.loadItemStackFromNBT(tag);
                        }
                }
        }

        @Override
        public void writeToNBT(NBTTagCompound tagCompound) {
                super.writeToNBT(tagCompound);
                                
                NBTTagList itemList = new NBTTagList();
                for (int i = 0; i < inv.length; i++) {
                        ItemStack stack = inv[i];
                        if (stack != null) {
                                NBTTagCompound tag = new NBTTagCompound();
                                tag.setByte("Slot", (byte) i);
                                stack.writeToNBT(tag);
                                itemList.appendTag(tag);
                        }
                }
                tagCompound.setTag("Inventory", itemList);
        }

                @Override
                public String getInvName() {
                        return "AeroMod.TileEntityGrinder";
                }

			@Override
			public boolean isInvNameLocalized() {

				return false;
			}

			@Override
			public boolean isStackValidForSlot(int i, ItemStack itemstack) {

				return false;
			}
}

 

Container Class

import cpw.mods.fml.common.FMLLog;
import AeroMod.Tutorial.TileEntity.TileEntityGrinder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace;

public class ContainerGrinder extends Container {

        protected TileEntityGrinder tileEntity;

        public ContainerGrinder (InventoryPlayer inventoryPlayer, TileEntityGrinder te){
            tileEntity = te;

            //the Slot constructor takes the IInventory and the slot number in that it binds to
            //and the x-y coordinates it resides on-screen
            for (int i = 0; i < 3; i++) {
                    for (int j = 0; j < 3; j++) {
                            addSlotToContainer(new Slot(tileEntity, j + i * 3, 62 + j * 18, 17 + i * 18));
                    }
            }

            //commonly used vanilla code that adds the player's inventory
            bindPlayerInventory(inventoryPlayer);
    		}

        @Override
    	public boolean canInteractWith(EntityPlayer par1EntityPlayer){
    		return this.tileEntity.isUseableByPlayer(par1EntityPlayer);
    	}

    
        
        protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
                for (int i = 0; i < 3; i++) {
                        for (int j = 0; j < 9; j++) {
                                addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
                                                8 + j * 18, 84 + i * 18));
                        }
                }

                for (int i = 0; i < 9; i++) {
                        addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
                }
        }
        
        @Override
        public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
        {
            ItemStack itemstack = null;
            Slot slot = (Slot)this.inventorySlots.get(par2);

            if (slot != null && slot.getHasStack())
            {
                ItemStack itemstack1 = slot.getStack();
                itemstack = itemstack1.copy();

                if (par2 == 2)
                {
                    if (!this.mergeItemStack(itemstack1, 3, 39, true))
                    {
                        return null;
                    }

                    slot.onSlotChange(itemstack1, itemstack);
                }
                else if (par2 != 1 && par2 != 0)
                {
                    if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null)
                    {
                        if (!this.mergeItemStack(itemstack1, 0, 1, false))
                        {
                            return null;
                        }
                    }
                    else if (TileEntityFurnace.isItemFuel(itemstack1))
                    {
                        if (!this.mergeItemStack(itemstack1, 1, 2, false))
                        {
                            return null;
                        }
                    }
                    else if (par2 >= 3 && par2 < 30)
                    {
                        if (!this.mergeItemStack(itemstack1, 30, 39, false))
                        {
                            return null;
                        }
                    }
                    else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
                    {
                        return null;
                    }
                }
                else if (!this.mergeItemStack(itemstack1, 3, 39, false))
                {
                    return null;
                }

                if (itemstack1.stackSize == 0)
                {
                    slot.putStack((ItemStack)null);
                }
                else
                {
                    slot.onSlotChanged();
                }

                if (itemstack1.stackSize == itemstack.stackSize)
                {
                    return null;
                }

                slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
            }

            return itemstack;
        }
        
}

 

Gui Class

import org.lwjgl.opengl.GL11;

import AeroMod.Tutorial.Container.ContainerGrinder;
import AeroMod.Tutorial.TileEntity.TileEntityGrinder;

import cpw.mods.fml.relauncher.*;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.StatCollector;
import net.minecraft.client.gui.inventory.*;

@SideOnly(Side.CLIENT)
public class GuiGrinder extends GuiContainer {

    public GuiGrinder (InventoryPlayer inventoryPlayer, TileEntityGrinder tileEntity) {
            super(new ContainerGrinder(inventoryPlayer, tileEntity));
    }

    @Override
    protected void drawGuiContainerForegroundLayer(int param1, int param2) {
            fontRenderer.drawString("Ore Grinder", 8, 6, 4210752);
    }

    
    @Override
    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            this.mc.renderEngine.bindTexture("/gui/grinder.png");
            int posX = (this.width - this.xSize) / 2;
            int posY = (this.height - this.ySize) / 2;
            this.drawTexturedModalRect(posX, posY, 0, 0, this.xSize, this.ySize);
            int i1;
            
            if (this.furnaceInventory.isBurning())
            {
                i1 = this.furnaceInventory.getBurnTimeRemainingScaled(12);
                this.drawTexturedModalRect(posX + 56, posY + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
            }

            i1 = this.furnaceInventory.getCookProgressScaled(24);
            this.drawTexturedModalRect(posX + 79, posY + 34, 176, 14, i1 + 1, 16);
    }

    private TileEntityFurnace furnaceInventory;
}

 

Guihandler Class

import AeroMod.Tutorial.Container.ContainerGrinder;
import AeroMod.Tutorial.Gui.GuiGrinder;
import AeroMod.Tutorial.TileEntity.TileEntityGrinder;
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 AeroModGuiHandler implements IGuiHandler {

    @Override
    public Object getServerGuiElement(int id, EntityPlayer player, World world,
                    int x, int y, int z) {
            TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
            if(tileEntity instanceof TileEntityGrinder){
                    return new ContainerGrinder(player.inventory, (TileEntityGrinder) tileEntity);
            }
            return null;
    }


    @Override
    public Object getClientGuiElement(int id, EntityPlayer player, World world,
                    int x, int y, int z) {
            TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
            if(tileEntity instanceof TileEntityGrinder){
                    return new GuiGrinder(player.inventory, (TileEntityGrinder) tileEntity);
            }
            return null;

    }
}

Link to comment
Share on other sites

Sorry, my mistake

 

import java.util.List;

import org.lwjgl.input.Keyboard;

import AeroMod.common.blocks.AquaBlueBlock;
import AeroMod.common.blocks.BrightYellowBlock;
import AeroMod.common.blocks.CoalBlock;
import AeroMod.common.blocks.EmeraldGreenBlock;
import AeroMod.common.blocks.GUIBlock;
import AeroMod.common.blocks.WaterstoneBlock;

import AeroMod.Entity.EntityGrenade;

import AeroMod.Ore.RubyOre;
import AeroMod.Ore.WaterStoneOre;
import AeroMod.Tutorial.TileEntity.TileEntityGrinder;

import AeroMod.common.AeroModFuelHandler;
import AeroMod.common.AeroModGuiHandler;
import AeroMod.common.WorldGeneration.WaterStoneOreWorldGeneration;

import AeroMod.common.tools.EnumToolMaterials;
import AeroMod.common.tools.ItemWaterStoneAxe;
import AeroMod.common.tools.ItemWaterStoneHoe;
import AeroMod.common.tools.ItemWaterStonePickaxe;
import AeroMod.common.tools.ItemWaterStoneShovel;
import AeroMod.common.tools.ItemWaterStoneSword;
import AeroMod.common.tools.ItemWaterStoneBow;

import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;


@Mod(modid="AeroMod",name="Tutorial Mod",version="v1")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)

public class AeroMod {


public static CreativeTabs DecorativeBlocksTab = new DecorativeBlocksTab(CreativeTabs.getNextID(), "Decorative Blocks Tab");
public static WaterStoneOreWorldGeneration GenWorld = new WaterStoneOreWorldGeneration();

public static Item ItemWaterStone;	
public static Item ItemWaterStoneBow;
public static Item ItemGrenade;
public static Item IngotSteel;
public static Item ItemWaterStonePickaxe;
public static Item ItemWaterStoneSword;
public static Item ItemWaterStoneAxe;
public static Item ItemWaterStoneShovel;
public static Item ItemWaterStoneHoe;

public static Block RubyOre;
public static Block CoalBlock;
public static Block WaterStoneBlock;
public static Block AquaBlueBlock;
public static Block BrightYellowBlock;
public static Block EmeraldGreenBlock;
public static Block WaterStoneOre;
public static Block GUIBlock;


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


@Init
public void load(FMLInitializationEvent event){

// items     Skip |ID Numbers 2256 - 2267|
ItemWaterStone = new WaterstoneItem(2014).setUnlocalizedName("WaterStone");
ItemGrenade = new GrenadeItem(2019).setUnlocalizedName("ItemGrenade");
IngotSteel = new IngotSteel(2020).setUnlocalizedName("IngotSteel");


//blocks
WaterStoneBlock = new WaterstoneBlock(2015, "WaterStoneBlock").setUnlocalizedName("WaterStoneBlock").setHardness(2.0F).setStepSound(Block.soundStoneFootstep).setResistance(10.0F);
CoalBlock = new CoalBlock(2016, "CoalBlock").setUnlocalizedName("CoalBlock").setHardness(3.0F).setStepSound(Block.soundStoneFootstep).setResistance(10.0F);
AquaBlueBlock = new AquaBlueBlock(2026, "AquaBlueBlock").setUnlocalizedName("AquaBlueBlock").setHardness(2.0F).setStepSound(Block.soundStoneFootstep).setResistance(10.0F);
BrightYellowBlock = new BrightYellowBlock(2027, "BrightYellowBLock").setUnlocalizedName("BrightYellowBlock").setHardness(2.0F).setStepSound(Block.soundStoneFootstep).setResistance(10.0F);
EmeraldGreenBlock = new EmeraldGreenBlock(2028, "EmeraldGreenBlock").setUnlocalizedName("EmeraldGreenBlock").setHardness(2.0F).setStepSound(Block.soundStoneFootstep).setResistance(10.0F);
GUIBlock = new GUIBlock(2031, "GUIBlock").setUnlocalizedName("GUIBlock").setHardness(2.0F).setStepSound(Block.soundMetalFootstep);

//Ore
WaterStoneOre = new WaterStoneOre(2029, "WaterStoneOre").setUnlocalizedName("WaterStoneOre").setCreativeTab(CreativeTabs.tabBlock).setHardness(10.0F).setResistance(10.0F).setLightValue(1.0F);
MinecraftForge.setBlockHarvestLevel(WaterStoneOre, "pickaxe", 1);
RubyOre = new RubyOre(2030, "RubyOre").setUnlocalizedName("RubyOre").setCreativeTab(CreativeTabs.tabBlock).setHardness(10.0F).setResistance(10.0F).setLightValue(1.0F);
MinecraftForge.setBlockHarvestLevel(RubyOre, "pickaxe", 1);

//Tools
ItemWaterStonePickaxe = new ItemWaterStonePickaxe(2021, EnumToolMaterials.WaterStone).setUnlocalizedName("ItemWaterStonePickaxe").setCreativeTab(CreativeTabs.tabTools);
ItemWaterStoneSword = new ItemWaterStoneSword(2022, EnumToolMaterials.WaterStone).setUnlocalizedName("ItemWaterStoneSword").setCreativeTab(CreativeTabs.tabCombat);
ItemWaterStoneAxe = new ItemWaterStoneAxe(2023, EnumToolMaterials.WaterStone).setUnlocalizedName("ItemWaterStoneAxe").setCreativeTab(CreativeTabs.tabTools);
ItemWaterStoneShovel = new ItemWaterStoneShovel(2024, EnumToolMaterials.WaterStone).setUnlocalizedName("ItemWaterStoneShovel").setCreativeTab(CreativeTabs.tabTools);
ItemWaterStoneHoe = new ItemWaterStoneHoe(2025, EnumToolMaterials.WaterStone).setUnlocalizedName("ItemWaterStoneHoe").setCreativeTab(CreativeTabs.tabTools);	
ItemWaterStoneBow = new ItemWaterStoneBow(2017).setUnlocalizedName("WaterStoneBow");


//adding names
LanguageRegistry.addName(ItemWaterStone, "Water Stone");
LanguageRegistry.addName(WaterStoneBlock, "Waterstone Block");
LanguageRegistry.addName(CoalBlock, "Coal Block");
LanguageRegistry.addName(ItemWaterStoneBow, "Waterstone Bow");
LanguageRegistry.addName(IngotSteel, "Steel Ingot");
LanguageRegistry.addName(ItemGrenade, "Grenade");
LanguageRegistry.addName(ItemWaterStonePickaxe, "WaterStone Pickaxe");
LanguageRegistry.addName(ItemWaterStoneSword, "WaterStone Sword");
LanguageRegistry.addName(ItemWaterStoneAxe, "WaterStone Axe");
LanguageRegistry.addName(ItemWaterStoneShovel, "WaterStone Shovel");
LanguageRegistry.addName(ItemWaterStoneHoe, "WaterStone Hoe");
LanguageRegistry.addName(AquaBlueBlock, "AquaBlue Block");
LanguageRegistry.addName(BrightYellowBlock, "BrightYellow Block");
LanguageRegistry.addName(EmeraldGreenBlock, "EmeraldGreen Block");
LanguageRegistry.addName(WaterStoneOre, "WaterStone Ore");
LanguageRegistry.addName(RubyOre, "Ruby Ore");
LanguageRegistry.addName(GUIBlock, "GUI Block");

//Blocks
GameRegistry.registerBlock(WaterStoneBlock, "Waterstone Block");
GameRegistry.registerBlock(CoalBlock, "Coal Block");
GameRegistry.registerBlock(AquaBlueBlock, "AquaBlue Block");
GameRegistry.registerBlock(BrightYellowBlock, "BrightYellow Block");
GameRegistry.registerBlock(EmeraldGreenBlock, "EmeraldGreen Block");
GameRegistry.registerBlock(WaterStoneOre, "WaterStone Ore");
GameRegistry.registerBlock(RubyOre, "Ruby Ore");
GameRegistry.registerBlock(GUIBlock, "GUI Block");


GameRegistry.registerWorldGenerator(GenWorld);
GameRegistry.registerFuelHandler(new AeroModFuelHandler());
GameRegistry.registerTileEntity(TileEntityGrinder.class, "containergrinder");

NetworkRegistry.instance().registerGuiHandler(this, new AeroModGuiHandler());



//Recipes
GameRegistry.addRecipe(new ItemStack(WaterStoneBlock,1), new Object[]
	{ "TTT","TTT","TTT",'T',ItemWaterStone});
GameRegistry.addRecipe(new ItemStack(ItemWaterStoneBow, 1), new Object[]
	{ " TX", "T X", " TX",'T',ItemWaterStone, 'X',Item.silk});
GameRegistry.addRecipe(new ItemStack(ItemGrenade,1), new Object[]
	{ "XTX","XTX","XXX",'T',Item.gunpowder, 'X', IngotSteel});
GameRegistry.addRecipe(new ItemStack(ItemWaterStonePickaxe, 1), new Object[]
	{"TTT"," X "," X ",'T',ItemWaterStone, 'X',Item.stick});
GameRegistry.addRecipe(new ItemStack(ItemWaterStoneSword, 1), new Object[]
	{"TTT"," X "," X ",'T',ItemWaterStone, 'X',Item.stick});
GameRegistry.addRecipe(new ItemStack(ItemWaterStoneAxe, 1), new Object[]
	{"TTT"," X "," X ",'T',ItemWaterStone, 'X',Item.stick});
GameRegistry.addRecipe(new ItemStack(ItemWaterStoneShovel, 1), new Object[]
	{"TTT"," X "," X ",'T',ItemWaterStone, 'X',Item.stick});
GameRegistry.addRecipe(new ItemStack(ItemWaterStoneHoe, 1), new Object[]
	{"TTT"," X "," X ",'T',ItemWaterStone, 'X',Item.stick});
GameRegistry.addRecipe(new ItemStack(AquaBlueBlock, 1), new Object[]
	{"TTT","TTT","TTT",'T', Item.stick,}); //MultiBlock + Dye
GameRegistry.addRecipe(new ItemStack(GUIBlock, 1), new Object[]
	{"TTT","SRS","TTT", 'T', Item.ingotIron, 'S', IngotSteel, 'R',Item.redstone });

//Smelting
GameRegistry.addSmelting(Item.ingotIron.itemID, new ItemStack(IngotSteel, 1), 2F);
GameRegistry.addSmelting(WaterStoneOre.blockID, new ItemStack(ItemWaterStone, 4), 2F);


//Entitys
EntityRegistry.registerModEntity(EntityGrenade.class, "Grenade", EntityRegistry.findGlobalUniqueEntityId(), this, 128, 1, true);
	LanguageRegistry.instance().addStringLocalization("entity.Grenade.name", "Grenade");


}
}

Link to comment
Share on other sites

Any updates on this?

 

I'm having a similar issue.  Things seem to be set up correctly, but the GUI never opens (no crash).  getClientGuiElement in the IGuiHandler never gets called.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I figured I'd poke this thread as it's the same issue.

 

Instead of, I don't know, creating a duplicate.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I figured I'd poke this thread as it's the same issue.

 

Instead of, I don't know, creating a duplicate.

No, I meant did you have another thread *before* this one was started, so I could look at your code there. I don't know if you have the same problem; as it it I haven't the faintest idea what's wrong with his code. @OP: can you check if getClientGUIElement() is getting called?

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

I am still learning but with code which is working I have a couple of differences, not sure if these are just different ways to do the same as you have

 

First I would try changing

 

NetworkRegistry.instance().registerGuiHandler(this, new AeroModGuiHandler());

 

to

 

NetworkRegistry.instance().registerGuiHandler(instance, new AeroModGuiHandler());

 

Other then that the only other difference I have is that I have my

 

registerTileEntities(), getServerGuiElement(), and getClientGuiElement() in the CommonProxy and

 

I am loading in this order

 

NetworkRegistry.instance().registerGuiHandler(instance, proxy);

   

proxy.registerTileEntities();

 

Again not sure if it helps but other then those changes your code looks almost the same as mine, and my Gui's are working.

Neoublie

Author of Codename: Project Shadow

 

if you do models and textures pm me. looking for some assistance.

Link to comment
Share on other sites

I figured I'd poke this thread as it's the same issue.

 

Instead of, I don't know, creating a duplicate.

No, I meant did you have another thread *before* this one was started, so I could look at your code there. I don't know if you have the same problem; as it it I haven't the faintest idea what's wrong with his code. @OP: can you check if getClientGUIElement() is getting called?

 

I hadn't, because this thread existed.

 

In any case, I solved my own problem by pulling up another GUI mod I'd made and literally copy-pasting code in until I had my new mod.

 

I still have no idea why one works and the other doesn't.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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

    • Hello. I've been having a problem when launching minecraft forge. It just doesn't open the game, and leaves me with this "(exit code 1)" error. Both regular and optifine versions of minecraft launch just fine, tried both with 1.18.2 and 1.20.1. I can assure that my drivers are updated so that can't be it, and i've tried using Java 17, 18 and 21 to no avail. Even with no mods installed, the thing won't launch. I'll leave the log here, although it's in spanish: https://jmp.sh/s/FPqGBSi30fzKJDt2M1gc My specs are this: Ryzen 3 4100 || Radeon R9 280x || 16gb ram || Windows 10 I'd appreciate any help, thank you in advance.
    • Hey, Me and my friends decided to start up a Server with "a few" mods, the last few days everything went well we used all the items we wanted. Now our Game crashes the moment we touch a Lava Bucket inside our Inventory. It just instantly closes and gives me an "Alc Cleanup"  Crash screen (Using GDLauncher). I honestly dont have a clue how to resolve this error. If anyone could help id really appreciate it, I speak German and Englisch so you can choose whatever you speak more fluently. Thanks in Advance. Plus I dont know how to link my Crash Report help for that would be nice too whoops
    • I hosted a minecraft server and I modded it, and there is always an error on the console which closes the server. If someone knows how to repair it, it would be amazing. Thank you. I paste the crash report down here: ---- Minecraft Crash Report ---- WARNING: coremods are present:   llibrary (llibrary-core-1.0.11-1.12.2.jar)   WolfArmorCore (WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar)   AstralCore (astralsorcery-1.12.2-1.10.27.jar)   CreativePatchingLoader (CreativeCore_v1.10.71_mc1.12.2.jar)   SecurityCraftLoadingPlugin ([1.12.2] SecurityCraft v1.9.8.jar)   ForgelinPlugin (Forgelin-1.8.4.jar)   midnight (themidnight-0.3.5.jar)   FutureMC (Future-MC-0.2.19.jar)   SpartanWeaponry-MixinLoader (SpartanWeaponry-1.12.2-1.5.3.jar)   Backpacked (backpacked-1.4.3-1.12.2.jar)   LoadingPlugin (Reskillable-1.12.2-1.13.0.jar)   LoadingPlugin (Bloodmoon-MC1.12.2-1.5.3.jar) Contact their authors BEFORE contacting forge // There are four lights! Time: 3/28/24 12:17 PM Description: Exception in server tick loop net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient     at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89)     at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:612)     at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)     at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)     at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)     at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98)     at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333)     at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)     at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient     at java.lang.Class.getDeclaredMethods0(Native Method)     at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)     at java.lang.Class.privateGetPublicMethods(Class.java:2902)     at java.lang.Class.getMethods(Class.java:1615)     at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:82)     at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82)     ... 31 more Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     ... 37 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@4e558728 from coremod FMLCorePlugin     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:260)     at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)     ... 39 more Caused by: java.lang.RuntimeException: Attempted to load class bsb for invalid side SERVER     at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62)     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:256)     ... 41 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Linux (amd64) version 5.10.0-28-cloud-amd64     Java Version: 1.8.0_382, Temurin     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Temurin     Memory: 948745536 bytes (904 MB) / 1564999680 bytes (1492 MB) up to 7635730432 bytes (7282 MB)     JVM Flags: 2 total; -Xmx8192M -Xms256M     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP 9.42 Powered by Forge 14.23.5.2860 63 mods loaded, 63 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     | State | ID                 | Version                 | Source                                                | Signature                                |     |:----- |:------------------ |:----------------------- |:----------------------------------------------------- |:---------------------------------------- |     | LC    | minecraft          | 1.12.2                  | minecraft.jar                                         | None                                     |     | LC    | mcp                | 9.42                    | minecraft.jar                                         | None                                     |     | LC    | FML                | 8.0.99.99               | forge-1.12.2-14.23.5.2860.jar                         | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | forge              | 14.23.5.2860            | forge-1.12.2-14.23.5.2860.jar                         | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | creativecoredummy  | 1.0.0                   | minecraft.jar                                         | None                                     |     | LC    | backpacked         | 1.4.2                   | backpacked-1.4.3-1.12.2.jar                           | None                                     |     | LC    | itemblacklist      | 1.4.3                   | ItemBlacklist-1.4.3.jar                               | None                                     |     | LC    | securitycraft      | v1.9.8                  | [1.12.2] SecurityCraft v1.9.8.jar                     | None                                     |     | LC    | aiimprovements     | 0.0.1.3                 | AIImprovements-1.12-0.0.1b3.jar                       | None                                     |     | LC    | jei                | 4.16.1.301              | jei_1.12.2-4.16.1.301.jar                             | None                                     |     | LC    | appleskin          | 1.0.14                  | AppleSkin-mc1.12-1.0.14.jar                           | None                                     |     | LC    | baubles            | 1.5.2                   | Baubles-1.12-1.5.2.jar                                | None                                     |     | LC    | astralsorcery      | 1.10.27                 | astralsorcery-1.12.2-1.10.27.jar                      | a0f0b759d895c15ceb3e3bcb5f3c2db7c582edf0 |     | LC    | attributefix       | 1.0.12                  | AttributeFix-Forge-1.12.2-1.0.12.jar                  | None                                     |     | LC    | atum               | 2.0.20                  | Atum-1.12.2-2.0.20.jar                                | None                                     |     | LC    | bloodmoon          | 1.5.3                   | Bloodmoon-MC1.12.2-1.5.3.jar                          | d72e0dd57935b3e9476212aea0c0df352dd76291 |     | LC    | forgelin           | 1.8.4                   | Forgelin-1.8.4.jar                                    | None                                     |     | LC    | bountiful          | 2.2.2                   | Bountiful-2.2.2.jar                                   | None                                     |     | LC    | camera             | 1.0.10                  | camera-1.0.10.jar                                     | None                                     |     | LC    | chisel             | MC1.12.2-1.0.2.45       | Chisel-MC1.12.2-1.0.2.45.jar                          | None                                     |     | LC    | collective         | 3.0                     | collective-1.12.2-3.0.jar                             | None                                     |     | LC    | reskillable        | 1.12.2-1.13.0           | Reskillable-1.12.2-1.13.0.jar                         | None                                     |     | LC    | compatskills       | 1.12.2-1.17.0           | CompatSkills-1.12.2-1.17.0.jar                        | None                                     |     | LC    | creativecore       | 1.10.0                  | CreativeCore_v1.10.71_mc1.12.2.jar                    | None                                     |     | LC    | customnpcs         | 1.12                    | CustomNPCs_1.12.2-(05Jul20).jar                       | None                                     |     | LC    | darknesslib        | 1.1.2                   | DarknessLib-1.12.2-1.1.2.jar                          | 220f10d3a93b3ff5fbaa7434cc629d863d6751b9 |     | LC    | dungeonsmod        | @VERSION@               | DungeonsMod-1.12.2-1.0.8.jar                          | None                                     |     | LC    | enhancedvisuals    | 1.3.0                   | EnhancedVisuals_v1.4.4_mc1.12.2.jar                   | None                                     |     | LC    | extrautils2        | 1.0                     | extrautils2-1.12-1.9.9.jar                            | None                                     |     | LC    | futuremc           | 0.2.6                   | Future-MC-0.2.19.jar                                  | None                                     |     | LC    | geckolib3          | 3.0.30                  | geckolib-forge-1.12.2-3.0.31.jar                      | None                                     |     | LC    | gottschcore        | 1.15.1                  | GottschCore-mc1.12.2-f14.23.5.2859-v1.15.1.jar        | None                                     |     | LC    | hardcorerevival    | 1.2.0                   | HardcoreRevival_1.12.2-1.2.0.jar                      | None                                     |     | LC    | waila              | 1.8.26                  | Hwyla-1.8.26-B41_1.12.2.jar                           | None                                     |     | LE    | imsm               | 1.12                    | Instant Massive Structures Mod 1.12.2.jar             | None                                     |     | L     | journeymap         | 1.12.2-5.7.1p2          | journeymap-1.12.2-5.7.1p2.jar                         | None                                     |     | L     | mobsunscreen       | @version@               | mobsunscreen-1.12.2-3.1.5.jar                         | None                                     |     | L     | morpheus           | 1.12.2-3.5.106          | Morpheus-1.12.2-3.5.106.jar                           | None                                     |     | L     | llibrary           | 1.7.20                  | llibrary-1.7.20-1.12.2.jar                            | None                                     |     | L     | mowziesmobs        | 1.5.8                   | mowziesmobs-1.5.8.jar                                 | None                                     |     | L     | nocubessrparmory   | 3.0.0                   | NoCubes_SRP_Combat_Addon_3.0.0.jar                    | None                                     |     | L     | nocubessrpnests    | 3.0.0                   | NoCubes_SRP_Nests_Addon_3.0.0.jar                     | None                                     |     | L     | nocubessrpsurvival | 3.0.0                   | NoCubes_SRP_Survival_Addon_3.0.0.jar                  | None                                     |     | L     | nocubesrptweaks    | V4.1                    | nocubesrptweaks-V4.1.jar                              | None                                     |     | L     | patchouli          | 1.0-23.6                | Patchouli-1.0-23.6.jar                                | None                                     |     | L     | artifacts          | 1.1.2                   | RLArtifacts-1.1.2.jar                                 | None                                     |     | L     | rsgauges           | 1.2.8                   | rsgauges-1.12.2-1.2.8.jar                             | None                                     |     | L     | rustic             | 1.1.7                   | rustic-1.1.7.jar                                      | None                                     |     | L     | silentlib          | 3.0.13                  | SilentLib-1.12.2-3.0.14+168.jar                       | None                                     |     | L     | scalinghealth      | 1.3.37                  | ScalingHealth-1.12.2-1.3.42+147.jar                   | None                                     |     | L     | lteleporters       | 1.12.2-3.0.2            | simpleteleporters-1.12.2-3.0.2.jar                    | None                                     |     | L     | spartanshields     | 1.5.5                   | SpartanShields-1.12.2-1.5.5.jar                       | None                                     |     | L     | spartanweaponry    | 1.5.3                   | SpartanWeaponry-1.12.2-1.5.3.jar                      | None                                     |     | L     | srparasites        | 1.9.18                  | SRParasites-1.12.2v1.9.18.jar                         | None                                     |     | L     | treasure2          | 2.2.0                   | Treasure2-mc1.12.2-f14.23.5.2859-v2.2.1.jar           | None                                     |     | L     | treeharvester      | 4.0                     | treeharvester_1.12.2-4.0.jar                          | None                                     |     | L     | twilightforest     | 3.11.1021               | twilightforest-1.12.2-3.11.1021-universal.jar         | None                                     |     | L     | variedcommodities  | 1.12.2                  | VariedCommodities_1.12.2-(31Mar23).jar                | None                                     |     | L     | voicechat          | 1.12.2-2.4.32           | voicechat-forge-1.12.2-2.4.32.jar                     | None                                     |     | L     | wolfarmor          | 3.8.0                   | WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar | None                                     |     | L     | worldborder        | 2.3                     | worldborder_1.12.2-2.3.jar                            | None                                     |     | L     | midnight           | 0.3.5                   | themidnight-0.3.5.jar                                 | None                                     |     | L     | structurize        | 1.12.2-0.10.277-RELEASE | structurize-1.12.2-0.10.277-RELEASE.jar               | None                                     |     Loaded coremods (and transformers):  llibrary (llibrary-core-1.0.11-1.12.2.jar)   net.ilexiconn.llibrary.server.core.plugin.LLibraryTransformer   net.ilexiconn.llibrary.server.core.patcher.LLibraryRuntimePatcher WolfArmorCore (WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar)    AstralCore (astralsorcery-1.12.2-1.10.27.jar)    CreativePatchingLoader (CreativeCore_v1.10.71_mc1.12.2.jar)    SecurityCraftLoadingPlugin ([1.12.2] SecurityCraft v1.9.8.jar)    ForgelinPlugin (Forgelin-1.8.4.jar)    midnight (themidnight-0.3.5.jar)   com.mushroom.midnight.core.transformer.MidnightClassTransformer FutureMC (Future-MC-0.2.19.jar)   thedarkcolour.futuremc.asm.CoreTransformer SpartanWeaponry-MixinLoader (SpartanWeaponry-1.12.2-1.5.3.jar)    Backpacked (backpacked-1.4.3-1.12.2.jar)   com.mrcrayfish.backpacked.asm.BackpackedTransformer LoadingPlugin (Reskillable-1.12.2-1.13.0.jar)   codersafterdark.reskillable.base.asm.ClassTransformer LoadingPlugin (Bloodmoon-MC1.12.2-1.5.3.jar)   lumien.bloodmoon.asm.ClassTransformer     Profiler Position: N/A (disabled)     Is Modded: Definitely; Server brand changed to 'fml,forge'     Type: Dedicated Server (map_server.txt)
    • When i add mods like falling leaves, visuality and kappas shaders, even if i restart Minecraft they dont show up in the mods menu and they dont work
    • Delete the forge-client.toml file in your config folder  
  • Topics

×
×
  • Create New...

Important Information

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