Search in sources :

Example 1 with TEMasterStone

use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.

the class RenderMasterStone method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
    if (tileEntity instanceof TEMasterStone) {
        String str = ((TEMasterStone) tileEntity).getCurrentRitual();
        MRSRenderer renderer = Rituals.getRendererForKey(str);
        if (renderer != null) {
            renderer.renderAt(((TEMasterStone) tileEntity), d0, d1, d2);
        }
    }
}
Also used : MRSRenderer(WayofTime.alchemicalWizardry.api.renderer.MRSRenderer) TEMasterStone(WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone)

Example 2 with TEMasterStone

use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.

the class BlockMasterStone method onBlockHarvested.

@Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
    TileEntity tile = world.getTileEntity(x, y, z);
    if (tile instanceof TEMasterStone) {
        ((TEMasterStone) tile).useOnRitualBroken();
    }
    super.onBlockHarvested(world, x, y, z, meta, player);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TEMasterStone(WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone)

Example 3 with TEMasterStone

use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.

the class BlockMasterStone method onBlockActivated.

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) {
    TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(x, y, z);
    if (tileEntity == null || player.isSneaking()) {
        return false;
    }
    ItemStack playerItem = player.getCurrentEquippedItem();
    if (playerItem == null) {
        return false;
    }
    Item item = playerItem.getItem();
    if (!(item instanceof ActivationCrystal)) {
        return false;
    }
    ActivationCrystal acItem = (ActivationCrystal) item;
    // tileEntity.setOwner(acItem.getOwnerName(playerItem));
    tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, acItem.getOwnerName(playerItem));
    world.markBlockForUpdate(x, y, z);
    return true;
}
Also used : Item(net.minecraft.item.Item) ActivationCrystal(WayofTime.alchemicalWizardry.common.items.ActivationCrystal) TEMasterStone(WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone) ItemStack(net.minecraft.item.ItemStack)

Example 4 with TEMasterStone

use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.

the class BlockMasterStone method onBlockDestroyedByExplosion.

@Override
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
    super.onBlockDestroyedByExplosion(world, x, y, z, explosion);
    TileEntity tile = world.getTileEntity(x, y, z);
    if (tile instanceof TEMasterStone) {
        ((TEMasterStone) tile).useOnRitualBrokenExplosion();
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TEMasterStone(WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone)

Example 5 with TEMasterStone

use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.

the class AlchemicalWizardryEventHooks method onLivingSpawnEvent.

@SubscribeEvent
public void onLivingSpawnEvent(CheckSpawn event) {
    if (!(event.entityLiving instanceof EntityMob)) {
        return;
    }
    String respawnRitual = "AW028SpawnWard";
    int dimension = event.world.provider.dimensionId;
    if (respawnMap.containsKey(dimension)) {
        List<CoordAndRange> list = respawnMap.get(dimension);
        if (list != null) {
            for (CoordAndRange coords : list) {
                TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
                if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual)) {
                    if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius) {
                        switch(event.getResult()) {
                            case ALLOW:
                                event.setResult(Result.DEFAULT);
                                break;
                            case DEFAULT:
                                event.setResult(Result.DENY);
                                break;
                            case DENY:
                                break;
                            default:
                                break;
                        }
                        break;
                    }
                } else {
                    list.remove(coords);
                }
            }
        }
    }
    if (event.entityLiving instanceof EntityCreeper) {
        return;
    }
    String forceSpawnRitual = "AW029VeilOfEvil";
    if (forceSpawnMap.containsKey(dimension)) {
        List<CoordAndRange> list = forceSpawnMap.get(dimension);
        if (list != null) {
            for (CoordAndRange coords : list) {
                TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
                if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual)) {
                    if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius) {
                        switch(event.getResult()) {
                            case ALLOW:
                                break;
                            case DEFAULT:
                                event.setResult(Result.ALLOW);
                                break;
                            case DENY:
                                event.setResult(Result.DEFAULT);
                                break;
                            default:
                                break;
                        }
                        break;
                    }
                } else {
                    list.remove(coords);
                }
            }
        }
    }
}
Also used : EntityMob(net.minecraft.entity.monster.EntityMob) TileEntity(net.minecraft.tileentity.TileEntity) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) TEMasterStone(WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

TEMasterStone (WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone)7 TileEntity (net.minecraft.tileentity.TileEntity)5 ItemStack (net.minecraft.item.ItemStack)3 RitualComponent (WayofTime.alchemicalWizardry.api.rituals.RitualComponent)2 MRSRenderer (WayofTime.alchemicalWizardry.api.renderer.MRSRenderer)1 RitualStone (WayofTime.alchemicalWizardry.common.block.RitualStone)1 ActivationCrystal (WayofTime.alchemicalWizardry.common.items.ActivationCrystal)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Block (net.minecraft.block.Block)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityCreeper (net.minecraft.entity.monster.EntityCreeper)1 EntityMob (net.minecraft.entity.monster.EntityMob)1 Item (net.minecraft.item.Item)1