just some cleanup of arrays

This commit is contained in:
yrsegal@gmail.com 2022-04-21 22:52:11 -04:00
parent 8f72b2b604
commit b43088b15e
5 changed files with 199 additions and 223 deletions

View file

@ -34,7 +34,6 @@ import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ComparatorBlock;
import net.minecraft.world.level.block.RepeaterBlock;
@ -55,37 +54,12 @@ public class RegisterClientStuff {
@SubscribeEvent
public static void init(FMLClientSetupEvent evt) {
evt.enqueueWork(() -> {
for (DataHolderItem dataHolder : new DataHolderItem[]{ HexItems.FOCUS.get(), HexItems.SPELLBOOK.get() }) {
ItemProperties.register((Item) dataHolder, ItemFocus.DATATYPE_PRED,
(stack, level, holder, holderID) -> {
var datum = dataHolder.readDatumTag(stack);
if (datum != null) {
var typename = datum.getAllKeys().iterator().next();
return switch (typename) {
case SpellDatum.TAG_ENTITY -> 1f;
case SpellDatum.TAG_DOUBLE -> 2f;
case SpellDatum.TAG_VEC3 -> 3f;
case SpellDatum.TAG_WIDGET -> 4f;
case SpellDatum.TAG_LIST -> 5f;
case SpellDatum.TAG_PATTERN -> 6f;
default -> 0f; // uh oh
};
}
return 0f;
});
ItemProperties.register((Item) dataHolder, ItemFocus.SEALED_PRED,
(stack, level, holder, holderID) -> dataHolder.canWrite(stack, SpellDatum.make(Widget.NULL)) ? 0f : 1f);
}
for (ItemPackagedSpell packager : new ItemPackagedSpell[]{
HexItems.CYPHER.get(),
HexItems.TRINKET.get(),
HexItems.ARTIFACT.get(),
}) {
ItemProperties.register(packager, ItemPackagedSpell.HAS_PATTERNS_PRED,
(stack, level, holder, holderID) ->
packager.getPatterns(stack) != null ? 1f : 0f
);
}
registerDataHolderOverrides(HexItems.FOCUS.get());
registerDataHolderOverrides(HexItems.SPELLBOOK.get());
registerPackagedSpellOverrides(HexItems.CYPHER.get());
registerPackagedSpellOverrides(HexItems.TRINKET.get());
registerPackagedSpellOverrides(HexItems.ARTIFACT.get());
ItemProperties.register(HexItems.BATTERY.get(), ItemManaBattery.MANA_PREDICATE,
(stack, level, holder, holderID) -> {
@ -105,49 +79,26 @@ public class RegisterClientStuff {
ItemProperties.register(HexItems.SLATE.get(), ItemSlate.WRITTEN_PRED,
(stack, level, holder, holderID) -> ItemSlate.hasPattern(stack) ? 1f : 0f);
var wands = new Item[]{
HexItems.WAND_OAK.get(),
HexItems.WAND_BIRCH.get(),
HexItems.WAND_SPRUCE.get(),
HexItems.WAND_JUNGLE.get(),
HexItems.WAND_DARK_OAK.get(),
HexItems.WAND_ACACIA.get(),
HexItems.WAND_AKASHIC.get(),
};
for (var wand : wands) {
ItemProperties.register(wand, ItemWand.FUNNY_LEVEL_PREDICATE,
(stack, level, holder, holderID) -> {
var name = stack.getHoverName().getString().toLowerCase(Locale.ROOT);
if (name.contains("old")) {
return 1f;
} else if (name.contains("wand of the forest")) {
return 2f;
} else {
return 0f;
}
});
}
registerWandOverrides(HexItems.WAND_OAK.get());
registerWandOverrides(HexItems.WAND_BIRCH.get());
registerWandOverrides(HexItems.WAND_SPRUCE.get());
registerWandOverrides(HexItems.WAND_JUNGLE.get());
registerWandOverrides(HexItems.WAND_DARK_OAK.get());
registerWandOverrides(HexItems.WAND_ACACIA.get());
registerWandOverrides(HexItems.WAND_AKASHIC.get());
HexTooltips.init();
});
for (var cutout : new Block[]{
HexBlocks.CONJURED_LIGHT.get(),
HexBlocks.CONJURED_BLOCK.get(),
HexBlocks.AKASHIC_DOOR.get(),
HexBlocks.AKASHIC_TRAPDOOR.get(),
HexBlocks.SCONCE.get(),
}) {
ItemBlockRenderTypes.setRenderLayer(cutout, RenderType.cutout());
}
ItemBlockRenderTypes.setRenderLayer(HexBlocks.CONJURED_LIGHT.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.CONJURED_BLOCK.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.AKASHIC_DOOR.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.AKASHIC_TRAPDOOR.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.SCONCE.get(), RenderType.cutout());
for (var mipped : new Block[]{
HexBlocks.AKASHIC_LEAVES1.get(),
HexBlocks.AKASHIC_LEAVES2.get(),
HexBlocks.AKASHIC_LEAVES3.get(),
}) {
ItemBlockRenderTypes.setRenderLayer(mipped, RenderType.cutoutMipped());
}
ItemBlockRenderTypes.setRenderLayer(HexBlocks.AKASHIC_LEAVES1.get(), RenderType.cutoutMipped());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.AKASHIC_LEAVES2.get(), RenderType.cutoutMipped());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.AKASHIC_LEAVES3.get(), RenderType.cutoutMipped());
ItemBlockRenderTypes.setRenderLayer(HexBlocks.AKASHIC_RECORD.get(), RenderType.translucent());
@ -235,6 +186,49 @@ public class RegisterClientStuff {
.withStyle(ChatFormatting.YELLOW))));
}
private static void registerDataHolderOverrides(DataHolderItem item) {
ItemProperties.register((Item) item, ItemFocus.DATATYPE_PRED,
(stack, level, holder, holderID) -> {
var datum = item.readDatumTag(stack);
if (datum != null) {
var typename = datum.getAllKeys().iterator().next();
return switch (typename) {
case SpellDatum.TAG_ENTITY -> 1f;
case SpellDatum.TAG_DOUBLE -> 2f;
case SpellDatum.TAG_VEC3 -> 3f;
case SpellDatum.TAG_WIDGET -> 4f;
case SpellDatum.TAG_LIST -> 5f;
case SpellDatum.TAG_PATTERN -> 6f;
default -> 0f; // uh oh
};
}
return 0f;
});
ItemProperties.register((Item) item, ItemFocus.SEALED_PRED,
(stack, level, holder, holderID) -> item.canWrite(stack, SpellDatum.make(Widget.NULL)) ? 0f : 1f);
}
private static void registerPackagedSpellOverrides(ItemPackagedSpell item) {
ItemProperties.register(item, ItemPackagedSpell.HAS_PATTERNS_PRED,
(stack, level, holder, holderID) ->
item.getPatterns(stack) != null ? 1f : 0f
);
}
private static void registerWandOverrides(ItemWand item) {
ItemProperties.register(item, ItemWand.FUNNY_LEVEL_PREDICATE,
(stack, level, holder, holderID) -> {
var name = stack.getHoverName().getString().toLowerCase(Locale.ROOT);
if (name.contains("old")) {
return 1f;
} else if (name.contains("wand of the forest")) {
return 2f;
} else {
return 0f;
}
});
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void registerParticles(ParticleFactoryRegisterEvent event) {
// does whatever a particle can

View file

@ -14,41 +14,41 @@ import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSi
import net.minecraft.world.level.levelgen.feature.foliageplacers.FancyFoliagePlacer;
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
import net.minecraft.world.level.levelgen.feature.trunkplacers.FancyTrunkPlacer;
import org.apache.commons.compress.utils.Lists;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.OptionalInt;
import java.util.Random;
public class AkashicTreeGrower extends AbstractTreeGrower {
public static final AkashicTreeGrower INSTANCE = new AkashicTreeGrower();
public static final Holder<ConfiguredFeature<TreeConfiguration, ?>>[] GROWERS;
public static final List<Holder<ConfiguredFeature<TreeConfiguration, ?>>> GROWERS = Lists.newArrayList();
static {
var leaves = new Block[]{
HexBlocks.AKASHIC_LEAVES1.get(),
HexBlocks.AKASHIC_LEAVES2.get(),
HexBlocks.AKASHIC_LEAVES3.get()
};
GROWERS = new Holder[leaves.length];
for (int i = 0; i < leaves.length; i++) {
GROWERS[i] = FeatureUtils.register(HexMod.MOD_ID + ":akashic_tree" + (i + 1), Feature.TREE,
new TreeConfiguration.TreeConfigurationBuilder(
BlockStateProvider.simple(HexBlocks.AKASHIC_LOG.get()),
// baseHeight, heightRandA, heightRandB
new FancyTrunkPlacer(5, 5, 3),
BlockStateProvider.simple(leaves[i]),
// radius, offset, height
new FancyFoliagePlacer(ConstantInt.of(1), ConstantInt.of(5), 5),
// limit, lower size, upper size, minclippedheight
new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(6))
).build());
}
GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES1.get(), "1"));
GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES2.get(), "2"));
GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES3.get(), "3"));
}
private static Holder<ConfiguredFeature<TreeConfiguration, ?>> buildTreeFeature(Block leaves, String name) {
return FeatureUtils.register(HexMod.MOD_ID + ":akashic_tree" + name, Feature.TREE,
new TreeConfiguration.TreeConfigurationBuilder(
BlockStateProvider.simple(HexBlocks.AKASHIC_LOG.get()),
// baseHeight, heightRandA, heightRandB
new FancyTrunkPlacer(5, 5, 3),
BlockStateProvider.simple(leaves),
// radius, offset, height
new FancyFoliagePlacer(ConstantInt.of(1), ConstantInt.of(5), 5),
// limit, lower size, upper size, minclippedheight
new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(6))
).build());
}
@Nullable
@Override
protected Holder<? extends ConfiguredFeature<?, ?>> getConfiguredFeature(Random pRandom, boolean pLargeHive) {
return GROWERS[pRandom.nextInt(GROWERS.length)];
return GROWERS.get(pRandom.nextInt(GROWERS.size()));
}
}

