Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.reactioncraft.desert.common;
- import java.util.List;
- import java.util.Random;
- import javax.annotation.Nullable;
- import com.reactioncraft.reactioncraft;
- import com.reactioncraft.core.common.blocks.BlockBase;
- import com.reactioncraft.integration.instances.IntegratedBlocks;
- import com.reactioncraft.integration.instances.IntegratedItems;
- import net.minecraft.block.BlockDirt;
- import net.minecraft.block.material.MapColor;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.properties.IProperty;
- import net.minecraft.block.properties.PropertyEnum;
- import net.minecraft.block.state.BlockStateContainer;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.init.Blocks;
- import net.minecraft.init.Items;
- import net.minecraft.item.EnumDyeColor;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemBlock;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.BlockRenderLayer;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class BlockDesertMulti extends BlockBase
- {
- public static final PropertyEnum<EnumDesertBlocks> TYPE = PropertyEnum.<EnumDesertBlocks>create("type", EnumDesertBlocks.class);
- public BlockDesertMulti(String name, Material materialIn)
- {
- super(materialIn, name);
- this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, EnumDesertBlocks.one1));
- this.setCreativeTab(reactioncraft.Reactioncraft);
- //this.getItemDropped(getDefaultState(), RANDOM, lightOpacity);
- }
- @Nullable
- public Item getItemDropped(IBlockState state, Random rand, int fortune)
- {
- if (state.getValue(BlockDesertMulti.TYPE) == EnumDesertBlocks.one1)
- {
- System.out.println("here?");
- return IntegratedBlocks.DesertBlocks.getItemDropped(IntegratedBlocks.DesertBlocks.getDefaultState().withProperty(BlockDesertMulti.TYPE, EnumDesertBlocks.one2), rand, fortune);
- //return Blocks.DIRT.getItemDropped(Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune);
- }
- if (state.getValue(BlockDesertMulti.TYPE) == EnumDesertBlocks.one2)
- {
- System.out.println("here!");
- return IntegratedItems.UncutLBGem;
- }
- if (state.getValue(BlockDesertMulti.TYPE) == EnumDesertBlocks.one3)
- {
- System.out.println("here@");
- return IntegratedItems.UncutDBGem;
- }
- else
- {
- System.out.println("why here?");
- return (Item) state;
- }
- }
- /**
- * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
- */
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
- {
- for (EnumDesertBlocks types : EnumDesertBlocks.values())
- {
- list.add(new ItemStack(itemIn, 1, types.getMetadata()));
- }
- }
- /**
- * Convert the given metadata into a BlockState for this Block
- */
- public IBlockState getStateFromMeta(int meta)
- {
- return this.getDefaultState().withProperty(TYPE, EnumDesertBlocks.byMetadata(meta));
- }
- /**
- * Convert the BlockState into the correct metadata value
- */
- public int getMetaFromState(IBlockState state)
- {
- return ((EnumDesertBlocks)state.getValue(TYPE)).getMetadata();
- }
- protected BlockStateContainer createBlockState()
- {
- return new BlockStateContainer(this, new IProperty[] {TYPE});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement