Skip to content

Commit

Permalink
feat: update to work with modonomicon 1.60
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Feb 28, 2024
1 parent 761b12d commit 56de821
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 34 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ smartbrainlib_version=1.13
smartbrainlib_version_range=[1.13,)
almost_unified_version=0.5.0
almost_unified_version_range=[0.5.0,)
modonomicon_version=1.56.0
modonomicon_version_range=[1.52.0,)
theurgy_version=1.13.0
theurgy_version_range=[1.11.0,)
modonomicon_version=1.60.0
modonomicon_version_range=[1.60.0,)
theurgy_version=1.17.1
theurgy_version_range=[1.17.1,)
per_viam_invenire_version_range=[0.1.57,)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import com.google.gson.JsonObject;
import com.klikli_dev.modonomicon.book.BookTextHolder;
import com.klikli_dev.modonomicon.book.conditions.BookCondition;
import com.klikli_dev.modonomicon.book.conditions.BookNoneCondition;
import com.klikli_dev.modonomicon.book.page.BookRecipePage;
import com.klikli_dev.occultism.crafting.recipe.RitualRecipe;
import com.klikli_dev.occultism.integration.modonomicon.OccultismModonomiconConstants;
Expand All @@ -20,20 +22,24 @@
import net.minecraft.world.level.Level;

public class BookRitualRecipePage extends BookRecipePage<RitualRecipe> {
public BookRitualRecipePage(BookTextHolder title1, ResourceLocation recipeId1, BookTextHolder title2, ResourceLocation recipeId2, BookTextHolder text, String anchor) {
super(OccultismRecipes.RITUAL_TYPE.get(), title1, recipeId1, title2, recipeId2, text, anchor);
public BookRitualRecipePage(BookTextHolder title1, ResourceLocation recipeId1, BookTextHolder title2, ResourceLocation recipeId2, BookTextHolder text, String anchor, BookCondition condition) {
super(OccultismRecipes.RITUAL_TYPE.get(), title1, recipeId1, title2, recipeId2, text, anchor, condition);
}

public static BookRitualRecipePage fromJson(JsonObject json) {
var common = BookRecipePage.commonFromJson(json);
var anchor = GsonHelper.getAsString(json, "anchor", "");
return new BookRitualRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor);
var condition = json.has("condition")
? BookCondition.fromJson(json.getAsJsonObject("condition"))
: new BookNoneCondition();
return new BookRitualRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor, condition);
}

public static BookRitualRecipePage fromNetwork(FriendlyByteBuf buffer) {
var common = BookRecipePage.commonFromNetwork(buffer);
var anchor = buffer.readUtf();
return new BookRitualRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor);
var condition = BookCondition.fromNetwork(buffer);
return new BookRitualRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor, condition);
}

@Override
Expand All @@ -49,10 +55,4 @@ protected ItemStack getRecipeOutput(Level level, RecipeHolder<RitualRecipe> reci

return recipe.value().getRitualDummy();
}

@Override
public void toNetwork(FriendlyByteBuf buffer) {
super.toNetwork(buffer);
buffer.writeUtf(this.anchor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.klikli_dev.occultism.integration.modonomicon.pages;

import com.klikli_dev.modonomicon.api.datagen.book.condition.BookConditionModel;
import com.klikli_dev.modonomicon.api.datagen.book.page.BookRecipePageModel;
import com.klikli_dev.occultism.integration.modonomicon.OccultismModonomiconConstants;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import com.google.gson.JsonObject;
import com.klikli_dev.modonomicon.book.BookTextHolder;
import com.klikli_dev.modonomicon.book.conditions.BookCondition;
import com.klikli_dev.modonomicon.book.conditions.BookNoneCondition;
import com.klikli_dev.modonomicon.book.page.BookProcessingRecipePage;
import com.klikli_dev.modonomicon.book.page.BookRecipePage;
import com.klikli_dev.occultism.crafting.recipe.SpiritFireRecipe;
Expand All @@ -18,30 +20,28 @@
import net.minecraft.util.GsonHelper;

public class BookSpiritFireRecipePage extends BookProcessingRecipePage<SpiritFireRecipe> {
public BookSpiritFireRecipePage(BookTextHolder title1, ResourceLocation recipeId1, BookTextHolder title2, ResourceLocation recipeId2, BookTextHolder text, String anchor) {
super(OccultismRecipes.SPIRIT_FIRE_TYPE.get(), title1, recipeId1, title2, recipeId2, text, anchor);
public BookSpiritFireRecipePage(BookTextHolder title1, ResourceLocation recipeId1, BookTextHolder title2, ResourceLocation recipeId2, BookTextHolder text, String anchor, BookCondition condition) {
super(OccultismRecipes.SPIRIT_FIRE_TYPE.get(), title1, recipeId1, title2, recipeId2, text, anchor, condition);
}

public static BookSpiritFireRecipePage fromJson(JsonObject json) {
var common = BookRecipePage.commonFromJson(json);
var anchor = GsonHelper.getAsString(json, "anchor", "");
return new BookSpiritFireRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor);
var condition = json.has("condition")
? BookCondition.fromJson(json.getAsJsonObject("condition"))
: new BookNoneCondition();
return new BookSpiritFireRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor, condition);
}

public static BookSpiritFireRecipePage fromNetwork(FriendlyByteBuf buffer) {
var common = BookRecipePage.commonFromNetwork(buffer);
var anchor = buffer.readUtf();
return new BookSpiritFireRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor);
var condition = BookCondition.fromNetwork(buffer);
return new BookSpiritFireRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor, condition);
}

