Search in sources :

Example 1 with BlockBloodRune

use of WayofTime.bloodmagic.block.BlockBloodRune in project BloodMagic by WayofTime.

the class BloodMagicCorePlugin method register.

@Override
public void register(IBloodMagicAPI apiInterface) {
    BloodMagicAPI api = (BloodMagicAPI) apiInterface;
    // Add forced blacklistings
    api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE);
    api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE);
    api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.OUTPUT_ROUTING_NODE);
    api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.OUTPUT_ROUTING_NODE);
    api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.ITEM_ROUTING_NODE);
    api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.ITEM_ROUTING_NODE);
    api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.MASTER_ROUTING_NODE);
    api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.MASTER_ROUTING_NODE);
    api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.DEMON_CRYSTAL);
    api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.DEMON_CRYSTAL);
    api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INVERSION_PILLAR);
    api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INVERSION_PILLAR);
    api.getBlacklist().addWellOfSuffering(new ResourceLocation("armor_stand"));
    api.getBlacklist().addWellOfSuffering(new ResourceLocation(BloodMagic.MODID, "sentient_specter"));
    api.getValueManager().setSacrificialValue(new ResourceLocation("armor_stand"), 0);
    api.getValueManager().setSacrificialValue(new ResourceLocation(BloodMagic.MODID, "sentient_specter"), 0);
    api.getValueManager().setTranquility(Blocks.LAVA, new TranquilityStack(EnumTranquilityType.LAVA, 1.2D));
    api.getValueManager().setTranquility(Blocks.FLOWING_LAVA, new TranquilityStack(EnumTranquilityType.LAVA, 1.2D));
    api.getValueManager().setTranquility(Blocks.WATER, new TranquilityStack(EnumTranquilityType.WATER, 1.0D));
    api.getValueManager().setTranquility(Blocks.FLOWING_WATER, new TranquilityStack(EnumTranquilityType.WATER, 1.0D));
    api.getValueManager().setTranquility(RegistrarBloodMagicBlocks.LIFE_ESSENCE, new TranquilityStack(EnumTranquilityType.WATER, 1.5D));
    api.getValueManager().setTranquility(Blocks.NETHERRACK, new TranquilityStack(EnumTranquilityType.FIRE, 0.5D));
    api.getValueManager().setTranquility(Blocks.DIRT, new TranquilityStack(EnumTranquilityType.EARTHEN, 0.25D));
    api.getValueManager().setTranquility(Blocks.FARMLAND, new TranquilityStack(EnumTranquilityType.EARTHEN, 1.0D));
    api.getValueManager().setTranquility(Blocks.POTATOES, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
    api.getValueManager().setTranquility(Blocks.CARROTS, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
    api.getValueManager().setTranquility(Blocks.WHEAT, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
    api.getValueManager().setTranquility(Blocks.NETHER_WART, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
    api.getValueManager().setTranquility(Blocks.BEETROOTS, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
    handleConfigValues(api);
    // Add standard blocks for altar components
    api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), ComponentType.GLOWSTONE.name());
    api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), ComponentType.GLOWSTONE.name());
    api.registerAltarComponent(Blocks.BEACON.getDefaultState(), ComponentType.BEACON.name());
    BlockDecorative decorative = (BlockDecorative) RegistrarBloodMagicBlocks.DECORATIVE_BRICK;
    api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_BRICK), ComponentType.BLOODSTONE.name());
    api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_TILE), ComponentType.BLOODSTONE.name());
    api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_BRICK), ComponentType.CRYSTAL.name());
    api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), ComponentType.CRYSTAL.name());
    BlockBloodRune bloodRune = (BlockBloodRune) RegistrarBloodMagicBlocks.BLOOD_RUNE;
    for (BloodRuneType runeType : BloodRuneType.values()) api.registerAltarComponent(bloodRune.getDefaultState().withProperty(bloodRune.getProperty(), runeType), ComponentType.BLOODRUNE.name());
}
Also used : IBloodMagicAPI(WayofTime.bloodmagic.api.IBloodMagicAPI) BloodRuneType(WayofTime.bloodmagic.block.enums.BloodRuneType) BlockDecorative(WayofTime.bloodmagic.block.BlockDecorative) ResourceLocation(net.minecraft.util.ResourceLocation) TranquilityStack(WayofTime.bloodmagic.incense.TranquilityStack) BlockBloodRune(WayofTime.bloodmagic.block.BlockBloodRune)

Example 2 with BlockBloodRune

use of WayofTime.bloodmagic.block.BlockBloodRune in project BloodMagic by WayofTime.

the class RitualAltarBuilder method getBloodRune.

