-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update to occultism recipe runtime conditions
- Loading branch information
1 parent
90d1413
commit c81bb43
Showing
20 changed files
with
335 additions
and
76 deletions.
There are no files selected for viewing
This file contains 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 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 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
36 changes: 0 additions & 36 deletions
36
src/main/java/com/klikli_dev/occultism_kubejs/EntityToSacrificeWrapper.java
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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
2 changes: 1 addition & 1 deletion
2
...sm_kubejs/EntityToSacrificeComponent.java → ...component/EntityToSacrificeComponent.java
This file contains 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
20 changes: 20 additions & 0 deletions
20
src/main/java/com/klikli_dev/occultism_kubejs/component/EntityToSacrificeWrapper.java
This file contains 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,20 @@ | ||
package com.klikli_dev.occultism_kubejs.component; | ||
|
||
import com.klikli_dev.occultism.crafting.recipe.RitualRecipe; | ||
import dev.latvian.mods.kubejs.typings.Info; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.entity.EntityType; | ||
|
||
@Info("Various entity to sacrifice related helper methods") | ||
public interface EntityToSacrificeWrapper { | ||
|
||
@Info("Returns an RitualRecipe.EntityToSacrifice of the input") | ||
static RitualRecipe.EntityToSacrifice of(RitualRecipe.EntityToSacrifice in) { | ||
return in; | ||
} | ||
|
||
@Info("Returns an RitualRecipe.EntityToSacrifice of the input") | ||
static RitualRecipe.EntityToSacrifice of(TagKey<EntityType<?>> tag, String displayName) { | ||
return new RitualRecipe.EntityToSacrifice(tag, displayName); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/klikli_dev/occultism_kubejs/component/EntityToSummonSettingsComponent.java
This file contains 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,40 @@ | ||
package com.klikli_dev.occultism_kubejs.component; | ||
|
||
import com.google.gson.JsonObject; | ||
import com.klikli_dev.occultism.crafting.recipe.RitualRecipe; | ||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.JsonOps; | ||
import dev.latvian.mods.kubejs.recipe.KubeRecipe; | ||
import dev.latvian.mods.kubejs.recipe.component.RecipeComponent; | ||
import dev.latvian.mods.rhino.Context; | ||
import dev.latvian.mods.rhino.type.TypeInfo; | ||
|
||
public record EntityToSummonSettingsComponent(String name, Codec<RitualRecipe.EntityToSummonSettings> codec) implements RecipeComponent<RitualRecipe.EntityToSummonSettings> { | ||
public static final RecipeComponent<RitualRecipe.EntityToSummonSettings> ENTITY_TO_SUMMON_SETTINGS = new EntityToSummonSettingsComponent("occultism:entity_to_summon_settings", RitualRecipe.EntityToSummonSettings.CODEC); | ||
|
||
public static final TypeInfo TYPE_INFO = TypeInfo.of(EntityToSummonSettingsComponent.class); | ||
|
||
@Override | ||
public TypeInfo typeInfo() { | ||
return TYPE_INFO; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.name; | ||
} | ||
|
||
@Override | ||
public RitualRecipe.EntityToSummonSettings wrap(Context cx, KubeRecipe recipe, Object from) { | ||
if (from instanceof RitualRecipe.EntityToSummonSettings k) { | ||
return k; | ||
} | ||
|
||
if (from instanceof JsonObject json) { | ||
return this.codec.decode(JsonOps.INSTANCE, json).result().orElseThrow().getFirst(); | ||
} | ||
|
||
return (RitualRecipe.EntityToSummonSettings) cx.jsToJava(from, this.typeInfo()); | ||
|
||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/klikli_dev/occultism_kubejs/component/EntityToSummonSettingsWrapper.java
This file contains 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,48 @@ | ||
package com.klikli_dev.occultism_kubejs.component; | ||
|
||
import com.klikli_dev.occultism.crafting.recipe.RitualRecipe; | ||
import dev.latvian.mods.kubejs.typings.Info; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.entity.EntityType; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Info("Various entity to sacrifice related helper methods") | ||
public interface EntityToSummonSettingsWrapper { | ||
|
||
@Info("Returns an RitualRecipe.EntityToSummonSettings of the input") | ||
static RitualRecipe.EntityToSummonSettings of(RitualRecipe.EntityToSummonSettings in) { | ||
return in; | ||
} | ||
|
||
@Info("Returns an RitualRecipe.EntityToSummonSettings of the input") | ||
static RitualRecipe.EntityToSummonSettings of(@Nullable EntityType<?> entityToSummon, | ||
@Nullable TagKey<EntityType<?>> entityTagToSummon, | ||
@Nullable CompoundTag entityNbt, | ||
@Nullable ResourceLocation spiritJobType, | ||
int spiritMaxAge, | ||
int summonNumber) { | ||
return new RitualRecipe.EntityToSummonSettings(entityToSummon, entityTagToSummon, entityNbt, spiritJobType, spiritMaxAge, summonNumber); | ||
} | ||
|
||
@Info("Returns an RitualRecipe.EntityToSummonSettings of the input") | ||
static RitualRecipe.EntityToSummonSettings ofEntity(@Nullable EntityType<?> entityToSummon, | ||
@Nullable CompoundTag entityNbt, | ||
@Nullable ResourceLocation spiritJobType, | ||
int spiritMaxAge, | ||
int summonNumber | ||
) { | ||
return new RitualRecipe.EntityToSummonSettings(entityToSummon, null, entityNbt, spiritJobType, spiritMaxAge, summonNumber); | ||
} | ||
|
||
@Info("Returns an RitualRecipe.EntityToSummonSettings of the input") | ||
static RitualRecipe.EntityToSummonSettings ofTag(@Nullable TagKey<EntityType<?>> entityTagToSummon, | ||
@Nullable CompoundTag entityNbt, | ||
@Nullable ResourceLocation spiritJobType, | ||
int spiritMaxAge, | ||
int summonNumber | ||
) { | ||
return new RitualRecipe.EntityToSummonSettings(null, entityTagToSummon, entityNbt, spiritJobType, spiritMaxAge, summonNumber); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/klikli_dev/occultism_kubejs/component/IsInBiomeConditionWrapper.java
This file contains 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,20 @@ | ||
package com.klikli_dev.occultism_kubejs.component; | ||
|
||
import com.klikli_dev.occultism.crafting.recipe.conditionextension.condition.IsInBiomeCondition; | ||
import dev.latvian.mods.kubejs.typings.Info; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.world.level.biome.Biome; | ||
|
||
@Info("Various IsInBiomeCondition related helper methods") | ||
public interface IsInBiomeConditionWrapper { | ||
|
||
@Info("Returns an IsInBiomeCondition of the input") | ||
static IsInBiomeCondition of(IsInBiomeCondition in) { | ||
return in; | ||
} | ||
|
||
@Info("Returns an IsInBiomeCondition of the input") | ||
static IsInBiomeCondition of(Holder<Biome> biome) { | ||
return new IsInBiomeCondition(biome); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...cultism_kubejs/RecipeResultComponent.java → ...bejs/component/RecipeResultComponent.java
This file contains 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 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
Oops, something went wrong.