Improve CraftTweaker documentation
This commit is contained in:
parent
980db3cd60
commit
20849b4a11
20 changed files with 70 additions and 0 deletions
30
build.gradle
30
build.gradle
|
@ -295,6 +295,7 @@ build.dependsOn signJar
|
|||
|
||||
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'
|
||||
|
||||
import com.google.gson.JsonArray
|
||||
import groovy.util.XmlSlurper
|
||||
import org.apache.commons.io.FileUtils
|
||||
|
||||
|
@ -356,6 +357,9 @@ task mtDocGen {
|
|||
for(annotation in annoations.toList()){
|
||||
if(annotation.asJsonObject.get("type").asString.equals("METHOD") && annotation.asJsonObject.get("name").asString.equals("Lstanhebben/zenscript/annotations/ZenMethod;")){
|
||||
def method = sanitsiseMethodName(annotation.asJsonObject.get("target").asString)
|
||||
if(hasZenDoc(annotation, annoations)){
|
||||
method = getZenDoc(annotation, annoations)
|
||||
}
|
||||
def zen_name = getZenMetName(clzz)
|
||||
builder.append(zen_name + "." + method)
|
||||
builder.append("\n")
|
||||
|
@ -371,6 +375,32 @@ task mtDocGen {
|
|||
}
|
||||
}
|
||||
|
||||
boolean hasZenDoc(JsonObject currentAnnotation, JsonArray annoations){
|
||||
for(annotation in annoations.toList()){
|
||||
if(annotation.asJsonObject.get("target").asString.equals(currentAnnotation.get("target").asString) && annotation.asJsonObject.get("name").asString.equals("Ltechreborn/compat/crafttweaker/ZenDocumentation;")){
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
String getZenDoc(JsonObject currentAnnotation, JsonArray annoations){
|
||||
for(annotation in annoations.toList()){
|
||||
if(annotation.asJsonObject.get("target").asString.equals(currentAnnotation.get("target").asString) && annotation.asJsonObject.get("name").asString.equals("Ltechreborn/compat/crafttweaker/ZenDocumentation;")){
|
||||
def methodName = annotation.asJsonObject.get("target").asString.split("\\(")[0]
|
||||
def methodParams = annotation.asJsonObject.get("value").asJsonObject.get("value").asString
|
||||
if(!methodParams.startsWith("(")){
|
||||
methodParams = "(" + methodParams
|
||||
}
|
||||
if(!methodParams.endsWith(")")){
|
||||
methodParams = methodParams + ")"
|
||||
}
|
||||
return methodName + methodParams
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//Gets the zenMethod class name from the class json object
|
||||
String getZenMetName(JsonObject jsonObject){
|
||||
def annoations = jsonObject.get("annotations").asJsonArray
|
||||
|
|
|
@ -53,11 +53,13 @@ public class CTAlloySmelter extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ public class CTAssemblingMachine extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ public class CTBlastFurnace extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ public class CTCentrifuge extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ public class CTChemicalReactor extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -49,11 +49,13 @@ public class CTCompressor extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -52,11 +52,13 @@ public class CTDistillationTower extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -49,11 +49,13 @@ public class CTExtractor extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -64,26 +64,31 @@ public class CTFluidGen {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("ILiquidStack fluid")
|
||||
public static void removeThermalFluid(ILiquidStack fluid) {
|
||||
removeFluid(EFluidGenerator.THERMAL, fluid);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("ILiquidStack fluid")
|
||||
public static void removeGasFluid(ILiquidStack fluid) {
|
||||
removeFluid(EFluidGenerator.GAS, fluid);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("ILiquidStack fluid")
|
||||
public static void removeSemiFluid(ILiquidStack fluid) {
|
||||
removeFluid(EFluidGenerator.SEMIFLUID, fluid);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("ILiquidStack fluid")
|
||||
public static void removeDieselFluid(ILiquidStack fluid) {
|
||||
removeFluid(EFluidGenerator.DIESEL, fluid);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("ILiquidStack fluid")
|
||||
public static void removePlasmaFluid(ILiquidStack fluid) {
|
||||
removeFluid(EFluidGenerator.PLASMA, fluid);
|
||||
}
|
||||
|
|
|
@ -50,16 +50,19 @@ public class CTFusionReactor {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeTopInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveTopInput(iIngredient));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeBottomInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveBottomInput(iIngredient));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output)));
|
||||
}
|
||||
|
|
|
@ -50,11 +50,13 @@ public class CTGrinder extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ public class CTImplosionCompressor extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ public class CTIndustrialElectrolyzer extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ public class CTIndustrialGrinder extends CTGeneric {
|
|||
* @param iIngredient Recipe input for which we should remove recipe
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) { CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName())); }
|
||||
|
||||
/**
|
||||
|
@ -99,6 +100,7 @@ public class CTIndustrialGrinder extends CTGeneric {
|
|||
* @param output Recipe output for which we should remove recipe
|
||||
*/
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -72,11 +72,13 @@ public class CTIndustrialSawmill extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public class CTRollingMachine {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
List<ResourceLocation> toRemove = new ArrayList<>();
|
||||
for (Map.Entry<ResourceLocation, IRecipe> recipe : RollingMachineRecipe.instance.getRecipeList().entrySet()) {
|
||||
|
|
|
@ -43,11 +43,13 @@ import techreborn.compat.crafttweaker.CTGeneric.Remove;
|
|||
public class CTScrapbox {
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient input")
|
||||
public static void addScrapboxDrop(IIngredient input) {
|
||||
RecipeHandler.addRecipe(new ScrapboxRecipe(CraftTweakerMC.getItemStack(input), 20, 2));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -46,11 +46,13 @@ public class CTVacuumFreezer extends CTGeneric {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IIngredient iIngredient")
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
CraftTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("IItemStack output")
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class RecipeSettings {
|
|||
}
|
||||
|
||||
@ZenMethod
|
||||
@ZenDocumentation("boolean useOreDict")
|
||||
public void setUseOreDict(boolean useOreDict){
|
||||
baseRecipe.setOreDict(useOreDict);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue