Allow changing Electric Boots using ThaumicBoots Keybinds. (#75)

* Allow changing Traveler Boots speed using ThaumicBoots Keybinds.

* Air speed bonus gets modified by speedModifier

* Spotless Apply :/

* Added the temp lib file for tests

This should instead use the remote dependency system once TB PR 27 is merged

* Fix potential NSM exception when GTNH Thaumic Boots is not present.

* Spotless apply.

* Now using ThaumicBoots 1.2.2-Pre build

* Delete ThaumicBoots-1.2.1-master+4e33b9941e-dirty-dev.jar

* Fixed DuplicateMod, Excluded EMT from the ThaumicBoots pre jar

* Fixing the EMT Issues + Updating the way the Electric Boots Work

* Update dependencies.gradle

* update

---------

Co-authored-by: Alastors <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-05-06 13:48:33 -04:00
1 parent 547db6d7d0
commit 74d1aced60
7 files changed
+59 -13

No files matched your search

+5 -1
View File
@@ -1,9 +1,13 @@
// Add your dependencies here
dependencies {
compileOnly 'com.github.GTNewHorizons:GT5-Unofficial:5.09.45.130:dev'
compileOnly 'com.github.GTNewHorizons:GT5-Unofficial:5.09.46.05:dev'
api 'com.github.GTNewHorizons:Baubles:1.0.4:dev'
api 'com.github.GTNewHorizons:ModularUI:1.1.42:dev'
api ('com.github.GTNewHorizons:ThaumicBoots:1.3.0:dev'){
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
}
api 'net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev'
api 'thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev'
+1 -1
View File
@@ -117,7 +117,7 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
}
+7
View File
@@ -7,6 +7,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -65,12 +66,18 @@ public class EMT {
@Mod.Instance("EMT")
public static EMT instance;
public static boolean isBootsActive = false;
public static final String BOOTS = "thaumicboots";
public boolean isSimulating() {
return !FMLCommonHandler.instance().getEffectiveSide().isClient();
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
if (Loader.isModLoaded(BOOTS)) {
isBootsActive = true;
}
EMTConfigHandler.init(event.getSuggestedConfigurationFile());
FMLCommonHandler.instance().bus().register(new EMTEventHandler());
if (FMLCommonHandler.instance().getSide().isClient()) {
@@ -18,6 +18,8 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -33,9 +35,11 @@ import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.items.armor.Hover;
import thaumicboots.api.IBoots;
@Interface(iface = "thaumicboots.api.IBoots", modid = "thaumicboots")
public class ItemElectricBootsTraveller extends ItemArmor
implements IRunicArmor, IElectricItem, IVisDiscountGear, IMetalArmor, ISpecialArmor {
implements IRunicArmor, IElectricItem, IVisDiscountGear, IMetalArmor, ISpecialArmor, IBoots {
public int maxCharge = 100000;
public int energyPerDamage = 1000;
@@ -128,8 +132,8 @@ public class ItemElectricBootsTraveller extends ItemArmor
}
player.stepHeight = 1.0F;
}
if (player.onGround) {
float speedMod = (float) getSpeedModifier(itemStack);
if (player.onGround || player.isOnLadder() || player.capabilities.isFlying) {
float bonus = speedBonus;
if (player.isInWater()) {
bonus /= 4.0F;
@@ -138,29 +142,45 @@ public class ItemElectricBootsTraveller extends ItemArmor
if (player.isSneaking()) {
bonus /= 2.0F;
}
player.moveFlying(player.moveStrafing, player.moveForward, bonus);
bonus *= speedMod;
if (EMT.isBootsActive) {
applyOmniState(player, bonus, itemStack);
} else {
player.moveFlying(0.0F, player.moveForward, bonus);
}
} else if (Hover.getHover(player.getEntityId())) {
// Base ItemBootsTraveller jumpBonus equals to jumpBonus of Electric Boots,
// so any other boots factor can be calculated via proportion method
player.jumpMovementFactor = 0.03F
/ ((ItemElectricBootsTraveller) EMTItems.electricBootsTraveller).jumpBonus
* jumpBonus;
* jumpBonus
* speedMod;
} else {
player.jumpMovementFactor = 0.05F
/ ((ItemElectricBootsTraveller) EMTItems.electricBootsTraveller).jumpBonus
* jumpBonus;
* jumpBonus
* speedMod;
}
}
}
@Optional.Method(modid = "thaumicboots")
public void applyOmniState(EntityPlayer player, float bonus, ItemStack itemStack) {
if (player.moveStrafing != 0.0 && itemStack.stackTagCompound.getBoolean("omni")) {
player.moveFlying(player.moveStrafing, 0.0F, bonus);
} else if (player.moveForward != 0.0) {
player.moveFlying(0.0F, player.moveForward, bonus);
}
}
@SubscribeEvent
public void onPlayerJump(LivingEvent.LivingJumpEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
boolean hasArmor = player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() == this;
ItemStack boots = player.getCurrentArmor(0);
boolean hasArmor = boots != null && boots.getItem() == this;
if (hasArmor) player.motionY += jumpBonus;
if (hasArmor) player.motionY += jumpBonus * (float) getJumpModifier(boots);
}
}
@@ -276,4 +296,19 @@ public class ItemElectricBootsTraveller extends ItemArmor
public int getRunicCharge(ItemStack itemStack) {
return 0;
}
// Avoid NSM Exception when ThaumicBoots is not present.
public double getSpeedModifier(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getDouble("speed");
}
return 1.0;
}
public double getJumpModifier(ItemStack stack) {
if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getDouble("jump");
}
return 1.0;
}
}