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

The following examples show how to use thaumcraft.api.aspects.AspectList#getAspects() . 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: ItemRenderRemoteJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    AspectList aspects = ((ItemJarFilled)ConfigItems.itemJarFilled).getAspects(stack);
    if(aspects != null) {
        tile.aspect = aspects.getAspects()[0];
        tile.amount = aspects.getAmount(tile.aspect);
    } else {
        tile.aspect = null;
        tile.amount = 0;
    }

    if(stack.hasTagCompound()) {
        tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId");
    }

    super.renderItem(type, stack, data);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.5f, 0.5f, 0.5f);

    RenderingRegistry.instance().renderInventoryBlock(RenderBlocks.getInstance(), RegisteredBlocks.blockRemoteJar, 0, RegisteredBlocks.blockRemoteJar.getRenderType());
    GL11.glPopMatrix();
}
 
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: ItemBlockRemoteJar.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
    boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
    if (placed && stack.hasTagCompound()) {
        TileRemoteJar tile = (TileRemoteJar) world.getTileEntity(x, y, z);

        AspectList aspects = ((ItemJarFilled) ConfigItems.itemJarFilled).getAspects(stack);
        if(aspects != null) {
            tile.aspect = aspects.getAspects()[0];
            tile.amount = aspects.getAmount(tile.aspect);
        }

        if(!world.isRemote) {
            tile.networkId = NBTHelper.getUUID(stack.getTagCompound(), "networkId");
            tile.markForUpdate();
        }
    }
    return placed;
}
 
Example 4
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 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 GardenCollection with MIT License 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: CrucibleRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 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 8
Source File: CrucibleRecipe.java    From PneumaticCraft 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 9
Source File: GuiResearchRecipeAuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GuiResearchRecipeAuraEffects(ResearchItem research, int page, double x, double y) {
    super(research, page, x, y);

    Injector inj = new Injector(this, GuiResearchRecipe.class);

    ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
    ResearchPage[] pages = inj.getField("pages");
    ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length];
    System.arraycopy(pages, 0, newPages, 0, pages.length);
    System.arraycopy(additionalPages, 0, newPages, pages.length, additionalPages.length);
    inj.setField("pages", newPages);
    inj.setField("maxPages", newPages.length);

    List<String> list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
    if ((list != null) && (list.size() > 0)) {
        for (String s : list) {
            try {
                String s2 = s.substring(1);
                ItemStack is = getFromCache(Integer.parseInt(s2));
                if (is != null) {
                    AspectList tags = ThaumcraftCraftingManager.getObjectTags(is);
                    tags = ThaumcraftCraftingManager.getBonusTags(is, tags);
                    if ((tags != null) && (tags.size() > 0)) {
                        for (Aspect a : tags.getAspects()) {
                            ArrayList<ItemStack> items = itemMap.get(a.getTag());
                            if (items == null) {
                                items = new ArrayList<ItemStack>();
                            }
                            ItemStack is2 = is.copy();
                            is2.stackSize = tags.getAmount(a);
                            items.add(is2);
                            itemMap.put(a.getTag(), items);
                        }
                    }
                }
            } catch (NumberFormatException e) {}
        }
    }
}
 
Example 10
Source File: PrimalAspectList.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public AspectList add(Aspect aspect, int amount) {
    AspectList al = new AspectList();
    al.add(aspect, amount);
    al = ResearchManager.reduceToPrimals(al);
    for(Aspect a : al.getAspects()) {
        super.add(a, al.getAmount(a));
    }
    return this;
}
 
Example 11
Source File: TileExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean doesContainerContain(AspectList ot) {
    for (Aspect tt : ot.getAspects()) {
        if (this.aspects.getAmount(tt) < ot.getAmount(tt)) {
            return false;
        }
    }
    return true;
}
 
Example 12
Source File: TileAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean doesContainerContain(AspectList list) {
    if (!isInputTile()) return false;
    if (holdingAspect == null) return false;

    for (Aspect a : list.getAspects()) if ((this.amount > 0) && (a == holdingAspect)) return true;
    return false;
}
 
Example 13
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
    EntityPlayer player = (EntityPlayer) e;

    if(player.getHeldItem() != null && player.getHeldItem().getItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
        ItemStack wand = player.getHeldItem();
        ItemWandCasting wandCasting = (ItemWandCasting) wand.getItem();
        AspectList al = wandCasting.getAspectsWithRoom(wand);
        for(Aspect a : al.getAspects()) {
            if(a != null) wandCasting.addRealVis(wand, a, 4, true);
        }
    }
}
 
Example 14
Source File: AdapterAspectContainer.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.TABLE, description = "Get the map of aspects stored in the block (summed, if there are multiple entries)")
public Map<String, Integer> getAspectsSum(IAspectContainer container) {
	AspectList aspectList = container.getAspects();
	if (aspectList == null) return null;
	Map<String, Integer> result = Maps.newHashMap();
	for (Aspect aspect : aspectList.getAspects()) {
		if (aspect == null) continue;
		String name = aspect.getName();
		int amount = Objects.firstNonNull(result.get(name), 0);
		result.put(name, amount + aspectList.getAmount(aspect));
	}
	return result;
}
 
Example 15
Source File: ConverterAspectList.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
public static List<Map<String, Object>> aspectsToMap(AspectList aspectList) {
	List<Map<String, Object>> aspects = Lists.newArrayList();
	if (aspectList == null) return aspects;

	for (Aspect aspect : aspectList.getAspects()) {
		if (aspect == null) continue;
		appendAspectEntry(aspects, aspect, aspectList.getAmount(aspect));
	}
	return aspects;
}