Skip to content

Commit

Permalink
Updated Forge to latest recommended.
Browse files Browse the repository at this point in the history
Added Thaumcraft integration.
Added Simply Jetpacks integration.
  • Loading branch information
Lunatrius committed Nov 7, 2014
1 parent b793bf7 commit 4966b97
Show file tree
Hide file tree
Showing 15 changed files with 355 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version_major=2
version_minor=8
version_micro=1
version_minecraft=1.7.10
version_forge=10.13.1.1217
version_forge=10.13.2.1230
version_minforge=10.13.0.1185
version_lunatriuscore=1.1.2.14

Expand Down
11 changes: 4 additions & 7 deletions gradle/scripts/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ dependencies {
compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev'
}

def addDependency(depFilename, depName, depPath) {
def depfile = new File('libs/' + depFilename)
if (depfile.isFile()) {
def addDependency(depFilter, depName, depPath) {
if (fileTree('libs').include(depFilter).getFiles().size() == 1) {
logger.lifecycle "Building with ${depName}..."

dependencies {
compile files(depfile)
}
} else {
logger.warn "Building without ${depName}..."

Expand All @@ -28,3 +23,5 @@ def addDependency(depFilename, depName, depPath) {
}

// addDependency('example.jar', 'example', 'com/github/lunatrius/example/integration/test')
addDependency('SimplyJetpacks*', 'SimplyJetpacks', 'com/github/lunatrius/ingameinfo/integration/simplyjetpacks')
addDependency('Thaumcraft*', 'Thaumcraft', 'com/github/lunatrius/ingameinfo/integration/thaumcraft')
2 changes: 2 additions & 0 deletions libs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.jar
*.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.lunatrius.ingameinfo.integration.simplyjetpacks;

import com.github.lunatrius.ingameinfo.integration.simplyjetpacks.tag.TagSimplyJetpacks;
import com.github.lunatrius.ingameinfo.reference.Names;
import com.github.lunatrius.ingameinfo.reference.Reference;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;

@Mod(modid = SimplyJetpacks.MODID, name = SimplyJetpacks.NAME, version = Reference.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES)
public class SimplyJetpacks {
public static final String MODID = Reference.MODID + "|" + Names.Mods.SIMPLYJETPACKS_MODID + "Integration";
public static final String NAME = Reference.NAME + " - " + Names.Mods.SIMPLYJETPACKS_NAME + " Integration";
public static final String DEPENDENCIES = "after:" + Reference.MODID + ";after:" + Names.Mods.SIMPLYJETPACKS_MODID;

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
if (Loader.isModLoaded(Names.Mods.SIMPLYJETPACKS_MODID)) {
TagSimplyJetpacks.register();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package com.github.lunatrius.ingameinfo.integration.simplyjetpacks.tag;

import cofh.api.energy.IEnergyContainerItem;
import com.github.lunatrius.ingameinfo.tag.TagIntegration;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.item.ItemStack;
import tonius.simplyjetpacks.item.ItemJetpack;
import tonius.simplyjetpacks.item.jetpack.Jetpack;

import java.util.Locale;

public abstract class TagSimplyJetpacks extends TagIntegration {
@Override
public String getCategory() {
return "simplyjetpacks";
}

public static class Energy extends TagSimplyJetpacks {
@Override
public String getValue() {
try {
final ItemStack chestplate = player.getCurrentArmor(2);
if (chestplate != null) {
if (chestplate.getItem() instanceof IEnergyContainerItem) {
final IEnergyContainerItem item = (IEnergyContainerItem) chestplate.getItem();
return String.valueOf(item.getEnergyStored(chestplate));
}
}
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static class MaxEnergy extends TagSimplyJetpacks {
@Override
public String getValue() {
try {
final ItemStack chestplate = player.getCurrentArmor(2);
if (chestplate != null) {
if (chestplate.getItem() instanceof IEnergyContainerItem) {
final IEnergyContainerItem item = (IEnergyContainerItem) chestplate.getItem();
return String.valueOf(item.getMaxEnergyStored(chestplate));
}
}
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static class Percent extends TagSimplyJetpacks {
@Override
public String getValue() {
try {
final ItemStack chestplate = player.getCurrentArmor(2);
if (chestplate != null) {
if (chestplate.getItem() instanceof IEnergyContainerItem) {
final IEnergyContainerItem item = (IEnergyContainerItem) chestplate.getItem();
return String.format(Locale.ENGLISH, "%.2f", 100.0 * item.getEnergyStored(chestplate) / item.getMaxEnergyStored(chestplate));
}
}
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static class Enabled extends TagSimplyJetpacks {
@Override
public String getValue() {
try {
final ItemStack chestplate = player.getCurrentArmor(2);
if (chestplate != null) {
if (chestplate.getItem() instanceof ItemJetpack) {
final ItemJetpack item = (ItemJetpack) chestplate.getItem();
final Jetpack jetpack = item.getJetpack(chestplate);
return String.valueOf(jetpack != null && jetpack.isOn(chestplate));
}
}
} catch (Throwable e) {
log(this, e);
}
return String.valueOf(false);
}
}

public static class Hover extends TagSimplyJetpacks {
@Override
public String getValue() {
try {
final ItemStack chestplate = player.getCurrentArmor(2);
if (chestplate != null) {
if (chestplate.getItem() instanceof ItemJetpack) {
final ItemJetpack item = (ItemJetpack) chestplate.getItem();
final Jetpack jetpack = item.getJetpack(chestplate);
return String.valueOf(jetpack != null && jetpack.isHoverModeOn(chestplate));
}
}
} catch (Throwable e) {
log(this, e);
}
return String.valueOf(false);
}
}

public static void register() {
TagRegistry.INSTANCE.register(new Energy().setName("sjenergy"));
TagRegistry.INSTANCE.register(new MaxEnergy().setName("sjmaxenergy"));
TagRegistry.INSTANCE.register(new Percent().setName("sjpercent"));
TagRegistry.INSTANCE.register(new Enabled().setName("sjenabled"));
TagRegistry.INSTANCE.register(new Hover().setName("sjhover"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.lunatrius.ingameinfo.integration.thaumcraft;

import com.github.lunatrius.ingameinfo.integration.thaumcraft.tag.TagThaumcraft;
import com.github.lunatrius.ingameinfo.reference.Names;
import com.github.lunatrius.ingameinfo.reference.Reference;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;

@Mod(modid = Thaumcraft.MODID, name = Thaumcraft.NAME, version = Reference.VERSION, dependencies = Thaumcraft.DEPENDENCIES)
public class Thaumcraft {
public static final String MODID = Reference.MODID + "|" + Names.Mods.THAUMCRAFT_MODID + "Integration";
public static final String NAME = Reference.NAME + " - " + Names.Mods.THAUMCRAFT_NAME + " Integration";
public static final String DEPENDENCIES = "after:" + Reference.MODID + ";after:" + Names.Mods.THAUMCRAFT_MODID;

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
if (Loader.isModLoaded(Names.Mods.THAUMCRAFT_MODID)) {
TagThaumcraft.register();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.github.lunatrius.ingameinfo.integration.thaumcraft.tag;

import com.github.lunatrius.ingameinfo.tag.TagIntegration;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import thaumcraft.common.Thaumcraft;

public abstract class TagThaumcraft extends TagIntegration {
@Override
public String getCategory() {
return "thaumcraft";
}

public static class WarpPerm extends TagThaumcraft {
@Override
public String getValue() {
try {
return String.valueOf(Thaumcraft.proxy.getPlayerKnowledge().getWarpPerm(player.getCommandSenderName()));
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static class WarpSticky extends TagThaumcraft {
@Override
public String getValue() {
try {
return String.valueOf(Thaumcraft.proxy.getPlayerKnowledge().getWarpSticky(player.getCommandSenderName()));
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static class WarpTemp extends TagThaumcraft {
@Override
public String getValue() {
try {
return String.valueOf(Thaumcraft.proxy.getPlayerKnowledge().getWarpTemp(player.getCommandSenderName()));
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static class WarpTotal extends TagThaumcraft {
@Override
public String getValue() {
try {
return String.valueOf(Thaumcraft.proxy.getPlayerKnowledge().getWarpTotal(player.getCommandSenderName()));
} catch (Throwable e) {
log(this, e);
}
return "-1";
}
}

public static void register() {
TagRegistry.INSTANCE.register(new WarpPerm().setName("tcwarpperm"));
TagRegistry.INSTANCE.register(new WarpSticky().setName("tcwarpsticky"));
TagRegistry.INSTANCE.register(new WarpTemp().setName("tcwarptemp"));
TagRegistry.INSTANCE.register(new WarpTotal().setName("tcwarptotal"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

@SuppressWarnings("HardCodedStringLiteral")
public final class Names {
public static final class Mods {
public static final String SIMPLYJETPACKS_MODID = "simplyjetpacks";
public static final String SIMPLYJETPACKS_NAME = "Simply Jetpacks";

public static final String THAUMCRAFT_MODID = "Thaumcraft";
public static final String THAUMCRAFT_NAME = "Thaumcraft";
}

public static final class Command {
public static final class Message {
public static final String USAGE = "commands.ingameinfoxml.usage";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.lunatrius.ingameinfo.tag;

import com.github.lunatrius.ingameinfo.reference.Reference;

public abstract class TagIntegration extends Tag {
public static class TagException extends Exception {
public TagException(Tag tag, Throwable cause) {
super(tag.getCategory() + "/" + tag.getName(), cause);
}
}

private boolean logged = false;

protected void log(TagIntegration tag, Throwable ex) {
if (!this.logged) {
Reference.logger.error("Tag error!", new TagException(tag, ex));
this.logged = true;
}
}
}
15 changes: 15 additions & 0 deletions src/main/resources/assets/ingameinfo/lang/de_DE.lang
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
# ingameinfoxml.tag.category.riding.name=Riding
# ingameinfoxml.tag.category.time.name=Time
# ingameinfoxml.tag.category.world.name=World
# ingameinfoxml.tag.category.simplyjetpacks.name=Simply Jetpacks
# ingameinfoxml.tag.category.thaumcraft.name=Thaumcraft

# gui - tag list - formatting tags
# ingameinfoxml.tag.black.desc=Black color (§0EXAMPLE§r).
Expand Down Expand Up @@ -250,6 +252,19 @@
# ingameinfoxml.tag.temperature.desc=Biome temperature.
# ingameinfoxml.tag.humidity.desc=Biome humidity.

# gui - tag list - integration - simply jetpacks
# ingameinfoxml.tag.sjenergy.desc=Jetpack energy.
# ingameinfoxml.tag.sjmaxenergy.desc=Jetpack maximum energy.
# ingameinfoxml.tag.sjpercent.desc=Jetpack energy left in percents.
# ingameinfoxml.tag.sjenabled.desc=§etrue§r if the jetpack is enabled, §efalse§r otherwise.
# ingameinfoxml.tag.sjhover.desc=§etrue§r if the jetpack is in hover mode, §efalse§r otherwise.

# gui - tag list - integration - thaumcraft
# ingameinfoxml.tag.tcwarpperm.desc=Player's permanent warp.
# ingameinfoxml.tag.tcwarpsticky.desc=Player's normal (sticky) warp.
# ingameinfoxml.tag.tcwarptemp.desc=Player's temporary warp.
# ingameinfoxml.tag.tcwarptotal.desc=Player's total warp.

# commands
commands.ingameinfoxml.usage=/igi <reload|load|save|enable|disable|taglist|config> [Dateiname]
commands.ingameinfoxml.reload=Lade neu...
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/assets/ingameinfo/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ ingameinfoxml.tag.category.playerpotion.name=Player - Potion Effects
ingameinfoxml.tag.category.riding.name=Riding
ingameinfoxml.tag.category.time.name=Time
ingameinfoxml.tag.category.world.name=World
ingameinfoxml.tag.category.simplyjetpacks.name=Simply Jetpacks
ingameinfoxml.tag.category.thaumcraft.name=Thaumcraft

# gui - tag list - formatting tags
ingameinfoxml.tag.black.desc=Black color (§0EXAMPLE§r).
Expand Down Expand Up @@ -250,6 +252,19 @@ ingameinfoxml.tag.hardcore.desc=§etrue§r if the world is in hardcore mode, §e
ingameinfoxml.tag.temperature.desc=Biome temperature.
ingameinfoxml.tag.humidity.desc=Biome humidity.

# gui - tag list - integration - simply jetpacks
ingameinfoxml.tag.sjenergy.desc=Jetpack energy.
ingameinfoxml.tag.sjmaxenergy.desc=Jetpack maximum energy.
ingameinfoxml.tag.sjpercent.desc=Jetpack energy left in percents.
ingameinfoxml.tag.sjenabled.desc=§etrue§r if the jetpack is enabled, §efalse§r otherwise.
ingameinfoxml.tag.sjhover.desc=§etrue§r if the jetpack is in hover mode, §efalse§r otherwise.

# gui - tag list - integration - thaumcraft
ingameinfoxml.tag.tcwarpperm.desc=Player's permanent warp.
ingameinfoxml.tag.tcwarpsticky.desc=Player's normal (sticky) warp.
ingameinfoxml.tag.tcwarptemp.desc=Player's temporary warp.
ingameinfoxml.tag.tcwarptotal.desc=Player's total warp.

# commands
commands.ingameinfoxml.usage=/igi <reload|load|save|enable|disable|taglist|config> [filename]
commands.ingameinfoxml.reload=Reloading...
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/assets/ingameinfo/lang/fr_FR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ ingameinfoxml.config.bottomright=En bas à droite
# ingameinfoxml.tag.category.riding.name=Riding
# ingameinfoxml.tag.category.time.name=Time
# ingameinfoxml.tag.category.world.name=World
# ingameinfoxml.tag.category.simplyjetpacks.name=Simply Jetpacks
# ingameinfoxml.tag.category.thaumcraft.name=Thaumcraft

# gui - tag list - formatting tags
# ingameinfoxml.tag.black.desc=Black color (§0EXAMPLE§r).
Expand Down Expand Up @@ -250,6 +252,19 @@ ingameinfoxml.config.bottomright=En bas à droite
# ingameinfoxml.tag.temperature.desc=Biome temperature.
# ingameinfoxml.tag.humidity.desc=Biome humidity.

# gui - tag list - integration - simply jetpacks
# ingameinfoxml.tag.sjenergy.desc=Jetpack energy.
# ingameinfoxml.tag.sjmaxenergy.desc=Jetpack maximum energy.
# ingameinfoxml.tag.sjpercent.desc=Jetpack energy left in percents.
# ingameinfoxml.tag.sjenabled.desc=§etrue§r if the jetpack is enabled, §efalse§r otherwise.
# ingameinfoxml.tag.sjhover.desc=§etrue§r if the jetpack is in hover mode, §efalse§r otherwise.

# gui - tag list - integration - thaumcraft
# ingameinfoxml.tag.tcwarpperm.desc=Player's permanent warp.
# ingameinfoxml.tag.tcwarpsticky.desc=Player's normal (sticky) warp.
# ingameinfoxml.tag.tcwarptemp.desc=Player's temporary warp.
# ingameinfoxml.tag.tcwarptotal.desc=Player's total warp.

# commands
commands.ingameinfoxml.usage=/igi <reload|load|save|enable|disable|taglist|config> [nondufichier]
commands.ingameinfoxml.reload=Rechargement...
Expand Down
Loading

0 comments on commit 4966b97

Please sign in to comment.