View file

@ -6,7 +6,6 @@ import at.petrak.hexcasting.common.items.*;
import at.petrak.hexcasting.common.items.magic.ItemManaBattery;
import at.petrak.hexcasting.common.items.magic.ItemPackagedSpell;
import at.petrak.paucal.api.datagen.PaucalItemModelProvider;
import com.mojang.datafixers.util.Pair;
import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.DyeColor;
@ -14,13 +13,15 @@ import net.minecraft.world.item.Item;
import net.minecraftforge.client.model.generators.ModelBuilder;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.RegistryObject;
public class HexItemModels extends PaucalItemModelProvider {
public HexItemModels(DataGenerator generator, ExistingFileHelper existingFileHelper) {
super(generator, HexMod.MOD_ID, existingFileHelper);
}
private static final String[] DATUM_TYPES = {"empty", "entity", "double", "vec3", "widget", "list", "pattern"};
private static final String[] PHIAL_SIZES = {"small", "medium", "large"};
@Override
protected void registerModels() {
simpleItem(HexItems.AMETHYST_DUST.get());
@ -50,48 +51,24 @@ public class HexItemModels extends PaucalItemModelProvider {
"layer0", modLoc("item/wands/old"));
singleTexture("wand_bosnia", new ResourceLocation("item/handheld_rod"),
"layer0", modLoc("item/wands/bosnia"));
var wands = new Item[]{
HexItems.WAND_OAK.get(),
HexItems.WAND_BIRCH.get(),
HexItems.WAND_SPRUCE.get(),
HexItems.WAND_JUNGLE.get(),
HexItems.WAND_DARK_OAK.get(),
HexItems.WAND_ACACIA.get(),
HexItems.WAND_CRIMSON.get(),
HexItems.WAND_WARPED.get(),
HexItems.WAND_AKASHIC.get(),
};
var wandKeys = new String[]{
"oak", "birch", "spruce", "jungle", "dark_oak", "acacia", "crimson", "warped", "akashic"
};
for (int i = 0; i < wands.length; i++) {
Item wand = wands[i];
String wandKey = wandKeys[i];
singleTexture(wand.getRegistryName().getPath(), new ResourceLocation("item/handheld_rod"),
"layer0", modLoc("item/wands/" + wandKey));
getBuilder(wand.getRegistryName().getPath())
.override()
.predicate(ItemWand.FUNNY_LEVEL_PREDICATE, 0)
.model(new ModelFile.UncheckedModelFile(modLoc("item/wand_" + wandKey)))
.end().override()
.predicate(ItemWand.FUNNY_LEVEL_PREDICATE, 1)
.model(new ModelFile.UncheckedModelFile(modLoc("item/wand_old")))
.end().override()
.predicate(ItemWand.FUNNY_LEVEL_PREDICATE, 2)
.model(new ModelFile.UncheckedModelFile(modLoc("item/wand_bosnia")))
.end();
}
buildWand(HexItems.WAND_OAK.get(), "oak");
buildWand(HexItems.WAND_BIRCH.get(), "birch");
buildWand(HexItems.WAND_SPRUCE.get(), "spruce");
buildWand(HexItems.WAND_JUNGLE.get(), "jungle");
buildWand(HexItems.WAND_DARK_OAK.get(), "dark_oak");
buildWand(HexItems.WAND_ACACIA.get(), "acacia");
buildWand(HexItems.WAND_CRIMSON.get(), "crimson");
buildWand(HexItems.WAND_WARPED.get(), "warped");
buildWand(HexItems.WAND_AKASHIC.get(), "akashic");
simpleItem(modLoc("patchouli_book"));
String[] datumStoredTypes = new String[]{
"empty", "entity", "double", "vec3", "widget", "list", "pattern"
};
// For stupid bad reasons we need to do this in ascending order.
for (int sealedIdx = 0; sealedIdx <= 1; sealedIdx++) {
var sealed = sealedIdx == 1;
for (int i = 0, stringsLength = datumStoredTypes.length; i < stringsLength; i++) {
var type = datumStoredTypes[i];
for (int i = 0, stringsLength = DATUM_TYPES.length; i < stringsLength; i++) {
var type = DATUM_TYPES[i];
var suffix = type + (sealed ? "_sealed" : "");
@ -117,32 +94,14 @@ public class HexItemModels extends PaucalItemModelProvider {
}
}
Pair<RegistryObject<Item>, String>[] packagers = new Pair[]{
new Pair(HexItems.CYPHER, "cypher"),
new Pair(HexItems.TRINKET, "trinket"),
new Pair(HexItems.ARTIFACT, "artifact"),
};
for (Pair<RegistryObject<Item>, String> p : packagers) {
simpleItem(modLoc(p.getSecond()));
simpleItem(modLoc(p.getSecond() + "_filled"));
getBuilder(p.getFirst().get().getRegistryName().getPath())
.override()
.predicate(ItemPackagedSpell.HAS_PATTERNS_PRED, -0.01f)
.model(new ModelFile.UncheckedModelFile(modLoc("item/" + p.getSecond())))
.end()
.override()
.predicate(ItemPackagedSpell.HAS_PATTERNS_PRED, 1f - 0.01f)
.model(new ModelFile.UncheckedModelFile(modLoc("item/" + p.getSecond() + "_filled")))
.end();
}
buildPackagedSpell(HexItems.CYPHER.get(), "cypher");
buildPackagedSpell(HexItems.TRINKET.get(), "trinket");
buildPackagedSpell(HexItems.ARTIFACT.get(), "artifact");
String[] sizeNames = new String[]{
"small", "medium", "large",
};
int maxFill = 4;
for (int size = 0; size < sizeNames.length; size++) {
for (int size = 0; size < PHIAL_SIZES.length; size++) {
for (int fill = 0; fill <= maxFill; fill++) {
String name = "phial_" + sizeNames[size] + "_" + fill;
String name = "phial_" + PHIAL_SIZES[size] + "_" + fill;
singleTexture(
name,
new ResourceLocation("item/generated"),
@ -199,4 +158,34 @@ public class HexItemModels extends PaucalItemModelProvider {
getBuilder(HexBlocks.AKASHIC_PRESSURE_PLATE.getId().getPath())
.parent(new ModelFile.UncheckedModelFile(modLoc("block/akashic_pressure_plate")));
}
private void buildWand(Item item, String name) {
singleTexture(item.getRegistryName().getPath(), new ResourceLocation("item/handheld_rod"),
"layer0", modLoc("item/wands/" + name));
getBuilder(item.getRegistryName().getPath())
.override()
.predicate(ItemWand.FUNNY_LEVEL_PREDICATE, 0)
.model(new ModelFile.UncheckedModelFile(modLoc("item/wand_" + name)))
.end().override()
.predicate(ItemWand.FUNNY_LEVEL_PREDICATE, 1)
.model(new ModelFile.UncheckedModelFile(modLoc("item/wand_old")))
.end().override()
.predicate(ItemWand.FUNNY_LEVEL_PREDICATE, 2)
.model(new ModelFile.UncheckedModelFile(modLoc("item/wand_bosnia")))
.end();
}
private void buildPackagedSpell(Item item, String name) {
simpleItem(modLoc(name));
simpleItem(modLoc(name + "_filled"));
getBuilder(item.getRegistryName().getPath())
.override()
.predicate(ItemPackagedSpell.HAS_PATTERNS_PRED, -0.01f)
.model(new ModelFile.UncheckedModelFile(modLoc("item/" + name)))
.end()
.override()
.predicate(ItemPackagedSpell.HAS_PATTERNS_PRED, 1f - 0.01f)
.model(new ModelFile.UncheckedModelFile(modLoc("item/" + name + "_filled")))
.end();
}
}

View file

@ -47,15 +47,9 @@ public class HexLootTables extends PaucalLootTableProvider {
HexBlocks.AKASHIC_PLANKS, HexBlocks.AKASHIC_TILE, HexBlocks.AKASHIC_PANEL,
HexBlocks.AKASHIC_TRAPDOOR);
for (Block block : new Block[] { HexBlocks.AKASHIC_LEAVES1.get(), HexBlocks.AKASHIC_LEAVES2.get(), HexBlocks.AKASHIC_LEAVES3.get()}) {
var leafPool = dropThisPool(block, 1)
.when(new AlternativeLootItemCondition.Builder(
CanToolPerformAction.canToolPerformAction(ToolActions.SHEARS_DIG),
MatchTool.toolMatches(ItemPredicate.Builder.item()
.hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1))))
));
lootTables.put(block, LootTable.lootTable().withPool(leafPool));
}
makeLeafTable(lootTables, HexBlocks.AKASHIC_LEAVES1.get());
makeLeafTable(lootTables, HexBlocks.AKASHIC_LEAVES2.get());
makeLeafTable(lootTables, HexBlocks.AKASHIC_LEAVES3.get());
var slatePool = LootPool.lootPool().name("slate").
setRolls(ConstantValue.exactly(1))
@ -70,4 +64,14 @@ public class HexLootTables extends PaucalLootTableProvider {
));
lootTables.put(HexBlocks.AKASHIC_DOOR.get(), LootTable.lootTable().withPool(doorPool));
}
private void makeLeafTable(Map<Block, LootTable.Builder> lootTables, Block block) {
var leafPool = dropThisPool(block, 1)
.when(new AlternativeLootItemCondition.Builder(
CanToolPerformAction.canToolPerformAction(ToolActions.SHEARS_DIG),
MatchTool.toolMatches(ItemPredicate.Builder.item()
.hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1))))
));
lootTables.put(block, LootTable.lootTable().withPool(leafPool));
}
}

