Java Code Examples for thaumcraft.api.aspects.AspectList#add()

The following examples show how to use thaumcraft.api.aspects.AspectList#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileEssentiaCompressor.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void readCustomNBT(NBTTagCompound compound) {
    super.readCustomNBT(compound);

    this.multiblockYIndex = compound.getInteger("multiblockYIndex");
    this.isMasterTile = compound.getBoolean("isMasterTile");
    this.multiblockId = compound.getInteger("multiblockId");
    this.isMultiblockPresent = compound.getBoolean("multiblockPresent");
    this.incSize = compound.getInteger("sizeInc");
    AspectList al = new AspectList();
    NBTTagCompound cmp = compound.getCompoundTag("aspects");
    for (Object tag : cmp.func_150296_c()) {
        String strTag = (String) tag;
        int amt = cmp.getInteger(strTag);
        al.add(Aspect.getAspect(strTag), amt);
    }
    this.al = al;
}
 
Example 2
Source File: RegisteredManipulations.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean affect(World world, INode node) {
    AspectList baseList = node.getAspectsBase();
    AspectList list = node.getAspects();
    for(Aspect a : baseList.getAspects()) {
        if(!a.isPrimal()) {
            Aspect[] subComponents = a.getComponents();
            int initialValue = baseList.getAmount(a);
            list.remove(a);
            baseList.remove(a);
            baseList.add(subComponents[0], initialValue);
            list.add(subComponents[0], initialValue);
            baseList.add(subComponents[1], initialValue);
            list.add(subComponents[1], initialValue);
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: ThaumcraftApiHelper.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public static AspectList getAllCompoundAspects(int amount) {
	if (allCompoundAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.getCompoundAspects()) {
			al.add(aspect, amount);
		}
		allCompoundAspects.put(amount, al);
	} 
	return allCompoundAspects.get(amount);
}
 
Example 4
Source File: ThaumcraftApiHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
public static AspectList getAllCompoundAspects(int amount) {
	if (allCompoundAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.getCompoundAspects()) {
			al.add(aspect, amount);
		}
		allCompoundAspects.put(amount, al);
	} 
	return allCompoundAspects.get(amount);
}
 
Example 5
Source File: ThaumcraftApiHelper.java    From GardenCollection with MIT License 5 votes vote down vote up
public static AspectList getAllAspects(int amount) {
	if (allAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.aspects.values()) {
			al.add(aspect, amount);
		}
		allAspects.put(amount, al);
	} 
	return allAspects.get(amount);
}
 
Example 6
Source File: ThaumcraftApiHelper.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public static AspectList getAllCompoundAspects(int amount) {
	if (allCompoundAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.getCompoundAspects()) {
			al.add(aspect, amount);
		}
		allCompoundAspects.put(amount, al);
	} 
	return allCompoundAspects.get(amount);
}
 
Example 7
Source File: ThaumcraftApiHelper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static AspectList getAllCompoundAspects(int amount) {
	if (allCompoundAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.getCompoundAspects()) {
			al.add(aspect, amount);
		}
		allCompoundAspects.put(amount, al);
	} 
	return allCompoundAspects.get(amount);
}
 
Example 8
Source File: ThaumcraftApiHelper.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public static AspectList getAllCompoundAspects(int amount) {
	if (allCompoundAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.getCompoundAspects()) {
			al.add(aspect, amount);
		}
		allCompoundAspects.put(amount, al);
	} 
	return allCompoundAspects.get(amount);
}
 
Example 9
Source File: ThaumcraftApiHelper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static AspectList getAllAspects(int amount) {
	if (allAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.aspects.values()) {
			al.add(aspect, amount);
		}
		allAspects.put(amount, al);
	} 
	return allAspects.get(amount);
}
 
Example 10
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static AspectList getAllCompoundAspects(int amount) {
	if (allCompoundAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.getCompoundAspects()) {
			al.add(aspect, amount);
		}
		allCompoundAspects.put(amount, al);
	} 
	return allCompoundAspects.get(amount);
}
 
Example 11
Source File: ThaumcraftApiHelper.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static AspectList getAllAspects(int amount) {
	if (allAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.aspects.values()) {
			al.add(aspect, amount);
		}
		allAspects.put(amount, al);
	} 
	return allAspects.get(amount);
}
 
