mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-01 05:48:53 -05:00
Recipe Book is workingggg!!!!!!!!!
This commit is contained in:
1 parent
7effc4c853
commit
c3d482c78f
9 files changed
+53
-15
No files matched your search
@@ -28,6 +28,7 @@ public class RecipeBookSettingsMixin {
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void cobblemon$init(CallbackInfo ci) {
|
||||
states.put(RecipeBookType.valueOf("COOKING_POT"), new RecipeBookSettings.TypeSettings(true, true));
|
||||
states.put(RecipeBookType.valueOf("BREWING_STAND"), new RecipeBookSettings.TypeSettings(true, true));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,6 +41,7 @@ public class RecipeBookTypeMixin {
|
||||
private static void cobblemon$addRecipeBookType(CallbackInfo ci) {
|
||||
ArrayList<RecipeBookType> types = new ArrayList<>(List.of($VALUES));
|
||||
types.add(cobblemon$createBookType("COOKING_POT", $VALUES.length));
|
||||
types.add(cobblemon$createBookType("BREWING_STAND", $VALUES.length + 1));
|
||||
$VALUES = types.toArray(RecipeBookType[]::new);
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.CobblemonRecipeCategories;
|
||||
import com.cobblemon.mod.common.item.crafting.CookingPotBookCategory;
|
||||
import com.cobblemon.mod.common.item.crafting.CookingPotRecipe;
|
||||
import com.cobblemon.mod.common.item.crafting.CookingPotShapelessRecipe;
|
||||
import com.cobblemon.mod.common.item.crafting.brewingstand.BrewingStandBookCategory;
|
||||
import com.cobblemon.mod.common.item.crafting.brewingstand.BrewingStandRecipe;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -62,7 +63,13 @@ public abstract class ClientRecipeBookMixin {
|
||||
}
|
||||
cir.setReturnValue(var7);
|
||||
} else if (recipe2 instanceof BrewingStandRecipe) {
|
||||
cir.setReturnValue(CobblemonRecipeCategories.BREWING_STAND.toVanillaCategory());
|
||||
BrewingStandBookCategory category = ((BrewingStandRecipe) recipe2).getCategory();
|
||||
RecipeBookCategories var7;
|
||||
switch (category) {
|
||||
case BrewingStandBookCategory.FOODS -> var7 = CobblemonRecipeCategories.BREWING_STAND_FOOD.toVanillaCategory();
|
||||
default -> throw new MatchException(null, null);
|
||||
}
|
||||
cir.setReturnValue(var7);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -55,6 +55,7 @@ public class RecipeBookCategoriesMixin {
|
||||
types.add(cobblemon$createCategory("COOKING_POT_BAITS", $VALUES.length + 3, new ItemStack(CobblemonItems.PERSIM_BERRY)));
|
||||
types.add(cobblemon$createCategory("COOKING_POT_MISC", $VALUES.length + 4, new ItemStack(CobblemonItems.MIRROR_HERB)));
|
||||
types.add(cobblemon$createCategory("BREWING_STAND", $VALUES.length + 5, new ItemStack(Items.BREWING_STAND)));
|
||||
types.add(cobblemon$createCategory("BREWING_STAND_FOOD", $VALUES.length + 6, new ItemStack(CobblemonItems.HP_UP)));
|
||||
$VALUES = types.toArray(RecipeBookCategories[]::new);
|
||||
}
|
||||
|
||||
@@ -71,7 +72,8 @@ public class RecipeBookCategoriesMixin {
|
||||
return;
|
||||
} else if (recipeBookType == RecipeBookType.valueOf("BREWING_STAND")) {
|
||||
List var10000 = ImmutableList.of(
|
||||
CobblemonRecipeCategories.BREWING_STAND.toVanillaCategory());
|
||||
CobblemonRecipeCategories.BREWING_STAND.toVanillaCategory(),
|
||||
CobblemonRecipeCategories.BREWING_STAND_FOOD.toVanillaCategory());
|
||||
cir.setReturnValue(var10000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ enum class CobblemonRecipeCategories {
|
||||
COOKING_POT_MEDICINES("COOKING_POT_MEDICINES"),
|
||||
COOKING_POT_BAITS("COOKING_POT_BAITS"),
|
||||
COOKING_POT_MISC("COOKING_POT_MISC"),
|
||||
BREWING_STAND("BREWING_STAND");
|
||||
BREWING_STAND("BREWING_STAND"),
|
||||
BREWING_STAND_FOOD("BREWING_STAND_FOOD"),;
|
||||
|
||||
companion object {
|
||||
val customAggregateCategories: Map<RecipeBookCategories, List<RecipeBookCategories>> = mapOf(
|
||||
@@ -25,7 +26,7 @@ enum class CobblemonRecipeCategories {
|
||||
COOKING_POT_FOODS.toVanillaCategory(), COOKING_POT_MISC.toVanillaCategory(), COOKING_POT_MEDICINES.toVanillaCategory(), COOKING_POT_BAITS.toVanillaCategory()
|
||||
),
|
||||
BREWING_STAND.toVanillaCategory() to listOf(
|
||||
BREWING_STAND.toVanillaCategory()
|
||||
BREWING_STAND_FOOD.toVanillaCategory()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
+31
-6
@@ -131,15 +131,21 @@ class BrewingStandMenu(
|
||||
fun getFuel(): Int = brewingStandData[1]
|
||||
fun getBrewingTicks(): Int = brewingStandData[0]
|
||||
override fun fillCraftSlotsStackedContents(itemHelper: StackedContents) {
|
||||
TODO("Not yet implemented")
|
||||
for (i in 0 until brewingStand.containerSize) {
|
||||
val itemStack = brewingStand.getItem(i)
|
||||
if (itemStack.isEmpty) continue
|
||||
itemHelper.accountSimpleStack(itemStack)
|
||||
}
|
||||
}
|
||||
|
||||
override fun clearCraftingContent() {
|
||||
TODO("Not yet implemented")
|
||||
for (i in 0 until brewingStand.containerSize) {
|
||||
brewingStand.setItem(i, ItemStack.EMPTY)
|
||||
}
|
||||
}
|
||||
|
||||
override fun recipeMatches(recipe: RecipeHolder<BrewingStandRecipe?>): Boolean {
|
||||
TODO("Not yet implemented")
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getResultSlotIndex(): Int {
|
||||
@@ -163,7 +169,12 @@ class BrewingStandMenu(
|
||||
}
|
||||
|
||||
override fun shouldMoveToInventory(slotIndex: Int): Boolean {
|
||||
TODO("Not yet implemented")
|
||||
return when (slotIndex) {
|
||||
0, 1, 2 -> false
|
||||
3 -> true
|
||||
4 -> false
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
override fun slotChanged(
|
||||
@@ -171,7 +182,11 @@ class BrewingStandMenu(
|
||||
dataSlotIndex: Int,
|
||||
stack: ItemStack
|
||||
) {
|
||||
TODO("Not yet implemented")
|
||||
if (dataSlotIndex == 3) {
|
||||
resultContainer.setItem(0, stack)
|
||||
} else if (dataSlotIndex == 4) {
|
||||
ingredientSlot.set(stack)
|
||||
}
|
||||
}
|
||||
|
||||
override fun dataChanged(
|
||||
@@ -179,7 +194,17 @@ class BrewingStandMenu(
|
||||
dataSlotIndex: Int,
|
||||
value: Int
|
||||
) {
|
||||
TODO("Not yet implemented")
|
||||
if (dataSlotIndex == 0) {
|
||||
val brewTime = value
|
||||
if (brewTime == 0) {
|
||||
resultContainer.setItem(0, ItemStack.EMPTY)
|
||||
}
|
||||
} else if (dataSlotIndex == 1) {
|
||||
val fuel = value
|
||||
if (fuel == 0) {
|
||||
resultContainer.setItem(0, ItemStack.EMPTY)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PotionSlot(container: Container, slot: Int, x: Int, y: Int) : Slot(container, slot, x, y) {
|
||||
|
||||
+1
-4
@@ -21,10 +21,7 @@ enum class BrewingStandBookCategory(
|
||||
private val categoryName: String,
|
||||
private val categoryId: Int
|
||||
) : StringRepresentable {
|
||||
FOODS("foods", 0),
|
||||
MEDICINES("medicines", 1),
|
||||
BAITS("baits", 2),
|
||||
MISC("misc", 3);
|
||||
FOODS("foods", 0);
|
||||
|
||||
override fun getSerializedName() = categoryName
|
||||
private fun getCategoryId() = categoryId
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ class BrewingStandRecipe(
|
||||
companion object {
|
||||
val CODEC: MapCodec<BrewingStandRecipe> = RecordCodecBuilder.mapCodec { instance ->
|
||||
instance.group(
|
||||
BrewingStandBookCategory.Companion.CODEC.fieldOf("category").orElse(BrewingStandBookCategory.MISC)
|
||||
BrewingStandBookCategory.Companion.CODEC.fieldOf("category").orElse(BrewingStandBookCategory.FOODS)
|
||||
.forGetter { recipe -> recipe.category }
|
||||
).apply(instance, ::BrewingStandRecipe)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"type": "cobblemon:brewing_stand",
|
||||
"category": "foods"
|
||||
}
|
||||
Reference in new issue
Block a user