mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-21 20:42:14 +00:00
Merge pull request #4 from GTNewHorizons/devBootsFix
Possible solution for GTNewHorizons/NewHorizons#2535
This commit is contained in:
6 files changed
+86
-12
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
package_group=emt
|
||||
mc_version=1.7.10
|
||||
forge_version=10.13.4.1614
|
||||
mod_version=1.2.6.5
|
||||
mod_version=1.2.6.6
|
||||
mod_name=ElectroMagicTools
|
||||
@@ -35,7 +35,7 @@ import org.apache.logging.log4j.Logger;
|
||||
public class EMT {
|
||||
public static final String NAME = "Electro-Magic Tools";
|
||||
public static final String MOD_ID = "EMT";
|
||||
public static final String VERSION = "1.2.6.4";
|
||||
public static final String VERSION = "1.2.6.6";
|
||||
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";
|
||||
@@ -52,6 +52,11 @@ public class EMT {
|
||||
public static final Logger LOGGER = LogManager.getLogger(NAME);
|
||||
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(CHANNEL);
|
||||
|
||||
public boolean isSimulating()
|
||||
{
|
||||
return !FMLCommonHandler.instance().getEffectiveSide().isClient();
|
||||
}
|
||||
|
||||
@Instance(MOD_ID)
|
||||
public static EMT instance;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import emt.util.EMTTextHelper;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import ic2.api.item.IMetalArmor;
|
||||
import ic2.core.item.ElectricItemManager;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -139,17 +140,49 @@ public class ItemElectricBootsTraveller extends ItemArmor implements IElectricIt
|
||||
}
|
||||
}
|
||||
|
||||
// make the boots worth upgrading
|
||||
public float getMaxHealthyDropDist()
|
||||
{
|
||||
return 20.0F;
|
||||
}
|
||||
|
||||
public float getMinimumDropDist()
|
||||
{
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingFall(LivingFallEvent event) {
|
||||
if (event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer entity = (EntityPlayer) event.entity;
|
||||
if ((entity.inventory.armorInventory[0] != null) && (entity.inventory.armorInventory[0].getItem() instanceof ItemElectricBootsTraveller)) {
|
||||
ItemStack stack = entity.inventory.armorInventory[0];
|
||||
if (ElectricItem.manager.use(stack, energyPerDamage, entity))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onLivingFall(LivingFallEvent event)
|
||||
{
|
||||
if( ( EMT.instance.isSimulating() ) && ( ( event.entity instanceof EntityLivingBase ) ) )
|
||||
{
|
||||
if( event.entity instanceof EntityPlayer )
|
||||
{
|
||||
EntityPlayer entity = (EntityPlayer) event.entity;
|
||||
if( ( entity.inventory.armorInventory[0] != null ) && ( entity.inventory.armorInventory[0].getItem() instanceof ItemElectricBootsTraveller ) )
|
||||
{
|
||||
ItemElectricBootsTraveller tUsedBoots = (ItemElectricBootsTraveller)entity.inventory.armorInventory[0].getItem();
|
||||
ItemStack stack = entity.inventory.armorInventory[0];
|
||||
|
||||
// Check if we dropped the minimum amount; To cover the jump-boost bonus without penalty
|
||||
if ( tUsedBoots.getMinimumDropDist() > event.distance )
|
||||
{
|
||||
event.setCanceled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
float tEnergyDemand = tUsedBoots.energyPerDamage * (( ( event.distance > tUsedBoots.getMaxHealthyDropDist() ) ? event.distance * 3 : event.distance ) - 4.0F);
|
||||
if( tEnergyDemand <= ElectricItem.manager.getCharge( stack ) )
|
||||
{
|
||||
//EMT.LOGGER.info( String.format("FD: %f DMG: %f EPD: %d HDD: %f", event.distance, tEnergyDemand, tUsedBoots.energyPerDamage, tUsedBoots.getMaxHealthyDropDist() ));
|
||||
ElectricItem.manager.discharge( stack, tEnergyDemand, Integer.MAX_VALUE, true, false, false );
|
||||
event.setCanceled( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
|
||||
@@ -20,6 +20,18 @@ public class ItemNanoBootsTraveller extends ItemElectricBootsTraveller {
|
||||
energyPerDamage = 5000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxHealthyDropDist()
|
||||
{
|
||||
return (float) EMTConfigHandler.nanoBootsMaxDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinimumDropDist()
|
||||
{
|
||||
return (float) EMTConfigHandler.nanoBootsMinDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDamageAbsorptionRatio() {
|
||||
return 0.9D;
|
||||
|
||||
@@ -20,6 +20,18 @@ public class ItemQuantumBootsTraveller extends ItemElectricBootsTraveller {
|
||||
energyPerDamage = 20000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxHealthyDropDist()
|
||||
{
|
||||
return (float) EMTConfigHandler.quantumBootsMaxDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinimumDropDist()
|
||||
{
|
||||
return (float) EMTConfigHandler.quantumBootsMinDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDamageAbsorptionRatio() {
|
||||
return 1D;
|
||||
|
||||
@@ -31,6 +31,10 @@ public class EMTConfigHandler {
|
||||
public static double nanoBootsJump;
|
||||
public static double quantumBootsJump;
|
||||
public static double tripleCompressedSolarOutput;
|
||||
public static double nanoBootsMinDrop;
|
||||
public static double nanoBootsMaxDrop;
|
||||
public static double quantumBootsMinDrop;
|
||||
public static double quantumBootsMaxDrop;
|
||||
|
||||
/** Essentias **/
|
||||
public static double fireOutput;
|
||||
@@ -106,6 +110,8 @@ public class EMTConfigHandler {
|
||||
public static boolean infusedQuantumChestplate;
|
||||
public static boolean aerGeneratorResearch;
|
||||
|
||||
|
||||
|
||||
public static void init(File file) {
|
||||
config = new Configuration(file);
|
||||
syncConfig();
|
||||
@@ -153,6 +159,12 @@ public class EMTConfigHandler {
|
||||
inventoryBaubleProdution = config.get(VALUES, "Inventory Charging Ring production", 32, "Default is 32").getInt();
|
||||
wandChargeFocusCost = config.get(VALUES, "Wand Focus: Wand Charging Cost", 40000, "Default is 40000").getInt();
|
||||
|
||||
|
||||
nanoBootsMinDrop = config.get(VALUES, "Nano Boots of the Traveller minimum drop", 6.0, "The distance allowed to fall without any damage").getDouble(nanoBootsMinDrop);
|
||||
nanoBootsMaxDrop = config.get(VALUES, "Nano Boots of the Traveller maximum healthy drop", 35.0, "Energy amount drained will tripled if player drops more than this amount of blocks").getDouble(nanoBootsMaxDrop);
|
||||
quantumBootsMinDrop = config.get(VALUES, "Quantum Boots of the Traveller minimum drop", 10.0, "The distance allowed to fall without any damage").getDouble(quantumBootsMinDrop);
|
||||
quantumBootsMaxDrop = config.get(VALUES, "Quantum Boots of the Traveller maximum healthy drop", 100.0, "Energy amount drained will tripled if player drops more than this amount of blocks").getDouble(quantumBootsMaxDrop);
|
||||
|
||||
thaumiumDrillResearch = config.get(RESEARCH, "Thaumium Drill", false).getBoolean(thaumiumDrillResearch);
|
||||
thaumiumChainsawResearch = config.get(RESEARCH, "Thaumium Chainsaw", false).getBoolean(thaumiumChainsawResearch);
|
||||
thaumiumDrillResearch = config.get(RESEARCH, "Thaumium Omnitool", false).getBoolean(thaumiumOmnitoolResearch);
|
||||
|
||||
Reference in new issue
Block a user