Topic category: Advanced modding
Hello there everyone,
(Wow I post too much on the forums here... Heheh... Whoops.)
So, I'm trying to make a tropical Survival Island-type mod. I've made coconuts, coconut trees, and the wood for the trees so far. But I have also made the wooden planks to go with it. I was wondering if there's any way to make these "Coconut Planks" behave like EVERY other wooden planks, in that they can:
1. Be used to craft everything that normal wooden planks can
2. Be used in conjunction with other types of planks for these recipes, in case the player doesn't have enough of one type of wood for something.
There's gotta be something I can add to the code to add this new block to a "wood class" or something, right?
If anyone can help, let me know.
Thanks,
-A
You should be able to just look up a tutorial for making trees in eclipse
For usage in recipes you should be able use in init FML life cycle
OreDictionary.registerOre("plankWood", YOUR_BLOCK);
@#2 Awesome. Where should I put that in the code? Here's the whole code for the block:
package mod.mcreator;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraft.world.World;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.material.Material;
import net.minecraft.block.SoundType;
import net.minecraft.block.Block;
import java.util.Random;
public class mcreator_coconutWoodPlanks {
public mcreator_coconutWoodPlanks() {
}
public static BlockCoconutWoodPlanks block;
public static Object instance;
public int addFuel(ItemStack fuel) {
return 0;
}
public void serverLoad(FMLServerStartingEvent event) {
}
public void preInit(FMLPreInitializationEvent event) {
}
public void registerRenderers() {
}
public void load(FMLInitializationEvent event) {
if (event.getSide() == Side.CLIENT) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:CoconutWoodPlanks", "inventory"));
}
}
static {
block = (BlockCoconutWoodPlanks) (new BlockCoconutWoodPlanks().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F)
.setUnlocalizedName("CoconutWoodPlanks").setLightOpacity(0).setCreativeTab(CreativeTabs.BUILDING_BLOCKS));
block.setHarvestLevel("axe", 0);
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
}
public void generateNether(World world, Random random, int chunkX, int chunkZ) {
}
static class BlockCoconutWoodPlanks extends Block {
int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
boolean red = false;
protected BlockCoconutWoodPlanks() {
super(Material.WOOD);
GameRegistry.registerBlock(this, "CoconutWoodPlanks");
setSoundType(SoundType.WOOD);
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
}
@Override
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
return red ? 15 : 0;
}
@Override
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
return red ? 15 : 0;
}
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.SOLID;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
}
@Override
public int tickRate(World world) {
return 10;
}
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
}
}
In the FML init event so in public void load(FMLInitializationEvent event) {}
Ok, so I tried:
public void load(FMLInitializationEvent event) {
OreDictionary.registerOre("plankWood", mcreator_coconutWoodPlanks);
if (event.getSide() == Side.CLIENT) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:CoconutWoodPlanks", "inventory"));
}
}
...and...
public void load(FMLInitializationEvent event) {
OreDictionary.registerOre("plankWood", CoconutWoodPlanks);
if (event.getSide() == Side.CLIENT) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:CoconutWoodPlanks", "inventory"));
}
}
...and...
public void load(FMLInitializationEvent event) {
OreDictionary.registerOre("plankWood", BlockCoconutWoodPlanks);
if (event.getSide() == Side.CLIENT) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:CoconutWoodPlanks", "inventory"));
}
}
...none of them worked. Could you please put it in the correct spot in that code, and look through the code to tell me what I should put in place of YOUR_BLOCK?
@#3 Whoops, didn't hit reply. See above. ^^^
Try your block variable
Hey, could you tell me how to do it inside Mcreator (with the code editor), please?
Thanks.
OreDictionary.registerOre("plankWood", poisonous_planks); is invalid for my poisonous planks
I REPLIED
uhh these are not replies
I'm new here I would be glad to communicate.
https://floridarehabexperts.com/
create a tag called "planks" make it so the namespace is minecraft and add the item (tag needs to be item type)