thaumcraft.api.aspects.Aspect Java Examples

The following examples show how to use thaumcraft.api.aspects.Aspect. 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: TileEntityIndustrialWandRecharge.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void updateEntity() {
    ic2EnergySink.updateEntity();
    if (!this.worldObj.isRemote) {
        if (getStackInSlot(0) != null) {

            ItemStack wand = getStackInSlot(0);
            if (wand != null && wand.getItem() instanceof ItemWandCasting) {
                ItemWandCasting wandItem = (ItemWandCasting) wand.getItem();
                if (ic2EnergySink.useEnergy(ConfigHandler.wandChargerConsumption) && wandItem.getAspectsWithRoom(wand) != null) {
                    wandItem.addVis(wand, Aspect.ORDER, 1, true);
                    wandItem.addVis(wand, Aspect.FIRE, 1, true);
                    wandItem.addVis(wand, Aspect.ENTROPY, 1, true);
                    wandItem.addVis(wand, Aspect.WATER, 1, true);
                    wandItem.addVis(wand, Aspect.EARTH, 1, true);
                    wandItem.addVis(wand, Aspect.AIR, 1, true);
                }
            }
            worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
        }
    }
}
 
Example #2
Source File: TileStickyJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void fillJar() {
    ForgeDirection inputDir = placedOn.getOpposite();

    TileEntity te = ThaumcraftApiHelper.getConnectableTile(parent.getWorldObj(), parent.xCoord, parent.yCoord, parent.zCoord, inputDir);
    if (te != null)
    {
        IEssentiaTransport ic = (IEssentiaTransport)te;
        if (!ic.canOutputTo(ForgeDirection.DOWN)) {
            return;
        }
        Aspect ta = null;
        if (parent.aspectFilter != null) {
            ta = parent.aspectFilter;
        } else if ((parent.aspect != null) && (parent.amount > 0)) {
            ta = parent.aspect;
        } else if ((ic.getEssentiaAmount(inputDir.getOpposite()) > 0) &&
                (ic.getSuctionAmount(inputDir.getOpposite()) < getSuctionAmount(ForgeDirection.UP)) && (getSuctionAmount(ForgeDirection.UP) >= ic.getMinimumSuction())) {
            ta = ic.getEssentiaType(inputDir.getOpposite());
        }
        if ((ta != null) && (ic.getSuctionAmount(inputDir.getOpposite()) < getSuctionAmount(ForgeDirection.UP))) {
            addToContainer(ta, ic.takeEssentia(ta, 1, inputDir.getOpposite()));
        }
    }
}
 
Example #3
Source File: DataFamiliar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void equipTick(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

    FamiliarData data = new FamiliarData(player.getCommandSenderName(), aspect.getTag());

    IInventory baublesInv = BaublesApi.getBaubles(player);
    if(baublesInv.getStackInSlot(0) == null) {
        handleUnequip(world, player, aspect);
        return;
    }

    if(familiarControllers.get(player) == null || !playersWithFamiliar.contains(data)) {
        handleEquip(world, player, aspect);
    }

    familiarControllers.get(player).tick();
}
 
Example #4
Source File: RandomizedAspectList.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void checkRandomization() {
    if((System.currentTimeMillis() - lastRandomization) > 500) {
        super.aspects.clear();
        for(Aspect a : aspectMap.keySet()) {
            if(a == null) continue;
            int am;
            if(halfCap) {
                int c = aspectMap.get(a);
                am = (c / 2) + RANDOM.nextInt(c / 2);
            } else {
                am = RANDOM.nextInt(aspectMap.get(a));
            }
            if(am > 0) {
                super.add(a, am);
            }
        }
        lastRandomization = System.currentTimeMillis();
    }
}
 
