-
Notifications
You must be signed in to change notification settings - Fork 39
added support GregTech Fuel Rods && add config sensorDataRefreshPeriod #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Baldrvolsk
wants to merge
5
commits into
xbony2:master
Choose a base branch
from
Baldrvolsk:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d8b74df
fix compile, add offline lib
Baldrvolsk e4d094e
added support GregTech Fuel Rods && update version mod
Baldrvolsk ab4c207
add config sensorDataRefreshPeriod
Baldrvolsk 7d1c154
Merge branch 'fixGTrod'
Baldrvolsk d8c5a54
fix added support GregTech Fuel Rods
Baldrvolsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| forgeVersion=1.7.10-10.13.4.1558-1.7.10 | ||
| ic2Version=net.industrial-craft:industrialcraft-2:2.2.817-experimental:dev | ||
| forgeVersion=1.7.10-10.13.4.1614-1.7.10 | ||
| ic2Version=net.industrial-craft:industrialcraft-2:2.2.827-experimental:dev | ||
|
|
||
| codeChickenCoreVersion=codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev | ||
| notEnoughItemsVersion=codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev | ||
| codeChickenLibVersion=codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev | ||
| argoVersion=net.sourceforge.argo:argo:3.19 | ||
| wailaVersion=mcp.mobius.waila:Waila:1.5.10_1.7.10 | ||
| openCVersion=li.cil.oc:OpenComputers:MC1.7.10-1.6.0.883-dev:dev | ||
|
|
||
| cofhCoreVersion=lib/CoFHCore-[1.7.10]3.1.2-325-dev.jar | ||
| brVersion=lib/BigReactors-0.4.3A.jar | ||
| aeVersion=lib/appliedenergistics2-rv3-beta-5-dev.jar | ||
| buildcraftVersion=lib/buildcraft-7.1.16-dev.jar | ||
| mekVersion=lib/Mekanism-1.7.10-8.1.7.252.jar | ||
| openCVersion=lib/OpenComputers-MC1.7.10-1.7.2.1166-universal.jar | ||
| rcVersion=lib/RotaryCraft1.7.10V19c.jar | ||
| gregtechVersion=lib/gregtech-5.09.32pre3stable.jar | ||
|
|
||
| newNuclearControlVersion=2.4.3a | ||
| newNuclearControlVersion=2.4.4a |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,50 +5,51 @@ | |
| import net.minecraftforge.common.config.Configuration; | ||
|
|
||
| import java.io.File; | ||
| import java.util.UUID; | ||
| //import java.util.UUID; | ||
|
|
||
| public class ConfigurationHandler { | ||
| public Configuration configuration; | ||
| public Configuration configuration; | ||
|
|
||
| public void init(File configFile) { | ||
| if (configuration == null) { | ||
| configuration = new Configuration(configFile); | ||
| } | ||
| loadConfiguration(); | ||
| } | ||
| public void init(File configFile) { | ||
| if (configuration == null) { | ||
| configuration = new Configuration(configFile); | ||
| } | ||
| loadConfiguration(); | ||
| } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please |
||
|
|
||
| private void loadConfiguration() { | ||
| try { | ||
| IC2NuclearControl.instance.alarmRange = configuration.get(Configuration.CATEGORY_GENERAL, "alarmRange", 64).getInt(); | ||
| IC2NuclearControl.instance.maxAlarmRange = configuration.get(Configuration.CATEGORY_GENERAL, "maxAlarmRange", 128).getInt(); | ||
| IC2NuclearControl.instance.allowedAlarms = configuration.get(Configuration.CATEGORY_GENERAL, "allowedAlarms", "default,sci-fi").getString().replaceAll(" ", ""); | ||
| IC2NuclearControl.instance.remoteThermalMonitorEnergyConsumption = configuration.get(Configuration.CATEGORY_GENERAL, "remoteThermalMonitorEnergyConsumption", 1).getInt(); | ||
| IC2NuclearControl.instance.screenRefreshPeriod = configuration.get(Configuration.CATEGORY_GENERAL, "infoPanelRefreshPeriod",20).getInt(); | ||
| IC2NuclearControl.instance.rangeTriggerRefreshPeriod = configuration.get(Configuration.CATEGORY_GENERAL, "rangeTriggerRefreshPeriod", 20).getInt(); | ||
| IC2NuclearControl.instance.SMPMaxAlarmRange = configuration.get(Configuration.CATEGORY_GENERAL, "SMPMaxAlarmRange", 256).getInt(); | ||
| IC2NuclearControl.instance.disableCapes = configuration.get(Configuration.CATEGORY_GENERAL, "disableCapes", false).getBoolean(false); | ||
| //IC2NuclearControl.isHttpSensorAvailableClient = configuration.getBoolean("isHttpSensorAvailableClient", Configuration.CATEGORY_GENERAL, false, "Turns on/off the recipes for the web upgrade client side"); | ||
| //IC2NuclearControl.isHttpSensorAvailableServer = configuration.getBoolean("isHttpSensorAvailableServer", Configuration.CATEGORY_GENERAL, true, "Turns on/off the recipes for the web upgrade server side"); | ||
| //IC2NuclearControl.instance.httpSensorKey = configuration.get(Configuration.CATEGORY_GENERAL, "httpSensorKey", UUID.randomUUID().toString().replace("-", "")).getString(); | ||
| IC2NuclearControl.instance.recipes = configuration.getString("recipes", Configuration.CATEGORY_GENERAL, "normal", "Valid inputs: normal, old or gregtech"); | ||
| }catch(Exception e) { | ||
| IC2NuclearControl.logger.error( | ||
| "Mod has a problem loading it's configuration", e); | ||
| }finally { | ||
| if(configuration.hasChanged()) { | ||
| configuration.save(); | ||
| } | ||
| } | ||
| } | ||
| private void loadConfiguration() { | ||
| try { | ||
| IC2NuclearControl.instance.alarmRange = configuration.get(Configuration.CATEGORY_GENERAL, "alarmRange", 64).getInt(); | ||
| IC2NuclearControl.instance.maxAlarmRange = configuration.get(Configuration.CATEGORY_GENERAL, "maxAlarmRange", 128).getInt(); | ||
| IC2NuclearControl.instance.allowedAlarms = configuration.get(Configuration.CATEGORY_GENERAL, "allowedAlarms", "default,sci-fi").getString().replaceAll(" ", ""); | ||
| IC2NuclearControl.instance.remoteThermalMonitorEnergyConsumption = configuration.get(Configuration.CATEGORY_GENERAL, "remoteThermalMonitorEnergyConsumption", 1).getInt(); | ||
| IC2NuclearControl.instance.screenRefreshPeriod = configuration.get(Configuration.CATEGORY_GENERAL, "infoPanelRefreshPeriod", 20).getInt(); | ||
| IC2NuclearControl.instance.dataRefreshPeriod = configuration.get(Configuration.CATEGORY_GENERAL, "sensorDataRefreshPeriod", 4, "can not be longer than infoPanelRefreshPeriod [default: 4]").getInt(); | ||
| IC2NuclearControl.instance.rangeTriggerRefreshPeriod = configuration.get(Configuration.CATEGORY_GENERAL, "rangeTriggerRefreshPeriod", 20).getInt(); | ||
| IC2NuclearControl.instance.SMPMaxAlarmRange = configuration.get(Configuration.CATEGORY_GENERAL, "SMPMaxAlarmRange", 256).getInt(); | ||
| IC2NuclearControl.instance.disableCapes = configuration.get(Configuration.CATEGORY_GENERAL, "disableCapes", false).getBoolean(false); | ||
| //IC2NuclearControl.isHttpSensorAvailableClient = configuration.getBoolean("isHttpSensorAvailableClient", Configuration.CATEGORY_GENERAL, false, "Turns on/off the recipes for the web upgrade client side"); | ||
| //IC2NuclearControl.isHttpSensorAvailableServer = configuration.getBoolean("isHttpSensorAvailableServer", Configuration.CATEGORY_GENERAL, true, "Turns on/off the recipes for the web upgrade server side"); | ||
| //IC2NuclearControl.instance.httpSensorKey = configuration.get(Configuration.CATEGORY_GENERAL, "httpSensorKey", UUID.randomUUID().toString().replace("-", "")).getString(); | ||
| IC2NuclearControl.instance.recipes = configuration.getString("recipes", Configuration.CATEGORY_GENERAL, "normal", "Valid inputs: normal, old or gregtech"); | ||
| } catch (Exception e) { | ||
| IC2NuclearControl.logger.error( | ||
| "Mod has a problem loading it's configuration", e); | ||
| } finally { | ||
| if (configuration.hasChanged()) { | ||
| configuration.save(); | ||
| } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these conventions are bad, sorry :P |
||
| } | ||
| } | ||
|
|
||
| public void save(){ | ||
| if (configuration.hasChanged()) { | ||
| configuration.save(); | ||
| } | ||
| } | ||
| public void save() { | ||
| if (configuration.hasChanged()) { | ||
| configuration.save(); | ||
| } | ||
| } | ||
|
|
||
| @SubscribeEvent | ||
| public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { | ||
| loadConfiguration(); | ||
| } | ||
| @SubscribeEvent | ||
| public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { | ||
| loadConfiguration(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/shedar/mods/ic2/nuclearcontrol/crossmod/gregtech/CrossGregTech.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package shedar.mods.ic2.nuclearcontrol.crossmod.gregtech; | ||
|
|
||
| import cpw.mods.fml.common.Loader; | ||
| import cpw.mods.fml.common.registry.GameRegistry; | ||
| import gregtech.api.items.GT_RadioactiveCell_Item; | ||
| import net.minecraft.item.ItemStack; | ||
|
|
||
| import gregtech.api.items.GT_RadioactiveCellIC_Item; | ||
| import shedar.mods.ic2.nuclearcontrol.IC2NuclearControl; | ||
| import shedar.mods.ic2.nuclearcontrol.crossmod.ModLib; | ||
|
|
||
| public class CrossGregTech { | ||
| private boolean _isApiAvailable; | ||
|
|
||
| public CrossGregTech() { | ||
| if(Loader.isModLoaded(ModLib.GT)) { | ||
| _isApiAvailable = true; | ||
| IC2NuclearControl.logger.info("[IC2NuclearControl] find GregTech"); | ||
| } else { | ||
| _isApiAvailable = false; | ||
| } | ||
|
|
||
| } | ||
| public boolean isApiAvailable() | ||
| { | ||
| return _isApiAvailable; | ||
| } | ||
|
|
||
| public int getNuclearCellTimeLeft(ItemStack stack) { | ||
| if (!_isApiAvailable || stack == null) { | ||
| return 0; | ||
| } | ||
| try { | ||
| if (stack.getItem() instanceof GT_RadioactiveCellIC_Item) { | ||
| String rodName = stack.getUnlocalizedName(); | ||
| GT_RadioactiveCell_Item rod = (GT_RadioactiveCell_Item) GameRegistry.findItem(ModLib.GT, rodName); | ||
| int maxDamage = rod.getMaxDamageEx(); | ||
| int currentDmg = GT_RadioactiveCellIC_Item.getDurabilityOfStack(stack); | ||
| int dmg = maxDamage - currentDmg; | ||
| return (dmg > 0) ? dmg : 0; | ||
| } else { | ||
| return -1; | ||
| } | ||
| } catch (Exception e) { | ||
| IC2NuclearControl.logger.error(e); | ||
| return -1; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix indentations