Search in sources :

Example 1 with LocalRitualStorage

use of WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage in project BloodMagic by WayofTime.

the class RitualEffectAlphaPact method performEffect.

@Override
public void performEffect(IMasterRitualStone ritualStone) {
    String owner = ritualStone.getOwner();
    int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
    World world = ritualStone.getWorld();
    int x = ritualStone.getXCoord();
    int y = ritualStone.getYCoord();
    int z = ritualStone.getZCoord();
    if (world.getWorldTime() % 20 != 0) {
        return;
    }
    LocalRitualStorage stor = ritualStone.getLocalStorage();
    if (stor instanceof LocalStorageAlphaPact) {
        LocalStorageAlphaPact storage = (LocalStorageAlphaPact) stor;
        Object[] demonList = storage.hoardList.toArray();
        for (Object demon : demonList) {
            if (demon instanceof EntityLivingBase) {
                if (!((EntityLivingBase) demon).isEntityAlive()) {
                    System.out.println(storage.hoardList.remove(demon));
                }
            }
        }
        System.out.println("Hi!");
        int summons = 0;
        int horizontalRange = 25;
        int verticalRange = 20;
        if (storage.hoardList.isEmpty()) {
            IHoardDemon demon = this.getRandomDemonForStage(world, x, y, z, horizontalRange, verticalRange);
            if (demon instanceof EntityLivingBase) {
                world.spawnEntityInWorld((EntityLivingBase) demon);
                storage.thrallDemon(demon);
            }
        } else {
        }
    }
}
Also used : LocalRitualStorage(WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage) EntityLivingBase(net.minecraft.entity.EntityLivingBase) World(net.minecraft.world.World) IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)

Example 2 with LocalRitualStorage

use of WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage in project BloodMagic by WayofTime.

the class TEMasterStone method readFromNBT.

@Override
public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    isActive = tag.getBoolean("isActive");
    owner = tag.getString("owner");
    cooldown = tag.getInteger("cooldown");
    var1 = tag.getInteger("var1");
    direction = tag.getInteger("direction");
    currentRitualString = tag.getString("currentRitualString");
    isRunning = tag.getBoolean("isRunning");
    runningTime = tag.getInteger("runningTime");
    NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
    int size = tagList.tagCount();
    this.tanks = new ReagentContainer[size];
    for (int i = 0; i < size; i++) {
        NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
        this.tanks[i] = ReagentContainer.readFromNBT(savedTag);
    }
    NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < attunedTagList.tagCount(); i++) {
        NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i);
        Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent"));
        this.attunedTankMap.put(reagent, savedTag.getInteger("amount"));
    }
    customRitualTag = tag.getCompoundTag("customRitualTag");
    LocalRitualStorage newStorage = Rituals.getLocalStorage(currentRitualString);
    NBTTagCompound localStorageTag = tag.getCompoundTag("localStorage");
    if (newStorage != null) {
        newStorage.readFromNBT(localStorageTag);
        storage = newStorage;
        storage.xCoord = xCoord;
        storage.yCoord = yCoord;
        storage.zCoord = zCoord;
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) LocalRitualStorage(WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Reagent(WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent)

Example 3 with LocalRitualStorage

use of WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage in project BloodMagic by WayofTime.

the class EntityMinorDemonGrunt method onUpdate.

/**
 * Called to update the entity's position/logic.
 */
@Override
public void onUpdate() {
    if (!this.enthralled) {
        TileEntity tile = this.worldObj.getTileEntity(this.demonPortal.xCoord, this.demonPortal.yCoord, this.demonPortal.zCoord);
        if (tile instanceof TEDemonPortal) {
            ((TEDemonPortal) tile).enthrallDemon(this);
            this.enthralled = true;
        } else if (tile instanceof IMasterRitualStone) {
            IMasterRitualStone stone = (IMasterRitualStone) tile;
            LocalRitualStorage stor = stone.getLocalStorage();
            if (stor instanceof LocalStorageAlphaPact) {
                LocalStorageAlphaPact storage = (LocalStorageAlphaPact) stor;
                storage.thrallDemon(this);
            }
        }
    }
    super.onUpdate();
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LocalRitualStorage(WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage) TEDemonPortal(WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal) IMasterRitualStone(WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone) LocalStorageAlphaPact(WayofTime.alchemicalWizardry.common.rituals.LocalStorageAlphaPact)

Aggregations

LocalRitualStorage (WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage)3 Reagent (WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent)1 IMasterRitualStone (WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone)1 IHoardDemon (WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)1 TEDemonPortal (WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal)1 LocalStorageAlphaPact (WayofTime.alchemicalWizardry.common.rituals.LocalStorageAlphaPact)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 TileEntity (net.minecraft.tileentity.TileEntity)1 World (net.minecraft.world.World)1