Skip to content

Commit

Permalink
Rework Cleansing Charm and add config
Browse files Browse the repository at this point in the history
-Greatly buffed the charm and made it no longer require a full hour to remove one point of warp
-Everything related to the charm is configurable
  • Loading branch information
IcarussOne committed Aug 15, 2024
1 parent 1decf80 commit 879fe30
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.verdantartifice.thaumicwonders.client.config;

import com.verdantartifice.thaumicwonders.ThaumicWonders;

import net.minecraftforge.common.config.Config;
import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Config(modid = ThaumicWonders.MODID, name = ThaumicWonders.NAME)
public class TWConfig {
@Config.Comment("General")
public static GeneralSettings general_settings = new GeneralSettings();

public static class GeneralSettings {
@Config.Name("Cleansing Charm: Capacity")
@Config.Comment("The maximum Vis capacity of the Cleansing Charm [default: 200]")
@Config.RangeInt(min = 1, max = 99999)
@Config.RequiresMcRestart
public int CC_CAPACITY = 200;

@Config.Name("Cleansing Charm: Cost")
@Config.Comment("The Vis cost after Warp is taken by the Cleansing Charm [default: 10]")
@Config.RangeInt(min = 1, max = 99999)
@Config.RequiresMcRestart
public int CC_COST = 10;

@Config.Name("Cleansing Charm: Flux")
@Config.Comment("The amount of seconds it takes for Flux to dissipate into the aura while the activated Cleansing Charm is worn [default: 10]")
@Config.RangeInt(min = 1, max = 99999)
@Config.RequiresMcRestart
public int CC_FLUX = 10;

@Config.Name("Cleansing Charm: Flux Amount")
@Config.Comment("The amount of Flux that generates from the activated Cleansing Charm [default: 0.1]")
@Config.RangeDouble(min = 0.1, max = 99999)
@Config.RequiresMcRestart
public double CC_FLUX_AMOUNT = 0.1D;

@Config.Name("Cleansing Charm: Time")
@Config.Comment("The amount of minutes it takes for the Cleansing Charm to remove Warp [default: 5]")
@Config.RangeInt(min = 1, max = 99999)
@Config.RequiresMcRestart
public int CC_TIME = 5;

@Config.Name("Cleansing Charm: Warp")
@Config.Comment("The amount of warp taken by the Cleansing Charm [default: 1]")
@Config.RangeInt(min = 1, max = 99999)
@Config.RequiresMcRestart
public int CC_WARP = 1;
}

@Mod.EventBusSubscriber(modid = ThaumicWonders.MODID)
public static class EventHandler {
@SubscribeEvent
public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.getModID().equals(ThaumicWonders.MODID)) {
ConfigManager.sync(ThaumicWonders.MODID, Config.Type.INSTANCE);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ private static void initInfusionRecipes() {
new Object[] {
Ingredient.fromItem(ItemsTC.primordialPearl),
"plateVoid",
new ItemStack(ItemsTC.crimsonPlateHelm, 1),
new ItemStack(ItemsTC.crimsonPlateHelm),
new ItemStack(ItemsTC.goggles, 1, 32767),
new ItemStack(Items.GHAST_TEAR),
new ItemStack(ItemsTC.salisMundus),
Expand All @@ -627,7 +627,7 @@ private static void initInfusionRecipes() {
"plateVoid",
"plateVoid",
"plateVoid",
new ItemStack(ItemsTC.crimsonPlateChest, 1),
new ItemStack(ItemsTC.crimsonPlateChest),
new ItemStack(ItemsTC.salisMundus),
"leather"
}
Expand All @@ -643,7 +643,7 @@ private static void initInfusionRecipes() {
Ingredient.fromItem(ItemsTC.primordialPearl),
"plateVoid",
"plateVoid",
new ItemStack(ItemsTC.crimsonPlateLegs, 1),
new ItemStack(ItemsTC.crimsonPlateLegs),
new ItemStack(ItemsTC.salisMundus),
"leather"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.List;

import com.verdantartifice.thaumicwonders.client.config.TWConfig;
import com.verdantartifice.thaumicwonders.common.items.base.ItemTW;

import baubles.api.BaubleType;
Expand All @@ -24,16 +25,16 @@
import thaumcraft.api.items.RechargeHelper;

public class ItemCleansingCharm extends ItemTW implements IBauble, IRechargable {
protected static final int VIS_CAPACITY = 200;
protected static final int MAX_PROGRESS = (20 * 60 * 60);
protected static final int ENERGY_PER_VIS = (MAX_PROGRESS / VIS_CAPACITY) - 1;
protected static final int VIS_CAPACITY = TWConfig.general_settings.CC_CAPACITY;
protected static final int MAX_PROGRESS = (20 * 60 * TWConfig.general_settings.CC_TIME);
protected static final int ENERGY_PER_VIS = (MAX_PROGRESS / TWConfig.general_settings.CC_COST) - 1;

public ItemCleansingCharm() {
super("cleansing_charm");
this.setMaxStackSize(1);
this.setNoRepair();
}

@Override
public int getMaxCharge(ItemStack stack, EntityLivingBase player) {
return VIS_CAPACITY;
Expand All @@ -52,25 +53,25 @@ public BaubleType getBaubleType(ItemStack itemstack) {
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase elb) {
if (elb != null && elb instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)elb;
EntityPlayer player = (EntityPlayer) elb;
IPlayerWarp warp = ThaumcraftCapabilities.getWarp(player);
if (warp.get(IPlayerWarp.EnumWarpType.NORMAL) > 0) {
if (this.hasEnergy(itemstack)) {
this.incrementProgress(itemstack);
int progress = this.getProgress(itemstack);
if (progress % 60 == 0) {
AuraHelper.polluteAura(player.world, player.getPosition(), 0.1F, true);
if (progress % 60 * TWConfig.general_settings.CC_FLUX == 0) {
AuraHelper.polluteAura(player.world, player.getPosition(), (float) TWConfig.general_settings.CC_FLUX_AMOUNT, true);
}
if (progress >= MAX_PROGRESS) {
ThaumcraftApi.internalMethods.addWarpToPlayer(player, -1, IPlayerWarp.EnumWarpType.NORMAL);
ThaumcraftApi.internalMethods.addWarpToPlayer(player, -TWConfig.general_settings.CC_WARP, IPlayerWarp.EnumWarpType.NORMAL);
this.setProgress(itemstack, 0);
}
}
this.consumeEnergy(itemstack, player);
}
}
}

protected void incrementProgress(ItemStack stack) {
this.setProgress(stack, this.getProgress(stack) + 1);
}
Expand All @@ -82,11 +83,11 @@ protected int getProgress(ItemStack stack) {
return 0;
}
}

protected void setProgress(ItemStack stack, int progress) {
stack.setTagInfo("progress", new NBTTagInt(progress));
}

protected void consumeEnergy(ItemStack stack, EntityLivingBase player) {
int energy = this.getEnergy(stack);
if (energy > 0) {
Expand All @@ -96,31 +97,31 @@ protected void consumeEnergy(ItemStack stack, EntityLivingBase player) {
}
this.setEnergy(stack, energy);
}

protected int getEnergy(ItemStack stack) {
if (stack.hasTagCompound()) {
return stack.getTagCompound().getInteger("energy");
} else {
return 0;
}
}

protected void setEnergy(ItemStack stack, int energy) {
stack.setTagInfo("energy", new NBTTagInt(energy));
}

protected boolean hasEnergy(ItemStack stack) {
return (this.getEnergy(stack) > 0 || RechargeHelper.getCharge(stack) > 0);
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
int percent = (int)(((double)this.getProgress(stack) / (double)MAX_PROGRESS) * 100);
int percent = (int) (((double) this.getProgress(stack) / (double) MAX_PROGRESS) * 100);
tooltip.add(I18n.format("item.thaumicwonders.cleansing_charm.tooltip.progress", percent));
super.addInformation(stack, worldIn, tooltip, flagIn);
}

@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/thaumicwonders/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ thaumicwonders.research.void_beacon.text.stage.2=Truly, this must be my magnum o

thaumicwonders.research.cleansing_charm.title=Cleansing Charm
thaumicwonders.research.cleansing_charm.text.stage.1=These headaches are becoming too much for me to bear. I can only make Sanity Soap so quickly, and it only does so much. There has to be a better way of managing this problem.
thaumicwonders.research.cleansing_charm.text.stage.2=Relief, at last. This new Cleansing Charm will draw the Warp from my body and disperse it into the aura as flux. Not a perfect solution, but all I have to do is wear it.<BR>The process is slow and draining, however. The charm must be charged with vis on a pedestal, and it takes a full charge to remove a single point of Warp. The process generates approximately one point of flux every thirty seconds, and I can expect it to take an hour for the charm to do its work.<BR>The charm only works on normal, "sticky" Warp. Temporary Warp vanishes more quickly than the charm can affect, and permanent Warp is beyond even its power to help me.
thaumicwonders.research.cleansing_charm.text.stage.2=Relief, at last. This new Cleansing Charm will draw the Warp from my body and disperse it into the aura as flux. Not a perfect solution, but all I have to do is wear it.<BR>The charm must be charged with vis on a pedestal, and charges are used upon it taking away a point of Warp. I can expect it to take a bit of time for the charm to do its work.<BR>The charm only works on normal, "sticky" Warp. Temporary Warp vanishes more quickly than the charm can affect, and permanent Warp is beyond even its power to help me.

thaumicwonders.research.flux_distiller.title=Flux Distiller
thaumicwonders.research.flux_distiller.text.stage.1=Soaking up flux into a capacitor is all well and good, but then what? I don't want to release it back into the aura if I can help it. There must be some way to safely dispose of this bound flux energy.
Expand Down

0 comments on commit 879fe30

Please sign in to comment.