Warp System
Warp is Thaumcraft’s madness/taint mechanic. Using certain items, completing research, or crafting specific things adds temporary, permanent, or sticky warp to a player. High warp causes various negative effects.
Warp Types
| Type | Description | Removal |
|---|---|---|
| Temporary | Decays over time naturally. | Automatically removed over time (~5 minutes per point). |
| Permanent | Never decays. Accumulates indefinitely. | Cannot be removed. |
| Sticky | Permanent warp that can be manually removed via certain items (e.g. Amulet ofWarding). | Can be reduced by using specific items. |
Warp Registration
addWarpToItem
ThaumcraftApi.addWarpToItem(ItemStack craftresult, int amount)
Adds sticky warp to a player when they craft the specified item.
// When a player crafts the resulting item, they gain 'amount' sticky warp
ThaumcraftApi.addWarpToItem(new ItemStack(ModItems.myCursedItem), 3);
| Parameter | Type | Description |
|---|---|---|
craftresult |
ItemStack |
The crafted item. Both item and metadata are matched. |
amount |
int |
Amount of sticky warp gained. |
addWarpToResearch
ThaumcraftApi.addWarpToResearch(String research, int amount)
Adds permanent warp to a player when they complete the specified research.
// Player gains 2 permanent warp upon completing "MY_RESEARCH"
ThaumcraftApi.addWarpToResearch("MY_RESEARCH", 2);
| Parameter | Type | Description |
|---|---|---|
research |
String |
The research key (must match exactly). |
amount |
int |
Amount of permanent warp gained. |
getWarp
ThaumcraftApi.getWarp(Object in)
Returns how much warp is associated with an item or research.
int warp = ThaumcraftApi.getWarp(new ItemStack(ModItems.myItem));
int warp = ThaumcraftApi.getWarp("MY_RESEARCH");
| Parameter | Type | Description |
|---|---|---|
in |
ItemStack or String |
The item or research key. |
Returns 0 if nothing is registered.
Runtime Warp Management
addWarpToPlayer
ThaumcraftApiHelper.addWarpToPlayer(EntityPlayer player, int amount, boolean temporary)
Adds temporary or permanent warp to a player at runtime (e.g. when using an item or casting a spell).
// Add 1 temporary warp point
ThaumcraftApiHelper.addWarpToPlayer(player, 1, true);
// Add 2 permanent warp points
ThaumcraftApiHelper.addWarpToPlayer(player, 2, false);
| Parameter | Type | Description |
|---|---|---|
player |
EntityPlayer |
The target player. |
amount |
int |
Amount of warp to add. Negative values only valid for temporary warp. |
temporary |
boolean |
true for temporary warp, false for permanent. |
addStickyWarpToPlayer
ThaumcraftApiHelper.addStickyWarpToPlayer(EntityPlayer player, int amount)
Adds sticky warp to a player. Sticky warp can be removed via the Amulet of Warding.
// Add 1 sticky warp point
ThaumcraftApiHelper.addStickyWarpToPlayer(player, 1);
// Remove 1 sticky warp point
ThaumcraftApiHelper.addStickyWarpToPlayer(player, -1);
| Parameter | Type | Description |
|---|---|---|
player |
EntityPlayer |
The target player. |
amount |
int |
Amount (positive adds, negative removes). |
Sync
All warp changes are automatically synced to the client-side player state.
IWandable and Warp
The IWandable interface allows tile entities to respond to wand interactions. While not strictly a warp interface, wand interactions can be used to implement warp-related mechanics (e.g. a warp-generating wand effect that adds warp on use).
See Wand Triggers for more on IWandable.
Warp Effects
High warp causes various negative effects on the player:
- Taintment Mobs: Spawn around players with high warp.
- Vis Discount: Players with high warp have reduced vis costs for spells.
- Research Penalty: High warp can cause research to fail or produce taint aspects.
- Wandering Trader: May refuse to deal with high-warp players.
Example: Warp-Generating Crafting Recipe
// In your mod's init
public void registerWarp() {
// Any player who crafts myWandOfDoom gains 3 sticky warp
ThaumcraftApi.addWarpToItem(new ItemStack(Item.getByNameOrId("mymod:wand_of_doom")), 3);
}
Example: Warp-Gaining Spell Effect
// In a focus or wand effect
public void onPlayerStoppedUsingFocus(ItemStack wandstack, World world, EntityPlayer player, int count) {
// Applying a "dark" spell costs the player 1 temporary warp
ThaumcraftApiHelper.addWarpToPlayer(player, 1, true);
}
Example: Research Warp
// In your research registration
public void registerResearchWarp() {
// Completing "ELDRITCH_LORE" grants 5 permanent warp
ThaumcraftApi.addWarpToResearch("ELDRITCH_LORE", 5);
}