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

Now, I'm working on the mod. I need to add your tree, wood blocks, respectively, are necessary for him, leaves and seedlings. The log is ready, now I suffer doing foliage. :D

I ask your help forum as it to make?

  • Author

I made the leaves, they are transparent, but I do not know how to do what they would have kept on my tree and dropped my sapling.

  • Author

Ok. I codding rubber leaves. Her Is code.

package cheshirX.highEnergetics.blocks.block;

import java.util.List;
import java.util.Random;

import cheshirX.highEnergetics.HighEnergetics;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


public class BlockRubberLeaves extends BlockLeaves
{
    public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15);
    
    public BlockPlanks.EnumType type;
    
    public ItemBlock item;
    
    public BlockRubberLeaves() {
        super();
        setRegistryName("rubber_leaves");
        setUnlocalizedName("rubber_leaves");
        setCreativeTab(HighEnergetics.tabHEI);
        
        //setDefaultState(this.blockState.getBaseState()/*.withProperty(LEVEL, new Integer(0))*/);
        type = BlockPlanks.EnumType.OAK;
    }

    
    @Override
    protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {
        if((type == BlockPlanks.EnumType.OAK || type == BlockPlanks.EnumType.DARK_OAK) && worldIn.rand.nextInt(chance) == 0) {
            spawnAsEntity(worldIn, pos, new ItemStack(Items.apple));
        }
    }
    
    @Override
    protected int getSaplingDropChance(IBlockState state) {
        return type == BlockPlanks.EnumType.JUNGLE ? 40 : super.getSaplingDropChance(state);
    }
    
    @Override
    protected ItemStack createStackedBlock(IBlockState state) {
        return new ItemStack(Item.getItemFromBlock(this), 1, type.getMetadata());
    }
    
    /**
     * Convert the given metadata into a BlockState for this Block
     */
    @Override
    public IBlockState getStateFromMeta(int meta) {
        return this.getDefaultState()/*.withProperty(LEVEL, new Integer(meta))*/;
    }
    
    /**
     * Convert the BlockState into the correct metadata value
     */
    @Override
    public int getMetaFromState(IBlockState state) {
        return 0;//state.getValue(LEVEL).intValue();
    }
    
    @Override
    public BlockPlanks.EnumType getWoodType(int meta) {
        return BlockPlanks.EnumType.OAK;
    }
    
    @Override
    protected BlockStateContainer createBlockState() {
        return new BlockStateContainer(this/*, LEVEL*/);
    }
    
    /**
     * Gets the metadata of the item this Block can drop. This method is called
     * when the block gets destroyed. It returns the metadata of the dropped
     * item based on the old metadata of the block.
     */
    @Override
    public int damageDropped(IBlockState state) {
        return 0;
    }
    
    @Override
    public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack) {
        if(!worldIn.isRemote && stack != null && stack.getItem() == Items.shears) {
            player.addStat(StatList.func_188055_a(this));
        } else {
            super.harvestBlock(worldIn, player, pos, state, te, stack);
        }
    }
    
    @Override
    public List<ItemStack> onSheared(ItemStack itemStack, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) {
        Block block = type.getMetadata() < 4 ? Blocks.leaves : Blocks.leaves2;
        int meta = type.getMetadata() % 4;
        return java.util.Arrays.asList(new ItemStack(block, 1, meta));
    }
    
    /**
     * Just here to prevent BlockLeaves's updateTick from running.
     */
    @Override
    public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
        //
    }
    
    /**
     * Just here to prevent BlockLeaves's beginLeavesDecay from running.
     */
    @Override
    public void beginLeavesDecay(IBlockState state, World world, BlockPos pos)
    {
        //
    }
    
    @Override
    @SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer()
    {
        return Minecraft.isFancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
    }
    
    /**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
    @Override
    public boolean isOpaqueCube(IBlockState state)
    {
        return !Minecraft.isFancyGraphicsEnabled();
    }
}

  • Author

Not all is Ok. Block do not rendering in inventory.

 

And I'm question:

How I do my leaves connected with my log?(sustain)

 

Sorry, I be latter.

 

 

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.