ssbbpeople Posted July 24, 2019 Share Posted July 24, 2019 Hi, I've recently finished the classes for my BlockGrinder, but onBlockActivated seems to not be firing when I right-click the block. When I right-click it, absolutely nothing happens. Here's the code: //When right-clicked @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(worldIn.isRemote) { return true; } final TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileGrinder) { playerIn.openGui(Main.instance, ModGuiHandler.MOD_GRINDER, worldIn, pos.getX(), pos.getY(), pos.getZ()); playerIn.addStat(StatList.FURNACE_INTERACTION); } return true; } I used the BlockFurnace class as reference for this method, but it doesn't open the GUI nor make the player right-click animation for the block Quote Link to comment Share on other sites More sharing options...
sunsigne Posted July 24, 2019 Share Posted July 24, 2019 This should probably be helping you : https://github.com/sunsigne/Sunsigne It's a mod i created 6 months ago in 1.12.2 and there is a fully fonctionnal "centrifuge", whose the fonction might be similar to your grinder Quote Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 24, 2019 Author Share Posted July 24, 2019 Thank you! I got the onBlockActivated method functioning correctly. Now I just have two smelting bugs... it instantly smelts items, even when there's no fuel Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted July 24, 2019 Share Posted July 24, 2019 45 minutes ago, ssbbpeople said: Thank you! I got the onBlockActivated method functioning correctly. Now I just have two smelting bugs... it instantly smelts items, even when there's no fuel Not sure if you are asking for help or not...but if you want help we need to see the code for your TE. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 24, 2019 Author Share Posted July 24, 2019 Yes, sorry I forgot to link my GitHub. Here's the link:https://github.com/SpookyBarca/Metallurgy All my Grinder files are in the same package. Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted July 24, 2019 Share Posted July 24, 2019 21 minutes ago, ssbbpeople said: Yes, sorry I forgot to link my GitHub. Here's the link:https://github.com/SpookyBarca/Metallurgy All my Grinder files are in the same package. You never ever check if the time passed smelting is high enough and you also never check if the furnace has fuel in your trySmeltItem method. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 24, 2019 Author Share Posted July 24, 2019 How can I check that in the trySmeltItem if there's no boolean? I thought I already checked that with boolean isItemValid method Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted July 24, 2019 Share Posted July 24, 2019 (edited) 56 minutes ago, ssbbpeople said: How can I check that in the trySmeltItem if there's no boolean? I thought I already checked that with boolean isItemValid method if (this.smeltTime >= this.maxSmeltTime) Edited July 24, 2019 by Animefan8888 Using the code block. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 24, 2019 Author Share Posted July 24, 2019 Okay, I inserted the code: private void trySmeltItem(){ if (this.smeltTime >= this.maxSmeltTime) { return; } ... And the bug still remains :-/ Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted July 24, 2019 Share Posted July 24, 2019 12 minutes ago, ssbbpeople said: Okay, I inserted the code: private void trySmeltItem(){ if (this.smeltTime >= this.maxSmeltTime) { return; } ... And the bug still remains ? No that is not what I said. You need to actually smelt the item when that condition is true. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 25, 2019 Author Share Posted July 25, 2019 Oh okay. So I rearranged it like this: if (this.canSmeltItem()) { if (this.smeltTime >= this.maxSmeltTime) { return; } The bug occurs, but its under the if statement canSmeltItem Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted July 25, 2019 Share Posted July 25, 2019 Just now, ssbbpeople said: Oh okay. So I rearranged it like this: if (this.canSmeltItem()) { if (this.smeltTime >= this.maxSmeltTime) { return; } The bug occurs, but its under the if statement canSmeltItem Do you know the Java language or is Minecraft Modding your first venture? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 25, 2019 Author Share Posted July 25, 2019 I'm starting to learn Java, I made the mistake of going to modding tutorials first Quote Link to comment Share on other sites More sharing options...
Draco18s Posted July 25, 2019 Share Posted July 25, 2019 Look at the if-statement. Consider likely values. Compute the outcome in your head. If that fails, use the debugger. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
Animefan8888 Posted July 25, 2019 Share Posted July 25, 2019 2 minutes ago, ssbbpeople said: I'm starting to learn Java, I made the mistake of going to modding tutorials first Yes, yes you have. You should probably get some programming experience first. Or if you are dead set on doing this you won't really get help here because we don't like to have to teach Java to people. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
ssbbpeople Posted July 25, 2019 Author Share Posted July 25, 2019 I understand that. I'm sort of in a time crunch, so I figured going for tutorials would be the fastest way, for now. In the future/now I'll study more on java Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.