public BlockStack getBloodRune(TileEntity tileEntity) {
    if (tileEntity != null) {
        if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
            IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
            if (itemHandler.getSlots() <= 0) {
                return null;
            }
            for (int i = 0; i < itemHandler.getSlots(); i++) {
                if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && itemHandler.extractItem(i, 1, true) != null) {
                    BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(ComponentType.BLOODRUNE), itemHandler.getStackInSlot(i).getItemDamage());
                    itemHandler.extractItem(i, 1, false);
                    return blockStack;
                }
            }
        } else if (tileEntity instanceof IInventory) {
            IInventory inv = (IInventory) tileEntity;
            for (int i = 0; i < inv.getSizeInventory(); i++) {
                if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune) {
                    BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(ComponentType.BLOODRUNE), inv.getStackInSlot(i).getItemDamage());
                    inv.decrStackSize(i, 1);
                    return blockStack;
                }
            }
        }
    }
    return null;
}
Also used : IInventory(net.minecraft.inventory.IInventory) IItemHandler(net.minecraftforge.items.IItemHandler) ItemBlock(net.minecraft.item.ItemBlock) BlockStack(WayofTime.bloodmagic.util.BlockStack) BlockBloodRune(WayofTime.bloodmagic.block.BlockBloodRune)

Example 3 with BlockBloodRune

use of WayofTime.bloodmagic.block.BlockBloodRune in project BloodMagic by WayofTime.

the class AltarUtil method getUpgrades.

@Nonnull
public static AltarUpgrade getUpgrades(World world, BlockPos pos, AltarTier currentTier) {
    AltarUpgrade upgrades = new AltarUpgrade();
    for (AltarTier tier : AltarTier.values()) {
        if (tier.ordinal() > currentTier.ordinal())
            return upgrades;
        for (AltarComponent component : tier.getAltarComponents()) {
            if (!component.isUpgradeSlot() || component.getComponent() != ComponentType.BLOODRUNE)
                continue;
            BlockPos componentPos = pos.add(component.getOffset());
            IBlockState state = world.getBlockState(componentPos);
            if (state.getBlock() instanceof BlockBloodRune)
                upgrades.upgrade(((BlockBloodRune) state.getBlock()).getBloodRune(world, componentPos, state));
        }
    }
    return upgrades;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockPos(net.minecraft.util.math.BlockPos) BlockBloodRune(WayofTime.bloodmagic.block.BlockBloodRune) Nonnull(javax.annotation.Nonnull)

Example 4 with BlockBloodRune

use of WayofTime.bloodmagic.block.BlockBloodRune in project BloodMagic by WayofTime.

the class RitualAltarBuilder method getMundaneBlock.

public BlockStack getMundaneBlock(TileEntity tileEntity) {
    if (tileEntity != null) {
        if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
            IItemHandler itemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
            if (itemHandler.getSlots() <= 0) {
                return null;
            }
            for (int i = 0; i < itemHandler.getSlots(); i++) {
                if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && !itemHandler.extractItem(i, 1, true).isEmpty()) {
                    Block block = Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem());
                    if (block != Blocks.AIR && block != Blocks.GLOWSTONE && block != RegistrarBloodMagicBlocks.DECORATIVE_BRICK) {
                        BlockStack blockStack = new BlockStack(block, itemHandler.getStackInSlot(i).getItemDamage());
                        itemHandler.extractItem(i, 1, false);
                        return blockStack;
                    }
                }
            }
        } else if (tileEntity instanceof IInventory) {
            IInventory inv = (IInventory) tileEntity;
            for (int i = 0; i < inv.getSizeInventory(); i++) {
                if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)) {
                    Block block = Block.getBlockFromItem(inv.getStackInSlot(i).getItem());
                    if (block != Blocks.GLOWSTONE && block != RegistrarBloodMagicBlocks.DECORATIVE_BRICK) {
                        BlockStack blockStack = new BlockStack(block, inv.getStackInSlot(i).getItemDamage());
                        inv.decrStackSize(i, 1);
                        return blockStack;
                    }
                }
            }
        }
    }
    return null;
}
Also used : IInventory(net.minecraft.inventory.IInventory) IItemHandler(net.minecraftforge.items.IItemHandler) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) ItemBlock(net.minecraft.item.ItemBlock) BlockStack(WayofTime.bloodmagic.util.BlockStack) BlockBloodRune(WayofTime.bloodmagic.block.BlockBloodRune)

Aggregations

BlockBloodRune (WayofTime.bloodmagic.block.BlockBloodRune)4 BlockStack (WayofTime.bloodmagic.util.BlockStack)2 IInventory (net.minecraft.inventory.IInventory)2 ItemBlock (net.minecraft.item.ItemBlock)2 IItemHandler (net.minecraftforge.items.IItemHandler)2 IBloodMagicAPI (WayofTime.bloodmagic.api.IBloodMagicAPI)1 BlockDecorative (WayofTime.bloodmagic.block.BlockDecorative)1 BloodRuneType (WayofTime.bloodmagic.block.enums.BloodRuneType)1 TranquilityStack (WayofTime.bloodmagic.incense.TranquilityStack)1 Nonnull (javax.annotation.Nonnull)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 BlockPos (net.minecraft.util.math.BlockPos)1