Example #5
Source File: CrucibleRecipe.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
	recipeOutput = result;
	this.aspects = tags;
	this.key = researchKey;
	this.catalyst = cat;
	if (cat instanceof String) {
		this.catalyst = OreDictionary.getOres((String) cat);
	}
	String hc = researchKey + result.toString();
	for (Aspect tag:tags.getAspects()) {
		hc += tag.getTag()+tags.getAmount(tag);
	}
	if (cat instanceof ItemStack) {
		hc += ((ItemStack)cat).toString();
	} else
	if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		for (ItemStack is :(ArrayList<ItemStack>)catalyst) {
			hc += is.toString();
		}
	}
	
	hash = hc.hashCode();
}
 
Example #6
Source File: CrucibleRecipe.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
	recipeOutput = result;
	this.aspects = tags;
	this.key = researchKey;
	this.catalyst = cat;
	if (cat instanceof String) {
		this.catalyst = OreDictionary.getOres((String) cat);
	}
	String hc = researchKey + result.toString();
	for (Aspect tag:tags.getAspects()) {
		hc += tag.getTag()+tags.getAmount(tag);
	}
	if (cat instanceof ItemStack) {
		hc += ((ItemStack)cat).toString();
	} else
	if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		for (ItemStack is :(ArrayList<ItemStack>)catalyst) {
			hc += is.toString();
		}
	}
	
	hash = hc.hashCode();
}
 
Example #7
Source File: ItemCrystalwell.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isSelected) {

    if(world.isRemote)
        return;
    if(Config.researchDifficulty == -1 && entity.ticksExisted % 200 == 0 && (entity instanceof EntityPlayer)){
        EntityPlayer player = (EntityPlayer)entity;
        Aspect aspect = (Aspect)Aspect.getPrimalAspects().get(world.rand.nextInt(6));
        short amount = (short)(world.rand.nextInt(4) + 1);
        Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount);
        PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), amount, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP) player);
        ResearchManager.scheduleSave(player);
        stack.setItemDamage(stack.getItemDamage() + 1);
        if(stack.getItemDamage() >= stack.getMaxDamage())
            ((EntityPlayer)entity).inventory.setInventorySlotContents(slot, null);
    }
}
 
Example #8
Source File: GrowingNodeBehavior.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private double getSaturation(AspectType type, Aspect aspect) {
    double mult = 1D;
    switch (type) {
        case WISP:
            mult -= 0.2D; //Growing node doesn't get saturated by wisps that fast.
            break;
        case WISP_ESSENCE:
            mult += 0.2D; //Growing node doesn't like essences all the time..
            break;
        case ASPECT_ORB:
            mult -= 0.3D; //Growing node prefers aspects in their most natural form.
            break;
        case MANA_BEAN:
        case CRYSTAL_ESSENCE:
            mult += 0.4D; //Mana beans are hard to breed but easy to multiply.. thus growing node doesn't like. Same goes for crystallized essentia
    }
    if(lastFedAspect != null) {
        if(lastFedAspect.equals(aspect)) {
            mult += 0.4D;
            lastFedRow++;
        }
    }
    lastFedAspect = aspect;
    double sat = aspect.isPrimal() ? 1.4D : 1D;
    return sat * mult;
}
 
Example #9
Source File: EntityAuraCore.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private boolean recieveAspectData() {
    String rec = getDataWatcher().getWatchableObjectString(ModConfig.entityAuraCoreDatawatcherAspectsId);
    if(oldAspectDataSent == null || !this.oldAspectDataSent.equals(rec)) {
        oldAspectDataSent = rec;
    } else {
        return false;
    }

    if(rec.equals("")) return false;

    String[] arr = rec.split(SPLIT);
    if(arr.length != 6) throw new IllegalStateException("Server sent wrong Aura Data! '"
            + rec + "' Please report this error to the mod authors!");
    for (int i = 0; i < arr.length; i++) {
        String s = arr[i];
        Aspect a = Aspect.getAspect(s);
        effectAspects[i] = a;
    }
    return true;
}
 
