Added StarTech compatiblity

This commit is contained in:
Timo Ley 2019-05-30 00:43:17 +02:00
parent 993ed37ccc
commit 6aa4b66ae5
7 changed files with 123 additions and 1 deletions

View File

@ -91,9 +91,10 @@ repositories {
}
dependencies {
deobfCompile ("com.gitlab.lcoremodders:LucraftCore:2.4.2")
deobfCompile 'com.gitlab.lcoremodders:LucraftCore:85e6c788'
deobfCompile 'com.gitlab.lcoremodders:HeroesExpansion:1.3.3'
deobfCompile 'com.gitlab.lcoremodders:SpeedsterHeroes:1e4b1fb951'
deobfCompile "star-tech-man-the-legendary-mod:star:tech:1.1.1"
compile fileTree(dir: 'libs', include: ['*.jar'])
}

View File

@ -5,13 +5,16 @@ import net.minecraftforge.fml.common.Loader;
public class CompatHandler {
public static boolean isHeroesExpansion;
public static boolean isSpeedsterHeroes;
public static boolean isStarTech;
public static HEProxy HeroesExpension;
public static SHProxy SpeedsterHeroes;
public static STProxy StarTech;
public static void check() {
isHeroesExpansion = Loader.isModLoaded("heroesexpansion");
isSpeedsterHeroes = Loader.isModLoaded("speedsterheroes");
isStarTech = Loader.isModLoaded("star-tech");
if (isHeroesExpansion) {
HeroesExpension = new HELoadedProxy();
@ -25,5 +28,11 @@ public class CompatHandler {
SpeedsterHeroes = new SHNotLoadedProxy();
}
if (isStarTech) {
StarTech = new STLoadedProxy();
} else {
StarTech = new STNotLoadedProxy();
}
}
}

View File

@ -0,0 +1,38 @@
package anvil.infinity.compat;
import com.nic.st.power.*;
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
import net.minecraft.entity.EntityLivingBase;
public class STLoadedProxy implements STProxy {
@Override
public Ability getAbilityPowerBlast(EntityLivingBase entity) {
return new AbilityPowerBlast(entity);
}
@Override
public Ability getAbilityPowerImpower(EntityLivingBase entity) {
return new AbilityPowerImpower(entity);
}
@Override
public Ability getAbilityPowerRocketBurst(EntityLivingBase entity) {
return new AbilityRocketBurst(entity);
}
@Override
public Ability getAbilityTendrils(EntityLivingBase entity) {
return new AbilityTendrils(entity);
}
@Override
public Ability getAbilityCyclone(EntityLivingBase entity) {
return new AbilityPowerCyclone(entity);
}
@Override
public Ability getAbilityBurnout(EntityLivingBase entity) {
return new AbilityGiveBurnout(entity);
}
}

View File

@ -0,0 +1,37 @@
package anvil.infinity.compat;
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
import net.minecraft.entity.EntityLivingBase;
public class STNotLoadedProxy implements STProxy {
@Override
public Ability getAbilityPowerBlast(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityPowerImpower(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityPowerRocketBurst(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityTendrils(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityCyclone(EntityLivingBase entity) {
return null;
}
@Override
public Ability getAbilityBurnout(EntityLivingBase entity) {
return null;
}
}

View File

@ -0,0 +1,20 @@
package anvil.infinity.compat;
import lucraft.mods.lucraftcore.superpowers.abilities.Ability;
import net.minecraft.entity.EntityLivingBase;
public interface STProxy {
Ability getAbilityPowerBlast(EntityLivingBase entity);
Ability getAbilityPowerImpower(EntityLivingBase entity);
Ability getAbilityPowerRocketBurst(EntityLivingBase entity);
Ability getAbilityTendrils(EntityLivingBase entity);
Ability getAbilityCyclone(EntityLivingBase entity);
Ability getAbilityBurnout(EntityLivingBase entity);
}

View File

@ -14,6 +14,8 @@ public class ConfigHandler {
public static int soulWorldID;
public static boolean snapCreative;
public static boolean heAbilities;
public static int powerCooldown;
public static boolean stAbilities;
public static void refreshConfig(File file) {
config = new Configuration(file);
@ -33,6 +35,8 @@ public class ConfigHandler {
soulWorldID = config.getInt("Soul World ID", category, 10, -255, 255, "The ID of the Soul World Dimension");
snapCreative = config.getBoolean("Can Snap change Gamemode", category, false, "Can the Snap change the Gamemode to Creative");
heAbilities = config.getBoolean("HeroesExpansion Abilities", category, true, "Should some stones use abilities from HeroesExpansion");
stAbilities = config.getBoolean("StarTech Abilities", category, true, "Should the Power Stone use the abilities from the StarTech Power Stone if installed");
powerCooldown= config.getInt("Power Burst Cooldown", category, 100, 0, 1000, "How big long should the StarTech Power Stone burst cooldown be");
}
}

View File

@ -2,6 +2,8 @@ package anvil.infinity.items;
import anvil.infinity.abilities.AbilityHasPowerStone;
import anvil.infinity.abilities.AbilitySaturation;
import anvil.infinity.compat.CompatHandler;
import anvil.infinity.config.ConfigHandler;
import lucraft.mods.lucraftcore.infinity.EnumInfinityStone;
import lucraft.mods.lucraftcore.infinity.ModuleInfinity;
import lucraft.mods.lucraftcore.infinity.items.ItemInfinityStone;
@ -41,6 +43,12 @@ public class ItemPowerStone extends ItemInfinityStone implements IAbilityProvide
abilities.put("damage", new AbilityPunch(entity).setDataValue(AbilityPunch.AMOUNT, Float.MAX_VALUE));
abilities.put("resistance", new AbilityDamageResistance(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
abilities.put("saturation", new AbilitySaturation(entity));
if (CompatHandler.isStarTech && ConfigHandler.stAbilities) {
abilities.put("power_blat", CompatHandler.StarTech.getAbilityPowerBlast(entity).setMaxCooldown(ConfigHandler.powerCooldown));
abilities.put("power_impower", CompatHandler.StarTech.getAbilityPowerImpower(entity));
abilities.put("power_rocket_burst", CompatHandler.StarTech.getAbilityPowerRocketBurst(entity).setMaxCooldown(100));
abilities.put("power_tendrils", CompatHandler.StarTech.getAbilityTendrils(entity));
}
return super.addStoneAbilities(entity, abilities, context);
}
@ -55,6 +63,11 @@ public class ItemPowerStone extends ItemInfinityStone implements IAbilityProvide
abilities.put("strength", new AbilityStrength(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
abilities.put("damage", new AbilityPunch(entity).setDataValue(AbilityPunch.AMOUNT, Float.MAX_VALUE));
abilities.put("resistance", new AbilityDamageResistance(entity).setDataValue(AbilityAttributeModifier.AMOUNT, Float.MAX_VALUE));
if (CompatHandler.isStarTech && ConfigHandler.stAbilities) {
abilities.put("power_tendrils", CompatHandler.StarTech.getAbilityTendrils(entity));
abilities.put("power_cyclone", CompatHandler.StarTech.getAbilityCyclone(entity));
abilities.put("power_burnout", CompatHandler.StarTech.getAbilityBurnout(entity));
}
return abilities;
}
}