Example 12
Source File: ItemCreativeNode.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    ForgeDirection dir = ForgeDirection.getOrientation(side);
    x += dir.offsetX;
    y += dir.offsetY;
    z += dir.offsetZ;

    if(placeRandomNode(world, x, y, z)) {
        int metadata = stack.getItemDamage();
        TileNode node = (TileNode) world.getTileEntity(x, y, z);

        if(metadata == 0) {
            node.setNodeType(NodeType.NORMAL);
            node.setNodeModifier(NodeModifier.BRIGHT);

            AspectList aspects = new AspectList();
            for(Aspect primal : Aspect.getPrimalAspects()) {
                aspects.add(primal, 500);
            }
            node.setAspects(aspects);
            node.markDirty();
            world.markBlockForUpdate(x, y, z);
        } else {
            node.setNodeType(NodeType.values()[metadata]);
        }

        return true;
    }
    return false;
}
 
Example 13
Source File: ResearchPageAuraAspects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static AspectList createPageAspectList(List<String> tagList) {
    AspectList list = new AspectList();
    for(String tag : tagList) {
        Aspect a = createAuraFakeAspect(tag);
        if(a != null) list.add(a, 0);
    }
    return list;
}
 
Example 14
Source File: RegisteredRecipes.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static List[] createAuraCoreRecipes() {
    List[] recipes = new List[7];
    for(int i = 0; i < 7; i++) {
        AspectList cost = new AspectList();
        switch (i) {
            case 0: cost.add(Aspect.AIR, 84); break;
            case 1: cost.add(Aspect.FIRE, 84); break;
            case 2: cost.add(Aspect.WATER, 84); break;
            case 3: cost.add(Aspect.EARTH, 84); break;
            case 4: cost.add(Aspect.ORDER, 84); break;
            case 5: cost.add(Aspect.ENTROPY, 84); break;
            case 6: cost.add(Aspect.AIR, 14).add(Aspect.FIRE, 14).add(Aspect.WATER, 14)
                    .add(Aspect.EARTH, 14).add(Aspect.ORDER, 14).add(Aspect.ENTROPY, 14);
        }

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wand = new ItemStack(item);
        item.setRod(wand, ConfigItems.WAND_ROD_GREATWOOD);
        item.setCap(wand, ConfigItems.WAND_CAP_GOLD);

        recipes[i] = Arrays.asList(cost, 3, 2, 3,
                Arrays.asList(
                        null, null, null, null, wand, null, null, null, null,
                        null, null, null, null, new ItemStack(ConfigBlocks.blockCrystal, 1, i),
                        new ItemStack(RegisteredItems.itemAuraCore), null, null, null
                ));
    }
    return recipes;
}
 
Example 15
Source File: TileAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public AspectList getAspects() {
    TileAuraPylon io = getInputTile();
    AspectList al = new AspectList();
    if (io != null && io.holdingAspect != null && io.amount > 0) {
        al.add(io.holdingAspect, io.amount);
    }
    return al;
}
 
Example 16
Source File: TileKnowledgeBook.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void beginResearch(AspectList researchTags) {
    AspectList workResearchList = new AspectList();
    for (Aspect a : researchTags.aspects.keySet()) {
        int value = researchTags.aspects.get(a);
        int newVal = (int) Math.max(LOWEST_AMOUNT, ((double) value) * MULTIPLIER);
        workResearchList.add(a, newVal);
    }
    this.workResearchAspects = workResearchList;
    this.researching = true;
}
 
Example 17
Source File: TileExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void readCustomNBT(NBTTagCompound nbttagcompound) {
    this.aspects.readFromNBT(nbttagcompound);
    this.id = nbttagcompound.getString("nodeId");

    AspectList al = new AspectList();
    NBTTagList tlist = nbttagcompound.getTagList("AspectsBase", 10);
    for (int j = 0; j < tlist.tagCount(); j++) {
        NBTTagCompound rs = tlist.getCompoundTagAt(j);
        if (rs.hasKey("key")) {
            al.add(Aspect.getAspect(rs.getString("key")), rs.getInteger("amount"));
        }
    }
    Short oldBase = nbttagcompound.getShort("nodeVisBase");
    this.aspectsBase = new AspectList();
    if ((oldBase > 0) && (al.size() == 0)) {
        for (Aspect a : this.aspects.getAspects()) {
            this.aspectsBase.merge(a, oldBase);
        }
    } else {
        this.aspectsBase = al.copy();
    }
    setNodeType(NodeType.values()[nbttagcompound.getByte("type")]);
    byte mod = nbttagcompound.getByte("modifier");
    if(mod >= 0) setNodeModifier(NodeModifier.values()[mod]); else setNodeModifier(null);
    byte exType = nbttagcompound.getByte("extendedNodeType");
    if(exType >= 0) setExtendedNodeType(ExtendedNodeType.values()[exType]); else setExtendedNodeType(null);
    if(nbttagcompound.hasKey("Behavior")) {
        behaviorSnapshot = nbttagcompound.getCompoundTag("Behavior");
    }
}
 