Example #10
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 #11
Source File: TileAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void readCustomNBT(NBTTagCompound compound) {
    this.isInputTile = compound.getBoolean("input");
    this.isMasterTile = compound.getBoolean("master");

    String tag = compound.getString("aspect");
    if (tag != null && !tag.equals("")) {
        this.holdingAspect = Aspect.getAspect(tag);
    } else {
        this.holdingAspect = null;
    }
    this.amount = compound.getInteger("amount");
    this.maxAmount = compound.getInteger("maxAmount");
    this.isPartOfMultiblock = compound.getBoolean("partOfMultiblock");
    this.crystalEssentiaStack = NBTHelper.getStack(compound, "crystalStack");
}
 
Example #12
Source File: SubTileEuclidaisy.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public void onUpdate(){
    super.onUpdate();

    if(redstoneSignal > 0)
        return;

    if(mana >= cost && !supertile.getWorldObj().isRemote && this.ticksExisted % 400 == 0) {
        Thaumcraft.proxy.burst(supertile.getWorldObj(), (double)supertile.xCoord + 0.5D, (double)supertile.yCoord + 0.5D, (double)supertile.zCoord + 0.5D, 1.0F);
        AspectList aspect;
        if(supertile.getWorldObj().rand.nextInt(10) < 4)
            aspect = (new AspectList()).add(Aspect.AURA, 2);
        else {
            Aspect[] aspects = Aspect.aspects.values().toArray(new Aspect[0]);
            aspect = (new AspectList()).add(aspects[supertile.getWorldObj().rand.nextInt(aspects.length)], 2);
        }
        ItemStack ess = new ItemStack(ConfigItems.itemWispEssence);
        ((ItemWispEssence)ess.getItem()).setAspects(ess, aspect);
        dropItem(supertile.getWorldObj(), supertile.xCoord, supertile.yCoord, supertile.zCoord, ess);
        mana -= cost;
        sync();
    }
}
 
Example #13
Source File: TileAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
private void doEssentiaTrail() {
    if((ticksExisted & 1) == 0) return;
    TileAuraPylon tile = getMasterTile();
    if(tile == null) return;
    TileAuraPylon inputTile = getInputTile();
    if(inputTile == null) return;
    Aspect a = inputTile.getAspectType();
    if(a == null) return;
    if(inputTile.amount <= 0) return;

    int count = 5;
    FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(tile.getWorldObj(), inputTile.xCoord + 0.5, inputTile.yCoord + 0.2, inputTile.zCoord + 0.5, tile.xCoord + 0.5, tile.yCoord + 1.7, tile.zCoord + 0.5, count, a.getColor(), 1);
    essentiaTrail.noClip = true;
    essentiaTrail.motionY = (0.1F + MathHelper.sin(count / 3.0F) * 0.01F);
    essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.001F + worldObj.rand.nextGaussian() * 0.002000000094994903D);
    essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.001F + worldObj.rand.nextGaussian() * 0.002000000094994903D);
    ParticleEngine.instance.addEffect(tile.getWorldObj(), essentiaTrail);
}
 
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: DeprecationItemPaybacks.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static ItemStack getPhialStack(Aspect aspect, int aspectAmount) {
    ItemEssence phial = (ItemEssence) ConfigItems.itemEssence;
    ItemStack phialStack = new ItemStack(phial, getPhialAmount(aspectAmount), 1);
    if(phialStack.stackSize > 0) {
        phial.setAspects(phialStack, new AspectList().add(aspect, 8));
        return phialStack;
    }
    return null;
}
 
