Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author

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

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.

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.

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.

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.

  • Author

How can I check that in the trySmeltItem if there's no boolean? I thought I already checked that with boolean isItemValid method

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 by Animefan8888
Using the code block.

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.

  • Author

Okay, I inserted the code:

	private void trySmeltItem(){
		
		if (this.smeltTime >= this.maxSmeltTime) {
			return;
		}
...

And the bug still remains :-/

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.

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.

  • Author

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

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?

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.

Look at the if-statement.

Consider likely values.

Compute the outcome in your head.

 

If that fails, use the debugger.

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.

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.

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.

  • Author

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.