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

I cant seem to get this to work

 

package com.linumhost.Items;


import com.linumhost.Blocks.Blocks;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class Wrench extends Item{


private static Block[] canWrench = new Block[1];

public static void populateArray(){
	canWrench[0] = Blocks.conduit;
}

public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int posx, int posy, int posz, int side, float x, float y, float z) {
	    if(!world.isRemote) {
	    	for(int i = 0; i > canWrench.length; i++){
	    		if(world.getBlock(posx, posy, posz) == canWrench[i]){
			    	System.out.println(canWrench[i]);
	    			return true;
	    		}
	    		return false;
	    	}
	    	return false;
	    }
		return false;
}

}

  • Author

Solved, simple but yet impossible mistake to find turns out I was checking if "i > canWrench.length" when i should of checked if "i < canWrench.length"

Sorry, just a little side note, but here, we can't help you if you don't describe the issue or problem to us. And a worse case of that, as you put it:

 

I cant seem to get this to work

 

^^^ That my friend is not telling us anything. We need a detailed description on the issue or at least a little more explanation or we can't do anything.

 

On the other hand,

 

Thank you for posting your code. That was wise of you. You don't know how many times people don't and it really is a struggle.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information

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.