Example #16
Source File: Thaumcraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void postInit(){
    ThaumcraftApi.registerObjectTag(Names.INGOT_IRON_COMPRESSED, new AspectList().add(Aspect.METAL, 8).add(Aspect.AIR, 1));
    registerPlasticAspects(ItemPlasticPlants.SQUID_PLANT_DAMAGE, Aspect.DARKNESS);
    registerPlasticAspects(ItemPlasticPlants.FIRE_FLOWER_DAMAGE, Aspect.FIRE);
    registerPlasticAspects(ItemPlasticPlants.CREEPER_PLANT_DAMAGE, Aspect.ENERGY);
    registerPlasticAspects(ItemPlasticPlants.SLIME_PLANT_DAMAGE, Aspect.SLIME);
    registerPlasticAspects(ItemPlasticPlants.RAIN_PLANT_DAMAGE, Aspect.WATER);
    registerPlasticAspects(ItemPlasticPlants.ENDER_PLANT_DAMAGE, Aspect.ELDRITCH);
    registerPlasticAspects(ItemPlasticPlants.LIGHTNING_PLANT_DAMAGE, Aspect.WEATHER);
    //registerPlasticAspects(ItemPlasticPlants.ADRENALINE_PLANT_DAMAGE , Aspect.
    registerPlasticAspects(ItemPlasticPlants.POTION_PLANT_DAMAGE, Aspect.POISON);
    registerPlasticAspects(ItemPlasticPlants.REPULSION_PLANT_DAMAGE, Aspect.ENTROPY);
    registerPlasticAspects(ItemPlasticPlants.HELIUM_PLANT_DAMAGE, Aspect.LIGHT);
    registerPlasticAspects(ItemPlasticPlants.CHOPPER_PLANT_DAMAGE, Aspect.AIR);
    //registerPlasticAspects(ItemPlasticPlants.MUSIC_PLANT_DAMAGE , Aspect.
    registerPlasticAspects(ItemPlasticPlants.PROPULSION_PLANT_DAMAGE, Aspect.MOTION);
    registerPlasticAspects(ItemPlasticPlants.FLYING_FLOWER_DAMAGE, Aspect.FLIGHT);

    ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.turbineBlade), new AspectList().add(Aspect.GREED, 2).add(Aspect.METAL, 3).add(Aspect.MOTION, 2).add(Aspect.ENERGY, 4));

    AspectList transAndCapAspects = new AspectList().add(Aspect.ENERGY, 2).add(Aspect.PLANT, 2).add(Aspect.METAL, 6);
    ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.transistor), transAndCapAspects);
    ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.capacitor), transAndCapAspects);

    AspectList pcbAspects = new AspectList().add(Aspect.ENERGY, 1).add(Aspect.PLANT, 2).add(Aspect.METAL, 6);
    ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.emptyPCB), pcbAspects);
    ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.unassembledPCB), pcbAspects);
    ThaumcraftApi.registerObjectTag(new ItemStack(Itemss.airCanister), new AspectList().add(Aspect.METAL, 30).add(Aspect.ENERGY, 4));

    /*  for(Item item : pcItems) {
          ThaumcraftApi.registerComplexObjectTag(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE), new AspectList());
      }
      for(Block block : pcBlocks) {
          ThaumcraftApi.registerComplexObjectTag(new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE), new AspectList());
      }*/
}
 
Example #17
Source File: TileVisNode.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method should never be called directly. Use VisNetHandler.drainVis() instead
 * @param aspect what aspect to drain
 * @param vis how much to drain
 * @return how much was actually drained
 */
public int consumeVis(Aspect aspect, int vis) {
	if (VisNetHandler.isNodeValid(getParent())) {
		int out = getParent().get().consumeVis(aspect, vis);
		if (out>0) {
			triggerConsumeEffect(aspect);
		}
		return out;
	}
	return 0;
}
 
Example #18
Source File: TileEssentiaCompressor.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public int containerContains(Aspect aspect) {
    if(isMultiblockFormed() && multiblockYIndex == 1) {
        TileEssentiaCompressor master = tryFindMasterTile();
        if(master == null) return 0;
        return master.al.getAmount(aspect);
    }
    return 0;
}
 
Example #19
Source File: TileStickyJar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void setSuction(Aspect paramAspect, int paramInt) {
    if(isValid()) {
        syncToParent();
        parent.setSuction(paramAspect, paramInt);
        syncFromParent();
    }
}
 
