Warp System

Warp is a mechanic representing the arcane instability caused by performing powerful or forbidden magical actions. Thaumcraft tracks three kinds of warp that affect the player differently.

Warp Types

Type Persistence Removal Cause
Permanent Forever Cannot be removed Research completion, using certain items
Temporary Decays over time Automatically via warp decay mechanic Casting high-cost spells, warp items
Sticky Permanent Can be reduced by using Salting Mundane items Crafting certain warp-associated items

Static Registration API

All warp registration is done via ThaumcraftApi.

addWarpToItem

public static void addWarpToItem(ItemStack craftresult, int amount)

Associates sticky warp with an item. When a player crafts the given item, they gain that amount of sticky warp.

Parameter Type Description
craftresult ItemStack The crafted item
amount int Sticky warp gained on craft

addWarpToResearch

public static void addWarpToResearch(String research, int amount)

Associates permanent warp with completing a research entry.

Parameter Type Description
research String Research key
amount int Permanent warp gained on completion

getWarp

public static int getWarp(Object in)

Returns the warp value registered for the given item or research key. Accepts an ItemStack or String.

int sticky = ThaumcraftApi.getWarp(itemStack);
int permanent = ThaumcraftApi.getWarp("RESEARCH_KEY");

Runtime Player Warp API

Runtime warp manipulation uses ThaumcraftApiHelper, which delegates to ThaumcraftApi.internalMethods.

addWarpToPlayer

public static void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary)

Adds warp to a player directly. Automatically syncs to the client.

Parameter Type Description
player EntityPlayer Target player
amount int Amount of warp to add (can be negative for temporary)
temporary boolean true = temporary warp, false = permanent warp

addStickyWarpToPlayer

public static void addStickyWarpToPlayer(EntityPlayer player, int amount)

Adds sticky warp to a player. Used when the player uses consumable warp-reducing items.

Parameter Type Description
player EntityPlayer Target player
amount int Sticky warp to add (can be negative to reduce)

Internal Method Handler

The warp APIs ultimately delegate through:

public static IInternalMethodHandler internalMethods = new DummyInternalMethodHandler()

After Thaumcraft’s FMLPreInitializationEvent, internalMethods is replaced with the real implementation. Calling warp methods before that point silently fails (the DummyInternalMethodHandler does nothing).

IInternalMethodHandler Interface

public interface IInternalMethodHandler {
    public void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary);
    public void addStickyWarpToPlayer(EntityPlayer player, int amount);
    public boolean isResearchComplete(String username, String researchkey);
    public boolean hasDiscoveredAspect(String username, Aspect aspect);
    public AspectList getDiscoveredAspects(String username);
    // ... other methods for vis, aspects, etc.
}

Usage Example

// In a crafting handler for a warp-generating item
public void onCrafted(ItemStack result, EntityPlayer player) {
    // Add sticky warp based on what was crafted
    ThaumcraftApi.addWarpToItem(result, 2);

    // Also add sticky warp directly to the player
    ThaumcraftApiHelper.addStickyWarpToPlayer(player, 1);
}

// In a spell casting handler
public void onCast(EntityPlayer player, AspectList cost) {
    // Add temporary warp based on vis spent
    int warpGain = cost.visSize() / 2;
    ThaumcraftApiHelper.addWarpToPlayer(player, warpGain, true);
}

// In a research completion handler
public void onResearchComplete(EntityPlayer player, String researchKey) {
    int warp = ThaumcraftApi.getWarp(researchKey);
    if (warp > 0) {
        ThaumcraftApiHelper.addWarpToPlayer(player, warp, false);
    }
}

Warp Display and Effects

Warp is displayed in the Thaumonomicon’s player status area. High permanent/sticky warp levels can cause:

  • Random arcane disturbances
  • Spawning of eldritch entities
  • Reduced maximum vis capacity

Temporary warp is visible as a blue glow around the player that fades over time.