Jump to content

Recommended Posts

Posted (edited)

I am making a block called Root Block and I want it to do the same things as a dirt block, except for plating crops but I want to be able to plant saplings on it. I can't figure out how to do this. Please Help! NOTE: I am new to modding so please tell me where to put whatever code you might send and what it does, please.

Edited by WimpyLlama
Posted (edited)
20 hours ago, WimpyLlama said:

I can't figure out how to do this.

Start by learning Java (elsewhere, there are many online tutorials), which you should be able to do in a couple weeks. Then install Forge's development system, described in detail elsewhere on this site.

 

20 hours ago, WimpyLlama said:

please tell me where to put whatever code you might send

Don't worry, you shouldn't be asking for code to be spoon fed to you, so you won't need to be told where to put any. However, what you can do (after learning Java and installing Forge) is to Google for Forge mods at GitHub. You can see code and how it's organized by successful modders.

Edited by jeffryfisher

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

I do know a bit of JAVA and from what other people have told me is with minecraft modding it's best to just learn how to mod not learn JAVA. And yes, I did make a block, here is my code.

package wimpyllama.wimprimstuff.blocks;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import wimpyllama.wimprimstuff.Reference;

public class BlockRootBlock extends Block {
	
	public BlockRootBlock(String unlocalizedName) {
		super(Material.GROUND);
		this.setUnlocalizedName(unlocalizedName);
		this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName));
		this.setHardness(0.5f);
		this.setResistance(0);
		this.setSoundType(SoundType.GROUND);
	}

	@Override
	public Item getItemDropped(IBlockState state, Random rand, int fortune) {
		return Item.getItemFromBlock(this);
	}

}

 

Posted

Did you consider extending dirt instead of the generic Block class? What issues did you encounter?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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