Search in sources :

Example 21 with EnumGem

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

the class BlockGemGlass method addRecipes.

@Override
public void addRecipes(RecipeMaker recipes) {
    for (int i = 0; i < 16; ++i) {
        EnumGem gem = getGem(i);
        recipes.addSurroundOre(blockName + i, new ItemStack(this, 8, i), gem.getShardOreName(), "blockGlass");
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ItemStack(net.minecraft.item.ItemStack)

Example 22 with EnumGem

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

the class BlockGemLamp method onBlockAdded.

@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
    if (!world.isRemote) {
        boolean powered = world.isBlockPowered(pos);
        EnumGem gem = EnumGem.values()[getMetaFromState(state)];
        setState(world, pos, getLamp(inverted ? !powered : powered), gem);
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem)

Example 23 with EnumGem

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

the class BlockGemLamp method neighborChanged.

@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
    if (!world.isRemote) {
        boolean powered = world.isBlockPowered(pos);
        EnumGem gem = EnumGem.values()[getMetaFromState(state)];
        BlockGemLamp newBlock = getLamp(inverted ? !powered : powered);
        if (inverted) {
            if (!lit && !powered) {
                world.scheduleUpdate(pos, this, 4);
            } else if (lit && powered) {
                setState(world, pos, newBlock, gem);
            }
        } else {
            if (lit && !powered) {
                world.scheduleUpdate(pos, this, 4);
            } else if (!lit && powered) {
                setState(world, pos, newBlock, gem);
            }
        }
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem)

Example 24 with EnumGem

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

the class BlockGemLamp method updateTick.

@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
    if (!world.isRemote) {
        boolean powered = world.isBlockPowered(pos);
        if (!powered) {
            EnumGem gem = EnumGem.values()[getMetaFromState(state)];
            setState(world, pos, getLamp(inverted ? !powered : powered), gem);
        }
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem)

Example 25 with EnumGem

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

the class BlockGemOre method addOreDict.

@Override
public void addOreDict() {
    for (int i = 0; i < 16; ++i) {
        EnumGem gem = getGem(i);
        OreDictionary.registerOre(gem.getOreOreName(), gem.getOre());
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem)

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