Skip to content

Commit

Permalink
再修
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuqi154 committed Sep 23, 2024
1 parent e4b03f8 commit 87f466e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,33 @@ public void assemble(BlockState state, Level level, BlockPos pos, RandomSource r
NonNullList<ItemStack> stacks = this.handler.getStacks();
Debug.getLogger().debug("Assembling");
Debug.getLogger().debug("stacks: "+stacks);
ItemStack result = GeneralPrescriptProcessApplier.result(state, stacks.subList(0,8), level);
ItemStack result = GeneralPrescriptProcessApplier.result(state, new ArrayList<>(stacks.subList(0,8)), level);
if(result.isEmpty()) {
Debug.getLogger().debug("result: "+result);
List<ItemStack> inputs = new ArrayList<>(stacks.subList(0, 8));
inputs.removeAll(List.of(ItemStack.EMPTY));
//inputs.forEach(itemStack -> itemStack.setCount(1));
Debug.getLogger().debug("inputs: "+inputs);
result = GeneralPrescriptProcessRecipe.ass(inputs, WGItem.SOUP.toStack());
Debug.getLogger().debug("real_result: "+result);
}
if(result!=null) {
if (result != null) {
stacks.set(9, result);
Debug.getLogger().debug("stacks: "+stacks);
Debug.getLogger().debug("set: " + stacks.get(9));
stacks.forEach(itemStack -> {
int index = stacks.indexOf(itemStack);
if (index != 9)
stacks.set(index, ItemStack.EMPTY);
});
Debug.getLogger().debug("stacks: "+stacks);
for (int i = 0; i < 9; i++) {
ItemStack stack = stacks.get(i).copy();
if (!stack.isEmpty()) {
Debug.getLogger().debug("stack: "+stack);
Debug.getLogger().debug("c: "+stack.getCount());
stack.setCount(stack.getCount()-1);
stacks.set(i,stack);
Debug.getLogger().debug("nc: "+stack.getCount());
Debug.getLogger().debug("nstack: "+stack);
}
}
Debug.getLogger().debug("out_stacks: "+stacks);
this.handler.setStacks(stacks);
}
}
Expand Down
104 changes: 31 additions & 73 deletions src/main/java/org/hiedacamellia/whispergrove/registers/WGItem.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.hiedacamellia.whispergrove.registers;

import net.minecraft.core.component.DataComponents;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.*;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;
import org.hiedacamellia.whispergrove.WhisperGrove;
import org.hiedacamellia.whispergrove.core.entry.BaseItem;
import org.hiedacamellia.whispergrove.core.entry.builder.BaseItemBuilder;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.Map;
Expand All @@ -20,104 +20,75 @@ public class WGItem {

//黄芪 Radix Astragali
//huang qi
public static final DeferredItem<BaseItem> MILKVETCH = ITEMS.register("milkvetch",
() -> new BaseItemBuilder()
.lung(0,2,0)
.properties(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());
public static final DeferredItem<BaseItem> MILKVETCH = ITEMS.register("milkvetch", () -> new BaseItemBuilder().lung(0,2,0).properties(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());

//阳起石 actinolite
//yang qi shi
public static final DeferredItem<BaseItem> ACTINOLITE = ITEMS.register("actinolite",
() -> new BaseItemBuilder().kidney(0,2,0)
.properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());
public static final DeferredItem<BaseItem> ACTINOLITE = ITEMS.register("actinolite", () -> new BaseItemBuilder().kidney(0,2,0).properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());

//紫石英 Fluorite
//zi shi ying
public static final DeferredItem<BaseItem> FLUORITE = ITEMS.register("fluorite",
() -> new BaseItemBuilder().heart(0,4,0).lung(0,4,0).kidney(0,4,0)
.properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());
public static final DeferredItem<BaseItem> FLUORITE = ITEMS.register("fluorite", () -> new BaseItemBuilder().heart(0,4,0).lung(0,4,0).kidney(0,4,0).properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());

//桂枝 Cassia Twig
//gui zhi
public static final DeferredItem<BaseItem> CASSIA_TWIG = ITEMS.register("cassia_twig", () -> new BaseItemBuilder().build());

//玫瑰花 Rose
//mei gui hua
public static final DeferredItem<BaseItem> ROSE = ITEMS.register("rose", () -> new BaseItemBuilder()
.liver(0,2,0)
.spleen(0,2,0).build());
public static final DeferredItem<BaseItem> ROSE = ITEMS.register("rose", () -> new BaseItemBuilder().liver(0,2,0).spleen(0,2,0).build());

//熟地黄 Roasted Rehmannia
//shu di huang
public static final DeferredItem<BaseItem> ROASTED_REHMANNIA = ITEMS.register("roasted_rehmannia", () -> new BaseItemBuilder()
.kidney(0,2,0).liver(0,2,0).build());
public static final DeferredItem<BaseItem> ROASTED_REHMANNIA = ITEMS.register("roasted_rehmannia", () -> new BaseItemBuilder().kidney(0,2,0).liver(0,2,0).build());

//海螵蛸 Roasted Cuttleflsh Bone
//hai piao xiao
public static final DeferredItem<BaseItem> ROASTED_CUTTLEFLSH_BONE = ITEMS.register("roasted_cuttleflsh_bone",
() -> new BaseItemBuilder().spleen(0,4,0).kidney(0,4,0)
.properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());
public static final DeferredItem<BaseItem> ROASTED_CUTTLEFLSH_BONE = ITEMS.register("roasted_cuttleflsh_bone", () -> new BaseItemBuilder().spleen(0,4,0).kidney(0,4,0).properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());

//附子 Prepared Common Monkshood Daughter Root
//fu zi
public static final DeferredItem<BaseItem> MONKSHOOD = ITEMS.register("monkshood", () -> new BaseItemBuilder().build());

//丁香 Clove
//ding xiang
public static final DeferredItem<BaseItem> CLOVE = ITEMS.register("clove", () -> new BaseItemBuilder()
.spleen(0,6,0).lung(0,6,0).kidney(0,6,0).build());
public static final DeferredItem<BaseItem> CLOVE = ITEMS.register("clove", () -> new BaseItemBuilder().spleen(0,6,0).lung(0,6,0).kidney(0,6,0).build());

//五味子 Schisandra chinensis
//wu wei zi
public static final DeferredItem<BaseItem> SCHISANDRA_CHINENSIS = ITEMS.register("schisandra_chinensis",
() -> new BaseItemBuilder().heart(0,4,0).lung(0,4,0).kidney(0,4,0)
.properties(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());
public static final DeferredItem<BaseItem> SCHISANDRA_CHINENSIS = ITEMS.register("schisandra_chinensis", () -> new BaseItemBuilder().heart(0,4,0).lung(0,4,0).kidney(0,4,0).properties(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());

//炙甘草 Roasted Liquorice Root
//zhi gan cao
public static final DeferredItem<BaseItem> PREPARED_LICORICE = ITEMS.register("prepared_licorice",
() -> new BaseItemBuilder().heart(0,4,0).spleen(0,4,0).lung(0,4,0)
.properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());
public static final DeferredItem<BaseItem> PREPARED_LICORICE = ITEMS.register("prepared_licorice", () -> new BaseItemBuilder().heart(0,4,0).spleen(0,4,0).lung(0,4,0).properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());

//人参 Panax ginseng
//ren shen
public static final DeferredItem<BaseItem> GINSENG = ITEMS.register("ginseng",
() -> new BaseItemBuilder().spleen(0,8,0)
.lung(0,8,0).heart(0,8,0).kidney(0,8,0)
.properties(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());
public static final DeferredItem<BaseItem> GINSENG = ITEMS.register("ginseng", () -> new BaseItemBuilder().properties(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());

//茯苓 Poria
//fu ling
public static final DeferredItem<BaseItem> PORIA_COCOS = ITEMS.register("poria_cocos",
() -> new BaseItemBuilder().spleen(0,0,1).properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());
public static final DeferredItem<BaseItem> PORIA_COCOS = ITEMS.register("poria_cocos", () -> new BaseItemBuilder().spleen(0,0,1).properties(new Item.Properties().rarity(Rarity.UNCOMMON)).build());

//麦芽 Malt
//mai ya
public static final DeferredItem<BaseItem> MALT = ITEMS.register("malt", () -> new BaseItemBuilder()
.spleen(0,0,1).build());
public static final DeferredItem<BaseItem> MALT = ITEMS.register("malt", () -> new BaseItemBuilder().spleen(0,0,1).build());

//阿胶 Donkey-hide Glue
//e jiao
public static final DeferredItem<BaseItem> DONKEY_HIDE_GELATIN = ITEMS.register("donkey_hide_gelatin",
() -> new BaseItemBuilder().lung(0,0,1).liver(0,0,1).kidney(0,0,1).build());
public static final DeferredItem<BaseItem> DONKEY_HIDE_GELATIN = ITEMS.register("donkey_hide_gelatin", () -> new BaseItemBuilder().lung(0,0,1).liver(0,0,1).kidney(0,0,1).build());

//煅龙骨 Fossilizid
//duan long gu
public static final DeferredItem<BaseItem> CALCINED_DRAGON_BONE = ITEMS.register("calcined_dragon_bone",
() -> new BaseItemBuilder().heart(0,0,1).liver(0,0,1).kidney(0,0,1).build());
public static final DeferredItem<BaseItem> CALCINED_DRAGON_BONE = ITEMS.register("calcined_dragon_bone", () -> new BaseItemBuilder().heart(0,0,1).liver(0,0,1).kidney(0,0,1).build());

//合欢皮 Albizzia Bark
//he huan pi
public static final DeferredItem<BaseItem> ALBIZIA_BARK = ITEMS.register("albizia_bark",
() -> new BaseItemBuilder().heart(0,0,1).liver(0,0,1).spleen(0,0,1).build());
public static final DeferredItem<BaseItem> ALBIZIA_BARK = ITEMS.register("albizia_bark", () -> new BaseItemBuilder().heart(0,0,1).liver(0,0,1).spleen(0,0,1).build());

//竹叶 bamboo leaf
//zhu ye
public static final DeferredItem<BaseItem> BAMBOO_LEAF = ITEMS.register("bamboo_leaf",
() -> new BaseItemBuilder().heart(2,0,0).build());
public static final DeferredItem<BaseItem> BAMBOO_LEAF = ITEMS.register("bamboo_leaf", () -> new BaseItemBuilder().heart(2,0,0).build());

//龙胆草 Gentian
//long dan cao
Expand All @@ -130,48 +101,39 @@ public class WGItem {

//竹茹 Bamboo Shavings
//zhu gu
public static final DeferredItem<BaseItem> BAMBOO_SHAVINGS = ITEMS.register("bamboo_shavings",
() -> new BaseItemBuilder().heart(4,0,0).lung(4,0,0).build());
public static final DeferredItem<BaseItem> BAMBOO_SHAVINGS = ITEMS.register("bamboo_shavings", () -> new BaseItemBuilder().heart(4,0,0).lung(4,0,0).build());

// //昆布 kelp
// //kun bu
// public static final DeferredItem<BaseItem> SEA_TANGLE = ITEMS.register("sea_tangle", () -> new BaseItemBuilder().build());

//寒水石 Gypsum
//han shui shi
public static final DeferredItem<BaseItem> GYPSUM_RUBRUM = ITEMS.register("gypsum_rubrum",
() -> new BaseItemBuilder().heart(6,0,0).kidney(6,0,0).build());
public static final DeferredItem<BaseItem> GYPSUM_RUBRUM = ITEMS.register("gypsum_rubrum", () -> new BaseItemBuilder().heart(6,0,0).kidney(6,0,0).build());

//龟板胶 Glue of Tortoise Plastron
//gui ban jiao
public static final DeferredItem<BaseItem> TORTOISE_PLASTRON_GLUE = ITEMS.register("tortoise_plastron_glue",
() -> new BaseItemBuilder().liver(4,0,0).kidney(4,0,0).build());
public static final DeferredItem<BaseItem> TORTOISE_PLASTRON_GLUE = ITEMS.register("tortoise_plastron_glue", () -> new BaseItemBuilder().liver(4,0,0).kidney(4,0,0).build());

//生地黄 Drying Rehmannia Root
//sheng di huang
public static final DeferredItem<BaseItem> DRYING_REHMANNIA = ITEMS.register("drying_rehmannia", () -> new BaseItemBuilder()
.heart(6,0,0).liver(6,0,0).kidney(6,0,0).build());
public static final DeferredItem<BaseItem> DRYING_REHMANNIA = ITEMS.register("drying_rehmannia", () -> new BaseItemBuilder().heart(6,0,0).liver(6,0,0).kidney(6,0,0).build());

//生甘草 Drying Licorice Root
//sheng gan cao
public static final DeferredItem<BaseItem> DRYING_LICORICE = ITEMS.register("drying_licorice",
() -> new BaseItemBuilder().heart(0,0,1).spleen(0,0,1).lung(0,0,1).build());
public static final DeferredItem<BaseItem> DRYING_LICORICE = ITEMS.register("drying_licorice", () -> new BaseItemBuilder().heart(0,0,1).spleen(0,0,1).lung(0,0,1).build());

//黄芪切片 Sliced Radix Astragali
//Sliced huang qi
public static final DeferredItem<BaseItem> SLICED_MILKVETCH = ITEMS.register("sliced_milkvetch",
() -> new BaseItemBuilder().properties(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());
public static final DeferredItem<BaseItem> SLICED_MILKVETCH = ITEMS.register("sliced_milkvetch", () -> new BaseItemBuilder().properties(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());

//桂枝切片 Sliced Cassia Twig
//Sliced Gui Zhi
public static final DeferredItem<BaseItem> SLICED_CASSIA_TWIG = ITEMS.register("sliced_cassia_twig", () -> new BaseItemBuilder()
.heart(0,6,0).lung(0,6,0).build());
public static final DeferredItem<BaseItem> SLICED_CASSIA_TWIG = ITEMS.register("sliced_cassia_twig", () -> new BaseItemBuilder().heart(0,6,0).lung(0,6,0).build());

//桂枝皮 Cassia Twig Bark
//Gui zhi pi
public static final DeferredItem<BaseItem> CASSIA_TWIG_BARK = ITEMS.register("cassia_twig_bark", () -> new BaseItemBuilder()
.heart(0,16,0).spleen(0,16,0).liver(0,16,0).kidney(0,16,0).build());
public static final DeferredItem<BaseItem> CASSIA_TWIG_BARK = ITEMS.register("cassia_twig_bark", () -> new BaseItemBuilder().heart(0,16,0).spleen(0,16,0).liver(0,16,0).kidney(0,16,0).build());

//地黄 Rehmannia Root
//di huang
Expand All @@ -182,30 +144,26 @@ public class WGItem {

//人参切片 Sliced Panax ginseng
//Sliced ren shen
public static final DeferredItem<BaseItem> SLICED_GINSENG = ITEMS.register("sliced_ginseng",
() -> new BaseItemBuilder().properties(new Item.Properties().food(new FoodProperties.Builder()
.nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());
public static final DeferredItem<BaseItem> SLICED_GINSENG = ITEMS.register("sliced_ginseng", () -> new BaseItemBuilder().spleen(0,8,0).lung(0,8,0).heart(0,8,0).kidney(0,8,0).properties(new Item.Properties().food(new FoodProperties.Builder().nutrition(2).saturationModifier(0.8f).alwaysEdible().build())).build());

//龙胆草切片 SLiced Gentian
//sliced long dan cao
public static final DeferredItem<BaseItem> SLICED_GENTIAN = ITEMS.register("sliced_gentian",
() -> new BaseItemBuilder().liver(8,0,0).build());
public static final DeferredItem<BaseItem> SLICED_GENTIAN = ITEMS.register("sliced_gentian", () -> new BaseItemBuilder().liver(8,0,0).build());

//墨鱼骨 Cuttleflsh Bone
//mo yu gu
public static final DeferredItem<BaseItem> CUTTLEBONE = ITEMS.register("cuttlebone", () -> new BaseItemBuilder().build());

//熟附片 Roasted Prepared Common Monkshood Daughter Root
//shu fu pian
public static final DeferredItem<BaseItem> SHU_FU_PIAN = ITEMS.register("roasted_monkshood", () -> new BaseItemBuilder()
.heart(0,12,0).kidney(0,12,0).spleen(0,12,0).build());
public static final DeferredItem<BaseItem> SHU_FU_PIAN = ITEMS.register("roasted_monkshood", () -> new BaseItemBuilder().heart(0,12,0).kidney(0,12,0).spleen(0,12,0).build());

//骨头碎片 bone fragment
//bone fragment
public static final DeferredItem<BaseItem> BONE_FRAGMENT = ITEMS.register("bone_fragment", () -> new BaseItemBuilder().build());


public static final DeferredItem<BaseItem> SOUP = ITEMS.register("soup", () -> new BaseItemBuilder().build());
public static final DeferredItem<BaseItem> SOUP = ITEMS.register("soup", () -> new BaseItem(new Item.Properties().food(new FoodProperties.Builder().nutrition(4).saturationModifier(1.5f).alwaysEdible().build())){@Override public @NotNull UseAnim getUseAnimation(@NotNull ItemStack stack) {return UseAnim.DRINK;}});

public static final String[] CROP_NAMES = {"rehmannia", "licorice", "milkvetch", "gentian", "ginseng" };

Expand Down

0 comments on commit 87f466e

Please sign in to comment.