Skip to content

Commit

Permalink
add ArsNouveau recipe doc, remove some old recipe doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZZank committed Jul 27, 2024
1 parent 728a57a commit b48757b
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 309 deletions.
64 changes: 64 additions & 0 deletions src/main/java/zzzank/probejs/docs/recipes/ArsNouveau.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package zzzank.probejs.docs.recipes;

import dev.latvian.kubejs.recipe.mod.ArsNouveauEnchantingApparatusRecipeJS;
import dev.latvian.kubejs.recipe.mod.ArsNouveauEnchantmentRecipeJS;
import dev.latvian.kubejs.recipe.mod.ArsNouveauGlyphPressRecipeJS;
import me.shedaniel.architectury.platform.Platform;
import net.minecraft.resources.ResourceLocation;
import zzzank.probejs.docs.Primitives;
import zzzank.probejs.lang.typescript.ScriptDump;
import zzzank.probejs.lang.typescript.code.type.Types;
import zzzank.probejs.lang.typescript.code.type.js.JSLambdaType;
import zzzank.probejs.plugin.ProbeJSPlugin;

import java.util.Map;

import static zzzank.probejs.docs.recipes.BuiltinRecipeDocs.recipeFn;
import static zzzank.probejs.docs.recipes.KubeJS.INGR;
import static zzzank.probejs.docs.recipes.KubeJS.STACK;
import static zzzank.probejs.docs.recipes.Minecraft.INGR_N;

/**
* @author ZZZank
*/
class ArsNouveau extends ProbeJSPlugin {

@Override
public void addPredefinedRecipeDoc(ScriptDump scriptDump, Map<ResourceLocation, JSLambdaType> predefined) {
if (!Platform.isModLoaded("ars_nouveau")) {
return;
}
predefined.put(
rl("enchanting_apparatus"),
recipeFn()
.param("output", STACK)
.param("reagent", INGR)
.param("inputs", INGR_N)
.returnType(Types.type(ArsNouveauEnchantingApparatusRecipeJS.class))
.build()
);
predefined.put(
rl("enchantment"),
recipeFn()
.param("enchantment", Types.primitive("Special.Enchantment"))
.param("level", Primitives.INTEGER)
.param("inputs", INGR_N)
.param("mana", Primitives.INTEGER)
.returnType(Types.type(ArsNouveauEnchantmentRecipeJS.class))
.build()
);
predefined.put(
rl("glyph_recipe"),
recipeFn()
.param("output", STACK)
.param("input", STACK)
.param("tier", Types.STRING)
.returnType(Types.type(ArsNouveauGlyphPressRecipeJS.class))
.build()
);
}

static ResourceLocation rl(String path) {
return new ResourceLocation("ars_nouveau", path);
}
}
14 changes: 13 additions & 1 deletion src/main/java/zzzank/probejs/docs/recipes/BuiltinRecipeDocs.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package zzzank.probejs.docs.recipes;

