Search in sources :

Example 1 with BlockManaBattery

use of com.teamwizardry.wizardry.common.block.BlockManaBattery in project Wizardry by TeamWizardry.

the class TileManaBattery method update.

@Override
public void update() {
    super.update();
    if (getBlockType() == ModBlocks.MANA_BATTERY && !((BlockManaBattery) getBlockType()).isStructureComplete(getWorld(), getPos()))
        return;
    if (getBlockType() != ModBlocks.CREATIVE_MANA_BATTERY) {
        for (BlockPos relative : poses) {
            BlockPos target = getPos().add(relative);
            TileEntity tile = world.getTileEntity(target);
            if (tile instanceof TilePearlHolder) {
                if (!((TilePearlHolder) tile).isPartOfStructure) {
                    ((TilePearlHolder) tile).isPartOfStructure = true;
                    ((TilePearlHolder) tile).structurePos = getPos();
                    ((TilePearlHolder) tile).setAllowOutsideSucking(false);
                    tile.markDirty();
                }
            }
        }
    } else {
        CapManager manager = new CapManager(getWizardryCap());
        manager.setMana(manager.getMaxMana());
        manager.setBurnout(0);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) CapManager(com.teamwizardry.wizardry.api.capability.CapManager) BlockManaBattery(com.teamwizardry.wizardry.common.block.BlockManaBattery) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

CapManager (com.teamwizardry.wizardry.api.capability.CapManager)1 BlockManaBattery (com.teamwizardry.wizardry.common.block.BlockManaBattery)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1