Posted April 3, 20178 yr Hello, Here's my code. I'm having trouble getting the getItemDropped function to actually be called. I created a new class called ModBlockDoor that extends BlockDoor. I overwrote the getItemDropped function like this: @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { System.out.println("INSIDE"); return /*state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.field_190931_a : */this.getModItem(); } public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(this.getItem()); } private Item getModItem() { System.out.println("Blocks equal? " + (this == BlockHandler.glassDoor) + " : " + (this.blockName == BlockHandler.glassDoor.blockName)); return this.blockName == BlockHandler.glassDoor.blockName ? BlockHandler.iGlassDoor : null; } Also, I had to comment out part of the line in the return of getItemDropped because otherwise forge complains that it can't find the symbol for Items.field_190931_a. (And yes, net.minecraft.init.Items is imported at the top..., and when I go to Items.java, I can see the field, which is public, so I don't know why I get this error....) Anyway, nothing get's printed out into the console when I destroy the block in-game, and an item doesn't drop. Any help would be appreciated.
April 4, 20178 yr Any log output? Also is the function getItemDropped show as a little green arrow at the left? Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
April 4, 20178 yr Author Here's the compiler output when I uncomment the piece of the return statement: warning: [options] bootstrap class path not set in conjunction with -source 1.6 R:\Minecraft\1.11.2\ExpandedAesthetics\build\sources\main\java\com\DragonFerocity\expanded\blocks\ModBlockDoor.java:57: error: cannot find symbol return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.field_190931_a : this.getModItem(); ^ symbol: variable field_190931_a location: class Items Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error 1 warning :compileJava FAILED As for the log output? That's exactly it, getItemDropped function appears to not be being called since the the text in the println statement never shows up. Also, I'm using Visual Studio, instead of Eclipse. Probably should have stated that before. Also, everything builds just fine, and runs without any errors in the game-run log.
April 4, 20178 yr When a block is broken, it will call Block#harvestBlock > dropBlockAsItem > dropBlockAsItemWithChance > getDrops > getItemDropped. You could try putting a breakpoint in there and tracing through the chain to see where it goes awry.
April 4, 20178 yr Author So, I tried setting a breakpoint on Block#harvestBlock, and it doesn't appear to hit it. Ever. Also, in creative mode, when you destroy a block is it supposed to drop itself? Nothing is dropping itself currently. And in survival, when I break a block, the harvestBlock function doesn't call the breakpoint I set. Maybe I'm doing something wrong though.
April 4, 20178 yr 53 minutes ago, DragonFerocity said: when you destroy a block is it supposed to drop itself? Absolutely fucking not. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 4, 20178 yr Author Let me restate that. I realize that that is wrong. In creative mode, when you destroy a block, is it supposed to drop it's corresponding item? Currently nothing is dropping anything - zilch - when I destroy something in creative mode.
April 4, 20178 yr 17 minutes ago, DragonFerocity said: In creative mode, when you destroy a block, is it supposed to drop it's corresponding item? No. It is not. It is not supposed to drop anything. Creative mode literally bypasses all harvestblock code. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 4, 20178 yr 1 hour ago, DragonFerocity said: And in survival, when I break a block, the harvestBlock function doesn't call the breakpoint I set. So where does it get to?
April 4, 20178 yr Author 2 minutes ago, Draco18s said: No. It is not. It is not supposed to drop anything. Creative mode literally bypasses all harvestblock code. Ok, that's... interesting 4 minutes ago, Jay Avery said: So where does it get to? I'm not sure. I started a survival mode world and destroyed some blocks, and the breakpoint still never triggered.
April 4, 20178 yr You know that /gamemode 0 exists, right? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 4, 20178 yr Author No, I didn't. I'll try that. I haven't owned Minecraft very long. About 3 weeks. Edited April 4, 20178 yr by DragonFerocity
April 4, 20178 yr Author Well, it does drop its respect item when I switch to survival... Could have avoided this if I knew about /gamemode 0.. But oh well. Now I do. Thanks,
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.