mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-21 04:22:09 +00:00
Added 3 Focus Enchants
This commit is contained in:
1 parent
9bdb607fb4
commit
42340fde1c
3 files changed
+70
-9
No files matched your search
@@ -2,14 +2,18 @@ package tombenpotter.emt.common.items.foci;
|
||||
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import tombenpotter.emt.common.items.foci.ItemBaseFocus;
|
||||
import tombenpotter.emt.common.util.ConfigHandler;
|
||||
|
||||
public class ItemChargeFocus extends ItemBaseFocus {
|
||||
@@ -27,6 +31,9 @@ public class ItemChargeFocus extends ItemBaseFocus {
|
||||
|
||||
@Override
|
||||
public AspectList getVisCost(ItemStack stack) {
|
||||
AspectList actualCost = new AspectList();
|
||||
for (Entry<Aspect, Integer> e : visCost.aspects.entrySet())
|
||||
actualCost.add(e.getKey(), (int)(e.getValue() * Math.pow(1.1, getUpgradeLevel(stack, FocusUpgradeType.potency))));
|
||||
return visCost;
|
||||
}
|
||||
|
||||
@@ -35,13 +42,27 @@ public class ItemChargeFocus extends ItemBaseFocus {
|
||||
return "WANDCHARGING";
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank)
|
||||
{
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.potency, FocusUpgradeType.frugal };
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define custom logic about which upgrades can be applied. This can be used to set up upgrade "trees"
|
||||
* that make certain upgrades available only when others are unlocked first, when certain research is completed, or similar logic.
|
||||
*
|
||||
*/
|
||||
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) {
|
||||
ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
|
||||
if (player.capabilities.isCreativeMode || wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) {
|
||||
if (!world.isRemote) {
|
||||
|
||||
int energyLeft = ConfigHandler.chargeFocusProduction;
|
||||
int energyLeft = (int)(ConfigHandler.chargeFocusProduction * Math.pow(1.1, getUpgradeLevel(itemstack, FocusUpgradeType.potency)));
|
||||
for (int i = 0; i < player.inventory.armorInventory.length; i++) {
|
||||
if (energyLeft > 0) {
|
||||
if ((player.inventory.armorInventory[i] != null) && (player.inventory.armorInventory[i].getItem() instanceof IElectricItem)) {
|
||||
|
||||
@@ -2,11 +2,13 @@ package tombenpotter.emt.common.items.foci;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import tombenpotter.emt.common.entities.EntityLaser;
|
||||
|
||||
@@ -40,9 +42,26 @@ public class ItemExplosionFocus extends ItemBaseFocus {
|
||||
if (!world.isRemote) {
|
||||
EntityLaser laser;
|
||||
laser = new EntityLaser(world, player, 2);
|
||||
laser.setExplosionStrengthModifier(getUpgradeLevel(itemstack, FocusUpgradeType.potency) * 0.5f + 1);
|
||||
world.spawnEntityInWorld(laser);
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank)
|
||||
{
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.potency, FocusUpgradeType.frugal };
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define custom logic about which upgrades can be applied. This can be used to set up upgrade "trees"
|
||||
* that make certain upgrades available only when others are unlocked first, when certain research is completed, or similar logic.
|
||||
*
|
||||
*/
|
||||
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package tombenpotter.emt.common.items.foci;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import ic2.api.item.ElectricItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import tombenpotter.emt.common.items.foci.ItemBaseFocus;
|
||||
import tombenpotter.emt.common.util.ConfigHandler;
|
||||
@@ -33,10 +36,27 @@ public class ItemWandChargingFocus extends ItemBaseFocus {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getVisCost(ItemStack focusstack) {
|
||||
public AspectList getVisCost(ItemStack stack) {
|
||||
AspectList actualCost = new AspectList();
|
||||
for (Entry<Aspect, Integer> e : visCost.aspects.entrySet())
|
||||
actualCost.add(e.getKey(), (int)(e.getValue() * Math.pow(1.1, getUpgradeLevel(stack, FocusUpgradeType.potency))));
|
||||
return visCost;
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank)
|
||||
{
|
||||
return new FocusUpgradeType[] { FocusUpgradeType.potency, FocusUpgradeType.frugal };
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define custom logic about which upgrades can be applied. This can be used to set up upgrade "trees"
|
||||
* that make certain upgrades available only when others are unlocked first, when certain research is completed, or similar logic.
|
||||
*
|
||||
*/
|
||||
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int integer) {
|
||||
|
||||
@@ -46,12 +66,13 @@ public class ItemWandChargingFocus extends ItemBaseFocus {
|
||||
ItemStack armor = player.inventory.armorInventory[1];
|
||||
if (armor != null) {
|
||||
if ((ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player) && (ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player)) && (ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player)) && (ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player)))) {
|
||||
wandItem.addVis(itemstack, Aspect.ORDER, 1, true);
|
||||
wandItem.addVis(itemstack, Aspect.FIRE, 1, true);
|
||||
wandItem.addVis(itemstack, Aspect.ENTROPY, 1, true);
|
||||
wandItem.addVis(itemstack, Aspect.WATER, 1, true);
|
||||
wandItem.addVis(itemstack, Aspect.EARTH, 1, true);
|
||||
wandItem.addVis(itemstack, Aspect.AIR, 1, true);
|
||||
int amount = (int)(100 * Math.pow(1.1, getUpgradeLevel(itemstack, FocusUpgradeType.potency)));
|
||||
wandItem.addRealVis(itemstack, Aspect.ORDER, amount, true);
|
||||
wandItem.addRealVis(itemstack, Aspect.FIRE, amount, true);
|
||||
wandItem.addRealVis(itemstack, Aspect.ENTROPY, amount, true);
|
||||
wandItem.addRealVis(itemstack, Aspect.WATER, amount, true);
|
||||
wandItem.addRealVis(itemstack, Aspect.EARTH, amount, true);
|
||||
wandItem.addRealVis(itemstack, Aspect.AIR, amount, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user