Skip to content

Commit

Permalink
Add back Disjunction Cloth
Browse files Browse the repository at this point in the history
Now with infinite durability.
  • Loading branch information
IcarussOne committed Oct 9, 2024
1 parent 814b02f commit 0be673c
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.verdantartifice.thaumicwonders.common.crafting.recipes;

import javax.annotation.Nonnull;

import com.verdantartifice.thaumicwonders.ThaumicWonders;
import com.verdantartifice.thaumicwonders.common.items.ItemsTW;

import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import net.minecraftforge.registries.IForgeRegistryEntry;

public class RecipeDisjunctionClothUse extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
public RecipeDisjunctionClothUse() {
super();
setRegistryName(ThaumicWonders.MODID, "disenchant");
}

@Override
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
return RecipeDisjunctionClothUse.matches(inv);
}

public static boolean matches(@Nonnull IInventory inv) {
boolean foundCloth = false;
boolean foundTarget = false;

for (int index = 0; index < inv.getSizeInventory(); index++) {
ItemStack stack = inv.getStackInSlot(index);
if (!stack.isEmpty()) {
if (stack.getItem() == ItemsTW.DISJUNCTION_CLOTH && !foundCloth) {
foundCloth = true;
} else if (stack.getItem() != ItemsTW.DISJUNCTION_CLOTH && !foundTarget && stack.isItemEnchanted()) {
foundTarget = true;
} else {
// Invalid item, abort
return false;
}
}
}

return foundCloth && foundTarget;
}

@Override
@Nonnull
public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) {
ItemStack stackToDisenchant = ItemStack.EMPTY;

for (int index = 0; index < inv.getSizeInventory(); index++) {
ItemStack stack = inv.getStackInSlot(index);
if (!stack.isEmpty() && stack.getItem() != ItemsTW.DISJUNCTION_CLOTH && stack.isItemEnchanted()) {
stackToDisenchant = stack.copy();
break;
}
}
if (!stackToDisenchant.isEmpty()) {
stackToDisenchant.getTagCompound().removeTag("ench");
}

return stackToDisenchant;
}

@Override
public boolean canFit(int width, int height) {
return (width >= 2) || (height >= 2);
}

@Override
@Nonnull
public ItemStack getRecipeOutput() {
// Recipe is dynamic, so return empty stack
return ItemStack.EMPTY;
}

@Override
public boolean isDynamic() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.verdantartifice.thaumicwonders.common.events;

import com.verdantartifice.thaumicwonders.ThaumicWonders;
import com.verdantartifice.thaumicwonders.common.crafting.recipes.RecipeDisjunctionClothUse;
import com.verdantartifice.thaumicwonders.common.items.ItemsTW;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import thaumcraft.api.aura.AuraHelper;

