Compare commits

...
12 Commits
Author SHA1 Message Date
JuliaandMartin Robertz e1e53af24f Update uses of crafting tools (#96)
Co-authored-by: Martin Robertz <[email protected]>
2025-05-25 16:34:37 +02:00
ceg 71c9976777 Fix ConcurrentModificationException in ItemShieldFocus (#95) 2025-05-18 19:04:37 +02:00
Martin Robertz cc46d6a039 update 2025-05-16 21:57:46 +02:00
Caedis 358a1f213e Replace Baubles with Baubles Expanded (#94) 2025-05-13 08:07:24 -05:00
Martin Robertz 91a816555b update 2025-04-28 20:26:16 +02:00
koolkrafter5 bb9ed2f219 Fix a bug where the essentia generator overdraws essentia from every nearby jar and voids essentia over its max capacity.
Make it so non-full generators do not check 9^3 blocks every tick for jars. The timer is set to 40 ticks (2 seconds) on failure. This reuses the timer value that was previously set to 0 every tick.
Fix logic error where a refuel value over 1 (is it ever even changed, or is it just to store the constant?) would overdraw and void essentia.
Move some default values from constructor to field declarations.
Clean up the fillfrompipe method.
2025-04-28 09:20:55 -04:00
Maya 730826c9d9 update 2025-04-23 14:48:09 -05:00
__felix__and__felix__ 0650072b85 Change optional decorator modid from gregtech to gregtech_nh for gt6 compat (#92)
Co-authored-by: __felix__ <134875831+48a3efa65c881ef567345b17f3910e06@users.noreply.github.com>
2025-04-23 14:48:01 -05:00
Maya d48233f266 update 2025-04-08 14:14:09 -05:00
Niclas Klugmann 367f37c7d5 Move Nano/Quantum armor pieces to GT Hazard API (#91) 2025-04-08 14:12:38 -05:00
Maya a1151399fc update 2025-03-16 13:11:39 -05:00
koolkrafter5 cb68d0a951 EMT Foci Bugfixes/Cleanup (#90) 2025-03-16 13:11:20 -05:00
26 changed files with 273 additions and 180 deletions

No files matched your search

+7 -6
View File
@@ -1,14 +1,15 @@
// Add your dependencies here
dependencies {
compileOnly 'com.github.GTNewHorizons:GT5-Unofficial:5.09.51.40:dev'
api 'com.github.GTNewHorizons:Baubles:1.0.4:dev'
api 'com.github.GTNewHorizons:ModularUI:1.2.17:dev'
api ('com.github.GTNewHorizons:ThaumicBoots:1.4.2:dev'){
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.8-GTNH:dev')
api('com.github.GTNewHorizons:ModularUI:1.2.18:dev')
api('com.github.GTNewHorizons:ThaumicBoots:1.4.7:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
exclude module: 'Baubles'
}
api('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
api 'net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev'
api 'thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev'
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.306:dev')
}
+4 -4
View File
@@ -14,7 +14,7 @@ modId = EMT
modGroup = emt
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -50,10 +50,10 @@ 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.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
generateGradleTokenClass = emt.EMTTags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
@@ -70,7 +70,7 @@ gradleTokenGroupName =
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = EMT.java
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -3
View File
@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -206,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
}
+1 -1
View File
@@ -40,7 +40,7 @@ public class EMT {
public static final String NAME = "Electro-Magic Tools";
public static final String MOD_ID = "EMT";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String VERSION = EMTTags.VERSION;
public static final String TEXTURE_PATH = "emt";
public static final String GUI_FACTORY = "emt.client.gui.config.EMTGuiFactory";
public static final String CLIENT_PROXY = "emt.proxy.ClientProxy";
@@ -4,12 +4,16 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT;
import emt.util.EMTConfigHandler;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
public class ItemNanoBootsTraveller extends ItemElectricBootsTraveller {
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh")
public class ItemNanoBootsTraveller extends ItemElectricBootsTraveller implements IHazardProtector {
public ItemNanoBootsTraveller(ArmorMaterial material, int par3, int par4) {
super(material, par3, par4);
@@ -51,4 +55,10 @@ public class ItemNanoBootsTraveller extends ItemElectricBootsTraveller {
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return EMT.TEXTURE_PATH + ":textures/models/nanobootstravel.png";
}
@Override
@Optional.Method(modid = "gregtech_nh")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return true;
}
}
@@ -4,12 +4,16 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT;
import emt.util.EMTConfigHandler;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
public class ItemQuantumBootsTraveller extends ItemElectricBootsTraveller {
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh")
public class ItemQuantumBootsTraveller extends ItemElectricBootsTraveller implements IHazardProtector {
public ItemQuantumBootsTraveller(ArmorMaterial material, int par3, int par4) {
super(material, par3, par4);
@@ -51,4 +55,10 @@ public class ItemQuantumBootsTraveller extends ItemElectricBootsTraveller {
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return EMT.TEXTURE_PATH + ":textures/models/quantumbootstravel.png";
}
@Override
@Optional.Method(modid = "gregtech_nh")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return true;
}
}
@@ -21,6 +21,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -28,6 +29,8 @@ import emt.EMT;
import emt.client.model.ModelSpecialArmor;
import emt.init.EMTItems;
import emt.util.EMTConfigHandler;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
import ic2.api.item.ElectricItem;
import ic2.api.item.IC2Items;
import ic2.core.IC2;
@@ -38,7 +41,8 @@ import ic2.core.item.armor.ItemArmorElectric;
import ic2.core.util.StackUtil;
import thaumcraft.api.IRunicArmor;
public class ItemInfusedQuantumChestplate extends ItemArmorElectric implements IRunicArmor {
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh")
public class ItemInfusedQuantumChestplate extends ItemArmorElectric implements IRunicArmor, IHazardProtector {
public static AudioSource audioSource;
protected static ArrayList<Integer> potionRemovalCost = new ArrayList<Integer>();
@@ -564,4 +568,10 @@ public class ItemInfusedQuantumChestplate extends ItemArmorElectric implements I
public int getRunicCharge(ItemStack itemStack) {
return 0;
}
@Override
@Optional.Method(modid = "gregtech_nh")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return true;
}
}
@@ -6,12 +6,16 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
import ic2.api.item.IC2Items;
public class ItemNanoGoggles extends ItemElectricGoggles {
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh")
public class ItemNanoGoggles extends ItemElectricGoggles implements IHazardProtector {
public ItemNanoGoggles(ArmorMaterial material, int renderIndex, int armorType) {
super(material, renderIndex, armorType);
@@ -50,4 +54,10 @@ public class ItemNanoGoggles extends ItemElectricGoggles {
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
IC2Items.getItem("nightvisionGoggles").getItem().onArmorTick(world, player, itemStack);
}
@Override
@Optional.Method(modid = "gregtech_nh")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return true;
}
}
@@ -14,15 +14,20 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import emt.EMT;
import emt.util.EMTConfigHandler;
import gregtech.api.hazards.Hazard;
import gregtech.api.hazards.IHazardProtector;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import ic2.api.item.IMetalArmor;
public class ItemNanoWing extends ItemThaumiumReinforcedWing implements IElectricItem, ISpecialArmor, IMetalArmor {
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh")
public class ItemNanoWing extends ItemThaumiumReinforcedWing
implements IElectricItem, ISpecialArmor, IMetalArmor, IHazardProtector {
public static int maxCharge = 1000000;
public int tier = 3;
@@ -176,4 +181,10 @@ public class ItemNanoWing extends ItemThaumiumReinforcedWing implements IElectri
public Item getEmptyItem(ItemStack itemStack) {
return this;
}
@Override
@Optional.Method(modid = "gregtech_nh")
public boolean protectsAgainst(ItemStack itemStack, Hazard hazard) {
return true;
}
}
@@ -34,20 +34,6 @@ public abstract class ItemBaseFocus extends ItemFocusBasic {
this.icon = ir.registerIcon(EMT.TEXTURE_PATH + ":" + "focus_" + textureName);
}
boolean hasDepth() {
return false;
}
@Override
public int getFocusColor(ItemStack stack) {
return 0;
}
@Override
public boolean isItemTool(ItemStack par1ItemStack) {
return true;
}
@Override
public EnumRarity getRarity(ItemStack itemstack) {
return EnumRarity.rare;
@@ -63,18 +49,10 @@ public abstract class ItemBaseFocus extends ItemFocusBasic {
return new AspectList();
}
public boolean isUseItem(ItemStack stack) {
return isVisCostPerTick(stack);
}
public boolean isVisCostPerTick() {
return false;
}
@Override
public ItemStack onFocusRightClick(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer,
MovingObjectPosition paramMovingObjectPosition) {
if (isUseItem(paramItemStack)) paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE);
if (isVisCostPerTick(paramItemStack)) paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE);
return paramItemStack;
}
@@ -84,19 +62,9 @@ public abstract class ItemBaseFocus extends ItemFocusBasic {
@Override
public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world, EntityPlayer player, int count) {}
@Override
public String getSortingHelper(ItemStack itemstack) {
return "00";
}
@Override
public boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
return false;
}
@Override
public int getItemEnchantability() {
return 5;
}
}
@@ -1,10 +1,12 @@
package emt.item.focus;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import emt.util.EMTConfigHandler;
@@ -35,32 +37,27 @@ public class ItemChargeFocus extends ItemBaseFocus {
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;
return actualCost;
}
@Override
public String getSortingHelper(ItemStack itemstack) {
return "WANDCHARGING";
return "WANDCHARGING" + super.getSortingHelper(itemstack);
}
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
return new FocusUpgradeType[] { FocusUpgradeType.potency, FocusUpgradeType.frugal };
}
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)) {
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, false)) {
if (!world.isRemote) {
int energyLeft = (int) (EMTConfigHandler.chargeFocusProduction
* Math.pow(1.1, getUpgradeLevel(itemstack, FocusUpgradeType.potency)));
int energyLeft = getChargeRate(itemstack);
for (int i = 0; i < player.inventory.armorInventory.length; i++) {
if (energyLeft > 0) {
if ((player.inventory.armorInventory[i] != null)
@@ -89,4 +86,16 @@ public class ItemChargeFocus extends ItemBaseFocus {
}
return itemstack;
}
private int getChargeRate(ItemStack itemstack) {
return (int) (EMTConfigHandler.chargeFocusProduction
* Math.pow(1.1, getUpgradeLevel(itemstack, FocusUpgradeType.potency)));
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(StatCollector.translateToLocal("item.EMT.focus.EU.cost.info"));
list.add(StatCollector.translateToLocalFormatted("item.EMT.focus.EU.cost.once", getChargeRate(stack)));
super.addInformation(stack, player, list, par4);
}
}
@@ -8,6 +8,7 @@ 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;
public class ItemChristmasFocus extends ItemBaseFocus {
@@ -30,7 +31,12 @@ public class ItemChristmasFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "CHRISTMAS";
return "CHRISTMAS" + super.getSortingHelper(itemstack);
}
@Override
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
return new FocusUpgradeType[] { FocusUpgradeType.frugal };
}
@Override
@@ -42,7 +48,7 @@ public class ItemChristmasFocus extends ItemBaseFocus {
int y = mop.blockY + 1;
int z = mop.blockZ;
if (player.capabilities.isCreativeMode
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) {
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, false)) {
if (!world.isRemote) {
EntitySnowman snowman;
snowman = new EntitySnowman(world);
@@ -1,13 +1,17 @@
package emt.item.focus;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import emt.entity.EntityEnergyBall;
import ic2.api.item.ElectricItem;
import thaumcraft.api.wands.FocusUpgradeType;
public class ItemEnergyBallFocus extends ItemBaseFocus {
@@ -22,7 +26,12 @@ public class ItemEnergyBallFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "ENERGYBALL";
return "ENERGYBALL" + super.getSortingHelper(itemstack);
}
@Override
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
return new FocusUpgradeType[] { FocusUpgradeType.frugal };
}
@Override
@@ -36,9 +45,10 @@ public class ItemEnergyBallFocus extends ItemBaseFocus {
return stack;
}
double val = ElectricItem.manager.discharge(armor, 5120, 4, true, false, false);
int cost = getCost(stack);
double val = ElectricItem.manager.discharge(armor, cost, 4, true, false, false);
if (val < 5120) {
if (val < cost) {
return stack;
}
@@ -51,4 +61,18 @@ public class ItemEnergyBallFocus extends ItemBaseFocus {
return stack;
}
/**
* Base cost of 5120 with a 10% discount per level of frugal.
*/
private int getCost(ItemStack stack) {
return (int) (5120 * (1.0 - (0.1 * getUpgradeLevel(stack, FocusUpgradeType.frugal))));
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(StatCollector.translateToLocal("item.EMT.focus.EU.cost.info"));
list.add(StatCollector.translateToLocalFormatted("item.EMT.focus.EU.cost.once", getCost(stack)));
this.addFocusInformation(stack, player, list, par4);
}
}
@@ -31,7 +31,7 @@ public class ItemExplosionFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "EXPLOSION";
return "EXPLOSION" + super.getSortingHelper(itemstack);
}
@Override
@@ -39,7 +39,7 @@ public class ItemExplosionFocus extends ItemBaseFocus {
MovingObjectPosition movingobjectposition) {
ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
if (player.capabilities.isCreativeMode
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) {
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, false)) {
if (!world.isRemote) {
EntityLaser laser;
laser = new EntityLaser(world, player, 1);
@@ -54,12 +54,4 @@ public class ItemExplosionFocus extends ItemBaseFocus {
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;
}
}
@@ -35,7 +35,7 @@ public class ItemMaintenanceFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "MAINTENANCE";
return "MAINTENANCE" + super.getSortingHelper(itemstack);
}
@Override
@@ -60,13 +60,13 @@ public class ItemMaintenanceFocus extends ItemBaseFocus {
if (hatchCandidateMetaTile instanceof MTEHatchMaintenance) {
MTEHatchMaintenance hatch = (MTEHatchMaintenance) hatchCandidateMetaTile;
if (player.capabilities.isCreativeMode
|| wand.consumeAllVis(itemStack, player, getVisCost(itemStack), true, true)) {
|| wand.consumeAllVis(itemStack, player, getVisCost(itemStack), true, false)) {
hatch.mCrowbar = true;
hatch.mScrewdriver = true;
hatch.mHardHammer = true;
hatch.mSolderingTool = true;
hatch.mWrench = true;
hatch.mSoftHammer = true;
hatch.mSoftMallet = true;
}
}
}
@@ -1,6 +1,7 @@
package emt.item.focus;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -12,6 +13,7 @@ import emt.entity.EntityShield;
import ic2.core.IC2;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.wands.FocusUpgradeType;
import thaumcraft.common.items.wands.ItemWandCasting;
public class ItemShieldFocus extends ItemBaseFocus {
@@ -35,22 +37,28 @@ public class ItemShieldFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "SHIELD";
return "SHIELD" + super.getSortingHelper(itemstack);
}
@Override
public boolean isUseItem(ItemStack stack) {
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
return new FocusUpgradeType[] { FocusUpgradeType.frugal };
}
@Override
public boolean isVisCostPerTick(ItemStack stack) {
return true;
}
@Override
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int count) {
ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
for (PotionEffect effect : new LinkedList<PotionEffect>(player.getActivePotionEffects())) {
List<PotionEffect> potionEffects = new ArrayList<>(player.getActivePotionEffects());
for (PotionEffect effect : potionEffects) {
IC2.platform.removePotion(player, effect.getPotionID());
}
if (!player.capabilities.isCreativeMode
&& !wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) {
&& !wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, false)) {
player.stopUsingItem();
}
}
@@ -61,7 +69,7 @@ public class ItemShieldFocus extends ItemBaseFocus {
ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
player.setItemInUse(itemstack, Integer.MAX_VALUE);
if (!world.isRemote && (player.capabilities.isCreativeMode
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true))) {
|| wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, false))) {
EntityShield shield = new EntityShield(world, player);
world.spawnEntityInWorld(shield);
}
@@ -1,9 +1,11 @@
package emt.item.focus;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import emt.util.EMTConfigHandler;
import ic2.api.item.ElectricItem;
@@ -28,7 +30,7 @@ public class ItemWandChargingFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "ELECTRICCHARGING";
return "ELECTRICCHARGING" + super.getSortingHelper(itemstack);
}
@Override
@@ -42,38 +44,63 @@ public class ItemWandChargingFocus extends ItemBaseFocus {
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;
return actualCost;
}
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
return new FocusUpgradeType[] { FocusUpgradeType.potency, FocusUpgradeType.frugal };
}
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
return true;
}
@Override
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int integer) {
if (!player.worldObj.isRemote) {
ItemWandCasting wandItem = (ItemWandCasting) itemstack.getItem();
if (wandIsFull(itemstack, wandItem)) {
return;
}
ItemStack armor = player.inventory.armorInventory[1];
if (armor != null) {
if ((ElectricItem.manager.use(armor, EMTConfigHandler.wandChargeFocusCost / 4, player)
&& (ElectricItem.manager.use(armor, EMTConfigHandler.wandChargeFocusCost / 4, player))
&& (ElectricItem.manager.use(armor, EMTConfigHandler.wandChargeFocusCost / 4, player))
&& (ElectricItem.manager.use(armor, EMTConfigHandler.wandChargeFocusCost / 4, player)))) {
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);
int cost = getCost(itemstack) / 4;
for (ItemStack stack : player.inventory.armorInventory) {
if (stack == null || ElectricItem.manager.getCharge(stack) < cost) {
return;
}
}
for (ItemStack stack : player.inventory.armorInventory) {
ElectricItem.manager.use(stack, cost, player);
}
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);
}
}
private boolean wandIsFull(ItemStack itemstack, ItemWandCasting wandItem) {
int size = wandItem.getMaxVis(itemstack);
for (Aspect a : Aspect.getPrimalAspects()) {
if (wandItem.getVis(itemstack, a) < size) {
return false;
}
}
return true;
}
/**
* Base cost from config with a 10% discount per level of frugal.
*/
private int getCost(ItemStack stack) {
return (int) (EMTConfigHandler.wandChargeFocusCost
* (1.0 - (0.1 * getUpgradeLevel(stack, FocusUpgradeType.frugal))));
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(StatCollector.translateToLocal("item.EMT.focus.EU.cost.info"));
list.add(StatCollector.translateToLocalFormatted("item.EMT.focus.EU.cost.tick", getCost(stack)));
super.addInformation(stack, player, list, par4);
}
}
@@ -56,12 +56,17 @@ public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory
public int storage;
public short mpshownstroage;
public int maxstorage;
public byte maxfuel;
public byte fuel;
public byte refuel;
public long timer = 0L;
public byte maxfuel = 64;
public byte fuel = 0;
// The amount to pull from jars (through the air like the runic matrix) when empty.
// Values above 1 do not work with essentia mirrors.
public byte refuel = 1;
// Used to make the generator sleep between failed attempts to draw essentia from nearby jars.
public int timer = 0;
// The number of ticks to wait after failing to draw essentia.
public final int refuelSleepTime = 40;
public boolean dead = true;
public byte color;
public byte color = -1;
private boolean side;
protected static final NumberFormatMUI numberFormat = new NumberFormatMUI();
@@ -94,18 +99,17 @@ public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory
public TileEntityBaseGenerator() {
this.energySource.setCapacity(EMTConfigHandler.EssentiaGeneratorStorage);
this.maxstorage = ((int) this.energySource.getCapacity());
this.maxfuel = 64;
this.fuel = 0;
this.refuel = 1;
this.color = -1;
}
@Override
public void updateEntity() {
this.side = !this.worldObj.isRemote;
this.dead = false;
this.timer += 1L;
if (this.timer <= Long.MAX_VALUE - 1) this.timer = 0L;
this.timer--;
if (this.timer <= Integer.MIN_VALUE + 1) this.timer = 0;
if (this.fuel + this.refuel > this.maxfuel) {
this.timer = refuelSleepTime;
}
storeFuel();
fillfrompipe();
createEnergy();
@@ -113,64 +117,61 @@ public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory
}
public void storeFuel() {
if (!side) return;
if (this.fuel < this.maxfuel) {
for (int x = this.xCoord - 4; x < this.xCoord + 4; x++) {
for (int y = this.yCoord - 4; y < this.yCoord + 4; y++) {
for (int z = this.zCoord - 4; z < this.zCoord + 4; z++) {
TileEntity tile = this.worldObj.getTileEntity(x, y, z);
if (tile instanceof IAspectSource) {
IAspectSource as = (IAspectSource) tile;
if ((as.doesContainerContainAmount(this.aspect, this.refuel))
&& (as.takeFromContainer(this.aspect, this.refuel))) {
PacketHandler.INSTANCE.sendToAllAround(
new PacketFXEssentiaSource(
this.xCoord,
this.yCoord,
this.zCoord,
(byte) (this.xCoord - x),
(byte) (this.yCoord - y),
(byte) (this.zCoord - z),
this.aspect.getColor()),
new NetworkRegistry.TargetPoint(
getWorldObj().provider.dimensionId,
this.xCoord,
this.yCoord,
this.zCoord,
32.0D));
addToContainer(this.aspect, this.refuel);
}
if (this.timer > 0 || !side) {
return;
}
boolean stored = false;
for (int x = this.xCoord - 4; x < this.xCoord + 4; x++) {
for (int y = this.yCoord - 4; y < this.yCoord + 4; y++) {
for (int z = this.zCoord - 4; z < this.zCoord + 4; z++) {
TileEntity tile = this.worldObj.getTileEntity(x, y, z);
if (tile instanceof IAspectSource as && as.takeFromContainer(this.aspect, this.refuel)) {
PacketHandler.INSTANCE.sendToAllAround(
new PacketFXEssentiaSource(
this.xCoord,
this.yCoord,
this.zCoord,
(byte) (this.xCoord - x),
(byte) (this.yCoord - y),
(byte) (this.zCoord - z),
this.aspect.getColor()),
new NetworkRegistry.TargetPoint(
getWorldObj().provider.dimensionId,
this.xCoord,
this.yCoord,
this.zCoord,
32.0D));
addToContainer(this.aspect, this.refuel);
if (this.fuel + this.refuel > this.maxfuel) {
return;
}
stored = true;
}
}
}
}
if (!stored) {
this.timer = refuelSleepTime;
}
}
public void fillfrompipe() {
if (!side) return;
if (this.fuel >= this.maxfuel || !side) return;
if (this.fuel == this.maxfuel) return;
TileEntity[] te = new TileEntity[ForgeDirection.VALID_DIRECTIONS.length];
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
te[i] = ThaumcraftApiHelper.getConnectableTile(
this.worldObj,
this.xCoord,
this.yCoord,
this.zCoord,
ForgeDirection.VALID_DIRECTIONS[i]);
if (te[i] != null) {
IEssentiaTransport pipe = (IEssentiaTransport) te[i];
if (!pipe.canOutputTo(ForgeDirection.VALID_DIRECTIONS[i])) {
return;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
TileEntity pipeTE = ThaumcraftApiHelper
.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, direction);
if (pipeTE != null) {
IEssentiaTransport pipe = (IEssentiaTransport) pipeTE;
if (!pipe.canOutputTo(direction)) {
continue;
}
if ((pipe.getEssentiaType(ForgeDirection.VALID_DIRECTIONS[i]) != null)
&& (pipe.getEssentiaType(ForgeDirection.VALID_DIRECTIONS[i]).equals(this.aspect))
&& (pipe.getSuctionAmount(ForgeDirection.VALID_DIRECTIONS[i])
< getSuctionAmount(ForgeDirection.VALID_DIRECTIONS[i]))) {
addToContainer(this.aspect, pipe.takeEssentia(this.aspect, 1, ForgeDirection.VALID_DIRECTIONS[i]));
if ((pipe.getEssentiaType(direction) != null) && (pipe.getEssentiaType(direction).equals(this.aspect))
&& (pipe.getSuctionAmount(direction) < getSuctionAmount(direction))) {
addToContainer(this.aspect, pipe.takeEssentia(this.aspect, 1, direction));
if (this.fuel >= this.maxfuel) {
return;
}
}
}
}
@@ -510,11 +511,6 @@ public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory
return 0L;
}
@Override
public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) {
return false;
}
@Override
public long injectEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) {
return 0L;
@@ -700,17 +696,17 @@ public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory
}
@Override
public byte getMetaID(int aX, int aY, int aZ) {
public int getMetaID(int aX, int aY, int aZ) {
return (byte) this.worldObj.getBlockMetadata(aX, aY, aZ);
}
@Override
public byte getMetaIDOffset(int aX, int aY, int aZ) {
public int getMetaIDOffset(int aX, int aY, int aZ) {
return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
}
@Override
public byte getMetaIDAtSide(ForgeDirection side) {
public int getMetaIDAtSide(ForgeDirection side) {
int tX = getOffsetX(side, 1);
int tY = getOffsetY(side, 1);
int tZ = getOffsetZ(side, 1);
@@ -718,7 +714,7 @@ public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory
}
@Override
public byte getMetaIDAtSideAndDistance(ForgeDirection side, int aDistance) {
public int getMetaIDAtSideAndDistance(ForgeDirection side, int aDistance) {
if (aDistance == 1) {
return getMetaIDAtSide(side);
}
@@ -713,17 +713,17 @@ public class TileEntitySolarBase extends TileEntityEMT implements IInventory, IW
}
@Override
public byte getMetaID(int aX, int aY, int aZ) {
public int getMetaID(int aX, int aY, int aZ) {
return (byte) this.worldObj.getBlockMetadata(aX, aY, aZ);
}
@Override
public byte getMetaIDOffset(int aX, int aY, int aZ) {
public int getMetaIDOffset(int aX, int aY, int aZ) {
return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ);
}
@Override
public byte getMetaIDAtSide(ForgeDirection side) {
public int getMetaIDAtSide(ForgeDirection side) {
int tX = getOffsetX(side, 1);
int tY = getOffsetY(side, 1);
int tZ = getOffsetZ(side, 1);
@@ -731,7 +731,7 @@ public class TileEntitySolarBase extends TileEntityEMT implements IInventory, IW
}
@Override
public byte getMetaIDAtSideAndDistance(ForgeDirection side, int aDistance) {
public int getMetaIDAtSideAndDistance(ForgeDirection side, int aDistance) {
if (aDistance == 1) {
return getMetaIDAtSide(side);
}
@@ -13,9 +13,9 @@ gui.EMT.book.aspect.output.eu.title=Essentia Ausgabe Buch
gui.EMT.book.aspect.output.essentia.eu=EU Leistung per Essentia
gui.EMT.key.unequip=Ausziehen
emt.Output=Ausgabe:
emt.Storage=Speicher:
emt.Storage=Speicher:
emt.PressShift=<Drücke SHIFT>
emt.Generating=Erzeugt:
emt.Generating=Erzeugt:
emt.Fuel=Brennstoff
#=============Tooltips=============
@@ -100,6 +100,9 @@ item.EMT.focus.charge.name=Stab Fokus: Aufladung
item.EMT.focus.chargeWand.name=Stab Fokus: Stabs Aufladung
item.EMT.focus.electricCloud.name=Electrische Wolke
item.EMT.focus.energyBall.name=Energie Ball Fokus
item.EMT.focus.EU.cost.info=EU pro Zauber
item.EMT.focus.EU.cost.once= §r%s §eEU§0
item.EMT.focus.EU.cost.tick= §r%s §eEU/t§0
#=============Block Names=============
tile.EMT.electricCloud.name=Electrische Wolke
@@ -109,6 +109,9 @@ item.EMT.focus.chargeWand.name=Wand Focus: Wand Charging
item.EMT.focus.maintenance.name=Wand Focus: Maintenance
item.EMT.focus.electricCloud.name=Electric Cloud
item.EMT.focus.energyBall.name=Energy Ball Focus
item.EMT.focus.EU.cost.info=EU per cast
item.EMT.focus.EU.cost.once= §r%s §eEU§0
item.EMT.focus.EU.cost.tick= §r%s §eEU/t§0
#=============Block Names=============
tile.EMT.electricCloud.name=Electric Cloud
@@ -102,6 +102,9 @@ item.EMT.focus.chargeWand.name=Набалдашник: Зарядка жезла
item.EMT.focus.maintenance.name=Набалдашник: Обслуживание
item.EMT.focus.electricCloud.name=Электризованное облако
item.EMT.focus.energyBall.name=Набалдашник: Наэлектризованное облако
item.EMT.focus.EU.cost.info=EU за использование
item.EMT.focus.EU.cost.once= §r%s §eEU§0
item.EMT.focus.EU.cost.tick= §r%s §eEU/тик§0
#=============Block Names=============
tile.EMT.electricCloud.name=Наэлектризованное облако
@@ -102,6 +102,9 @@ item.EMT.focus.charge.name=法杖核心:充电
item.EMT.focus.chargeWand.name=法杖核心:化魔
item.EMT.focus.electricCloud.name=雷云之光
item.EMT.focus.energyBall.name=法杖核心:能量球
item.EMT.focus.EU.cost.info=EU/每次施法
item.EMT.focus.EU.cost.once= §r%s §eEU§0
item.EMT.focus.EU.cost.tick= §r%s §eEU/t§0
#=============Block Names=============
tile.EMT.electricCloud.name=雷云之光