Custom Wood Question

Started by Mr_Alpha on

Topic category: Advanced modding

Last seen on 14:42, 8. Mar 2022
Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Wood Question

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

Last seen on 02:43, 17. Nov 2019
Joined Oct 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You should be able to just
Tue, 01/03/2017 - 20:28

You should be able to just look up a tutorial for making trees in eclipse

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For usage in recipes you
Tue, 01/03/2017 - 21:28

For usage in recipes you should be able use in init FML life cycle 
OreDictionary.registerOre("plankWood", YOUR_BLOCK);

Last seen on 14:42, 8. Mar 2022
Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:For usage in recipes you
Tue, 01/03/2017 - 23:55

@#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;
        }

    }
}

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the FML init event so in
Wed, 01/04/2017 - 20:29

In the FML init event so in public void load(FMLInitializationEvent event) {}

Last seen on 14:42, 8. Mar 2022
Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, so I tried:
Wed, 01/04/2017 - 20:49

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?

Last seen on 14:42, 8. Mar 2022
Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:In the FML init event so in
Wed, 01/04/2017 - 20:50

@#3 Whoops, didn't hit reply. See above. ^^^

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try your block variable
Wed, 01/04/2017 - 21:15

Try your block variable

Last seen on 10:11, 11. Apr 2020
Joined Jun 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, could you tell me how…
Wed, 04/08/2020 - 14:55

Hey, could you tell me how to do it inside Mcreator (with the code editor), please?

Thanks.

Last seen on 20:23, 30. Oct 2023
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
OreDictionary.registerOre(…
Sat, 10/10/2020 - 22:45

OreDictionary.registerOre("plankWood", poisonous_planks); is invalid for my poisonous planks

Last seen on 20:23, 30. Oct 2023
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I REPLIED
Sat, 10/10/2020 - 22:46

I REPLIED

Last seen on 20:23, 30. Oct 2023
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
uhh these are not replies
Sat, 10/10/2020 - 22:46

uhh these are not replies

Last seen on 21:52, 28. Dec 2022
Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
create a tag called "planks"…
Mon, 11/23/2020 - 20:18

create a tag called "planks" make it so the namespace is minecraft  and add the item (tag needs to be item type)