Java Code Examples for thaumcraft.api.aspects.Aspect#getTag()

The following examples show how to use thaumcraft.api.aspects.Aspect#getTag() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: DataFamiliar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void handleEquip(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

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

    if(!addClientQueue.contains(data)) addClientQueue.add(data);
    if(!playersWithFamiliar.contains(data)) playersWithFamiliar.add(data);
    markDirty();

    if(!familiarControllers.containsKey(player)) {
        FamiliarController controller = new FamiliarController(player);
        familiarControllers.put(player, controller);
    }
}
 
Example 8
Source File: DataFamiliar.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void handleUnequip(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

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

    if(!removeClientQueue.contains(data)) removeClientQueue.add(data);
    if(playersWithFamiliar.contains(data)) playersWithFamiliar.remove(data);
    markDirty();

    familiarControllers.remove(player);
}
 
Example 9
Source File: AuraResearchManager.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void tryUnlockAuraEffect(EntityPlayer player, Aspect aspect) {
    if(!AuraEffectHandler.registeredEffects.containsKey(aspect)) return;
    if(isBlacklisted(aspect)) return;

    if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS")) return;
    if(!Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect)) return;

    String res = String.format(TC_AURA_RESEARCH_STR, aspect.getTag());
    if(ResearchManager.isResearchComplete(player.getCommandSenderName(), res)) return;
    Thaumcraft.proxy.getResearchManager().completeResearch(player, res);

    PacketTCNotificationText text = new PacketTCNotificationText("gadomancy.aura.research.unlock", aspect.getTag());
    PacketHandler.INSTANCE.sendTo(text, (EntityPlayerMP) player);
}
 
Example 10
Source File: BlockEssentiaGenerator.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
    TileEntityEssentiaGenerator tile = (TileEntityEssentiaGenerator) world.getTileEntity(x, y, z);
    if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IEssentiaContainerItem) {
        IEssentiaContainerItem item = (IEssentiaContainerItem) player.getHeldItem().getItem();
        Aspect aspect = item.getAspects(player.getHeldItem()).getAspects()[0];
        if (tile.isFree[0]) {
            tile.aspects[0] = aspect.getTag();
            tile.isFree[0] = false;
        } else if (tile.isFree[1]) {
            tile.aspects[1] = aspect.getTag();
            tile.isFree[1] = false;
        } else if (tile.isFree[2]) {
            tile.aspects[2] = aspect.getTag();
            tile.isFree[2] = false;
        } else if (tile.isFree[3]) {
            tile.aspects[3] = aspect.getTag();
            tile.isFree[3] = false;
        }
        return true;
    } else if (player.getHeldItem() == null && player.isSneaking()) {
        for (int i = 0; i < tile.aspects.length; i++) {
            if (!tile.isFree[i]) {
                tile.isFree[i] = true;
            }
        }
        return true;
    }
    return false;
}
 
Example 11
Source File: AdapterDeconstructor.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.STRING, description = "What aspect does the Table contain")
public String getAspect(Object target) throws Exception {
	Aspect aspect = ASPECT.get(target);
	return aspect != null? aspect.getTag() : "";
}
 
Example 12
Source File: AdapterEssentiaTransport.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.STRING, description = "Returns the type of essentia wished in the tube")
public String getSuctionType(IEssentiaTransport pipe,
		@Arg(description = "Direction suction coming from", name = "direction") ForgeDirection direction) {
	Aspect asp = pipe.getSuctionType(direction);
	return (asp != null)? asp.getTag() : "";
}
 
Example 13
Source File: AdapterEssentiaTransport.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.STRING, description = "Returns the type of essentia in the tube")
public String getEssentiaType(IEssentiaTransport pipe,
		@Arg(description = "Direction suction coming from", name = "direction") ForgeDirection direction) {
	Aspect asp = pipe.getEssentiaType(direction);
	return (asp != null)? asp.getTag() : "";
}