@Override
public ResourceLocation getType() {
return OccultismModonomiconConstants.Page.SPIRIT_FIRE_RECIPE;
}

@Override
public void toNetwork(FriendlyByteBuf buffer) {
super.toNetwork(buffer);
buffer.writeUtf(this.anchor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.klikli_dev.occultism.integration.modonomicon.pages;

import com.klikli_dev.modonomicon.api.datagen.book.condition.BookConditionModel;
import com.klikli_dev.modonomicon.api.datagen.book.page.BookRecipePageModel;
import com.klikli_dev.occultism.integration.modonomicon.OccultismModonomiconConstants;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import com.google.gson.JsonObject;
import com.klikli_dev.modonomicon.book.BookTextHolder;
import com.klikli_dev.modonomicon.book.conditions.BookCondition;
import com.klikli_dev.modonomicon.book.conditions.BookNoneCondition;
import com.klikli_dev.modonomicon.book.page.BookProcessingRecipePage;
import com.klikli_dev.modonomicon.book.page.BookRecipePage;
import com.klikli_dev.occultism.crafting.recipe.SpiritTradeRecipe;
Expand All @@ -18,30 +20,28 @@
import net.minecraft.util.GsonHelper;

public class BookSpiritTradeRecipePage extends BookProcessingRecipePage<SpiritTradeRecipe> {
public BookSpiritTradeRecipePage(BookTextHolder title1, ResourceLocation recipeId1, BookTextHolder title2, ResourceLocation recipeId2, BookTextHolder text, String anchor) {
super(OccultismRecipes.SPIRIT_TRADE_TYPE.get(), title1, recipeId1, title2, recipeId2, text, anchor);
public BookSpiritTradeRecipePage(BookTextHolder title1, ResourceLocation recipeId1, BookTextHolder title2, ResourceLocation recipeId2, BookTextHolder text, String anchor, BookCondition condition) {
super(OccultismRecipes.SPIRIT_TRADE_TYPE.get(), title1, recipeId1, title2, recipeId2, text, anchor, condition);
}

public static BookSpiritTradeRecipePage fromJson(JsonObject json) {
var common = BookRecipePage.commonFromJson(json);
var anchor = GsonHelper.getAsString(json, "anchor", "");
return new BookSpiritTradeRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor);
var condition = json.has("condition")
? BookCondition.fromJson(json.getAsJsonObject("condition"))
: new BookNoneCondition();
return new BookSpiritTradeRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor, condition);
}

public static BookSpiritTradeRecipePage fromNetwork(FriendlyByteBuf buffer) {
var common = BookRecipePage.commonFromNetwork(buffer);
var anchor = buffer.readUtf();
return new BookSpiritTradeRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor);
var condition = BookCondition.fromNetwork(buffer);
return new BookSpiritTradeRecipePage(common.title1(), common.recipeId1(), common.title2(), common.recipeId2(), common.text(), anchor, condition);
}

@Override
public ResourceLocation getType() {
return OccultismModonomiconConstants.Page.SPIRIT_TRADE_RECIPE;
}

@Override
public void toNetwork(FriendlyByteBuf buffer) {
super.toNetwork(buffer);
buffer.writeUtf(this.anchor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.klikli_dev.occultism.integration.modonomicon.pages;

import com.klikli_dev.modonomicon.api.datagen.book.condition.BookConditionModel;
import com.klikli_dev.modonomicon.api.datagen.book.page.BookRecipePageModel;
import com.klikli_dev.occultism.integration.modonomicon.OccultismModonomiconConstants;
import org.jetbrains.annotations.NotNull;
Expand Down

0 comments on commit 56de821

Please sign in to comment.