@Mod.EventBusSubscriber(modid = ThaumicWonders.MODID)
public class CraftingEvents {
@SubscribeEvent
public static void onCrafting(PlayerEvent.ItemCraftedEvent event) {
// If this was a disenchantment using a Disjunction Cloth, disperse vis into the aura
if (!event.player.world.isRemote && RecipeDisjunctionClothUse.matches(event.craftMatrix)) {
for (int index = 0; index < event.craftMatrix.getSizeInventory(); index++) {
ItemStack stack = event.craftMatrix.getStackInSlot(index);
if (!stack.isEmpty() && stack.getItem() != ItemsTW.DISJUNCTION_CLOTH && stack.isItemEnchanted()) {
NBTTagList tagList = stack.getEnchantmentTagList();
int totalLevels = 0;
for (int tagIndex = 0; tagIndex < tagList.tagCount(); tagIndex++) {
NBTTagCompound tag = tagList.getCompoundTagAt(tagIndex);
totalLevels += tag.getInteger("lvl");
}
if (totalLevels > 0) {
AuraHelper.addVis(event.player.world, event.player.getPosition(), (totalLevels * 5.0F));
}
break;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.verdantartifice.thaumicwonders.common.items.consumables.ItemLetheWater;
import com.verdantartifice.thaumicwonders.common.items.consumables.ItemPanacea;
import com.verdantartifice.thaumicwonders.common.items.entities.ItemFlyingCarpet;
import com.verdantartifice.thaumicwonders.common.items.misc.ItemDisjunctionCloth;
import com.verdantartifice.thaumicwonders.common.items.misc.ItemStructureDiviner;
import com.verdantartifice.thaumicwonders.common.items.misc.ItemTimewinder;
import com.verdantartifice.thaumicwonders.common.items.plants.ItemCinderpearlSeed;
Expand All @@ -31,6 +32,7 @@ public class InitItems {
public static final Set<IVariantItem> ITEM_VARIANT_HOLDERS = new HashSet<IVariantItem>();

public static void initItems(IForgeRegistry<Item> forgeRegistry) {
registerItem(forgeRegistry, new ItemDisjunctionCloth());
registerItem(forgeRegistry, new ItemPrimalDestroyer());
registerItem(forgeRegistry, new ItemFlyingCarpet());
registerItem(forgeRegistry, new ItemTimewinder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.verdantartifice.thaumicwonders.ThaumicWonders;
import com.verdantartifice.thaumicwonders.common.blocks.BlocksTW;
import com.verdantartifice.thaumicwonders.common.crafting.recipes.RecipeDisjunctionClothUse;
import com.verdantartifice.thaumicwonders.common.crafting.recipes.RecipeFlyingCarpetDyes;
import com.verdantartifice.thaumicwonders.common.fluids.FluidQuicksilver;
import com.verdantartifice.thaumicwonders.common.items.ItemsTW;
Expand Down Expand Up @@ -191,6 +192,7 @@ private static void initCoalescencePlatform() {
}

private static void initNormalRecipes(IForgeRegistry<IRecipe> forgeRegistry) {
forgeRegistry.register(new RecipeDisjunctionClothUse());
forgeRegistry.register(new RecipeFlyingCarpetDyes());

ResourceLocation qsGroup = new ResourceLocation(ThaumicWonders.MODID, "quicksilver_bucket_group");
Expand Down Expand Up @@ -360,6 +362,12 @@ private static void initCrucibleRecipes() {
new ItemStack(Items.ENDER_PEARL),
new AspectList().add(Aspect.MOTION, 15).add(Aspect.ELDRITCH, 10)
));
ThaumcraftApi.addCrucibleRecipe(new ResourceLocation(ThaumicWonders.MODID, "disjunction_cloth"), new CrucibleRecipe(
"TWOND_DISJUNCTION_CLOTH",
new ItemStack(ItemsTW.DISJUNCTION_CLOTH),
new ItemStack(ItemsTC.fabric),
new AspectList().add(Aspect.MAGIC, 40).add(Aspect.VOID, 40).add(Aspect.AURA, 20)
));
ThaumcraftApi.addCrucibleRecipe(new ResourceLocation(ThaumicWonders.MODID, "alchemist_stone"), new CrucibleRecipe(
"TWOND_CATALYZATION_CHAMBER",
new ItemStack(ItemsTW.ALCHEMIST_STONE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

@GameRegistry.ObjectHolder(ThaumicWonders.MODID)
public class ItemsTW {
public static final Item DISJUNCTION_CLOTH = null;
public static final ItemSword PRIMAL_DESTROYER = null;
public static final Item FLYING_CARPET = null;
public static final Item TIMEWINDER = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.verdantartifice.thaumicwonders.common.items.misc;

import com.verdantartifice.thaumicwonders.common.items.base.ItemTW;

import net.minecraft.item.ItemStack;

public class ItemDisjunctionCloth extends ItemTW {
public ItemDisjunctionCloth() {
super("disjunction_cloth");
setMaxStackSize(1);
setNoRepair();
}

@Override
public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
return false;
}
}
5 changes: 5 additions & 0 deletions src/main/resources/assets/thaumicwonders/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ tile.thaumicwonders.cinderpearl_crop.name=Cinderpearl
tile.thaumicwonders.vishroom_crop.name=Vishroom

// Items
item.thaumicwonders.disjunction_cloth.name=Disjunction Cloth
item.thaumicwonders.primal_destroyer.name=Primal Destroyer
item.thaumicwonders.flying_carpet.name=Flying Carpet
item.thaumicwonders.timewinder.name=Timewinder
Expand Down Expand Up @@ -95,6 +96,10 @@ thaumicwonders.research.everburning_urn.title=Everburning Urn
thaumicwonders.research.everburning_urn.text.stage.1=The Everfull Urn is an incredibly useful device, but I'm convinced that I can do better. Something similar, but for other types of fluids. Fluids like, say... lava?
thaumicwonders.research.everburning_urn.text.stage.2=By infusing the Everfull Urn with a series of microscopic portals to the Nether, I'm able to siphon all the lava that I could ever need. The process is not perfect, however.<BR>For one thing, it's slow. Whereas its watery brethren fills up in moments, this device, which I've dubbed the Everburning Urn, takes about a minute to generate a single bucket.<BR>The process is much more draining to the aura, as well. My calculations indicate that maintaining the portal mesh consumes about 25 points of vis from the aura.<BR>Finally, for safety's sake, I've disabled the urn's ability to automatically fill nearby vessels. Can't have liquid hot magma just flying around the place.

thaumicwonders.research.disjunction_cloth.title=Disjunction Cloth
thaumicwonders.research.disjunction_cloth.text.stage.1=Augh! This enchantment table is so incredibly frustrating at times. It's so... random! And then when I don't get what I want, I have to craft a new item from scratch! There has to be a better way to do this.<BR>I believe that alchemy may hold the solution to this problem. I just need something to soak up the magical energy bound to these enchanted items. Of course, I'll need an enchanted item to test on. It doesn't need to be anything too advanced, a simple Protection enchantment should serve my needs nicely.
thaumicwonders.research.disjunction_cloth.text.stage.2=My research has borne fruit! It may not solve the problem of randomized enchantment, but this new Disjunction Cloth will get rid of any unwanted enchantments beautifully.<BR>As a bonus, it doesn't just soak up enchantment energy, it unbinds it! The unbound energy is then dispersed into the aura as vis. My calculations indicate that the cloth will release 5 points of vis into the aura for every level of enchantment that it unbinds.

thaumicwonders.research.dimensional_ripper.title=Dimensional Perforator
thaumicwonders.research.dimensional_ripper.text.stage.1=If I'm going to continue to study these flux rifts and properly utilize them, I'll need better tools. Current methods revolve mostly around polluting aura with flux in large quantities, hoping the emerging rifts are not too far to get to, and to also hope they will not cause yet another violent rearrangement of my furniture and floor plans.<BR>This is too haphazard and uncontrollable to make rifts this way, as well as annoying to repair the damages caused by the breach in the fabric of reality.<BR>A precision is required, an option preferably less costly and damaging to the aura.
thaumicwonders.research.dimensional_ripper.text.stage.2=I do believe I've outdone myself in the area of rifts here. By channeling concentrated beams of Vitium in a particular way into one singular spot, I was able to successfully create a tear in the real space right where I want it to be.<BR>A single Dimensional Perforator isn't enough, however, nor could it ever be. The energies required would be completely infeasible. Rather, a pair of the devices must be used. By placing them precisely ten blocks apart and having the output ends facing each other, the machines can resonate together, amplifying their power enough to serve my needs. When so placed, small amounts of energy will flit between them, confirming that they are connected.<BR>Each of the two devices must be fueled with at least fifty Vitium essentia to reach critical mass. Applying a redstone signal to either perforator will disable the pair and prevent any reaction from taking place. Perforators disabled in this way can be fed additional essentia, beyond the minimum of fifty, to result in a larger rift once they're finally activated. I need to be careful and plan the expected size beforehand.<BR>As a safety measure, the perforators will not activate if they sense another rift already open nearby, but not at the target point. The veil between us and the void can only take so much tampering before it fails completely and makes or perhaps lets-in something utterly terrible, or causes a devastating feedback from the aura itself, and I'm not §othat§r crazy to find out the exact specifics in practice. Not yet at least...<PAGE>Additionally, despite using Vitium as a power source and the means to create a Rift, the Dimensional Perforators cannot sustain the rift or stabilize it enough by any means. After all, this machine's purpose is to create a rift in the first place, not maintain or manipulate it. I should use other means of interacting with rifts if I desire something specific.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "thaumicwonders:items/disjunction_cloth"
}
}
29 changes: 28 additions & 1 deletion src/main/resources/assets/thaumicwonders/research/alchemy.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,33 @@
],
"addenda": []
},
{
"key": "TWOND_DISJUNCTION_CLOTH",
"name": "thaumicwonders.research.disjunction_cloth.title",
"icons": ["thaumicwonders:disjunction_cloth"],
"category": "THAUMIC_WONDERS",
"parents": ["TWOND_BASE"],
"siblings": [],
"meta": [],
"location": [2, 0],
"reward_item": [],
"reward_knowledge": [],
"stages": [
{
"text": "thaumicwonders.research.disjunction_cloth.text.stage.1",
"required_knowledge": ["THEORY;ALCHEMY;1","THEORY;AUROMANCY;1"],
"required_research":["!auram"],
"required_item": ["thaumcraft:enchanted_placeholder;1;0;{ench:[{id:0s,lvl:1s}]}"]
},
{
"text": "thaumicwonders.research.disjunction_cloth.text.stage.2",
"recipes": [
"thaumicwonders:disjunction_cloth"
]
}
],
"addenda": []
},
{
"key": "TWOND_CATALYZATION_CHAMBER",
"name": "thaumicwonders.research.catalyzation_chamber.title",
Expand Down Expand Up @@ -158,7 +185,7 @@
"name": "thaumicwonders.research.lethe_water.title",
"icons": ["thaumicwonders:lethe_water"],
"category": "THAUMIC_WONDERS",
"parents": ["TWOND_BASE"],
"parents": ["TWOND_DISJUNCTION_CLOTH"],
"siblings": [],
"meta": [],
"location": [4, 0],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0be673c

Please sign in to comment.