Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ developmentEnvironmentUserName = Developer

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true

# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/fox/spiteful/forbidden/FMEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import fox.spiteful.forbidden.potions.DarkPotions;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.entities.ITaintedMob;
import thaumcraft.api.wands.WandCap;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumcraft.common.lib.utils.Utils;
Expand Down Expand Up @@ -481,25 +482,27 @@ public void onGetHurt(LivingHurtEvent event) {

ItemStack wand = ((EntityPlayer) event.entityLiving).getCurrentEquippedItem();
if (event.source.getDamageType().equals("taint")
&& ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("tainted")) {
&& ((ItemWandCasting) wand.getItem()).getRod(wand) == ForbiddenItems.WAND_ROD_TAINTED) {

for (int x = 0; x < 3; x++) {
((ItemWandCasting) wand.getItem()).addVis(wand, primals[randy.nextInt(6)], 1, true);
}
}

if ((event.source.getDamageType().equals("wither") || event.source.isFireDamage())
&& ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("infernal")) {
&& ((ItemWandCasting) wand.getItem()).getRod(wand) == ForbiddenItems.WAND_ROD_INFERNAL) {

event.setCanceled(true);
}
}

if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
ItemStack equip = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem();
if (equip != null && equip.getItem() instanceof ItemWandCasting) {
if (((ItemWandCasting) equip.getItem()).getCap(equip).getTag().equals("alchemical")
&& ((ItemWandCasting) equip.getItem()).getRod(equip).getTag().startsWith("blood")) {
if (event.source.getEntity() instanceof EntityPlayer player) {
ItemStack equip = player.getCurrentEquippedItem();
if (equip != null && equip.getItem() instanceof ItemWandCasting wand) {
WandCap cap = wand.getCap(equip);
// "blood_iron" is the Blood Iron Infused Cap from Blood Arsenal
if ((cap == ForbiddenItems.WAND_CAP_ALCHEMICAL || cap.getTag().equals("blood_iron"))
&& wand.getRod(equip).getTag().startsWith("blood")) {
event.entityLiving.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,20 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;

import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import fox.spiteful.forbidden.Config;
import fox.spiteful.forbidden.compat.Compat;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;

public class BloodStaffUpdate implements IWandRodOnUpdate {

Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
public class BloodStaffUpdate extends BloodWandUpdate {

@Override
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
if (Compat.bm && Config.crossWand && player.ticksExisted % 25 == 0) {
try {
if (!checkHotbar(itemstack, player)) return;

SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);

int cost;
if (((ItemWandCasting) itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical"))
cost = Config.bloodvis - 1;
else cost = Config.bloodvis;

cost = Math.max(0, cost);

for (int x = 0; x < primals.length; x++) {
int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)
- ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]);
if (deficit > 0) {
deficit = Math.min(deficit, 100);
if (player.capabilities.isCreativeMode)
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if (syphonHealth(player)) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
return;
} else return;
}
}
if (!(checkHotbar(itemstack, player))) return;
super.onUpdate(itemstack, player);
}

} catch (Exception e) {
return;
}
}
@Override
protected int regenTimer() {
return 25;
}

@Override
public boolean syphonHealth(EntityPlayer player) {
if (player.getHealth() > 3) {
player.setHealth(player.getHealth() - 3);
Expand All @@ -60,14 +27,8 @@ public boolean syphonHealth(EntityPlayer player) {
player.setHealth(0);
player.onDeath(new DamageSource("blooderp"));
return true;
} else return false;
}

private boolean checkHotbar(ItemStack stack, EntityPlayer player) {
for (int x = 0; x < 9; ++x) {
ItemStack item = player.inventory.getStackInSlot(x);
if (item == stack) return true;
} else {
return false;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,56 @@
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import fox.spiteful.forbidden.Config;
import fox.spiteful.forbidden.compat.Compat;
import fox.spiteful.forbidden.items.ForbiddenItems;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.api.wands.WandCap;
import thaumcraft.common.items.wands.ItemWandCasting;

public class BloodWandUpdate implements IWandRodOnUpdate {

Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
public class BloodWandUpdate extends DarkWandRodOnUpdate {

public void onUpdate(ItemStack itemstack, EntityPlayer player) {
if (Compat.bm && Config.crossWand && player.ticksExisted % 100 == 0) {
try {
SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);

int cost;
if (((ItemWandCasting) itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical"))
cost = Config.bloodvis - 1;
else cost = Config.bloodvis;

cost = Math.max(0, cost);

for (int x = 0; x < primals.length; x++) {
int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)
- ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]);
if (deficit > 0) {
deficit = Math.min(deficit, 100);
if (player.capabilities.isCreativeMode)
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if (syphonHealth(player)) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
return;
} else return;
}
if (!Compat.bm || !Config.crossWand || player.ticksExisted % regenTimer() != 0) {
return;
}
try {
SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);

WandCap cap = ((ItemWandCasting) itemstack.getItem()).getCap(itemstack);
// "blood_iron" is the Blood Iron Infused Cap from Blood Arsenal
int cost = cap == ForbiddenItems.WAND_CAP_ALCHEMICAL || cap.getTag().equals("blood_iron")
? Config.bloodvis - 1
: Config.bloodvis;

cost = Math.max(0, cost);

int maxVis = getMaxVis(itemstack);
for (Aspect primal : primals) {
int deficit = maxVis - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primal);
if (deficit <= 0) {
continue;
}
deficit = Math.min(deficit, 100);
if (player.capabilities.isCreativeMode)
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primal, 1, true);
else if (SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primal, 1, true);
else if (syphonHealth(player)) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primal, 1, true);
return;
} else {
return;
}

} catch (Throwable e) {
return;
}
}

} catch (Exception ignored) {}
}

public boolean syphonHealth(EntityPlayer player) {
if (player.getHealth() > 6) {
player.setHealth(player.getHealth() - 3);
return true;
} else return false;
} else {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@
import net.minecraft.item.ItemStack;

import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;

public class CreativeWandUpdate implements IWandRodOnUpdate {

Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
public class CreativeWandUpdate extends DarkWandRodOnUpdate {

public void onUpdate(ItemStack itemstack, EntityPlayer player) {
for (int x = 0; x < primals.length; x++) {
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x])
< ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) {
((ItemWandCasting) itemstack.getItem()).addVis(
itemstack,
primals[x],
((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)
- ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]),
true);
int maxVis = getMaxVis(itemstack);
for (Aspect primal : primals) {
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primal) < maxVis) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primal, maxVis, true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package fox.spiteful.forbidden.items.wands;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;

public abstract class DarkWandRodOnUpdate implements IWandRodOnUpdate {

static final Aspect[] primals = Aspect.getPrimalAspects().toArray(new Aspect[0]);

protected static int getMaxVis(ItemStack itemstack) {
return ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack);
}

protected boolean checkHotbar(ItemStack stack, EntityPlayer player) {
for (int x = 0; x < 9; ++x) {
ItemStack item = player.inventory.getStackInSlot(x);
if (item == stack) return true;
}
return false;
}

/**
* The number of ticks between when the wand core regenerates vis
*/
protected int regenTimer() {
return 100;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@
import net.minecraft.potion.Potion;

import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;

public class InfernalWandUpdate implements IWandRodOnUpdate {
public class InfernalWandUpdate extends DarkWandRodOnUpdate {

Aspect primals[] = { Aspect.ORDER, Aspect.ENTROPY, Aspect.AIR, Aspect.EARTH, Aspect.WATER };
static final Aspect[] primals = { Aspect.ORDER, Aspect.ENTROPY, Aspect.AIR, Aspect.EARTH, Aspect.WATER };

public void onUpdate(ItemStack itemstack, EntityPlayer player) {
if (player.ticksExisted % 100 == 0) {
if (player.ticksExisted % regenTimer() == 0) {
int maxVis = getMaxVis(itemstack);
if (player.worldObj.provider.dimensionId == -1) {
for (int x = 0; x < primals.length; x++) {
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x])
< ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) / 10) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
for (Aspect primal : primals) {
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primal) < maxVis / 10) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primal, 1, true);
}
}
}

if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, Aspect.FIRE)
< ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) / 5) {
if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, Aspect.FIRE) < maxVis / 5) {
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, Aspect.FIRE, 1, true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,20 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import am2.api.ArsMagicaApi;
import am2.api.IExtendedProperties;
import fox.spiteful.forbidden.Config;
import fox.spiteful.forbidden.compat.Compat;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;

public class ManaStaffUpdate implements IWandRodOnUpdate {

Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
public class ManaStaffUpdate extends ManaWandUpdate {

public void onUpdate(ItemStack itemstack, EntityPlayer player) {
if (Compat.am2 && Config.crossWand) {
if (player.ticksExisted % 40 == 0) {

try {
IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player);

float cost;
if (((ItemWandCasting) itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum"))
cost = 0.5F;
else cost = 1.0F;
if (!(checkHotbar(itemstack, player))) return;
super.onUpdate(itemstack, player);
}

if (prop == null || prop.getCurrentMana() <= 0) return;
@Override
protected int regenTimer() {
return 40;
}

for (int x = 0; x < primals.length; x++) {
int deficit = ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)
- ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]);
if (deficit > 0) {
deficit = Math.min(deficit, 100);
if (prop.getCurrentMana() > cost * deficit) {
prop.setCurrentMana(prop.getCurrentMana() - cost * deficit);
((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
}
}
}
} catch (Throwable e) {}
}
}
@Override
protected float getCost(boolean hasVinteumCaps) {
return hasVinteumCaps ? 0.5F : 1.0F;
}
}
Loading