Skip to content

Commit 11641eb

Browse files
committed
Merge pull request #22 from HTTYMD-Team/experimental
1.1.0 Release
2 parents 92f7bd9 + 79d5ea8 commit 11641eb

File tree

109 files changed

+5612
-2503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+5612
-2503
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
.project
55
.classpath
66
bin/
7-
libs/
87
classes/
98
minecraft/
109
HTTYMD.iml

CONTRIBUTING.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ To build this workspace:
55
1. Fork this repository
66
* run `gradlew setupDecompWorkspace`
77
* Prepare your preferred IDE
8-
* For Eclipse, you can either install the Gradle plugin and point to build.gradle or you can run `gradlew.bat setupDecompWorkspace eclipse` and import this folder
8+
* For Eclipse, you can either install the Gradle plugin and point to build.gradle or you can run `gradlew.bat setupDecompWorkspace` and import this folder
99
* TODO: give basic Intellij instructions
1010
* Start developing
11+
12+
#### Code Guidelines
13+
- Use Hard Tabs (not spaces)
14+
- Minimize Wrapping
15+
- No Comment Wrapping
16+
- Indent once for each block level
17+
- Constants must be UPPERCASED
18+
- For one line if statements, omit brackets ('{' and '}')
19+
- Documented code is highly recommended (high use code must be documented)
20+
- For heavy Battlegear 2 manipulation, use the bg2 package
21+
- Removal of public or protected methods and classes is now forbidden until major version bump. Deprecate only. See [Semantic Versioning](http://semver.org)
22+
- It is suggested to mark probable changes between upcomming MC versions
23+
24+
#### Issue Submission Guidelines
25+
- Use [pastebin](http://pastebin.com), [gist](https://gist.github.com/), or another paste site for logs (DON'T SUBMIT LOGS DIRECTLY INTO ISSUE)
26+
- Name your issue descriptively (like "Hitting dragon with shield crashes", not "Help" or "Dragon crash")
27+
- In the issue body, describe your problem and provide a link to the log (if available)
28+
- Describe how to replicate the issue (descretion is expected)
29+
- (For crashes) No logs, no help

build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gradlew.bat build

build.gradle

Lines changed: 71 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,97 @@
11
buildscript {
2-
repositories {
3-
mavenCentral()
4-
maven {
5-
name = "forge"
6-
url = "http://files.minecraftforge.net/maven"
7-
}
8-
maven {
9-
name = "sonatype"
10-
url = "https://oss.sonatype.org/content/repositories/snapshots/"
11-
}
12-
}
13-
dependencies {
14-
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
15-
}
2+
repositories {
3+
mavenCentral()
4+
maven {
5+
name = "forge"
6+
url = "http://files.minecraftforge.net/maven"
7+
}
8+
maven {
9+
name = "sonatype"
10+
url = "https://oss.sonatype.org/content/repositories/snapshots/"
11+
}
12+
}
13+
dependencies {
14+
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
15+
16+
classpath fileTree(dir: 'libs', include: '*.jar')
17+
}
1618
}
1719

1820
apply plugin: 'idea'
1921
idea {
20-
module {
21-
inheritOutputDirs = true
22-
}
22+
module {
23+
inheritOutputDirs = true
24+
}
2325
}
2426

2527
apply plugin: 'forge'
28+
sourceCompatibility = 1.6
29+
targetCompatibility = 1.6
30+
31+
ext.configFile = file "mod.prop"
32+
configFile.withReader {
33+
// Load config. Can be referenced as config
34+
def prop = new Properties()
35+
prop.load(it)
36+
ext.config = new ConfigSlurper().parse prop
37+
}
2638

27-
version = "1.7.10-10.13.2.1230F-1.0.2R"
39+
version = config.mcversion+"-"+config.forgeversion+"F-"+config.modversion //"1.7.10-10.13.2.1230F-1.0.2R"
2840
group= "com.httymd" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2941
archivesBaseName = "HTTYMD"
3042

3143
minecraft {
32-
version = "1.7.10-10.13.2.1230"
33-
runDir = "minecraft"
44+
version = config.mcversion+"-"+config.forgeversion //"1.7.10-10.13.2.1230"
45+
runDir = "minecraft"
46+
}
47+
48+
49+
sourceSets {
50+
main {
51+
java { srcDir 'java' }
52+
resources { srcDir 'resources' include('**') }
53+
}
3454
}
3555

3656
processResources
3757
{
38-
// this will ensure that this task is redone when the versions change.
39-
inputs.property "version", project.version
40-
inputs.property "mcversion", project.minecraft.version
41-
42-
// replace stuff in mcmod.info, nothing else
43-
from(sourceSets.main.resources.srcDirs) {
44-
include 'mcmod.info'
45-
46-
// replace version and mcversion
47-
expand 'version':project.version, 'mcversion':project.minecraft.version
48-
}
49-
50-
// copy everything else, thats not the mcmod.info
51-
from(sourceSets.main.resources.srcDirs) {
52-
exclude 'mcmod.info'
53-
}
58+
// this will ensure that this task is redone when the versions change.
59+
inputs.property "version", project.version
60+
inputs.property "mcversion", project.minecraft.version
61+
62+
from(sourceSets.main.resources.srcDirs) {
63+
include 'mcmod.info'
64+
// replace version and mcversion
65+
expand 'version':config.modversion, 'mcversion':config.mcversion
66+
}
5467
}
5568

56-
sourceSets {
57-
main {
58-
java { srcDir 'java' }
59-
resources { srcDir 'resources' }
60-
}
69+
dependencies {
6170
}
6271

6372

64-
dependencies {
65-
// you may put jars on which you depend on in ./libs
66-
// or you may define them like so..
67-
//compile "some.group:artifact:version:classifier"
68-
//compile "some.group:artifact:version"
69-
70-
// real examples
71-
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
72-
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
73-
74-
// for more info...
75-
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
76-
// http://www.gradle.org/docs/current/userguide/dependency_management.html
73+
task deobfJar(type: Jar) {
74+
from sourceSets.main.output
75+
classifier = 'deobf'
76+
destinationDir = file 'releases/API'
77+
}
7778

79+
task sourceJar(type: Jar) {
80+
from sourceSets.main.allSource
81+
classifier = 'sources'
82+
destinationDir = file 'releases/API'
7883
}
7984

85+
jar {
86+
//Place jar into distribution folder
87+
destinationDir = file 'releases'
88+
//Keep the jar as clean as possible
89+
includeEmptyDirs = false
90+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
91+
}
8092

93+
artifacts {
94+
archives deobfJar
95+
archives sourceJar
96+
archives jar
97+
}

java/com/httymd/Config.java

Lines changed: 97 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,131 @@
11
package com.httymd;
22

3-
import com.httymd.util.Utils;
3+
import java.util.HashMap;
4+
5+
import com.httymd.entity.EntityTameableFlying;
46

57
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
8+
import net.minecraft.entity.EntityList;
9+
import net.minecraft.entity.EntityLivingBase;
610
import net.minecraftforge.common.config.Configuration;
711

812
public class Config {
913

14+
public static String CATEGORYS[] = {"dragons", "testing", "bg2"};
15+
private static final String STRING_PREFIX = "config."+HTTYMDMod.ID+":";
16+
17+
static {
18+
for(int i = 0; i < CATEGORYS.length; i++)
19+
CATEGORYS[i] = STRING_PREFIX+"category."+CATEGORYS[i];
20+
}
21+
1022
private final Configuration config;
11-
private static final String STRING_PREFIX = "config.";
1223
private int startEntityID = -1;
24+
/////////////////
25+
// Dragons Cat
26+
/////////////////
27+
private boolean verticalDragonRiding = true;
1328
private boolean canOwnMultipleDragons = true;
29+
private boolean feedHealsDragons = true;
30+
private String forcedTameable = "";
31+
/////////////////
32+
// Testing Cat
33+
/////////////////
1434
private boolean debugMode = false;
1535
private boolean experimentalMode = false;
36+
/////////////////
37+
// BG2 Cat
38+
/////////////////
39+
private boolean useBG2 = true;
40+
private boolean useBg2Daggers = true;
41+
private boolean useBg2ForWarhammer = true;
42+
43+
private HashMap<Class<? extends EntityLivingBase>, Boolean> forcedTameCache = new HashMap<Class<? extends EntityLivingBase>, Boolean>();
1644

1745
public Config(FMLPreInitializationEvent evt) {
18-
config = new Configuration(evt.getSuggestedConfigurationFile());
46+
this.config = new Configuration(evt.getSuggestedConfigurationFile());
1947

20-
syncConfig();
48+
this.syncConfig();
2149
}
2250

23-
public void syncConfig() {
24-
25-
startEntityID = config.getInt("DragonEntityID", Configuration.CATEGORY_GENERAL, startEntityID, -1, 255,
26-
"Overrides the entity ID for dragons to fix problems with manual IDs from other mods.\nSet to -1 for automatic assignment (recommended).\nWarning: wrong values may cause crashes and loss of data! Must restart Minecraft to take effect",
27-
getLocalKey("startEntityID"));
28-
canOwnMultipleDragons = config.getBoolean("MultiDragonOwnership", Configuration.CATEGORY_GENERAL, true,
29-
"Provides ability to own multiple dragons", getLocalKey("multiDragonOwnership"));
30-
debugMode = config.getBoolean("DebugMode", Configuration.CATEGORY_GENERAL, false,
31-
"Enable debug mode, developers recommended", getLocalKey("debugMode"));
32-
experimentalMode = config.getBoolean("ExperimentalMode", Configuration.CATEGORY_GENERAL, false,
33-
"Enable an experimental version (warning: may be less stable)", getLocalKey("experimentalMode"));
34-
35-
if (config.hasChanged())
36-
config.save();
51+
public Configuration getConfig() {
52+
return this.config;
3753
}
3854

3955
protected String getLocalKey(String ending) {
40-
return Utils.getLocalString(STRING_PREFIX + ending);
56+
return STRING_PREFIX + ending;
4157
}
42-
43-
public Configuration getConfig() {
44-
return config;
58+
59+
public boolean getVerticalDragonRiding() {
60+
return this.verticalDragonRiding;
4561
}
4662

47-
public int getStartEntityID() {
48-
return startEntityID;
63+
public boolean getMultiDragonOwnership() {
64+
return this.canOwnMultipleDragons;
4965
}
5066

51-
public boolean getMultiDragonOwnership() {
52-
return canOwnMultipleDragons;
67+
public int getStartEntityID() {
68+
return this.startEntityID;
5369
}
5470

5571
public boolean isDebugMode() {
56-
return debugMode;
72+
return this.debugMode;
5773
}
5874

5975
public boolean isExperimental() {
60-
return experimentalMode;
76+
return this.experimentalMode;
77+
}
78+
79+
public boolean canUseBg2() {
80+
return this.useBG2;
81+
}
82+
83+
public boolean useBg2Daggers() {
84+
return this.useBg2Daggers;
85+
}
86+
87+
public boolean useBg2ForWarhammer() {
88+
return this.useBg2ForWarhammer;
89+
}
90+
91+
public boolean isTameable(EntityTameableFlying e) {
92+
Boolean result = this.forcedTameCache.get(e.getClass());
93+
if(result != null) return result.booleanValue();
94+
String name = EntityList.getEntityString(e).replace(" ", "").replace(HTTYMDMod.ID+".", "").toLowerCase();
95+
String checkStr = this.forcedTameable.replace(" ", "").toLowerCase();
96+
result = checkStr.indexOf(name) != -1;
97+
this.forcedTameCache.put(e.getClass(), result);
98+
return result;
99+
}
100+
101+
public boolean canFeedHeal() {
102+
return this.feedHealsDragons;
103+
}
104+
105+
public void syncConfig() {
106+
107+
/*this.startEntityID = this.config.getInt("DragonEntityID", Configuration.CATEGORY_GENERAL, this.startEntityID, -1, 255,
108+
"Overrides the entity ID for dragons to fix problems with manual IDs from other mods.\nSet to -1 for automatic assignment (recommended).\nWarning: wrong values may cause crashes and loss of data! Must restart Minecraft to take effect",
109+
this.getLocalKey("startEntityID"));*/
110+
111+
String cat = Configuration.CATEGORY_GENERAL;
112+
113+
cat = CATEGORYS[0];
114+
this.verticalDragonRiding = this.config.getBoolean("Vertical Riding", cat, true, "Enable the vertical climb when riding by looking up or down", this.getLocalKey("verticalDragonRiding"));
115+
this.canOwnMultipleDragons = this.config.getBoolean("Multi Ownership", cat, true, "Provides ability to own multiple dragons", this.getLocalKey("multiOwn"));
116+
this.feedHealsDragons = this.config.getBoolean("Feed Heals", cat, true, "Determines whether feeding dragons heals them", this.getLocalKey("feedHeals"));
117+
this.forcedTameable = this.config.getString("Force Tameable", cat, "", "A list of entity names which are forced to be tameable (seperator may be anything ths isn't a space)", this.getLocalKey("forcedTameable"));
118+
119+
cat = CATEGORYS[1];
120+
this.debugMode = this.config.getBoolean("Debug Mode", cat, false, "Enable debug mode, developers recommended", this.getLocalKey("debugMode"));
121+
this.experimentalMode = this.config.getBoolean("Experimental Mode", cat, false, "Enable an experimental version (warning: may be less stable)", this.getLocalKey("experimentalMode"));
122+
123+
cat = CATEGORYS[2];
124+
this.useBG2 = this.config.getBoolean("Use BG2", cat, true, "Enables the use of BG2 (if installed)", this.getLocalKey("useBG2"));
125+
this.useBg2Daggers = this.config.getBoolean("Use BG2 Daggers", cat, true, "Allows you to specifiy whether to use Battlegear 2 to replace HTTYMD dagger behavior with BG2 dagger behavior", this.getLocalKey("useBg2Daggers"));
126+
this.useBg2ForWarhammer = this.config.getBoolean("Use BG2 Warhammers", cat, true, "Allows you to specifiy whether to use Battlegear 2 for HTTYMD Warhammers", this.getLocalKey("useBg2ForWarhammer"));
127+
128+
if (this.config.hasChanged())
129+
this.config.save();
61130
}
62131
}

0 commit comments

Comments
 (0)