July 19, 201312 yr Author Should be. Ok is there anyway i could check if it was a furnace recipe so it worked with modded ores or will it only work with vanilla ores
July 19, 201312 yr Block brokenBlock = Block.blocksList[world.getBlockId(x, y, z)]; int meta = world.getBlockMetadata(x, y, z); ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta));
July 19, 201312 yr Author Block brokenBlock = Block.blocksList[world.getBlockId(x, y, z)]; int meta = world.getBlockMetadata(x, y, z); ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); Ok does this just check if it is a smelting recipe or should this be all the code I need for it to work?
July 19, 201312 yr You'll want to check if result != null and then spawn an EntityItem in the world if it is not remote.
July 19, 201312 yr Author You'll want to check if result != null and then spawn an EntityItem in the world if it is not remote. Should the EntityItem spawned in be result?
July 19, 201312 yr Author Yes. Ok thanks a lot I'll work on this and come back if somethings wrong and i cant figure it out
July 21, 201312 yr Author Yes. For the auto-smelting pickaxe this is my code but how do I drop the item I've messed around and whenever I try something it crashes when i break the block and doesnt work public boolean onBlockDestroyed(ItemStack itemStack, World world, int par1, int par2, int par3, int par4, EntityLivingBase entityLivingBase) { Block brokenBlock = Block.blocksList[world.getBlockId(par1, par1, par3)]; int meta = world.getBlockMetadata(par1, par2, par3); ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { //How do I drop the item? } return true; }
July 21, 201312 yr EntityItem item = new EntityItem(world, i, j, k, result); world.spawnEntityInWorld(item);
July 21, 201312 yr Author EntityItem item = new EntityItem(world, i, j, k, result); world.spawnEntityInWorld(item); When i login and break a block I crash and when i log back in theres the ingot and the ore on the ground if it was an ore block i broke public boolean onBlockDestroyed(ItemStack itemStack, World world, int par1, int par2, int par3, int par4, EntityLivingBase entityLivingBase) { Block brokenBlock = Block.blocksList[world.getBlockId(par2, par3, par4)]; int meta = world.getBlockMetadata(par2, par3, par4); ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { EntityItem drop = new EntityItem(world, par2, par3, par4, result); world.spawnEntityInWorld(drop); } return false; }
July 21, 201312 yr Author Okay, well I kind of need a crash log for that. Ok here ---- Minecraft Crash Report ---- // I feel sad now Time: 7/21/13 4:09 PM Description: Unexpected error java.lang.NullPointerException at net.minecraft.item.ItemStack.<init>(ItemStack.java:71) at Kenoba10.Too_Much_Tools.NetherStar.ItemNetherStarPickaxe.onBlockDestroyed(ItemNetherStarPickaxe.java:33) at net.minecraft.item.ItemStack.onBlockDestroyed(ItemStack.java:402) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:174) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDamageBlock(PlayerControllerMP.java:293) at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1307) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1868) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:898) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826) at net.minecraft.client.main.Main.main(Main.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:57) at net.minecraft.launchwrapper.Launch.main(Launch.java:18) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.item.ItemStack.<init>(ItemStack.java:71) at Kenoba10.Too_Much_Tools.NetherStar.ItemNetherStarPickaxe.onBlockDestroyed(ItemNetherStarPickaxe.java:33) at net.minecraft.item.ItemStack.onBlockDestroyed(ItemStack.java:402) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:174) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDamageBlock(PlayerControllerMP.java:293) at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1307) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player747'/302, l='MpServer', x=204.59, y=62.62, z=251.30]] Chunk stats: MultiplayerChunkCache: 441 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (232,64,256), Chunk: (at 8,4,0 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) Level time: 29596 game time, 1312 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false Forced entities: 70 total; [EntityZombie['Zombie'/137, l='MpServer', x=243.69, y=27.00, z=275.47], EntityBat['Bat'/136, l='MpServer', x=248.75, y=32.10, z=243.50], EntityCow['Cow'/142, l='MpServer', x=264.59, y=69.00, z=237.47], EntitySkeleton['Skeleton'/128, l='MpServer', x=239.50, y=30.00, z=273.50], EntityZombie['Zombie'/133, l='MpServer', x=247.34, y=27.00, z=211.94], EntityZombie['Zombie'/132, l='MpServer', x=243.30, y=11.00, z=208.70], EntityBat['Bat'/135, l='MpServer', x=248.41, y=32.10, z=243.47], EntitySkeleton['Skeleton'/134, l='MpServer', x=245.09, y=24.00, z=218.47], EntityCow['Cow'/152, l='MpServer', x=283.31, y=65.00, z=254.47], EntityZombie['Zombie'/153, l='MpServer', x=276.50, y=21.00, z=273.50], EntitySkeleton['Skeleton'/42, l='MpServer', x=133.59, y=42.00, z=213.94], EntitySkeleton['Skeleton'/43, l='MpServer', x=132.50, y=41.00, z=222.50], EntityZombie['Zombie'/41, l='MpServer', x=127.97, y=53.00, z=326.47], EntityZombie['Zombie'/46, l='MpServer', x=142.31, y=38.00, z=274.56], EntityCreeper['Creeper'/47, l='MpServer', x=140.94, y=30.00, z=291.59], EntityBat['Bat'/44, l='MpServer', x=132.00, y=27.10, z=241.56], EntityZombie['Zombie'/45, l='MpServer', x=134.72, y=24.00, z=258.50], EntitySquid['Squid'/51, l='MpServer', x=157.50, y=56.38, z=223.13], EntityMinecartChest['entity.MinecartChest.name'/49, l='MpServer', x=139.50, y=32.50, z=330.50], EntityOcelot['Ocelot'/48, l='MpServer', x=138.06, y=65.00, z=318.56], EntityBat['Bat'/55, l='MpServer', x=156.53, y=36.10, z=296.75], EntityZombie['Zombie'/54, l='MpServer', x=146.31, y=26.00, z=250.88], EntityZombie['Zombie'/53, l='MpServer', x=146.50, y=26.00, z=252.50], EntityBat['Bat'/52, l='MpServer', x=146.59, y=18.10, z=247.75], EntityCreeper['Creeper'/58, l='MpServer', x=145.50, y=51.00, z=323.50], EntityMinecartChest['entity.MinecartChest.name'/57, l='MpServer', x=147.50, y=36.50, z=318.50], EntityCreeper['Creeper'/56, l='MpServer', x=145.00, y=31.00, z=310.41], EntityZombie['Zombie'/63, l='MpServer', x=175.03, y=54.00, z=249.47], EntityCow['Cow'/62, l='MpServer', x=171.50, y=67.00, z=225.50], EntitySquid['Squid'/61, l='MpServer', x=172.50, y=56.38, z=213.50], EntityClientPlayerMP['Player747'/302, l='MpServer', x=204.59, y=62.62, z=251.30], EntityItem['item.item.dyePowder.black'/64, l='MpServer', x=161.38, y=18.13, z=256.84], EntityBat['Bat'/65, l='MpServer', x=174.72, y=33.10, z=292.53], EntityCreeper['Creeper'/66, l='MpServer', x=160.50, y=31.00, z=314.50], EntityCow['Cow'/77, l='MpServer', x=187.88, y=63.00, z=175.91], EntityCow['Cow'/78, l='MpServer', x=188.78, y=63.00, z=208.75], EntitySkeleton['Skeleton'/79, l='MpServer', x=183.53, y=28.00, z=235.88], EntityMinecartChest['entity.MinecartChest.name'/85, l='MpServer', x=182.50, y=28.50, z=329.50], EntityCow['Cow'/84, l='MpServer', x=186.47, y=67.00, z=312.63], EntityCow['Cow'/86, l='MpServer', x=191.03, y=64.00, z=330.13], EntitySkeleton['Skeleton'/81, l='MpServer', x=190.50, y=21.00, z=269.50], EntityCow['Cow'/80, l='MpServer', x=183.06, y=63.00, z=251.91], EntityCow['Cow'/83, l='MpServer', x=189.97, y=63.00, z=308.88], EntityCreeper['Creeper'/82, l='MpServer', x=188.50, y=33.00, z=265.53], EntityCow['Cow'/93, l='MpServer', x=204.50, y=71.00, z=175.50], EntityCow['Cow'/95, l='MpServer', x=201.13, y=65.00, z=180.13], EntityCow['Cow'/94, l='MpServer', x=206.44, y=65.00, z=191.25], EntityBat['Bat'/102, l='MpServer', x=201.13, y=28.02, z=285.50], EntityCow['Cow'/103, l='MpServer', x=201.69, y=64.00, z=284.72], EntitySkeleton['Skeleton'/100, l='MpServer', x=195.59, y=17.21, z=283.30], EntityCreeper['Creeper'/101, l='MpServer', x=200.69, y=26.36, z=277.69], EntityCreeper['Creeper'/98, l='MpServer', x=194.09, y=21.00, z=268.97], EntitySpider['Spider'/99, l='MpServer', x=191.50, y=22.00, z=272.75], EntityCow['Cow'/96, l='MpServer', x=196.81, y=64.00, z=188.88], EntitySkeleton['Skeleton'/97, l='MpServer', x=196.50, y=21.00, z=267.50], EntityCreeper['Creeper'/110, l='MpServer', x=208.50, y=26.00, z=269.50], EntityCreeper['Creeper'/111, l='MpServer', x=213.00, y=28.00, z=270.63], EntityBat['Bat'/108, l='MpServer', x=227.88, y=13.01, z=239.03], EntitySpider['Spider'/109, l='MpServer', x=208.72, y=58.77, z=250.94], EntityCow['Cow'/104, l='MpServer', x=192.44, y=63.00, z=316.09], EntityEnderman['Enderman'/117, l='MpServer', x=211.22, y=39.00, z=324.34], EntityCow['Cow'/116, l='MpServer', x=223.31, y=64.00, z=316.22], EntitySpider['Spider'/115, l='MpServer', x=211.28, y=48.00, z=305.47], EntityCreeper['Creeper'/114, l='MpServer', x=221.63, y=53.00, z=307.03], EntitySpider['Spider'/113, l='MpServer', x=212.53, y=40.00, z=319.25], EntityCreeper['Creeper'/112, l='MpServer', x=208.28, y=26.00, z=272.97], EntityCreeper['Creeper'/127, l='MpServer', x=225.69, y=17.00, z=250.44], EntityBat['Bat'/126, l='MpServer', x=230.25, y=32.10, z=230.38], EntityCreeper['Creeper'/125, l='MpServer', x=227.31, y=11.00, z=234.63], EntityCreeper['Creeper'/124, l='MpServer', x=232.50, y=32.00, z=207.00]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2298) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:851) at net.minecraft.client.main.Main.main(Main.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:57) at net.minecraft.launchwrapper.Launch.main(Launch.java:18) -- System Details -- Details: Minecraft Version: 1.6.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_25, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 810777376 bytes (773 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 7171 (401576 bytes; 0 MB) allocated, 1027 (57512 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 1, tallocated: 63 FML: MCP v8.04 FML v6.2.19.787 Minecraft Forge 9.10.0.787 4 mods loaded, 4 mods active mcp{8.04} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{6.2.19.787} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{9.10.0.787} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available TooMuchTools{1.0} [Too Much Tools] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: Intel® HD Graphics Family GL version 3.1.0 - Build 8.15.10.2430, Intel Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Pack: Default Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 1971 (110376 bytes; 0 MB) allocated, 223 (12488 bytes; 0 MB) used
July 21, 201312 yr if(brokenBlock != null) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { EntityItem drop = new EntityItem(world, par2, par3, par4, result); world.spawnEntityInWorld(drop); return false; } }
July 22, 201312 yr Author if(brokenBlock != null) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { EntityItem drop = new EntityItem(world, par2, par3, par4, result); world.spawnEntityInWorld(drop); return false; } } Thanks but when I break it with the pick the first time i break that ore type I get an ingot and the ore, the rest of the then I just get the ore back
July 22, 201312 yr if(world.getBlockId(i, j, k) == Block.wood.blockID) { for(int x = -1; x <= 1; x++) { for(int y = 0; y <= 15; y++) { for(int z = -1; z <= 1; z++) { if(world.getBlockId(i + x, j + y, k + z) == Block.wood.blockID) { int meta = world.getBlockMetadata(i + x, j + y, k + z); ItemStack drop = new ItemStack(Block.wood, 1, meta); EntityItem item = new EntityItem(world, i + x, j + y, k + z, drop); world.setBlock(i + x, j + y, k + z, 0); world.spawnEntityInWorld(item); } } } } } That first if statement seems EXTREMELY redundant... But oh well I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
July 22, 201312 yr if(brokenBlock != null) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { EntityItem drop = new EntityItem(world, par2, par3, par4, result); world.spawnEntityInWorld(drop); return false; } } Thanks but when I break it with the pick the first time i break that ore type I get an ingot and the ore, the rest of the then I just get the ore back That makes sense. The problem with the ore is the fact that what a block drops is set inside the block's class. And to my knowledge, there is no way to void that block drop. But I guess you could do a hackish type job by using gamerules... By that I mean set block drops to false and then back to true again once it dropped the item. As to it only working once... I am not sure I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
July 22, 201312 yr That first if statement seems EXTREMELY redundant... But oh well It's to tell it that breaking a block beneath a wood block won't have the "timber" effect. If that weren't there it could work by breaking it otherwise. Thanks for the concern, though.
July 22, 201312 yr That first if statement seems EXTREMELY redundant... But oh well It's to tell it that breaking a block beneath a wood block won't have the "timber" effect. If that weren't there it could work by breaking it otherwise. Thanks for the concern, though. That still doesn't quite work out logically in my mind... Why check the block you are breaking is wood, if you are wanting to check the block under it? That is what caused my confusion in the first place. I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
July 22, 201312 yr That still doesn't quite work out logically in my mind... Why check the block you are breaking is wood, if you are wanting to check the block under it? That is what caused my confusion in the first place. So for example, you are using the axe to break a dirt block. Above the dirt block is a tree. The timber effect should not take place since you are breaking dirt. That is why it checks for logs first, so that "hey, you're breaking a wood block now, let's know out the rest of 'em" will happen.
July 22, 201312 yr That still doesn't quite work out logically in my mind... Why check the block you are breaking is wood, if you are wanting to check the block under it? That is what caused my confusion in the first place. So for example, you are using the axe to break a dirt block. Above the dirt block is a tree. The timber effect should not take place since you are breaking dirt. That is why it checks for logs first, so that "hey, you're breaking a wood block now, let's know out the rest of 'em" will happen. That makes sense now I didn't think of that... Good job mate! Glad someone has common sense I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
July 22, 201312 yr Author if(brokenBlock != null) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { EntityItem drop = new EntityItem(world, par2, par3, par4, result); world.spawnEntityInWorld(drop); return false; } } For the pickaxe do you know of any way to prevent the default block drop and when I break the ore for the first time it gives me an ingot and the ore. The rest of the time i only get the ore.
July 22, 201312 yr Author if(brokenBlock != null) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(brokenBlock, 1, meta)); if(result != null) { EntityItem drop = new EntityItem(world, par2, par3, par4, result); world.spawnEntityInWorld(drop); return false; } } Thanks but when I break it with the pick the first time i break that ore type I get an ingot and the ore, the rest of the then I just get the ore back That makes sense. The problem with the ore is the fact that what a block drops is set inside the block's class. And to my knowledge, there is no way to void that block drop. But I guess you could do a hackish type job by using gamerules... By that I mean set block drops to false and then back to true again once it dropped the item. As to it only working once... I am not sure Ok how could I do that gamerule thing? Also when I overrided canHarvestBlock when I broke a block I got the ingot back and niot the ore but it took a super long time to mine and then for all blocks mined with the pick this happened
July 24, 201312 yr Author How can I make this auto smelting pickaxe its getting very frustrating how could I do the gamemode thing though?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.