Example #20
Source File: EntityAuraCore.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Aspect[] electParliament() {
    Aspect[] colors = new Aspect[6];

    Aspect[] aspects = internalAuraList.getAspectsSortedAmount();

    int totalSize = internalAuraList.visSize();

    int availableSeats = 6;
    for(Aspect aspect : aspects) {
        float percent = internalAuraList.getAmount(aspect) / (float)totalSize;

        int seats = (int) Math.ceil(availableSeats * percent);
        seats = Math.min(seats, availableSeats);
        availableSeats -= seats;

        for(int i = 0; i < colors.length && seats > 0; i++) {
            if(colors[i] == null) {
                colors[i] = aspect;
                seats--;
            }
        }

        if(availableSeats <= 0) {
            break;
        }
    }

    for(int i = 0; i < colors.length; i++) {
        if(colors[i] == null) {
            colors[i] = aspects[0];
        }
    }
    return colors;
}
 
Example #21
Source File: ResearchItem.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return the aspect aspects ordinal with the highest value. Used to determine scroll color and similar things
 */
public Aspect getResearchPrimaryTag() {
	Aspect aspect=null;
	int highest=0;
	if (tags!=null)
	for (Aspect tag:tags.getAspects()) {
		if (tags.getAmount(tag)>highest) {
			aspect=tag;
			highest=tags.getAmount(tag);
		};
	}
	return aspect;
}
 
Example #22
Source File: NodeManipulatorResultHandler.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void combine(AspectList containingList, Aspect a, Aspect b, int addition) {
    if(!canCombine(a, b)) return;
    Aspect combination = NodeManipulatorResultHandler.getCombination(a, b);
    int lowerAmount;
    if(containingList.getAmount(a) < containingList.getAmount(b)) {
        lowerAmount = containingList.getAmount(a);
    } else {
        lowerAmount = containingList.getAmount(b);
    }
    containingList.remove(a, lowerAmount);
    containingList.remove(b, lowerAmount);
    containingList.add(combination, lowerAmount + addition);
}
 
Example #23
Source File: CrucibleRecipe.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public AspectList removeMatching(AspectList itags) {
	AspectList temptags = new AspectList();
	temptags.aspects.putAll(itags.aspects);
	
	for (Aspect tag:aspects.getAspects()) {
		temptags.remove(tag, aspects.getAmount(tag));
	}
	
	itags = temptags;
	return itags;
}
 
Example #24
Source File: TileStickyJar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Aspect getEssentiaType(ForgeDirection paramForgeDirection) {
    if(isValid()) {
        syncToParent();
        Aspect result = parent.getEssentiaType(changeDirection(paramForgeDirection));
        syncFromParent();
        return result;
    }
    return null;
}
 
Example #25
Source File: CrucibleRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example #26
Source File: CrucibleRecipe.java    From GardenCollection with MIT License 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example #27
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 #28
Source File: ItemFocusBasic.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack,EntityPlayer player, List list, boolean par4) {
	AspectList al = this.getVisCost(stack);
	if (al!=null && al.size()>0) {
		list.add(StatCollector.translateToLocal(isVisCostPerTick(stack)?"item.Focus.cost2":"item.Focus.cost1"));
		for (Aspect aspect:al.getAspectsSorted()) {
			DecimalFormat myFormatter = new DecimalFormat("#####.##");
			String amount = myFormatter.format(al.getAmount(aspect)/100f);
			list.add(" \u00A7"+aspect.getChatcolor()+aspect.getName()+"\u00A7r x "+ amount);				
		}
	}
	addFocusInformation(stack,player,list,par4);
}
 
Example #29
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 #30
Source File: TileKnowledgeBook.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void searchForCognitio() {
    if((ticksExisted & 31) == 0) {
        int drainRange = 4;
        ForgeDirection[] toTry = ForgeDirection.VALID_DIRECTIONS;
        for (ForgeDirection dir : toTry) {
            if(dir == null) continue; //LUL should not happen...
            if(EssentiaHandler.drainEssentia(this, Aspect.MIND, dir, drainRange)) {
                ticksCognitio += COGNITIO_TICKS;
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
                markDirty();
                break;
            }
        }
    }
}