View file

@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.advancements.OvercastTrigger;
import at.petrak.hexcasting.api.mod.HexItemTags;
import at.petrak.hexcasting.common.blocks.HexBlocks;
import at.petrak.hexcasting.common.items.HexItems;
import at.petrak.hexcasting.common.items.ItemWand;
import at.petrak.hexcasting.common.recipe.SealFocusRecipe;
import at.petrak.hexcasting.common.recipe.SealSpellbookRecipe;
import at.petrak.hexcasting.common.recipe.ingredient.StateIngredientHelper;
@ -15,7 +16,6 @@ import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.core.Registry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.*;
import net.minecraft.resources.ResourceLocation;
@ -29,6 +29,7 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.Tags;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.function.Consumer;
@ -44,39 +45,15 @@ public class HexRecipes extends PaucalRecipeProvider {
specialRecipe(recipes, SealFocusRecipe.SERIALIZER);
specialRecipe(recipes, SealSpellbookRecipe.SERIALIZER);
var wands = new Item[]{
HexItems.WAND_OAK.get(),
HexItems.WAND_BIRCH.get(),
HexItems.WAND_SPRUCE.get(),
HexItems.WAND_JUNGLE.get(),
HexItems.WAND_DARK_OAK.get(),
HexItems.WAND_ACACIA.get(),
HexItems.WAND_CRIMSON.get(),
HexItems.WAND_WARPED.get(),
HexItems.WAND_AKASHIC.get(),
};
var woods = new Item[]{
Items.OAK_PLANKS,
Items.BIRCH_PLANKS,
Items.SPRUCE_PLANKS,
Items.JUNGLE_PLANKS,
Items.DARK_OAK_PLANKS,
Items.ACACIA_PLANKS,
Items.CRIMSON_PLANKS,
Items.WARPED_PLANKS,
HexBlocks.AKASHIC_PLANKS.get().asItem(),
};
for (int i = 0; i < wands.length; i++) {
ShapedRecipeBuilder.shaped(wands[i])
.define('W', woods[i])
.define('S', Items.STICK)
.define('A', HexItems.CHARGED_AMETHYST.get())
.pattern(" SA")
.pattern(" WS")
.pattern("S ")
.unlockedBy("has_item", has(HexItems.CHARGED_AMETHYST.get()))
.save(recipes);
}
wandRecipe(recipes, HexItems.WAND_OAK.get(), Items.OAK_PLANKS);
wandRecipe(recipes, HexItems.WAND_BIRCH.get(), Items.BIRCH_PLANKS);
wandRecipe(recipes, HexItems.WAND_SPRUCE.get(), Items.SPRUCE_PLANKS);
wandRecipe(recipes, HexItems.WAND_JUNGLE.get(), Items.JUNGLE_PLANKS);
wandRecipe(recipes, HexItems.WAND_DARK_OAK.get(), Items.DARK_OAK_PLANKS);
wandRecipe(recipes, HexItems.WAND_ACACIA.get(), Items.ACACIA_PLANKS);
wandRecipe(recipes, HexItems.WAND_CRIMSON.get(), Items.CRIMSON_PLANKS);
wandRecipe(recipes, HexItems.WAND_WARPED.get(), Items.WARPED_PLANKS);
wandRecipe(recipes, HexItems.WAND_AKASHIC.get(), HexBlocks.AKASHIC_PLANKS.get().asItem());
ringCornered(HexItems.FOCUS.get(), 1, Ingredient.of(Tags.Items.DUSTS_GLOWSTONE),
Ingredient.of(Tags.Items.LEATHER), Ingredient.of(HexItems.CHARGED_AMETHYST.get()))
@ -149,33 +126,22 @@ public class HexRecipes extends PaucalRecipeProvider {
.pattern(" B ")
.unlockedBy("has_item", has(HexItems.AMETHYST_DUST.get())).save(recipes);
}
Item[] politicsInMyVidya = new Item[]{
Items.EGG,
Items.STONE_BRICK_WALL,
Items.GLASS,
Items.BREAD,
Items.WHEAT,
Items.CARROT,
Items.GLASS_BOTTLE,
Items.RAW_COPPER,
Items.MOSS_BLOCK,
Items.HONEYCOMB,
Items.RAW_IRON,
Items.WATER_BUCKET,
Items.AZALEA,
Items.ARROW,
};
for (int i = 0; i < politicsInMyVidya.length; i++) {
var item = HexItems.PRIDE_COLORIZERS[i].get();
ShapedRecipeBuilder.shaped(item)
.define('B', Items.BOWL)
.define('D', HexItems.AMETHYST_DUST.get())
.define('C', politicsInMyVidya[i])
.pattern(" C ")
.pattern(" D ")
.pattern(" B ")
.unlockedBy("has_item", has(HexItems.AMETHYST_DUST.get())).save(recipes);
}
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[0].get(), Items.EGG); // Trans
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[1].get(), Items.STONE_BRICK_WALL); // Gay
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[2].get(), Items.GLASS); // Agender
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[3].get(), Items.BREAD); // Asexual
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[4].get(), Items.WHEAT); // Bisexual
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[5].get(), Items.CARROT); // Pansexual
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[6].get(), Items.GLASS_BOTTLE); // Genderqueer
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[7].get(), Items.RAW_COPPER); // Demigirl
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[8].get(), Items.MOSS_BLOCK); // Non-Binary
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[9].get(), Items.HONEYCOMB); // Lesbian
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[10].get(), Items.RAW_IRON); // Demiboy
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[11].get(), Items.WATER_BUCKET); // Genderfluid
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[12].get(), Items.AZALEA); // Intersex
gayRecipe(recipes, HexItems.PRIDE_COLORIZERS[13].get(), Items.ARROW); // Aroace
ShapedRecipeBuilder.shaped(HexItems.UUID_COLORIZER.get())
.define('B', Items.BOWL)
.define('D', HexItems.AMETHYST_DUST.get())
@ -367,8 +333,31 @@ public class HexRecipes extends PaucalRecipeProvider {
.save(recipes, modLoc("brainsweep/akashic_record"));
}
private void wandRecipe(Consumer<FinishedRecipe> recipes, ItemWand wand, Item plank) {
ShapedRecipeBuilder.shaped(wand)
.define('W', plank)
.define('S', Items.STICK)
.define('A', HexItems.CHARGED_AMETHYST.get())
.pattern(" SA")
.pattern(" WS")
.pattern("S ")
.unlockedBy("has_item", has(HexItems.CHARGED_AMETHYST.get()))
.save(recipes);
}
private void gayRecipe(Consumer<FinishedRecipe> recipes, Item colorizer, Item material) {
ShapedRecipeBuilder.shaped(colorizer)
.define('B', Items.BOWL)
.define('D', HexItems.AMETHYST_DUST.get())
.define('C', material)
.pattern(" C ")
.pattern(" D ")
.pattern(" B ")
.unlockedBy("has_item", has(HexItems.AMETHYST_DUST.get())).save(recipes);
}
protected void specialRecipe(Consumer<FinishedRecipe> consumer, SimpleRecipeSerializer<?> serializer) {
var name = Registry.RECIPE_SERIALIZER.getKey(serializer);
var name = ForgeRegistries.RECIPE_SERIALIZERS.getKey(serializer);
SpecialRecipeBuilder.special(serializer).save(consumer, prefix("dynamic/" + name.getPath()).toString());
}