Search in sources :

Example 6 with EnumGem

use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.

the class BlockGemBrick method addRecipes.

@Override
public void addRecipes(RecipeMaker recipes) {
    ItemStack bricks = new ItemStack(Blocks.STONEBRICK, 1, OreDictionary.WILDCARD_VALUE);
    for (int i = 0; i < 16; ++i) {
        EnumGem gem = getGem(i);
        recipes.addSurroundOre(blockName + i, new ItemStack(this, 8, i), coated ? gem.getItemOreName() : gem.getShardOreName(), bricks);
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ItemStack(net.minecraft.item.ItemStack)

Example 7 with EnumGem

use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.

the class BlockGemSubtypes method getModels.

@Override
public void getModels(Map<Integer, ModelResourceLocation> models) {
    for (int i = 0; i < 16; ++i) {
        EnumGem gem = EnumGem.values()[i];
        models.put(i, new ModelResourceLocation(getFullName().toLowerCase(), "gem=" + gem.getName()));
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 8 with EnumGem

use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.

the class ItemGlowRoseFertilizer method clOnItemUse.

@Override
protected EnumActionResult clOnItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    Random rand = SilentGems.random;
    BlockPos center = pos.offset(EnumFacing.UP);
    if (worldIn.isAirBlock(center)) {
        // Always one at position used.
        EnumGem gem = EnumGem.values()[rand.nextInt(16)];
        IBlockState glowRose = ModBlocks.glowRose.getDefaultState().withProperty(EnumGem.VARIANT_GEM, gem);
        // Fail to use if glow rose can't be placed at center.
        if (!ModBlocks.glowRose.canBlockStay(worldIn, center, glowRose) || !worldIn.isAirBlock(center) || !worldIn.isAirBlock(center.up()))
            return EnumActionResult.FAIL;
        else // Only make changes on the server side!
        if (worldIn.isRemote)
            return EnumActionResult.SUCCESS;
        worldIn.setBlockState(center, glowRose, 2);
        // Random extras
        int extraCount = rand.nextInt(3);
        BlockPos target;
        int x, y, z;
        for (int i = 0; i < extraCount; ++i) {
            x = center.getX() + rand.nextInt(7) - 3;
            z = center.getZ() + rand.nextInt(7) - 3;
            // Try place one block higher, move down 1-2 if needed.
            for (y = center.getY() + 1; y > center.getY() - 2; --y) {
                target = new BlockPos(x, y, z);
                gem = EnumGem.values()[rand.nextInt(16)];
                glowRose = ModBlocks.glowRose.getDefaultState().withProperty(EnumGem.VARIANT_GEM, gem);
                if (ModBlocks.glowRose.canBlockStay(worldIn, target, glowRose) && worldIn.isAirBlock(target) && worldIn.isAirBlock(target.up())) {
                    worldIn.setBlockState(target, glowRose, 2);
                    break;
                }
            }
        }
        if (!playerIn.capabilities.isCreativeMode)
            StackHelper.shrink(playerIn.getHeldItem(hand), 1);
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.FAIL;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Random(java.util.Random) EnumGem(net.silentchaos512.gems.lib.EnumGem) BlockPos(net.minecraft.util.math.BlockPos)

Example 9 with EnumGem

use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.

the class ItemReturnHome method clGetSubItems.

@Override
protected void clGetSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
    if (!ItemHelper.isInCreativeTab(item, tab))
        return;
    for (EnumGem gem : EnumGem.values()) {
        ItemStack stack = new ItemStack(item, 1, gem.ordinal());
        setCharge(stack, getMaxCharge(stack));
        list.add(stack);
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ItemStack(net.minecraft.item.ItemStack)

Example 10 with EnumGem

use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.

the class ItemReturnHome method addRecipes.

@Override
public void addRecipes(RecipeMaker recipes) {
    for (EnumGem gem : EnumGem.values()) {
        ItemStack result = new ItemStack(this, 1, gem.ordinal());
        recipes.addShapedOre("return_home_" + gem.name(), result, " s ", "sgs", "ici", 's', ModItems.craftingMaterial.gildedString, 'g', gem.getItemOreName(), 'i', "ingotGold", 'c', new ItemStack(ModItems.chaosOrb, 1, ItemChaosOrb.Type.FRAGILE.ordinal()));
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EnumGem (net.silentchaos512.gems.lib.EnumGem)27 ItemStack (net.minecraft.item.ItemStack)16 IBlockState (net.minecraft.block.state.IBlockState)4 BlockPos (net.minecraft.util.math.BlockPos)3 Random (java.util.Random)2 IArmor (net.silentchaos512.gems.api.IArmor)2 WeightedRandomItemSG (net.silentchaos512.gems.util.WeightedRandomItemSG)2 RecipeMaker (net.silentchaos512.lib.registry.RecipeMaker)2 Predicate (com.google.common.base.Predicate)1 Block (net.minecraft.block.Block)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 IItemColor (net.minecraft.client.renderer.color.IItemColor)1 ItemColors (net.minecraft.client.renderer.color.ItemColors)1 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)1 Item (net.minecraft.item.Item)1 IRecipe (net.minecraft.item.crafting.IRecipe)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 EnumFacing (net.minecraft.util.EnumFacing)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 WeightedRandom (net.minecraft.util.WeightedRandom)1