mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Replace 256 wand of the forest recipe jsons with one custom recipe type
Prevents flooding JEI with tons of irrelevant recipes, and recipe book buttons going offscreen if you look at all the variants of the wand. Side effect is not showing the colored wands in JEI/Patchouli, but that's fine.
This commit is contained in:
1 parent
7cbe19271c
commit
12e67ab394
261 files changed
+160
-6164
No files matched your search
@@ -54,7 +54,6 @@ import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.item.ItemLaputaShard;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ItemManaTablet;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
@@ -76,7 +75,6 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
registry.registerSubtypeInterpreter(ModItems.incenseStick, ItemBrewBase::getSubtype);
|
||||
registry.registerSubtypeInterpreter(ModItems.bloodPendant, ItemBrewBase::getSubtype);
|
||||
|
||||
registry.registerSubtypeInterpreter(ModItems.twigWand, stack -> ItemTwigWand.getColor1(stack) + "_" + ItemTwigWand.getColor2(stack));
|
||||
registry.registerSubtypeInterpreter(ModItems.flightTiara, stack -> String.valueOf(ItemFlightTiara.getVariant(stack)));
|
||||
registry.registerSubtypeInterpreter(ModItems.lexicon, stack -> String.valueOf(ItemNBTHelper.getBoolean(stack, ItemLexicon.TAG_ELVEN_UNLOCK, false)));
|
||||
registry.registerSubtypeInterpreter(ModItems.laputaShard, stack -> String.valueOf(ItemLaputaShard.getShardLevel(stack)));
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.Random;
|
||||
public class BlockModMushroom extends MushroomBlock implements IHornHarvestable, ICustomApothecaryColor {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(4.8, 0, 4.8, 12.8, 16, 12.8);
|
||||
private final DyeColor color;
|
||||
public final DyeColor color;
|
||||
|
||||
public BlockModMushroom(DyeColor color, Properties builder) {
|
||||
super(builder);
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* This class was created by <Hubry>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [2020-01-30, 17:20 (UTC+2)]
|
||||
*/
|
||||
package vazkii.botania.common.crafting.recipe;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import vazkii.botania.common.block.decor.BlockModMushroom;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.material.ItemPetal;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TwigWandRecipe implements ICraftingRecipe {
|
||||
public static final IRecipeSerializer<TwigWandRecipe> SERIALIZER = new Serializer();
|
||||
private final ShapedRecipe compose;
|
||||
|
||||
public TwigWandRecipe(ShapedRecipe compose) {
|
||||
this.compose = compose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull CraftingInventory inv, @Nonnull World worldIn) {
|
||||
return compose.matches(inv, worldIn);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getCraftingResult(CraftingInventory inv) {
|
||||
int first = -1;
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
Item item = stack.getItem();
|
||||
|
||||
int colorId;
|
||||
if (item instanceof ItemPetal) {
|
||||
colorId = ((ItemPetal) item).color.getId();
|
||||
} else if (item instanceof BlockItem && ((BlockItem) item).getBlock() instanceof BlockModMushroom) {
|
||||
colorId = ((BlockModMushroom) ((BlockItem) item).getBlock()).color.getId();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (first == -1)
|
||||
first = colorId;
|
||||
else
|
||||
return ItemTwigWand.forColors(first, colorId);
|
||||
}
|
||||
return ItemTwigWand.forColors(first != -1 ? first : 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height) {
|
||||
return compose.canFit(width, height);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return new ItemStack(ModItems.twigWand);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return compose.getId();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NonNullList<ItemStack> getRemainingItems(CraftingInventory inv) {
|
||||
return compose.getRemainingItems(inv);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
return compose.getIngredients();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return compose.getGroup();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return compose.getIcon();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return SERIALIZER;
|
||||
}
|
||||
|
||||
private static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<TwigWandRecipe> {
|
||||
@Nonnull
|
||||
@Override
|
||||
public TwigWandRecipe read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json) {
|
||||
return new TwigWandRecipe(CRAFTING_SHAPED.read(recipeId, json));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TwigWandRecipe read(@Nonnull ResourceLocation recipeId, @Nonnull PacketBuffer buffer) {
|
||||
return new TwigWandRecipe(CRAFTING_SHAPED.read(recipeId, buffer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(@Nonnull PacketBuffer buffer, @Nonnull TwigWandRecipe recipe) {
|
||||
CRAFTING_SHAPED.write(buffer, recipe.compose);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,23 +39,7 @@ import vazkii.botania.client.gui.box.GuiBaubleBox;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.ArmorUpgradeRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.BlackHoleTalismanExtractRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.CompositeLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.CosmeticAttachRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.CosmeticRemoveRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.HelmRevealingRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.KeepIvyRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.LensDyeingRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.ManaGunClipRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.ManaGunLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.ManaGunRemoveLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.ManaUpgradeRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.PhantomInkRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.ShapelessManaUpgradeRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.SpellClothRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.*;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
import vazkii.botania.common.item.brew.ItemIncenseStick;
|
||||
import vazkii.botania.common.item.brew.ItemVial;
|
||||
@@ -744,6 +728,7 @@ public final class ModItems {
|
||||
register(r, PhantomInkRecipe.SERIALIZER, "phantom_ink_apply");
|
||||
register(r, SpellClothRecipe.SERIALIZER, "spell_cloth_apply");
|
||||
register(r, TerraPickTippingRecipe.SERIALIZER, "terra_pick_tipping");
|
||||
register(r, TwigWandRecipe.SERIALIZER, "twig_wand");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
Reference in new issue
Block a user