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

The following examples show how to use thaumcraft.api.aspects.Aspect#getAspect() . 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: PacketTCNotificationText.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public IMessage onMessage(PacketTCNotificationText message, MessageContext ctx) {
    if(message.text == null) return null;
    String translated = StatCollector.translateToLocal(message.text);
    ResourceLocation image = null;
    int color = message.color;
    Aspect a = Aspect.getAspect(message.additionalInfo);
    if(a != null) {
        image = a.getImage();
        color = a.getColor();
    }
    if(message.text.equals("gadomancy.aura.research.unlock")) {
        if(a != null) {
            translated = EnumChatFormatting.GREEN + String.format(translated, a.getName());
        } else {
            translated = EnumChatFormatting.GREEN + String.format(translated, message.additionalInfo);
        }
    }
    color &= 0xFFFFFF;
    PlayerNotifications.addNotification(translated, image, color);
    return null;
}
 
Example 2
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 3
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 4
Source File: GrowingNodeBehavior.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void readFromNBT(NBTTagCompound nbtTagCompound) {
    this.isSaturated = nbtTagCompound.getBoolean("overallSaturated");
    this.overallHappiness = nbtTagCompound.getDouble("overallHappiness");

    if(nbtTagCompound.hasKey("lastFed")) {
        this.lastFedAspect = Aspect.getAspect(nbtTagCompound.getString("lastFedAspect"));
        this.lastFedRow = nbtTagCompound.getInteger("lastFedRow");
    }

    NBTTagList list = nbtTagCompound.getTagList("saturationValues", 10);
    for (int i = 0; i < list.tagCount(); i++) {
        NBTTagCompound aspectCompound = list.getCompoundTagAt(i);
        String name = aspectCompound.getString("aspectName");
        double saturation = aspectCompound.getDouble("aspectSaturation");
        Aspect a = Aspect.getAspect(name);
        if(a != null) {
            aspectSaturation.put(a, saturation);
        }
    }
}
 
Example 5
Source File: FamiliarHandlerClient.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public static void playerRenderEvent(EntityPlayer player, float partialTicks) {
    String ownerName = player.getCommandSenderName();
    if(!clientFamiliars.containsKey(ownerName)) return;

    ExFamiliarData data = clientFamiliars.get(ownerName);
    PartialEntityFamiliar fam = data.familiar;

    Aspect aspect = Aspect.getAspect(data.data.aspectTag);

    if(ENTITY_WISP == null) ENTITY_WISP = new EntityWisp(new FakeWorld());
    ENTITY_WISP.setType(aspect.getTag());
    ENTITY_WISP.ticksExisted = fam.dummyEntity.ticksExisted;
    GL11.glPushMatrix();
    if(fam.owner == null || fam.owner.get() == null) {
        fam.owner = new WeakReference<EntityPlayer>(player);
    }
    EntityPlayer current = Minecraft.getMinecraft().thePlayer;
    double diffX = fam.renderX - current.posX + player.posX;
    double diffY = fam.renderY - current.posY + player.posY + 0.5;
    double diffZ = fam.renderZ - current.posZ + player.posZ;

    String currentPl = current.getCommandSenderName();
    String otherPl = player.getCommandSenderName();

    if(!currentPl.equals(otherPl)) {
        diffY += 1.32;

        EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity;
        diffX -= ((entity.posX - entity.lastTickPosX) * partialTicks);
        diffY -= ((entity.posY - entity.lastTickPosY) * partialTicks);
        diffZ -= ((entity.posZ - entity.lastTickPosZ) * partialTicks);
    }

    ItemRenderFamiliar.renderEntityWispFor(fam.owner.get(), ENTITY_WISP, diffX, diffY, diffZ, 0, partialTicks);
    GL11.glPopMatrix();
}
 
Example 6
Source File: ModConfig.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static String[] refactorAspects(String listOfAspects) {
    List<String> aspects = new ArrayList<String>();
    if(listOfAspects != null && listOfAspects.length() > 0) {
        String[] aspectTags = listOfAspects.split(",");
        for (String s : aspectTags) {
            if(Aspect.getAspect(s) != null) aspects.add(s);
        }
    }
    return aspects.toArray(new String[aspects.size()]);
}
 
Example 7
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 8
Source File: ResearchPageAuraAspects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static Aspect createAuraFakeAspect(String tag) {
    Aspect original = Aspect.getAspect(tag);
    if(original == null) return null;
    String fakeTemp = "GADOMANCY_TEMP_" + tag;

    Aspect fake = new FakeAspect(fakeTemp, original.getColor(), null, original.getImage(), original.getBlend(), true);
    fake.setTag(original.getTag());
    return fake;
}
 
Example 9
Source File: AdapterAspectContainer.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@ScriptCallable(returnTypes = ReturnType.NUMBER, description = "Get amount of specific aspect stored in this block")
public int getAspectCount(IAspectContainer container,
		@Arg(name = "aspect", description = "Aspect to be checked") String aspectName) {

	Aspect aspect = Aspect.getAspect(aspectName.toLowerCase(Locale.ENGLISH));
	Preconditions.checkNotNull(aspect, "Invalid aspect name");
	AspectList list = container.getAspects();
	if (list == null) return 0;
	return list.getAmount(aspect);
}
 
Example 10
Source File: ItemEtherealFamiliar.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static Aspect getFamiliarAspect(ItemStack stack) {
    if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return null;
    String tag = NBTHelper.getData(stack).getString("aspect");
    if(tag == null || tag.equalsIgnoreCase("")) return null;
    return Aspect.getAspect(tag);
}
 
Example 11
Source File: ItemFamiliar_Old.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Aspect getAspect(ItemStack stack) {
    if(!hasAspect(stack)) return null;
    if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return null;
    if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return null;
    return Aspect.getAspect(stack.getTagCompound().getString("aspect"));
}
 
Example 12
Source File: ItemFamiliar_Old.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean hasAspect(ItemStack stack) {
    if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false;
    if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return false;
    return Aspect.getAspect(stack.getTagCompound().getString("aspect")) != null;
}