Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Vladan899

Forge Modder
  • Content Count

    29
  • Joined

  • Last visited

Posts posted by Vladan899

  1. I do not know how or where to register Custom recipe? Where do i do that?

    And no i didn't use vanila recipe...

    i used from this site....as tutorial.

    http://jabelarminecraft.blogspot.com/p/minecraft-modding-containers.html

     

    And there i do not see any requirements to register custom recipe.

  2. Vanila Furnace Recipe is working fine...i was using same methods to re-create Recipe but different outputs.

     

    When i put ironOre it should give me back IronDust.

    but no smelting is occurring like it dose not see recipe. Like it dose not exist.

    this is entire class.

    package com.vladan899.MachinesRecpie;
    
    import java.util.Iterator;
    import java.util.Map;
    import java.util.Map.Entry;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockStoneBrick;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.EnumDyeColor;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemFishFood;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.crafting.FurnaceRecipes;
    
    import com.google.common.collect.Maps;
    import com.vladan899.blocks.BlockList;
    import com.vladan899.items.ItemList;
    
    public class SmasherRecpie {
     private static final SmasherRecpie smeltingBase = new SmasherRecpie();
        private Map smeltingList = Maps.newHashMap();
        private Map experienceList = Maps.newHashMap();
    
        public static SmasherRecpie instance()
        {
            return smeltingBase;
        }
    
        private SmasherRecpie()
        {
            this.addSmeltingRecipeForBlock(Blocks.iron_ore, new ItemStack(ItemList.IronDust), 0.7F);
            this.addSmeltingRecipeForBlock(Blocks.gold_ore, new ItemStack(ItemList.GoldDust), 1.0F);
            this.addSmeltingRecipeForBlock(BlockList.OreCopper, new ItemStack(ItemList.CopperDust), 1.0F);
            this.addSmeltingRecipeForBlock(BlockList.OreSilver, new ItemStack(ItemList.SilverDust), 1.0F);
            this.addSmeltingRecipeForBlock(BlockList.OreTin, new ItemStack(ItemList.TinDust), 1.0F);
           
    
        }
    
        public void addSmeltingRecipeForBlock(Block input, ItemStack stack, float experience)
        {
            this.addSmelting(Item.getItemFromBlock(input), stack, experience);
        }
    
        public void addSmelting(Item input, ItemStack stack, float experience)
        {
            this.addSmeltingRecipe(new ItemStack(input, 1, 32767), stack, experience);
        }
    
        public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience)
        {
            this.smeltingList.put(input, stack);
            this.experienceList.put(stack, Float.valueOf(experience));
        }
    
        public ItemStack getSmeltingResult(ItemStack stack)
        {
            Iterator iterator = this.smeltingList.entrySet().iterator();
            Entry entry;
    
            do
            {
                if (!iterator.hasNext())
                {
                    return null;
                }
    
                entry = (Entry)iterator.next();
            }
            while (!this.compareItemStacks(stack, (ItemStack)entry.getKey()));
    
            return (ItemStack)entry.getValue();
        }
    
        private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
        {
            return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata());
        }
    
        public Map getSmeltingList()
        {
            return this.smeltingList;
        }
    
        public float getSmeltingExperience(ItemStack stack)
        {
            float ret = stack.getItem().getSmeltingExperience(stack);
            if (ret != -1) return ret;
    
            Iterator iterator = this.experienceList.entrySet().iterator();
            Entry entry;
    
            do
            {
                if (!iterator.hasNext())
                {
                    return 0.0F;
                }
    
                entry = (Entry)iterator.next();
            }
            while (!this.compareItemStacks(stack, (ItemStack)entry.getKey()));
    
            return ((Float)entry.getValue()).floatValue();
        }
    }
    

  3. Also, the general logic in
    update

    is flawed. You just set the current burn time without condition every tick. That doesn't seem right.

     

     

    this better?

    boolean hasBeenSmelting = this.isBurning();
    	boolean changeSmeltingState = false;
    	if (this.isBurning())
            {
                --this.burnTime;
            }
    
            if (!this.worldObj.isRemote)
            {
                if (!this.isBurning() && (this.Total_slots[1] == null || this.Total_slots[0] == null))
                {
                    if (!this.isBurning() && this.cookTime > 0)
                    {
                        this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.cookTime);
                    }
                }
                else
                {
                    if (!this.isBurning() && this.canSmelt())
                    {
                        this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.Total_slots[1]);
    
                        if (this.isBurning())
                        {
                        	changeSmeltingState = true;
    
                            if (this.Total_slots[1] != null)
                            {
                                --this.Total_slots[1].stackSize;
    
                                if (this.Total_slots[1].stackSize == 0)
                                {
                                    this.Total_slots[1] = Total_slots[1].getItem().getContainerItem(Total_slots[1]);
                                }
                            }
                        }
                    }
    
                    if (this.isBurning() && this.canSmelt())
                    {
                        ++this.cookTime;
    
                        if (this.cookTime == this.furnaceSpeed)
                        {
                            this.cookTime = 0;
    
                            this.smeltItem();
                            changeSmeltingState = true;
                        }
                    }
                    else
                    {
                        this.cookTime = 0;
                    }
                }
    
                if (hasBeenSmelting != this.isBurning())
                {
                	changeSmeltingState = true;
                	BlockMachineSmasher.setState(this.isBurning(), this.worldObj, this.pos);
                }
            }
    
            if (changeSmeltingState)
            {
                this.markDirty();
            }

  4. Whatever i open Custom furnace game freezes for 1-3 seconds and then crashes on desktop. If i do not interact with a block...it works.

    CrashLog

    ---- Minecraft Crash Report ----
    // Hey, that tickles! Hehehe!
    
    Time: 8/28/15 8:49 PM
    Description: Ticking entity
    
    java.lang.NullPointerException: Ticking entity
    at com.vladan899.container.ContainerOreSmasher.detectAndSendChanges(ContainerOreSmasher.java:87)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)
    at net.minecraft.world.World.updateEntity(World.java:1997)
    at net.minecraft.world.World.updateEntities(World.java:1823)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
    at java.lang.Thread.run(Unknown Source)
    
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at com.vladan899.container.ContainerOreSmasher.detectAndSendChanges(ContainerOreSmasher.java:87)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)
    at net.minecraft.world.World.updateEntity(World.java:1997)
    
    -- Entity being ticked --
    Details:
    Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
    Entity ID: 181
    Entity Name: Player460
    Entity's Exact location: 206.53, 63.00, 159.00
    Entity's Block location: 206.00,63.00,159.00 - World: (206,63,159), Chunk: (at 14,3,15 in 12,9; contains blocks 192,0,144 to 207,255,159), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Entity's Momentum: 0.00, -0.08, 0.00
    Entity's Rider: ~~ERROR~~ NullPointerException: null
    Entity's Vehicle: ~~ERROR~~ NullPointerException: null
    Stacktrace:
    at net.minecraft.world.World.updateEntities(World.java:1823)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)
    
    -- Affected level --
    Details:
    Level name: New World
    All players: 1 total; [EntityPlayerMP['Player460'/181, l='New World', x=206.53, y=63.00, z=159.00]]
    Chunk stats: ServerChunkCache: 625 Drop: 0
    Level seed: 1024147731026552001
    Level generator: ID 00 - default, ver 1. Features enabled: true
    Level generator options: 
    Level spawn location: 212.00,64.00,164.00 - World: (212,64,164), Chunk: (at 4,4,4 in 13,10; contains blocks 208,0,160 to 223,255,175), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 27815 game time, 27815 day time
    Level dimension: 0
    Level storage version: 0x04ABD - Anvil
    Level weather: Rain time: 95848 (now: false), thunder time: 101675 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true
    Stacktrace:
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
    at java.lang.Thread.run(Unknown Source)
    
    -- System Details --
    Details:
    Minecraft Version: 1.8
    Operating System: Windows 8.1 (amd64) version 6.3
    Java Version: 1.8.0_51, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 806670504 bytes (769 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1499 4 mods loaded, 4 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1499.jar) 
    UCHIJAAAA	Forge{11.14.3.1499} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1499.jar) 
    UCHIJAAAA	expansion{Alpha 0.0.5} [Expansion: Overhaul] (bin) 
    Loaded coremods (and transformers): 
    GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
    Profiler Position: N/A (disabled)
    Player Count: 1 / 8; [EntityPlayerMP['Player460'/181, l='New World', x=206.53, y=63.00, z=159.00]]
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'fml,forge'

     

    Github

    https://github.com/Vladan899/MoreIndustries

     

    I know it has something to do with .ContainerOreSmasher.detectAndSendChanges...but i do not know what?

  5. Please help here... :-\ I can't seems to figure out what is the issue...it keeps telling me same error.

     

    Can someone help what i'm doing wrong with detectAndSendChanges() method?

    Cuz it keeps point at this line in container.

       

     if (this.LastCookTime != tileEntity.getField(2))

     

    while in tileEntity getfield is like

    switch (id)
            {
                case 0:
                    return this.burnTime;
                case 1:
                    return this.cureentItemBurnTime;
                case 2:
                    return this.cookTime;
                case 3:
                    return this.furnaceSpeed;
                default:
                    return 0;
            }

  6. Error Log.

     

    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_51]
    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_51]
    at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_51]
    Caused by: java.lang.NullPointerException
    at com.vladan899.container.ContainerOreSmasher.detectAndSendChanges(ContainerOreSmasher.java:87) ~[ContainerOreSmasher.class:?]
    at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:62) ~[Container.class:?]
    at com.vladan899.container.ContainerOreSmasher.addCraftingToCrafters(ContainerOreSmasher.java:69) ~[ContainerOreSmasher.class:?]
    at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:92) ~[FMLNetworkHandler.class:?]
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2578) ~[EntityPlayer.class:?]
    at com.vladan899.blocks.properties.BlockMachineSmasher.onBlockActivated(BlockMachineSmasher.java:54) ~[blockMachineSmasher.class:?]
    at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:476) ~[itemInWorldManager.class:?]
    at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:624) ~[NetHandlerPlayServer.class:?]
    at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) ~[C08PacketPlayerBlockPlacement.class:?]
    at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) ~[C08PacketPlayerBlockPlacement.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_51]
    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_51]
    at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?]
    ... 5 more
    [00:50:15] [server thread/ERROR]: Encountered an unexpected exception
    net.minecraft.util.ReportedException: Ticking entity
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:781) ~[MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) ~[MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) ~[integratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_51]
    Caused by: java.lang.NullPointerException
    at com.vladan899.container.ContainerOreSmasher.detectAndSendChanges(ContainerOreSmasher.java:87) ~[ContainerOreSmasher.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263) ~[EntityPlayerMP.class:?]
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031) ~[World.class:?]
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) ~[WorldServer.class:?]
    at net.minecraft.world.World.updateEntity(World.java:1997) ~[World.class:?]
    at net.minecraft.world.World.updateEntities(World.java:1823) ~[World.class:?]
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587) ~[WorldServer.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775) ~[MinecraftServer.class:?]
    ... 4 more
    [00:50:15] [server thread/ERROR]: This crash report has been saved to: D:\Modding\forge-1.8-11.14.3.1499-src\eclipse\.\crash-reports\crash-2015-08-21_00.50.15-server.txt
    [00:50:15] [server thread/INFO]: Stopping server
    [00:50:15] [server thread/INFO]: Saving players
    [00:50:15] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: ---- Minecraft Crash Report ----
    // There are four lights!
    
    Time: 8/21/15 12:50 AM
    Description: Ticking entity
    
    java.lang.NullPointerException: Ticking entity
    at com.vladan899.container.ContainerOreSmasher.detectAndSendChanges(ContainerOreSmasher.java:87)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)
    at net.minecraft.world.World.updateEntity(World.java:1997)
    at net.minecraft.world.World.updateEntities(World.java:1823)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
    at java.lang.Thread.run(Unknown Source)
    
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at com.vladan899.container.ContainerOreSmasher.detectAndSendChanges(ContainerOreSmasher.java:87)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)
    at net.minecraft.world.World.updateEntity(World.java:1997)
    
    -- Entity being ticked --
    Details:
    Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
    Entity ID: 182
    Entity Name: Player784
    Entity's Exact location: 206.53, 63.00, 159.00
    Entity's Block location: 206.00,63.00,159.00 - World: (206,63,159), Chunk: (at 14,3,15 in 12,9; contains blocks 192,0,144 to 207,255,159), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Entity's Momentum: 0.00, -0.08, 0.00
    Entity's Rider: ~~ERROR~~ NullPointerException: null
    Entity's Vehicle: ~~ERROR~~ NullPointerException: null
    Stacktrace:
    at net.minecraft.world.World.updateEntities(World.java:1823)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)
    
    -- Affected level --
    Details:
    Level name: New World
    All players: 1 total; [EntityPlayerMP['Player784'/182, l='New World', x=206.53, y=63.00, z=159.00]]
    Chunk stats: ServerChunkCache: 625 Drop: 0
    Level seed: 1024147731026552001
    Level generator: ID 00 - default, ver 1. Features enabled: true
    Level generator options: 
    Level spawn location: 212.00,64.00,164.00 - World: (212,64,164), Chunk: (at 4,4,4 in 13,10; contains blocks 208,0,160 to 223,255,175), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 27575 game time, 27575 day time
    Level dimension: 0
    Level storage version: 0x04ABD - Anvil
    Level weather: Rain time: 96088 (now: false), thunder time: 101915 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true
    Stacktrace:
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
    at java.lang.Thread.run(Unknown Source)
    
    -- System Details --
    Details:
    Minecraft Version: 1.8
    Operating System: Windows 8.1 (amd64) version 6.3
    Java Version: 1.8.0_51, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 752127976 bytes (717 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1499 4 mods loaded, 4 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1499.jar) 
    UCHIJAAAA	Forge{11.14.3.1499} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1499.jar) 
    UCHIJAAAA	expansion{Alpha 0.0.5} [Expansion: Overhaul] (bin) 
    Loaded coremods (and transformers): 
    GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
    Profiler Position: N/A (disabled)
    Player Count: 1 / 8; [EntityPlayerMP['Player784'/182, l='New World', x=206.53, y=63.00, z=159.00]]
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'fml,forge'

     

     

    Whatever i open my custom furnace it opens for about 1-2 seconds or  less and then crashes.

    It opens the gui but it after short while crashes.

    Edit: I did made detectAndSendChanges method with empthy body and it wont crash...and i do not know how to fix this.

  7. TileEntity

    http://pastebin.com/54RqLRwy

    Block

    http://pastebin.com/DRQmWxeX

     

    Container

    http://pastebin.com/dZFiUzXW

     

     

    main

    http://pastebin.com/PBfZAd8Y

     

    Thing is i can't get it to work...i got GUI to show ...slots and upgrade one...

    When items is placed in fuel/input slot ....it shows in upgrade slot as well...and i can eather click on upgrade slots or ...one of these 2 to remove them.

    Furnace can't smelt......but vanila code works fine...ie consuming item and making burn time...but i wanna to item damage and get burn time

    When item reaches max damge to zero to item is removed from fuels slot....ie destryied.

     

    And how to make Upgrade slots to work...even thou i set isValidForSlot return false...i can place any item?

  8. I'm maybe not the best in Java  but what's is SlotFurnaceFuel?

    Slot for coal..planks, charkcoal, wood tools etc

     

     

    You are opening The gui on client side. Open The gui on Server side, The Server will Inform  The client about it

    Changed from

    if (!worldIn.isRemote)

    To

    if (worldIn.isRemote)

     

     

    now it works...but furnace is not working ... :(

    Thanks for answering.

     

  9. I've look everywhere and i see people said @NetworkMod...but that is not longer used.

    I was able to make my funace to open gui and show slots for fuel,smelting item and smelting result where i wanted.

    Thing is when i enter gui with right click i can't move any items while im in gui....that dose not allow me to see if my furnace is working. Outside works fine...

    I can shift click ore into coresponding slot that will be smelted but i can't move coal or any item to fuel slot...dus making me unable to see if furnace is working.

     

    Here is Block itself:

    package com.expansion.blocks;
    
    import java.util.Random;
    
    import com.expansion.main.Main;
    import com.expansion.tileEntities.TileEntityGrinder;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.material.Material;
    import net.minecraft.block.properties.IProperty;
    import net.minecraft.block.properties.PropertyDirection;
    import net.minecraft.block.state.BlockState;
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.InventoryHelper;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.tileentity.TileEntityFurnace;
    import net.minecraft.util.BlockPos;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.world.World;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class BlockGrinder extends BlockContainer {
    
    public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
    private final boolean isBurning;
    private static boolean keepInventory;
    
    protected BlockGrinder(Boolean IsBurning) {
    	super(Material.rock);
    	isBurning = IsBurning;
    }
    
    
    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta) {
    
    	return new TileEntityGrinder();
    }
    
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
        {
            return Item.getItemFromBlock(Blocks.furnace);
        }
    
        public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
        {
            this.setDefaultFacing(worldIn, pos, state);
        }
    
        private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
        {
            if (!worldIn.isRemote)
            {
                Block block = worldIn.getBlockState(pos.north()).getBlock();
                Block block1 = worldIn.getBlockState(pos.south()).getBlock();
                Block block2 = worldIn.getBlockState(pos.west()).getBlock();
                Block block3 = worldIn.getBlockState(pos.east()).getBlock();
                EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    
                if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock())
                {
                    enumfacing = EnumFacing.SOUTH;
                }
                else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock())
                {
                    enumfacing = EnumFacing.NORTH;
                }
                else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock())
                {
                    enumfacing = EnumFacing.EAST;
                }
                else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock())
                {
                    enumfacing = EnumFacing.WEST;
                }
    
                worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
            }
        }
        
        public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
        { 
        	if (!worldIn.isRemote)
            {
                return true;
            }
            else
            {
                TileEntity tileentity = worldIn.getTileEntity(pos);
    
                if (tileentity instanceof TileEntityGrinder)
                {
                	 playerIn.openGui(Main.instance, BlockList.GuiGrinder, worldIn, pos.getX(), pos.getY(), pos.getZ());
                }
               
                return true;
            }
            
        }
        
        public static void setState(boolean active, World worldIn, BlockPos pos)
        {
            IBlockState iblockstate = worldIn.getBlockState(pos);
            TileEntity tileentity = worldIn.getTileEntity(pos);
            keepInventory = true;
    
            if (active)
            {
                worldIn.setBlockState(pos, BlockList.GrinderActive.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);           
            }
            else
            {
                worldIn.setBlockState(pos, BlockList.GrinderIdle.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);       
            }
    
            keepInventory = false;
    
            if (tileentity != null)
            {
                tileentity.validate();
                worldIn.setTileEntity(pos, tileentity);
            }
        }
        
        public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
        {
            return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
        }
        
        public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
        {
            worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
    
            if (stack.hasDisplayName())
            {
                TileEntity tileentity = worldIn.getTileEntity(pos);
    
                if (tileentity instanceof TileEntityGrinder)
                {
                    ((TileEntityGrinder)tileentity).setCustomInventoryName(stack.getDisplayName());
                }
            }
        }
        
        public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
        {
            if (!keepInventory)
            {
                TileEntity tileentity = worldIn.getTileEntity(pos);
    
                if (tileentity instanceof TileEntityGrinder)
                {
                    InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityGrinder)tileentity);
                    worldIn.updateComparatorOutputLevel(pos, this);
                }
            }
    
            super.breakBlock(worldIn, pos, state);
        }
        
        public boolean hasComparatorInputOverride()
        {
            return true;
        }
    
        public int getComparatorInputOverride(World worldIn, BlockPos pos)
        {
            return Container.calcRedstone(worldIn.getTileEntity(pos));
        }
    
        @SideOnly(Side.CLIENT)
        public Item getItem(World worldIn, BlockPos pos)
        {
            return Item.getItemFromBlock(BlockList.GrinderIdle);
        }
        
        public int getRenderType()
        {
            return 3;
        }
        
        @SideOnly(Side.CLIENT)
        public IBlockState getStateForEntityRender(IBlockState state)
        {
            return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH);
        }
    
        
        public IBlockState getStateFromMeta(int meta)
        {
            EnumFacing enumfacing = EnumFacing.getFront(meta);
    
            if (enumfacing.getAxis() == EnumFacing.Axis.Y)
            {
                enumfacing = EnumFacing.NORTH;
            }
    
            return this.getDefaultState().withProperty(FACING, enumfacing);
        }
        
        public int getMetaFromState(IBlockState state)
        {
            return ((EnumFacing)state.getValue(FACING)).getIndex();
        }
    
        protected BlockState createBlockState()
        {
            return new BlockState(this, new IProperty[] {FACING});
        }
    
        
        static final class SwitchEnumFacing
        {
            static final int[] FACING_LOOKUP = new int[EnumFacing.values().length];      
            static
            {
                try
                {
                    FACING_LOOKUP[EnumFacing.WEST.ordinal()] = 1;
                }
                catch (NoSuchFieldError var4)
                {
                    ;
                }
    
                try
                {
                    FACING_LOOKUP[EnumFacing.EAST.ordinal()] = 2;
                }
                catch (NoSuchFieldError var3)
                {
                    ;
                }
    
                try
                {
                    FACING_LOOKUP[EnumFacing.NORTH.ordinal()] = 3;
                }
                catch (NoSuchFieldError var2)
                {
                    ;
                }
    
                try
                {
                    FACING_LOOKUP[EnumFacing.SOUTH.ordinal()] = 4;
                }
                catch (NoSuchFieldError var1)
                {
                    ;
                }
            }
        }
    
    }
    

     

    Container:

    package com.expansion.containers;
    
    import com.expansion.tileEntities.TileEntityGrinder;
    
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.ICrafting;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.inventory.Slot;
    import net.minecraft.inventory.SlotFurnaceFuel;
    import net.minecraft.inventory.SlotFurnaceOutput;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.crafting.FurnaceRecipes;
    import net.minecraft.tileentity.TileEntityFurnace;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class ContainerGrinder extends Container {
    
    private final IInventory tileFurnace;
        private int LastCookTime;
        private int LastFurnaceSpeed;
        private int LastBurnTime;
        private int LastItemBurnTime;
    
    public ContainerGrinder(InventoryPlayer playerInventory, TileEntityGrinder tileEntityGrinder) {
    	this.tileFurnace = playerInventory;
    	//Slot for Smelting items
    	this.addSlotToContainer(new Slot(tileEntityGrinder, 0, 56, 17));
    
    	//Slot for Fuel
    	this.addSlotToContainer(new SlotFurnaceFuel(tileEntityGrinder, 1, 56, 53));
    
    	//Smelt Item slot
    	this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, tileEntityGrinder, 2, 115, 35));
    
    	//Players Inventory
    	for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 9; ++j)
                {
                    this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
                }
            }
    	//Players hotbar
            for (int i = 0; i < 9; ++i)
            {
                this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 142));
            }
    }
    
    @Override
    public boolean canInteractWith(EntityPlayer playerIn) {
    
    	return this.tileFurnace.isUseableByPlayer(playerIn);
    }
    
    public void addCraftingToCrafters(ICrafting listener)
        {
            super.addCraftingToCrafters(listener);
            listener.func_175173_a(this, this.tileFurnace);
        }
    
        /**
         * Looks for changes made in the container, sends them to every listener.
         */
        public void detectAndSendChanges()
        {
            super.detectAndSendChanges();
    
            for (int i = 0; i < this.crafters.size(); ++i)
            {
                ICrafting icrafting = (ICrafting)this.crafters.get(i);
    
                if (this.LastItemBurnTime != this.tileFurnace.getField(2))
                {
                    icrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.getField(2));
                }
    
                if (this.LastBurnTime != this.tileFurnace.getField(0))
                {
                    icrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.getField(0));
                }
    
                if (this.LastCookTime != this.tileFurnace.getField(1))
                {
                    icrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.getField(1));
                }
    
                if (this.LastFurnaceSpeed != this.tileFurnace.getField(3))
                {
                    icrafting.sendProgressBarUpdate(this, 3, this.tileFurnace.getField(3));
                }
            }
    
            this.LastItemBurnTime = this.tileFurnace.getField(2);
            this.LastBurnTime = this.tileFurnace.getField(0);
            this.LastCookTime = this.tileFurnace.getField(1);
            this.LastFurnaceSpeed = this.tileFurnace.getField(3);
        }
        
        @SideOnly(Side.CLIENT)
        public void updateProgressBar(int id, int data)
        {
            this.tileFurnace.setField(id, data);
        }
        
        public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
        {
            ItemStack itemstack = null;
            Slot slot = (Slot)this.inventorySlots.get(index);
    
            if (slot != null && slot.getHasStack())
            {
                ItemStack itemstack1 = slot.getStack();
                itemstack = itemstack1.copy();
    
                if (index == 2)
                {
                    if (!this.mergeItemStack(itemstack1, 3, 39, true))
                    {
                        return null;
                    }
    
                    slot.onSlotChange(itemstack1, itemstack);
                }
                else if (index != 1 && index != 0)
                {
                    if (FurnaceRecipes.instance().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 (index >= 3 && index < 30)
                    {
                        if (!this.mergeItemStack(itemstack1, 30, 39, false))
                        {
                            return null;
                        }
                    }
                    else if (index >= 30 && index < 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(playerIn, itemstack1);
            }
    
            return itemstack;
        }
    
    }

     

    GuiHandler:

    package com.expansion.handler;
    
    import com.expansion.blocks.BlockList;
    import com.expansion.containers.ContainerGrinder;
    import com.expansion.gui.GuiGrinder;
    import com.expansion.tileEntities.TileEntityGrinder;
    
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.BlockPos;
    import net.minecraft.world.World;
    import net.minecraftforge.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) {
    
    	BlockPos pos = new BlockPos(x,y,z);
    	TileEntity tileEntity = world.getTileEntity(pos);
    
            if(tileEntity != null)
            {
            	switch (ID)
            	{
            		case BlockList.GuiGrinder: 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) {
    
    	BlockPos pos = new BlockPos(x,y,z);
    	TileEntity tileEntity = world.getTileEntity(pos);
    
            if(tileEntity != null)
            {
            	switch (ID)
            	{
            		case BlockList.GuiGrinder: return new GuiGrinder(player.inventory,(TileEntityGrinder)tileEntity);
            	}
    
    
    	}
    	return null;
    }
    
    }
    

     

    TileEntity:

    package com.expansion.tileEntities;
    
    import com.expansion.blocks.BlockGrinder;
    import com.expansion.containers.ContainerGrinder;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockFurnace;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.ContainerFurnace;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.inventory.ISidedInventory;
    import net.minecraft.inventory.SlotFurnaceFuel;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemBlock;
    import net.minecraft.item.ItemHoe;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.ItemSword;
    import net.minecraft.item.ItemTool;
    import net.minecraft.item.crafting.FurnaceRecipes;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.nbt.NBTTagList;
    import net.minecraft.server.gui.IUpdatePlayerListBox;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ChatComponentText;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.util.IChatComponent;
    import net.minecraftforge.fml.common.registry.GameRegistry;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class TileEntityGrinder extends TileEntity implements ISidedInventory
    {
    
    private static final int[] slotsTop = new int[] {0};
        private static final int[] slotsBottom = new int[] {2, 1};
        private static final int[] slotsSides = new int[] {1};
        private ItemStack[] slots = new ItemStack[3];
        public int furnaceSpeed;
        public int burnTime;
        public int currentItemBurnTime;
        public int cookTime;
        private String furnaceCustomName;
    
    @Override
    public int getSizeInventory() 
    {
    
    	return this.slots.length;
    }
    
    @Override
    public ItemStack getStackInSlot(int index)
    {
    
    	return this.slots[index];
    }
    
    @Override
    public ItemStack decrStackSize(int index, int count)
    {
    
    	if (this.slots[index] != null)
            {
                ItemStack itemstack;
    
                if (this.slots[index].stackSize <= count)
                {
                    itemstack = this.slots[index];
                    this.slots[index] = null;
                    return itemstack;
                }
                else
                {
                    itemstack = this.slots[index].splitStack(count);
    
                    if (this.slots[index].stackSize == 0)
                    {
                        this.slots[index] = null;
                    }
    
                    return itemstack;
                }
            }
            else
            {
                return null;
            }
    }
    
    @Override
    public ItemStack getStackInSlotOnClosing(int index) 
    {
    
    	if (this.slots[index] != null)
            {
                ItemStack itemstack = this.slots[index];
                this.slots[index] = null;
                return itemstack;
            }
            else
            {
                return null;
            }
    }
    
    @Override
    public void setInventorySlotContents(int index, ItemStack stack)
    {
    
    	boolean flag = stack != null && stack.isItemEqual(this.slots[index]) && ItemStack.areItemStackTagsEqual(stack, this.slots[index]);
            this.slots[index] = stack;
    
            if (stack != null && stack.stackSize > this.getInventoryStackLimit())
            {
                stack.stackSize = this.getInventoryStackLimit();
            }
    
            if (index == 0 && !flag)
            {
                
                this.cookTime = 0;
                this.markDirty();
            }
    
    }
    
    
    
    
    @Override
    public int getInventoryStackLimit() 
    {
    
    	return 64;
    }
    
    @Override
    public boolean isUseableByPlayer(EntityPlayer player) 
    {
    
    	 return true;
    }
    
    @Override
    public void openInventory(EntityPlayer player) {}
    @Override
    public void closeInventory(EntityPlayer player) {}
    
    @Override
    public boolean isItemValidForSlot(int index, ItemStack stack)
    {
    
    	return index == 2 ? false : (index != 1 ? true : isItemFuel(stack) || SlotFurnaceFuel.isBucket(stack));
    }
    
    public static boolean isItemFuel(ItemStack itemStack)
    {
           return getItemBurnTime(itemStack) > 0;
    }
    
    
    public static int getItemBurnTime(ItemStack itemStack)
        {
            if (itemStack == null)
            {
                return 0;
            }
            else
            {
                Item item = itemStack.getItem();
    
                if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
                {
                    Block block = Block.getBlockFromItem(item);
    
                    if (block == Blocks.wooden_slab)            
                        return 150;               
                    if (block.getMaterial() == Material.wood)               
                        return 300;              
                    if (block == Blocks.coal_block)
                        return 16000;
                }
    
                if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
                if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
                if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200;
                if (item == Items.stick) return 100;
                if (item == Items.coal) return 1600;
                if (item == Items.lava_bucket) return 20000;
                if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
                if (item == Items.blaze_rod) return 2400;
                return GameRegistry.getFuelValue(itemStack);
            }
        }
    
    
    @Override
    public int getField(int id)
    {
    	switch(id)
    	{
    	case 1: return this.burnTime;
    	case 2: return this.cookTime;
    	case 3: return this.currentItemBurnTime;
    	case 4: return this.furnaceSpeed;
    	default: return 0;
    
    	}
    }
    
    @Override
    public void setField(int id, int value) 
    {
    	switch(id)
    	{
    	case 1: this.burnTime = value;
    	case 2: this.cookTime = value;
    	case 3: this.currentItemBurnTime = value;
    	case 4: this.furnaceSpeed = 150;
    
    
    	}
    
    }
    
    @Override
    public int getFieldCount()
    {		
    	return 4;
    }
    
    @Override
    public void clear() 
    {
    
    	for (int i = 0; i < this.slots.length; ++i)
            {
                this.slots[i] = null;
            }
    
    }
    
    @Override
    public String getName()
    {
    
    	return this.hasCustomName() ? furnaceCustomName : "container.Grinder";
    }
    
    @Override
    public boolean hasCustomName()
    {
    
    	return this.furnaceCustomName != null && this.furnaceCustomName.length() > 0;
    }
    
    @Override
    public IChatComponent getDisplayName() 
    {
    
    	return new ChatComponentText(this.getName());
    }
    
    public int[] getSlotsForFace(EnumFacing side) 
    {
    
    	return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides);
    }
    
    public boolean canInsertItem(int index, ItemStack itemStack, EnumFacing direction) {
    
    	return this.isItemValidForSlot(index, itemStack);
    }
    
    public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
    
    	if (direction == EnumFacing.DOWN && index == 1)
            {
                Item item = stack.getItem();
    
                if (item != Items.water_bucket && item != Items.bucket)
                {
                    return false;
                }
            }
    	return true;
    }
    
    public void update()
    {
    	boolean flag = this.burnTime > 0;
    	boolean flag1 = false;
    
    	if(this.burnTime > 0)
    	{
    		this.burnTime --;
    
    	}
    	if(this.worldObj.isRemote)
    	{
    		if(this.burnTime == 0 && this.canSmelt())
    		{
    			this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.slots[1]);
    
    			if(this.isBurning())
    			{
    				flag1 = true;
    
    				if(this.slots[1] != null)
    				{
    					this.slots[1].stackSize--;
    
    					if(this.slots[1].stackSize == 0)
    					{
    						this.slots[1] = this.slots[1].getItem().getContainerItem(this.slots[1]);
    					}
    				}
    			}
    		}
    	}
    	if(this.isBurning() && this.canSmelt())
    	{
    		this.cookTime++;
    
    		if(this.cookTime == this.furnaceSpeed)
    		{
    			this.cookTime = 0;
    			this.canSmelt();
    			flag1 = true;
    		}
    		else
    		{
    			this.cookTime = 0;
    		}
    		if(flag != this.isBurning())
    		{
    			flag1 = true;
    			BlockGrinder.setState(this.isBurning(), this.worldObj, this.pos);
    		}
    	}
    	if(flag1)
    	{
    		this.markDirty();
    	}
    }
    
    private boolean canSmelt()	
    {
    	if(this.slots[0] == null)
    	{
    		return false;
    	}
    	else
    	{
    		ItemStack itemStack = FurnaceRecipes.instance().getSmeltingResult(this.slots[0]);							
    		if(itemStack == null) return false;
    		if(this.slots[2] == null) this.slots[2] = itemStack.copy();
    		else if(!this.slots[2].isItemEqual(itemStack)) return false;
    
    		int result = this.slots[2].stackSize + itemStack.stackSize;
    
    		return (result <= this.getInventoryStackLimit() && result <= itemStack.getMaxStackSize());
    	}
    }
    public void smeltItem()
    {
    	if(this.canSmelt())
    	{
    		ItemStack itemStack = FurnaceRecipes.instance().getSmeltingResult(this.slots[0]);
    		if(this.slots[2] == null) this.slots[2] = itemStack.copy();
    
    		else if(!this.slots[2].isItemEqual(itemStack))
    		this.slots[2].stackSize += itemStack.stackSize;
    		this.slots[0].stackSize--;
    
    		if(this.slots[0].stackSize <= 0) this.slots[0] = null;								
    	}			
    }
    
    private boolean isBurning() 
    {
    
    	return burnTime > 0;
    }
    
    public void setCustomInventoryName(String displayName) {
    
    	 this.furnaceCustomName = displayName;
    }
    
    public void readFromNBT(NBTTagCompound compound)
        {
            super.readFromNBT(compound);
            NBTTagList nbttaglist = compound.getTagList("Items", 10);
            this.slots = new ItemStack[this.getSizeInventory()];
    
            for (int i = 0; i < nbttaglist.tagCount(); ++i)
            {
                NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
                byte b0 = nbttagcompound1.getByte("Slot");
    
                if (b0 >= 0 && b0 < this.slots.length)
                {
                    this.slots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
                }
            }
    
            this.burnTime = compound.getShort("BurnTime");
            this.cookTime = compound.getShort("CookTime");
            this.cookTime = compound.getShort("CookTimeTotal");
            this.currentItemBurnTime = getItemBurnTime(this.slots[1]);
    
            if (compound.hasKey("CustomName", )
            {
                this.furnaceCustomName = compound.getString("CustomName");
            }
        }
    
    public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
        {
            return new ContainerGrinder(playerInventory, this);
        }
    
    
    
    public void writeToNBT(NBTTagCompound compound)
        {
            super.writeToNBT(compound);
            compound.setShort("BurnTime", (short)this.burnTime);
            compound.setShort("CookTime", (short)this.cookTime);
            compound.setShort("CookTimeTotal", (short)this.cookTime);
            NBTTagList nbttaglist = new NBTTagList();
    
            for (int i = 0; i < this.slots.length; ++i)
            {
                if (this.slots[i] != null)
                {
                    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                    nbttagcompound1.setByte("Slot", (byte)i);
                    this.slots[i].writeToNBT(nbttagcompound1);
                    nbttaglist.appendTag(nbttagcompound1);
                }
            }
    
            compound.setTag("Items", nbttaglist);
    
            if (this.hasCustomName())
            {
                compound.setString("CustomName", this.furnaceCustomName);
            }
        }
    
    @SideOnly(Side.CLIENT)
        public int getBurnTimeRemainingScaled(int widthBurnBar)
        {
            if (this.currentItemBurnTime == 0)
            {
                this.currentItemBurnTime = 200;
            }
    
            return this.burnTime * widthBurnBar / this.currentItemBurnTime;
        }
    
    public int getCookProgressScaled(int widthBurnBar)
        {
            return this.cookTime * widthBurnBar / 200;
        }
    
    }
    

     

    MainClass:

    package com.expansion.main;
    
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.fml.common.FMLCommonHandler;
    import net.minecraftforge.fml.common.Mod;
    import net.minecraftforge.fml.common.Mod.EventHandler;
    import net.minecraftforge.fml.common.Mod.Instance;
    import net.minecraftforge.fml.common.SidedProxy;
    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    import net.minecraftforge.fml.common.network.IGuiHandler;
    import net.minecraftforge.fml.common.network.NetworkRegistry;
    import net.minecraftforge.fml.common.registry.GameRegistry;
    
    import com.expansion.MachinesRecpie.GrinderRecpie;
    import com.expansion.achievements.achievementLists;
    import com.expansion.blocks.BlockList;
    import com.expansion.handler.GuiHandler;
    import com.expansion.items.ItemList;
    import com.expansion.recipes.CraftingManager;
    import com.expansion.recipes.RecipesRemoval;
    import com.expansion.recipes.SmeltingRegistry;
    import com.expansion.tileEntities.TileEntityGrinder;
    import com.expansion.worldGen.WorldRegster;
    @Mod(modid = Main.modID, name = Main.Name,version= Main.Version)
    public class Main {
    
    
    public static final String modID = "expansion";
    public static final String Name = "Expansion: Overhaul";
    public static final String Version = "Alpha 0.0.5";
    public static final String ClientProxy = "com.expansion.main.ClientProxy";
    public static final String ServerProxy = "com.expansion.main.ServerProxy";
    
    @SidedProxy(clientSide = Main.ClientProxy, serverSide = Main.ServerProxy)
    public static ServerProxy proxy;
    
    @Instance(modID)
    public static Main instance;
    
    
    @EventHandler
    public void PreLoad(FMLPreInitializationEvent PreEvent){
    	ItemList.MainRegistry();
    	BlockList.MainRegistry();
    	WorldRegster.MainRegistry();
    
    }
    
    @EventHandler
    public void Load(FMLInitializationEvent Event){
    	RecipesRemoval.RecpieRemover();	
    	CraftingManager.registerCrafting();	
    	SmeltingRegistry.RegisterSmelting();
    	achievementLists.MainRegistry();
    	NetworkRegistry.INSTANCE.registerGuiHandler(instance,new GuiHandler());
    	GameRegistry.registerTileEntity(TileEntityGrinder.class, "TileEntityGrinder");
    
    
    	proxy.RegisterRender();
    }
    
    @EventHandler
    public void PostLoad(FMLPostInitializationEvent PostEvent){
    
    }
    }
    

  10. I do read the code and i can see and read errors but i seek some assistance.

    If you are frustrated and do not wanna say something helpful that" learn Java" or pointing out errors.

    Thing is no one is born alive and learned on it's own some programming language.

    If you do not have to say/point to my error...I would ask you nicely not to post anything.

  11. ((BlockFurnace) BlockList.GrinderOn).setState(this.isBurning(), this.worldObj, this.pos);

     

    now it crashes and here is crash log

     

    ---- Minecraft Crash Report ----

    // Don't do that.

     

    Time: 7/14/15 8:03 PM

    Description: Ticking block entity

     

    java.lang.ClassCastException: com.expansion.blocks.BlockMachineGrinder cannot be cast to net.minecraft.block.BlockFurnace

    at com.expansion.tileentity.TileEntityGrinder.update(TileEntityGrinder.java:269)

    at net.minecraft.world.World.updateEntities(World.java:1879)

    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)

    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)

    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)

    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)

    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)

    at java.lang.Thread.run(Unknown Source)

     

     

    A detailed walkthrough of the error, its code path and all known details is as follows:

    ---------------------------------------------------------------------------------------

     

    -- Head --

    Stacktrace:

    at com.expansion.tileentity.TileEntityGrinder.update(TileEntityGrinder.java:269)

     

    -- Block entity being ticked --

    Details:

    Name: TileEntityGrinder // com.expansion.tileentity.TileEntityGrinder

    Block type: ID #207 (tile.GrinderOff // com.expansion.blocks.BlockMachineGrinder)

    Block data value: 2 / 0x2 / 0b0010

    Block location: World: (-215,87,240), Chunk: (at 9,5,0 in -14,15; contains blocks -224,0,240 to -209,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

    Actual block type: ID #207 (tile.GrinderOff // com.expansion.blocks.BlockMachineGrinder)

    Actual block data value: 2 / 0x2 / 0b0010

    Stacktrace:

    at net.minecraft.world.World.updateEntities(World.java:1879)

    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)

     

    -- Affected level --

    Details:

    Level name: New World

    All players: 1 total; [EntityPlayerMP['Player714'/301, l='New World', x=-214.63, y=87.17, z=237.95]]

    Chunk stats: ServerChunkCache: 625 Drop: 0

    Level seed: 675717299778829591

    Level generator: ID 00 - default, ver 1. Features enabled: true

    Level generator options:

    Level spawn location: -208.00,64.00,248.00 - World: (-208,64,248), Chunk: (at 0,4,8 in -13,15; contains blocks -208,0,240 to -193,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

    Level time: 77868 game time, 77868 day time

    Level dimension: 0

    Level storage version: 0x04ABD - Anvil

    Level weather: Rain time: 11444 (now: true), thunder time: 92610 (now: false)

    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true

    Stacktrace:

    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)

    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)

    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)

    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)

    at java.lang.Thread.run(Unknown Source)

     

    -- System Details --

    Details:

    Minecraft Version: 1.8

    Operating System: Windows 8.1 (amd64) version 6.3

    Java Version: 1.8.0_45, Oracle Corporation

    Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

    Memory: 833048920 bytes (794 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1487 4 mods loaded, 4 mods active

    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

    UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1487.jar)

    UCHIJAAAA Forge{11.14.3.1487} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1487.jar)

    UCHIJAAAA expansion{Alpha 0.0.5} [Expansion: Overhaul] (bin)

    Loaded coremods (and transformers):

    GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.

    Profiler Position: N/A (disabled)

    Player Count: 1 / 8; [EntityPlayerMP['Player714'/301, l='New World', x=-214.63, y=87.17, z=237.95]]

    Type: Integrated Server (map_client.txt)

    Is Modded: Definitely; Client brand changed to 'fml,forge'

     

  12. Hello everyone and I've been tinkering...trying to figure out the problem

    Thing is ...i got to render my custom furnace in my inventory and i can see gui and slots are working just fine...and bug that i encountered is when i place coal down and my ore...

    Block turns to Same block with number 0 while inventory is open...items is not created...1 coal is used...and items will not appear on out slot.

    and most annying thing while i did test...is when i do that...as soon i put 2 items into respective slots....my machine turns into BLOCK locking vanilla furnace with no gui...just as ordinary block.

     

    Here is tileEnity:

    http://pastebin.com/2BQQexEH

     

    GuiHandler:

    http://pastebin.com/4LvdWMwm

     

    Container:

    http://pastebin.com/Ki1aJZ3W

     

    Block:

    http://pastebin.com/U9LmaRcq

     

     

    In Main where is preinit, init, and postinit.

    Gui have been registered as GameRegistry.registerTileEntity(TileEntityGrinder.class, "TileEntityGrinder"); in Init Section.

     

    Forge Version is 11.14.3.1487

  13. @Override

    public EnumFlowerColor getBlockType() {

    // TODO Auto-generated method stub

    return BlockFlower.EnumFlowerColor.YELLOW;

    }

     

    When it's yellow it shows this  message: [09:01:17] [Client thread/ERROR] [FML]: Model definition for location expansion:Blue_Flower#type=dandelion not found

     

     

    When yellow is replaced with RED it shows 9 error "Type" with different vanila flowers definition plus it shows in creative inventory 8 additional Flowers that have same name but looking at code they look like they are vanila ones.

    When is changed to yellow it just shows that errow asking for dandelion type....it maybe have some issues with this :return BlockFlower.EnumFlowerColor.YELLOW;

     

     

     

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.