Skip to content

Commit

Permalink
+ more functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
bioastroiner committed Jan 1, 2024
1 parent 04c31ba commit b85b8eb
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,55 @@ public void setContent(String write){
}

static {
ScriptProvider.POST_PREINIT.hint_content = "";
ScriptProvider.POST_PREINIT.hint_content = "import mods.gregtech.oredict.IMaterialFactory;\n" +
"\n" +
"var factory = IMaterialFactory.create(3023,\"ExampeliumExamplie\",\"Exampellies Examplium\");\n" +
"\n" +
"factory.addIdenticalNames(\"Exampelate Exampelittium\",\"Example Example Example\",\"Exxxxxxx\");\n" +
"factory.setRGBa(0xFFFFFF); // white\n" +
"//factory.setRGBa(255,255,255,255);\n" +
"//factory.stealLooks(<material:copper>);\n" +
"//factory.steal(<material:iron>);\n" +
"factory.setTexture(\"DULL\");\n" +
"factory.qual(5,8,8); // or call .speed, .duribility and .qual alone\n" +
"factory.heat(3000); // in Kelvin\n" +
"//factory.hide();\n" +
"\n" +
"factory.formula(\"ExAmPl\"); //.tooltip\n" +
"\n" +
"// automatically gets set to GTTweaker but you can change it\n" +
"factory.setOriginalMod(\"GTTweaker\");\n" +
"\n" +
"/* other useful builtin Methods\n" +
"IMaterialFactory stealStatsElement(IMaterial aStatsToCopy);\n" +
"IMaterialFactory setDensity(double aGramPerCubicCentimeter);\n" +
"IMaterialFactory addSourceOf(IMaterial... aMaterials);\n" +
"IMaterialFactory hide();\n" +
"IMaterialFactory hide(boolean aHidden);\n" +
"\n" +
"// use TD.Tags data, use commands to get a list of all possible tags you can choose from\n" +
"IMaterialFactory.tag(String tag);\n" +
"IMaterialFactory.add(String tag);\n" +
"\n" +
"// sets visible names\n" +
"IMaterialFactory visName(String... aOreDictNames);\n" +
"IMaterialFactory visPrefix(String... aOreDictNames);\n" +
"IMaterialFactory visDefault(IMaterial... aMaterials);\n" +
"\n" +
"IMaterialFactory lens(byte aColor);\n" +
"IMaterialFactory alloyCentrifuge();\n" +
"IMaterialFactory alloyElectrolyzer();\n" +
"IMaterialFactory alloySimple();\n" +
"IMaterialFactory alloyCentrifuge(long aMelt);\n" +
"IMaterialFactory alloyElectrolyzer(long aMelt);\n" +
"IMaterialFactory alloySimple(long aMelt);\n" +
"IMaterialFactory alloyCentrifuge(long aMelt, long aBoil);\n" +
"IMaterialFactory alloyElectrolyzer(long aMelt, long aBoil);\n" +
"IMaterialFactory alloySimple(long aMelt, long aBoil);\n" +
"IMaterialFactory alloyCentrifuge(IMaterial aHeat);\n" +
"IMaterialFactory alloyElectrolyzer(IMaterial aHeat);\n" +
"IMaterialFactory alloySimple(IMaterial aHeat);\n" +
"*/";
ScriptProvider.AFTER_INIT.hint_content = "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public interface IMaterialFactory {
@ZenMethod
IMaterialFactory setOriginalMod(String modID, String name);

@ZenMethod
IMaterialFactory formula(String formula);

@ZenMethod
IMaterialFactory tooltip(String tooltip);

@ZenMethod
IMaterialFactory addIdenticalNames(String... names);

Expand All @@ -37,6 +43,12 @@ public interface IMaterialFactory {
@ZenMethod
IMaterialFactory add(String... tags);

@ZenMethod
IMaterialFactory tag(String tag);

@ZenMethod
IMaterialFactory tag(String... tags);

@ZenMethod
IMaterialFactory qual(float aSpeed, long aDurability, long aQuality);

Expand Down Expand Up @@ -91,6 +103,9 @@ public interface IMaterialFactory {
@ZenMethod
IMaterialFactory visPrefix(String... aOreDictNames);

@ZenMethod
IMaterialFactory visPrefix(IPrefix... aPrefixes);

@ZenMethod
IMaterialFactory visDefault(IMaterial... aMaterials);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import stanhebben.zenscript.annotations.ZenMethod;

public interface IPrefix {

@ZenGetter
String oreDictName();
@ZenGetter
long amount();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import minetweaker.MineTweakerAPI;
import mods.bio.gttweaker.api.mods.gregtech.oredict.IMaterial;
import mods.bio.gttweaker.api.mods.gregtech.oredict.IMaterialFactory;
import mods.bio.gttweaker.api.mods.gregtech.oredict.IPrefix;
import mods.bio.gttweaker.core.GTTweaker;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import stanhebben.zenscript.annotations.NotNull;
Expand Down Expand Up @@ -38,6 +40,7 @@ public CTMaterialFactory(short id, @Optional @NotNull String oreDictName, @Optio
MineTweakerAPI.apply(new BuildMaterialAction(id, oreDictName, localName));
}
backing_material = OreDictMaterial.MATERIAL_ARRAY[id];
backing_material.setOriginalMod(GTTweaker.MOD_DATA);
}

public CTMaterialFactory(IMaterial material) {
Expand All @@ -59,6 +62,17 @@ public IMaterialFactory setOriginalMod(String modID, String name) {
return this;
}

@Override
public IMaterialFactory formula(String formula) {
return tooltip(formula);
}

@Override
public IMaterialFactory tooltip(String tooltip) {
backing_material.tooltip(tooltip);
return this;
}

@Override
@ZenMethod
public IMaterialFactory addIdenticalNames(String... names) {
Expand Down Expand Up @@ -124,6 +138,16 @@ public IMaterialFactory add(String... tags) {
return ret;
}

@Override
public IMaterialFactory tag(String tag) {
return add(tag);
}

@Override
public IMaterialFactory tag(String... tags) {
return add(tags);
}

@Override
@ZenMethod
public IMaterialFactory qual(float aSpeed, long aDurability, long aQuality) {
Expand Down Expand Up @@ -248,6 +272,11 @@ public IMaterialFactory visPrefix(String... aOreDictNames) {
return this;
}

@Override
public IMaterialFactory visPrefix(IPrefix... aPrefixes) {
return visPrefix(Arrays.stream(aPrefixes).map(IPrefix::oreDictName).toArray(String[]::new));
}

@Override
@ZenMethod
public IMaterialFactory visDefault(IMaterial... aMaterials) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public int hashCode() {

/* GETTERS */

@Override
public String oreDictName() {
return prefix_internal.mNameInternal;
}

/**
* @return gets a qualified amount on terms of U, its a float TODO we need to work on Unit System and make it a bit unified
*/
Expand Down

0 comments on commit b85b8eb

Please sign in to comment.