
INTENSS
Members-
Posts
32 -
Joined
-
Last visited
Everything posted by INTENSS
-
I switched up the method so it looks like this... private void infuseItem() { if (!canInfuse()) { return; } ItemStack itemstack = InfusionRecipes.getInfusionResults(slots[1].getItem(), slots[2].getItem()); if (slots[3] == null) { slots[3] = itemstack.copy(); } else if (slots[3] == itemstack) { this.slots[3].stackSize++; } for (int i = 0; i < 2; i++) { if (slots[i].stackSize <= 0) { slots[i] = new ItemStack(slots[i].getItem()); } else { slots[i].stackSize--; } if (slots[i].stackSize <= 0) { slots[i] = null; } } } It resolved the crash, however now it will burn fuel but not create the item but that is more than likely in my recipes class so i can figure that out. You were right Belpois, thanks for the help.
-
I went and reviewed the vanilla smeltItem method and clipped in the the section of code that decreases stack size to see if it was in fact my loop crashing and its not. with the vanilla smeltItem method it crashed when trying to decrease the stack size. as for the setFull3d 'm honestly not sure why i put that in there lol is removed though its not needed. method with error causing line pointed out. private void infuseItem() { if (canInfuse()) { ItemStack itemstack = InfusionRecipes.getInfusionResults(slots[1].getItem(), slots[2].getItem()); if (slots[3] == null) { slots[3] = itemstack.copy(); } else if (slots[3].getItem() == itemstack.getItem()) { this.slots[3].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } for (int i = 0; i < 2; i++) { if (slots[i].stackSize <= 0) { // < --------------------------------------------------------------------------------------------------- CRASH IS ON THIS LINE slots[i] = new ItemStack(slots[i].getItem()); } else { slots[i].stackSize--; } if (slots[i].stackSize <= 0) { slots[i] = null; } } } } Crash Report ---- Minecraft Crash Report ---- // Oops. Time: 2/5/15 2:18 PM Description: Ticking block entity java.lang.NullPointerException: Ticking block entity at AdvancedEnergy.tileentities.MetallicInfuserTE.infuseItem(MetallicInfuserTE.java:237) at AdvancedEnergy.tileentities.MetallicInfuserTE.updateEntity(MetallicInfuserTE.java:286) at net.minecraft.world.World.updateEntities(World.java:2160) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at AdvancedEnergy.tileentities.MetallicInfuserTE.infuseItem(MetallicInfuserTE.java:237) at AdvancedEnergy.tileentities.MetallicInfuserTE.updateEntity(MetallicInfuserTE.java:286) -- Block entity being ticked -- Details: Name: MetallicInfuserTE // AdvancedEnergy.tileentities.MetallicInfuserTE Block type: ID #167 (tile.null // AdvancedEnergy.machines.MetallicInfuser) Block data value: 5 / 0x5 / 0b0101 Block location: World: (229,69,262), Chunk: (at 5,4,6 in 14,16; contains blocks 224,0,256 to 239,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Actual block type: ID #167 (tile.null // AdvancedEnergy.machines.MetallicInfuser) Actual block data value: 5 / 0x5 / 0b0101 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2160) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) -- Affected level -- Details: Level name: Copy of New World All players: 1 total; [EntityPlayerMP['Player265'/209, l='Copy of New World', x=231.39, y=69.00, z=261.17]] Chunk stats: ServerChunkCache: 709 Drop: 0 Level seed: 2850766302080461089 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (224,64,248), Chunk: (at 0,4,8 in 14,15; contains blocks 224,0,240 to 239,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 746 game time, 746 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 17383 (now: false), thunder time: 81497 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_31, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 837371904 bytes (798 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available ae{1.0a} [Advanced Energy] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player265'/209, l='Copy of New World', x=231.39, y=69.00, z=261.17]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge'
-
I'm getting a ticking block entity error from this method below I know this is where is coming from. Its coming from the for loop. Now I'm building a dual input machine and I'm not sure if I'm doing this correctly. I'm looping through the fuel, and 2 input slots. Now I also have 3 upgrade slots. should I be looping though and checking ALL slots and not just the fuel and 2 inputs? The loop is whats crashing out the game and I'm just not sure if I'm writing it correctly or I'm just not checking what i need too. I can supply the rest of the code if needed but everything worked perfectly until I wrote this method. private void infuseItem() { if (canInfuse()) { ItemStack itemstack = InfusionRecipes.getInfusionResults(slots[1].getItem(), slots[2].getItem()); if (slots[3] == null) { slots[3] = itemstack.copy(); } else if (slots[3].getItem() == itemstack.getItem()) { this.slots[3].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } for (int i = 0; i < 2; i++) { if (slots[i].stackSize <= 0) { slots[i] = new ItemStack(slots[i].getItem().setFull3D()); } else { slots[i].stackSize--; } if (slots[i].stackSize <= 0) { slots[i] = null; } } } } any help would be appreciated.
-
thank you deadrecon98 I COMPLETELY overlooked that and it fixed my issue. I went over the code, heck I don't know how many times and simply missed it. I tried creatTileEntity just to test it and that did not work just wanted to let you all know, at least not the with the way I have things configured. Thanks for all those who replied.
-
I'm working on a new machine and when I go to create the createNewTileEntity() method its keeps giving me and error must override or implement a supertype method I've never had this happen with any other machine I've built in the past and I'm plugging along in the same order of writing as I do with every machine. I'll post my block class and my Tileentity class below. Now neither one of them are finished all the methods needed to get this Gui to work should be completed. I can post the gui, handler, and container classes if needed but this error has to do with calling the tile entity. and YES everything is registered. and help would be appreciated block class: import java.util.Random; import AdvancedEnergy.Main; import AdvancedEnergy.tileentities.MetallicInfuserTE; import AdvancedEnergy.tileentities.OreProTE; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class MetallicInfuser extends Block { private final Random ran = new Random(); private final boolean isActive; private static boolean keepInventory = false; @SideOnly(Side.CLIENT) private IIcon iconTop; @SideOnly(Side.CLIENT) private IIcon iconFront; public MetallicInfuser(boolean state) { super(Material.iron); this.isActive = state; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) { this.blockIcon = register.registerIcon("ae:infuser_side"); this.iconFront = register.registerIcon(this.isActive ? "ae:infuser_on" : "ae:infuser_off"); this.iconTop = register.registerIcon("ae:infuser_side"); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.placeBlock(world, x, y, z); } private void placeBlock(World world, int x, int y, int z) { if (!world.isRemote) { Block block1 = world.getBlock(x, y, z -1); Block block2 = world.getBlock(x, y, z +1); Block block3 = world.getBlock(x - 1, y, z); Block block4 = world.getBlock(x + 1, y, z); byte i = 3; if (block1.func_149730_j() && !block2.func_149730_j()) { i = 3; } if (block2.func_149730_j() && !block1.func_149730_j()) { i = 2; } if (block3.func_149730_j() && !block4.func_149730_j()) { i = 5; } if (block4.func_149730_j() && !block3.func_149730_j()) { i = 4; } world.setBlockMetadataWithNotify(x, y, z, i, 2); } } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) { int i = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if ( i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if ( i == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if ( i == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if ( i == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if (itemstack.hasDisplayName()) { ((MetallicInfuserTE)world.getTileEntity(x, y, z)).setGuiDisplayName(itemstack.getDisplayName()); } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { FMLNetworkHandler.openGui(player, Main.instance, Main.guiIDMetallicInfuser, world, x, y, z); } return true; } @Override public TileEntity createNewTileEntity(World world, int i) { // < --------- ERROR HAPPENS HERE return new MetallicInfuserTE(); } } this is the TileEntity class so far. All tha6ts needed should be completed import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import AdvancedEnergy.machines.OrePro; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class MetallicInfuserTE extends TileEntity implements ISidedInventory { private ItemStack slots[]; private int infuserPower; private int infuserCookTime; private String customName; public MetallicInfuserTE() { slots = new ItemStack[10]; } @Override public int getSizeInventory() { // TODO Auto-generated method stub return 0; } @Override public ItemStack getStackInSlot(int p_70301_1_) { // TODO Auto-generated method stub return null; } @Override public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { // TODO Auto-generated method stub return null; } @Override public ItemStack getStackInSlotOnClosing(int p_70304_1_) { // TODO Auto-generated method stub return null; } @Override public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) { // TODO Auto-generated method stub } public void setGuiDisplayName(String name) { customName = name; } @Override public String getInventoryName() { return hasCustomInventoryName() ? customName : "container.Metallic Infuser"; } @Override public boolean hasCustomInventoryName() { return customName != null && customName.length() > 0; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; } else { return player.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64.0D; } } @Override public void openInventory() { // TODO Auto-generated method stub } @Override public void closeInventory() { // TODO Auto-generated method stub } @Override public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { // TODO Auto-generated method stub return false; } @Override public int[] getAccessibleSlotsFromSide(int p_94128_1_) { // TODO Auto-generated method stub return null; } @Override public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { // TODO Auto-generated method stub return false; } @Override public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { // TODO Auto-generated method stub return false; } } Hope someone can maybe see something I missed.
-
I resolved the issue on my own. I was calling my inactive furnace in my main registry AND in the block class itself. removed the from the class and called it off the main registry and everything work perfect.
-
Any ideas? Anyone...
-
I don't get it I have the idle and active blocks registered and intialized.. any ideas as to what might be causing that? I can post all the class files for the furnace if that's what it takes public void preLoad(FMLPreInitializationEvent event) { // Register Items MagnesiumDust.loadItem(); MagnesiumIngot.loadItem(); // Register Blocks // machines magFurnaceIdle = new MagFurnace(false).setHardness(3.5F).setBlockName("MagFuranceIdle").setCreativeTab(MainRegistry.btpTab); magFurnaceActive = new MagFurnace(true).setHardness(3.5F).setLightLevel(0.875F).setBlockName("MagFurnaceActive"); // Register Armor // Register Tools // Register Weapons GameRegistry.registerBlock(magFurnaceIdle, "MagFurnaceIdle"); GameRegistry.registerBlock(magFurnaceActive, "MagFurnaceActive"); /* GameRegistry.registerWorldGenerator(new WorldGeneration(), 0); */ GameRegistry.registerFuelHandler(new FurnaceFuel()); }
-
it crashed at System.out.println(MagFurnaceActive.magFurnaceActive.getTickRandomly()); full report: Time: 1/28/15 11:07 PM Description: Ticking block entity java.lang.NullPointerException: Ticking block entity at com.INTENSS.BTP.Blocks.MagFurnace.updateFurnaceState(MagFurnace.java:117) at com.INTENSS.BTP.TileEntities.MagFurnaceTE.updateEntity(MagFurnaceTE.java:243) at net.minecraft.world.World.updateEntities(World.java:2160) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.INTENSS.BTP.Blocks.MagFurnace.updateFurnaceState(MagFurnace.java:117) at com.INTENSS.BTP.TileEntities.MagFurnaceTE.updateEntity(MagFurnaceTE.java:243) -- Block entity being ticked -- Details: Name: MagFurnaceTE // com.INTENSS.BTP.TileEntities.MagFurnaceTE Block type: ID #165 (tile.MagFuranceIdle // com.INTENSS.BTP.Blocks.MagFurnace) Block data value: 2 / 0x2 / 0b0010 Block location: World: (-94,71,100), Chunk: (at 2,4,4 in -6,6; contains blocks -96,0,96 to -81,255,111), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Actual block type: ID #165 (tile.MagFuranceIdle // com.INTENSS.BTP.Blocks.MagFurnace) Actual block data value: 2 / 0x2 / 0b0010 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2160) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) -- Affected level -- Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player109'/854, l='New World', x=-93.37, y=71.00, z=98.39]] Chunk stats: ServerChunkCache: 922 Drop: 0 Level seed: 802661551686316304 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (12,64,212), Chunk: (at 12,4,4 in 0,13; contains blocks 0,0,208 to 15,255,223), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 27433 game time, 12895 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 102794 (now: false), thunder time: 125213 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_31, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 831641168 bytes (793 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available btp{1.0a} [bring The Pain] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player109'/854, l='New World', x=-93.37, y=71.00, z=98.39]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [23:07:51] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-01-28_23.07.51-server.txt [23:07:51] [Client thread/INFO] [FML]: Waiting for the server to terminate/save. [23:07:51] [server thread/INFO]: Saving worlds [23:07:51] [server thread/INFO]: Saving chunks for level 'New World'/Overworld [23:07:51] [server thread/INFO]: Saving chunks for level 'New World'/Nether [23:07:51] [server thread/INFO]: Saving chunks for level 'New World'/The End [23:07:52] [server thread/INFO] [FML]: Unloading dimension 0 [23:07:52] [server thread/INFO] [FML]: Unloading dimension -1 [23:07:52] [server thread/INFO] [FML]: Unloading dimension 1 [23:07:52] [server thread/INFO] [FML]: Applying holder lookups [23:07:52] [server thread/INFO] [FML]: Holder lookups applied [23:07:52] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [23:07:52] [Client thread/INFO] [FML]: Server terminated. AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
-
yeah everything is initialized and registered
-
Its is the second sipplet in my original post. That crash report is the most recent I since re-named it to updateFurnaceState. I'll post it again but it is in my original post. updateFurnaceState(): public static void updateFurnaceState(boolean state, World worldObj, int xCoord, int yCoord, int zCoord) { int l = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity tileentity = worldObj.getTileEntity(xCoord, yCoord, zCoord); active = true; if (state) { worldObj.setBlock(xCoord, yCoord, zCoord, MagFurnaceActive.magFurnaceActive); // < --- LINE 116 } else { worldObj.setBlock(xCoord, yCoord, zCoord, MagFurnaceIdle.magFurnaceIdle); } active = false; worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, l, 2); if (tileentity != null) { tileentity.validate(); worldObj.setTileEntity(xCoord, yCoord, zCoord, tileentity); } } updateEntity(): public void updateEntity() { boolean flag = this.burnTime > 0; boolean flag1 = false; if (this.burnTime > 0) { --this.burnTime; } if (!this.worldObj.isRemote) { if (this.burnTime != 0 || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null) { if (this.burnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.burnTime > 0) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.cookTime; if (this.cookTime == 200) { this.cookTime = 0; this.smeltItem(); flag1 = true; } } else { this.cookTime = 0; } } // this statement is causing the issue if (flag != this.burnTime > 0) { flag1 = true; MagFurnace.updateFurnaceBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); // < -- LINE 243 } } if (flag1) { this.markDirty(); } }
-
Complete crash report Time: 1/28/15 7:39 PM Description: Ticking block entity java.lang.NullPointerException: Ticking block entity at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86) at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653) at net.minecraft.world.World.setBlock(World.java:519) at net.minecraft.world.World.setBlock(World.java:681) at com.INTENSS.BTP.Blocks.MagFurnace.updateFurnaceState(MagFurnace.java:116) at com.INTENSS.BTP.TileEntities.MagFurnaceTE.updateEntity(MagFurnaceTE.java:243) at net.minecraft.world.World.updateEntities(World.java:2160) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86) at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653) at net.minecraft.world.World.setBlock(World.java:519) at net.minecraft.world.World.setBlock(World.java:681) at com.INTENSS.BTP.Blocks.MagFurnace.updateFurnaceState(MagFurnace.java:116) at com.INTENSS.BTP.TileEntities.MagFurnaceTE.updateEntity(MagFurnaceTE.java:243) -- Block entity being ticked -- Details: Name: MagFurnaceTE // com.INTENSS.BTP.TileEntities.MagFurnaceTE Block type: ID #165 (tile.MagFuranceIdle // com.INTENSS.BTP.Blocks.MagFurnace) Block data value: 2 / 0x2 / 0b0010 Block location: World: (-89,71,96), Chunk: (at 7,4,0 in -6,6; contains blocks -96,0,96 to -81,255,111), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Actual block type: ID #165 (tile.MagFuranceIdle // com.INTENSS.BTP.Blocks.MagFurnace) Actual block data value: 2 / 0x2 / 0b0010 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2160) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) -- Affected level -- Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player812'/135, l='New World', x=-89.12, y=71.00, z=93.31]] Chunk stats: ServerChunkCache: 731 Drop: 0 Level seed: 802661551686316304 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (12,64,212), Chunk: (at 12,4,4 in 0,13; contains blocks 0,0,208 to 15,255,223), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 23182 game time, 8644 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 107045 (now: false), thunder time: 129464 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_31, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 533985640 bytes (509 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available btp{1.0a} [bring The Pain] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player812'/135, l='New World', x=-89.12, y=71.00, z=93.31]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [19:39:30] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-01-28_19.39.30-server.txt [19:39:30] [Client thread/INFO] [FML]: Waiting for the server to terminate/save. [19:39:30] [server thread/INFO]: Saving worlds [19:39:30] [server thread/INFO]: Saving chunks for level 'New World'/Overworld [19:39:30] [server thread/INFO]: Saving chunks for level 'New World'/Nether [19:39:30] [server thread/INFO]: Saving chunks for level 'New World'/The End [19:39:30] [server thread/INFO] [FML]: Unloading dimension 0 [19:39:30] [server thread/INFO] [FML]: Unloading dimension -1 [19:39:30] [server thread/INFO] [FML]: Unloading dimension 1 [19:39:30] [server thread/INFO] [FML]: Applying holder lookups [19:39:30] [server thread/INFO] [FML]: Holder lookups applied [19:39:30] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [19:39:30] [Client thread/INFO] [FML]: Server terminated. AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
-
Thanks for replying, I noted the lines in the code snipplets but that is kind of tough to see so here they are. updateEntity(): if (flag != this.burnTime > 0) { flag1 = true; MagFurnace.updateFurnaceBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); // report points to this line } updateFurnaceBlockState(): if (state) { worldObj.setBlock(xCoord, yCoord, zCoord, MagFurnaceActive.magFurnaceActive); // report points to this line } else { worldObj.setBlock(xCoord, yCoord, zCoord, MagFurnaceIdle.magFurnaceIdle); } Hope that helps I can provide whatever else that may be needed
-
I had an issue with my furnace crashing the game when breaking the block while it was active or had been active. I fixed that issue however it seems another issue has come up with my updateEntity() method in my TileEntity class & in my updateFurnaceBlockState() method in my main block class. The crash report points out 2 lines of code 1 in each method, I'll post the full methods below and note the lines the report says is an issue. I didn't want to get on here and ask but I've been trying to figure this out since yesterday am starting to pull my hair out. updateEntity() method in my TileEntity class: public void updateEntity() { boolean flag = this.burnTime > 0; boolean flag1 = false; if (this.burnTime > 0) { --this.burnTime; } if (!this.worldObj.isRemote) { if (this.burnTime != 0 || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null) { if (this.burnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.burnTime > 0) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.cookTime; if (this.cookTime == 200) { this.cookTime = 0; this.smeltItem(); flag1 = true; } } else { this.cookTime = 0; } } // this statement is causing the issue if (flag != this.burnTime > 0) { flag1 = true; MagFurnace.updateFurnaceBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); // report points to this line } } if (flag1) { this.markDirty(); } } updateFurnaceBlockState() method from my main block class: public static void updateFurnaceBlockState(boolean state, World worldObj, int xCoord, int yCoord, int zCoord) { int l = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity tileentity = worldObj.getTileEntity(xCoord, yCoord, zCoord); active = true; if (state) { worldObj.setBlock(xCoord, yCoord, zCoord, MagFurnaceActive.magFurnaceActive); // report points to this line } else { worldObj.setBlock(xCoord, yCoord, zCoord, MagFurnaceIdle.magFurnaceIdle); } active = false; worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, l, 2); if (tileentity != null) { tileentity.validate(); worldObj.setTileEntity(xCoord, yCoord, zCoord, tileentity); } } any suggestions will be appreciated and I can supply any further information needed.
-
you need to create the slot in your GUI.png then add another drawTexturedModalRect(params of the slot) and replace isBurning with your custom method example: isConsumingFuel(). you'll need to create new methods for your power consumption. example snipplet (this is not the full method, just what you need to modify): if (this.magFurnace.isBurning()) { int i = this.magFurnace.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 104, l + 33 + 12 - i, 176, 0, 14, i + 1); i = this.magFurnace.getCookProgressScaled(14); this.drawTexturedModalRect(k + 67, l + 33 + 12 - i, 176, 14, 14, i + 1); }
-
I've resolved the crashing issue so the game no longer crashes and the GUI opens a functions regardless of the state. I WAS in fact calling BlockFurnace in the updateEntity() method. now that I switched and fixed the main issue my MagFurnace Block no longer updates to active when it is cooking and the particles have stopped displaying. These are minor issue I can figure out. Thanks for trying to help shadowfacts
-
the video I posted is the first of a series of 14 and he builds an entire block with complete GUI set up and EXPLAINS everything as he does it
-
[1.7.10]Rotating custom model depending on which side it is placed
INTENSS replied to _Gustav0_'s topic in Modder Support
these are 5 methods from the vanilla furnace the does what I believe your trying to do. study these and toy with them a bit. 2 of these add the textures. This will set the block so it always places facing the player. public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); this.func_149930_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); } private void func_149930_e(World p_149930_1_, int p_149930_2_, int p_149930_3_, int p_149930_4_) { if (!p_149930_1_.isRemote) { Block block = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ - 1); Block block1 = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ + 1); Block block2 = p_149930_1_.getBlock(p_149930_2_ - 1, p_149930_3_, p_149930_4_); Block block3 = p_149930_1_.getBlock(p_149930_2_ + 1, p_149930_3_, p_149930_4_); byte b0 = 3; if (block.func_149730_j() && !block1.func_149730_j()) { b0 = 3; } if (block1.func_149730_j() && !block.func_149730_j()) { b0 = 2; } if (block2.func_149730_j() && !block3.func_149730_j()) { b0 = 5; } if (block3.func_149730_j() && !block2.func_149730_j()) { b0 = 4; } p_149930_1_.setBlockMetadataWithNotify(p_149930_2_, p_149930_3_, p_149930_4_, b0, 2); } } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return p_149691_1_ == 1 ? this.field_149935_N : (p_149691_1_ == 0 ? this.field_149935_N : (p_149691_1_ != p_149691_2_ ? this.blockIcon : this.field_149936_O)); } /** * the field _149936_0 can basically be the same as N just use proper texture names. O just switches the face of the block if the stat go active. */ @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.blockIcon = p_149651_1_.registerIcon("furnace_side"); this.field_149936_O = p_149651_1_.registerIcon(this.field_149932_b ? "furnace_front_on" : "furnace_front_off"); this.field_149935_N = p_149651_1_.registerIcon("furnace_top"); } public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2, 2); } if (l == 1) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 5, 2); } if (l == 2) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3, 2); } if (l == 3) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 4, 2); } if (p_149689_6_.hasDisplayName()) { ((TileEntityFurnace)p_149689_1_.getTileEntity(p_149689_2_, p_149689_3_, p_149689_4_)).func_145951_a(p_149689_6_.getDisplayName()); } } -
this guys videos should help you out..
-
well I've been testing and decided to create some cheap textures (I normally do this last) to verify that my block was in fact the block being placed. My custom INACTIVE furnace is being place, can be broken, GUI opens ect.. but when I throw fuel and an item to cook/smelt it updates the block with the vanilla minecraft block then crashes if I right or left click it, which really has me confused. I've went over this code for hours now and I KNOW I'm not casting to that vanilla block anywhere at all...
-
I just through all the code again for the the furnace and not once amd I casting my MagFurnaceTE to TileEntityFurnace, its odd because it only crashes when its in it's active state and works perfect when in inactive state update: it also crashes when I break it while active but does not while inactive.
-
GUI code import org.lwjgl.opengl.GL11; import com.INTENSS.BTP.Containers.ContainerMagFurnace; import com.INTENSS.BTP.TileEntities.MagFurnaceTE; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerFurnace; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class FurnaceGui extends GuiContainer { public static final ResourceLocation GuiTexture = new ResourceLocation("btp:textures/gui/mag_furnace.png"); public MagFurnaceTE magFurnace; public FurnaceGui(InventoryPlayer player, MagFurnaceTE entity) { super(new ContainerMagFurnace(player, entity)); this.magFurnace = entity; } protected void drawGuiContainerForegroundLayer(int i, int j) { String s = this.magFurnace.hasCustomInventoryName() ? this.magFurnace.getInventoryName() : I18n.format(this.magFurnace.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } protected void drawGuiContainerBackgroundLayer(float a, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(GuiTexture); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); if (this.magFurnace.isBurning()) { int i1 = this.magFurnace.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); i1 = this.magFurnace.getCookProgressScaled(24); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16); } } }
-
this is for 1.7.10 I've created a custom furnace and almost everything works great, when its in idle state (not cooking) I right click and the GUI opens perfectly and everything works. Now when it is cooking (active state) and I try to open the GUI it crashes my game. only thing I'm getting from the crash report is: Ticking memory connection java.lang.ClassCastException: com.INTENSS.BTP.TileEntities.MagFurnaceTE cannot be cast to net.minecraft.tileentity.TileEntityFurnace this is my onBlockActivated() snipplet: public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float hitX, float hitY, float hitZ) { if (!world.isRemote) { FMLNetworkHandler.openGui(player, MainRegistry.instance, MainRegistry.guiIDMagFurnace, world, x, y, z); } return true; } I can provide any further information requested. I've poured over my code and can't seem to locate an issue. Has anyone else had this problem? Any suggestions will be appreciated.
-
for one the if/else statement is not a loop, but that's getting off topic, here is standard VERY basic string array. String[] burnList; burnList = new String[1000]; burnLis[0] = item; burnLis[1] = item; burnLis[2] = item; Now I would run through the array with a for LOOP. for (int i = 0; i < burnList.length(); i++) { // if STATEMENTS go here } What I mean by multiple lines of codes is, which I should have clarified this, I do not want to add a bunch of "&&" in the if statement. If I can run 1 basic if statement and cycle through the array with a for loop to verify if an item can be used as fuel. Hope I'm making sense I am NO GOOD at explaining things through text.
-
Ok so I've come up with this: package com.INTENSS.BTP; import com.INTENSS.BTP.Blocks.PyroxBlock; import com.INTENSS.BTP.Items.PyroxIngot; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.IFuelHandler; public class FurnaceFuel implements IFuelHandler { @Override public int getBurnTime(ItemStack fuel) { Block blockFuel = Block.getBlockFromItem(fuel.getItem()); Item itemFuel = fuel.getItem(); if (blockFuel == PyroxBlock.pyroxBlock) { return 640; } else if (itemFuel == PyroxIngot.pyroxIngot) { return 160; } else { return 0; } } } Which this works great if I want to enter multiple lines of code per item. I'd like to use an Array. Now I am not new to Java but I am to minecraft modding, what would I set this? I've tried standard approaches when it comes to creating the array but I cant seem to get it to call the item/block and the burn times and I'm not exactly sure why