import lombok.val;
import net.minecraft.resources.ResourceLocation;
import zzzank.probejs.lang.typescript.ScriptDump;
import zzzank.probejs.lang.typescript.code.type.TSClassType;
import zzzank.probejs.lang.typescript.code.type.Types;
import zzzank.probejs.lang.typescript.code.type.js.JSLambdaType;
import zzzank.probejs.plugin.ProbeJSPlugin;
Expand All @@ -17,8 +19,9 @@
*/
public class BuiltinRecipeDocs extends ProbeJSPlugin {

public final List<Supplier<ProbeJSPlugin>> ALL = new ArrayList<>(Arrays.asList(
public static final List<Supplier<ProbeJSPlugin>> ALL = new ArrayList<>(Arrays.asList(
Minecraft::new,
ArsNouveau::new,
Thermal::new,
KubeJS::new
));
Expand All @@ -27,6 +30,15 @@ public static JSLambdaType.Builder recipeFn() {
return Types.lambda().method();
}

public static TSClassType classType(String className) {
try {
val c = Class.forName(className);
return Types.type(c);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}

@Override
public void addPredefinedRecipeDoc(ScriptDump scriptDump, Map<ResourceLocation, JSLambdaType> predefined) {
for (Supplier<ProbeJSPlugin> supplier : ALL) {
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/zzzank/probejs/docs/recipes/Thermal.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraftforge.fml.ModList;
import zzzank.probejs.lang.typescript.ScriptDump;
import zzzank.probejs.lang.typescript.code.type.BaseType;
import zzzank.probejs.lang.typescript.code.type.TSClassType;
import zzzank.probejs.lang.typescript.code.type.Types;
import zzzank.probejs.lang.typescript.code.type.js.JSLambdaType;
import zzzank.probejs.plugin.ProbeJSPlugin;
Expand All @@ -14,6 +13,7 @@

import static zzzank.probejs.docs.recipes.BuiltinRecipeDocs.recipeFn;
import static zzzank.probejs.docs.recipes.KubeJS.*;
import static zzzank.probejs.docs.recipes.BuiltinRecipeDocs.classType;

/**
* @author ZZZank
Expand All @@ -37,15 +37,6 @@ public static JSLambdaType fuelStyleRecipe() {
.build();
}

public static TSClassType classType(String className) {
try {
val c = Class.forName(className);
return Types.type(c);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}

private static ResourceLocation rl(String path) {
return new ResourceLocation("thermal", path);
}
Expand Down
18 changes: 0 additions & 18 deletions src/main/resources/docs/ars_nouveau.d.ts

This file was deleted.

95 changes: 1 addition & 94 deletions src/main/resources/docs/general.d.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,4 @@

/**
* @target dev.latvian.kubejs.recipe.ingredientaction.IngredientActionFilter
* @assign number
* @assign dev.latvian.kubejs.item.ingredient.IngredientJS
* @assign {index: number, item: dev.latvian.kubejs.item.ingredient.IngredientJS}
*/
class IngredientActionFilter {
}

/**
* @target net.minecraft.core.Vec3i
* @assign [number, number, number]
*/
class Vec3i {
}

/**
* @target net.minecraft.item.ItemStack
* @assign Internal.ItemStackJS_
*/
class ItemStack {
}

/**
* @target com.google.gson.JsonObject
* @assign {}
*/
class JsonObject {
}

/**
* @target dev.latvian.kubejs.item.ItemStackJS
* @assign net.minecraft.item.Item
* @assign `${number}x ${string}`
* @assign object
*/
class ItemStackJS {
}

/**
* @target dev.latvian.kubejs.item.ingredient.IngredientJS
Expand Down Expand Up @@ -85,13 +47,6 @@ class EntityJS {
getServer(): net.minecraft.server.MinecraftServer
}

/**
* @target net.minecraft.util.ResourceLocation
* @assign string
*/
class ResourceLocation {
}

/**
* @target net.minecraft.nbt.CompoundTag
* @assign string
Expand All @@ -100,20 +55,6 @@ class ResourceLocation {
class CompoundTag {
}

/**
* @target java.util.Map
* @assign {[key in K]: V}
*/
class Map {
}

/**
* @target dev.latvian.kubejs.text.Text
* @assign string
*/
class Text {
}

/**
* @target java.lang.Class
* Represents the base Java Class
Expand Down Expand Up @@ -158,38 +99,4 @@ class CompoundNBT {
*/
class AttachedData {
[x: string]: any;
}

/**
* @target dev.latvian.kubejs.fluid.FluidStackJS
* @assign net.minecraft.fluid.Fluid
*/
class FluidStackJS {
}

/**
* @target dev.latvian.mods.rhino.mod.util.color.Color
* @assign string
*/
class Color {
}

/**
* @target dev.latvian.kubejs.recipe.filter.RecipeFilter
* @assign dev.latvian.kubejs.recipe.filter.RecipeFilter[]
* @assign {exact?: boolean, not?: Internal.RecipeFilter_, or?: Internal.RecipeFilter_[], id?: string | RegExp, type?: string, group?: string, mod?: string, input?: Internal.IngredientJS_, output?: Internal.IngredientJS_}
*/
class RecipeFilter {
}

/**
* @target dev.latvian.kubejs.block.BlockStatePredicate
* @assign dev.latvian.kubejs.block.BlockStatePredicate[]
* @assign {or?: dev.latvian.kubejs.block.BlockStatePredicate[], not?: dev.latvian.kubejs.block.BlockStatePredicate[]}
* @assign net.minecraft.block.Block
* @assign net.minecraft.block.BlockState
* @assign `#${Tag.block}`
* @assign RegExp
*/
class BlockStatePredicate {
}
}
Loading

0 comments on commit b48757b

Please sign in to comment.