Example 18
Source File: NBTHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static AspectList getAspectList(NBTTagCompound compound, String tag, AspectList defaultValue) {
    if(!compound.hasKey(tag)) return defaultValue;
    NBTTagCompound cmp = compound.getCompoundTag(tag);
    AspectList out = new AspectList();
    for (Object key : cmp.func_150296_c()) {
        String strKey = (String) key;
        Aspect a = Aspect.getAspect(strKey);
        if(a != null) {
            out.add(a, cmp.getInteger(strKey));
        }
    }
    return out;
}
 
Example 19
Source File: ThaumcraftApiHelper.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public static AspectList getAllAspects(int amount) {
	if (allAspects.get(amount)==null) {
		AspectList al = new AspectList();
		for (Aspect aspect:Aspect.aspects.values()) {
			al.add(aspect, amount);
		}
		allAspects.put(amount, al);
	} 
	return allAspects.get(amount);
}
 
Example 20
Source File: FamiliarController.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void tick() {
    IInventory baubles = BaublesApi.getBaubles(owningPlayer);
    ItemStack stack = baubles.getStackInSlot(0);
    if (stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return;

    if (tickLastEffect > 0) {
        tickLastEffect--;
        return;
    }

    FamiliarAugment.FamiliarAugmentList augments = ItemEtherealFamiliar.getAugments(stack);
    if (augments == null) return;

    if (augments.isEmpty()) {
        doDefaultAttack();
        tickLastEffect = AS_DELAY_DEF;
    } else {
        FamiliarAugment.FamiliarAugmentPair effectElement = null;
        for (FamiliarAugment.FamiliarAugmentPair pair : augments) {
            FamiliarAugment augment = pair.augment;
            if (augment.equals(FamiliarAugment.SHOCK) || augment.equals(FamiliarAugment.FIRE)
                    || augment.equals(FamiliarAugment.POISON) || augment.equals(FamiliarAugment.WEAKNESS)) {
                effectElement = pair;
                break;
            }
        }

        AspectList costs = new AspectList();

        int dmgLevel = augments.getLevel(FamiliarAugment.DAMAGE_INCREASE);
        if (dmgLevel > 0) {
            for (int i = 0; i < dmgLevel; i++) {
                costs.add(FamiliarAugment.DAMAGE_INCREASE.getCostsPerLevel());
            }
        }

        int attackSpeedLevel = augments.getLevel(FamiliarAugment.ATTACK_SPEED);
        if (attackSpeedLevel > 0) {
            for (int i = 0; i < attackSpeedLevel; i++) {
                costs.add(FamiliarAugment.ATTACK_SPEED.getCostsPerLevel());
            }
        }

        int rangeLevel = augments.getLevel(FamiliarAugment.RANGE_INCREASE);
        if (rangeLevel > 0) {
            for (int i = 0; i < rangeLevel; i++) {
                costs.add(FamiliarAugment.RANGE_INCREASE.getCostsPerLevel());
            }
        }

        double damage = DMG_DEF + (dmgLevel != -1 ? DMG_INC * dmgLevel : 0);
        int ticksUntilNextAttack = AS_DELAY_DEF - (attackSpeedLevel != -1 ? AS_INC * attackSpeedLevel : 0);
        double range = RANGE_DEF + (rangeLevel != -1 ? RANGE_INC * rangeLevel : 0);
        
        if(effectElement != null) {
            for (int i = 0; i < effectElement.level; i++) {
                costs.add(effectElement.augment.getCostsPerLevel());
            }
        }

        if (!owningPlayer.capabilities.isCreativeMode && !consumeVisFromInventory(owningPlayer, costs, false)) {
            return;
        }

        if (effectElement == null) {
            if (doEnhancedDefaultAttack(damage, range)) {
                tickLastEffect = ticksUntilNextAttack;
                if(!owningPlayer.capabilities.isCreativeMode && RAND.nextInt(3) == 0) {
                    consumeVisFromInventory(owningPlayer, costs, true);
                }
            }
        } else {
            if (doAttack(effectElement, damage, range)) {
                tickLastEffect = ticksUntilNextAttack;
                if(!owningPlayer.capabilities.isCreativeMode && RAND.nextInt(3) == 0) {
                    consumeVisFromInventory(owningPlayer, costs, true);
                }
            }
        }
    }
}