mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 03:43:30 +01:00
re-added JEI compat
This commit is contained in:
parent
5db697abb1
commit
5b7df8bd45
7 changed files with 121 additions and 133 deletions
|
@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
|||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: '1.18'
|
||||
mappings channel: 'official', version: '1.18.1'
|
||||
|
||||
runs {
|
||||
client {
|
||||
|
@ -102,11 +102,10 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.18-38.0.14'
|
||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
|
||||
|
||||
// TODO JEI
|
||||
/* compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.1.75:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.1.75")*/
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47")
|
||||
|
||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61:api")
|
||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-61")
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*
|
||||
package de.ellpeck.naturesaura.compat.jei;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -8,14 +7,14 @@ import de.ellpeck.naturesaura.recipes.AltarRecipe;
|
|||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||
import mezz.jei.api.helpers.IGuiHelper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -40,8 +39,8 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18n.format("container." + JEINaturesAuraPlugin.ALTAR + ".name");
|
||||
public Component getTitle() {
|
||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.ALTAR + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,9 +56,9 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
|||
@Override
|
||||
public void setIngredients(AltarRecipe altarRecipe, IIngredients iIngredients) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
builder.add(altarRecipe.input.getMatchingStacks());
|
||||
builder.add(altarRecipe.input.getItems());
|
||||
if (altarRecipe.catalyst != Ingredient.EMPTY)
|
||||
builder.add(altarRecipe.catalyst.getMatchingStacks());
|
||||
builder.add(altarRecipe.catalyst.getItems());
|
||||
if (altarRecipe.requiredType != null)
|
||||
builder.add(altarRecipe.getDimensionBottle());
|
||||
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||
|
@ -68,17 +67,16 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
|||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout iRecipeLayout, AltarRecipe recipe, IIngredients iIngredients) {
|
||||
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
|
||||
var group = iRecipeLayout.getItemStacks();
|
||||
group.init(0, true, 0, 18);
|
||||
group.set(0, Arrays.asList(recipe.input.getMatchingStacks()));
|
||||
group.set(0, Arrays.asList(recipe.input.getItems()));
|
||||
group.init(1, false, 80, 18);
|
||||
group.set(1, recipe.output);
|
||||
group.init(2, true, 26, 18);
|
||||
group.set(2, recipe.catalyst == Ingredient.EMPTY ?
|
||||
Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getMatchingStacks()));
|
||||
Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getItems()));
|
||||
group.init(3, true, 51, 18);
|
||||
if (recipe.requiredType != null)
|
||||
group.set(3, recipe.getDimensionBottle());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,32 +1,28 @@
|
|||
/*
|
||||
package de.ellpeck.naturesaura.compat.jei;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.Lighting;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.recipes.AnimalSpawnerRecipe;
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||
import mezz.jei.api.helpers.IGuiHelper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SpawnEggItem;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeSpawnEggItem;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -35,48 +31,53 @@ import java.util.Map;
|
|||
public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecipe> {
|
||||
|
||||
private final IDrawable background;
|
||||
private final Map<EntityType, Entity> entityCache = new HashMap<>();
|
||||
private final Map<EntityType<?>, Entity> entityCache = new HashMap<>();
|
||||
|
||||
public AnimalSpawnerCategory(IGuiHelper helper) {
|
||||
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86);
|
||||
}
|
||||
|
||||
private static void renderEntity(MatrixStack matrixstack, int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
|
||||
float f = (float) Math.atan(yaw / 40.0F);
|
||||
float f1 = (float) Math.atan(pitch / 40.0F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef((float) x, (float) y, 1050.0F);
|
||||
RenderSystem.scalef(1.0F, 1.0F, -1.0F);
|
||||
private static void renderEntity(PoseStack matrixstack, int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
|
||||
var f = (float) Math.atan(yaw / 40.0F);
|
||||
var f1 = (float) Math.atan(pitch / 40.0F);
|
||||
var posestack = RenderSystem.getModelViewStack();
|
||||
posestack.pushPose();
|
||||
posestack.translate(x, y, 1050.0D);
|
||||
posestack.scale(1.0F, 1.0F, -1.0F);
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
matrixstack.translate(0.0D, 0.0D, 1000.0D);
|
||||
matrixstack.scale(scale, scale, scale);
|
||||
Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
||||
Quaternion quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
||||
quaternion.multiply(quaternion1);
|
||||
matrixstack.rotate(quaternion);
|
||||
float f2 = entity.renderYawOffset;
|
||||
float f3 = entity.rotationYaw;
|
||||
float f4 = entity.rotationPitch;
|
||||
float f5 = entity.prevRotationYawHead;
|
||||
float f6 = entity.rotationYawHead;
|
||||
entity.renderYawOffset = 180.0F + f * 20.0F;
|
||||
entity.rotationYaw = 180.0F + f * 40.0F;
|
||||
entity.rotationPitch = -f1 * 20.0F;
|
||||
entity.rotationYawHead = entity.rotationYaw;
|
||||
entity.prevRotationYawHead = entity.rotationYaw;
|
||||
EntityRendererManager entityrenderermanager = Minecraft.getInstance().getRenderManager();
|
||||
quaternion1.conjugate();
|
||||
entityrenderermanager.setCameraOrientation(quaternion1);
|
||||
var quaternion = Vector3f.ZP.rotationDegrees(180.0F);
|
||||
var quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
|
||||
quaternion.mul(quaternion1);
|
||||
matrixstack.mulPose(quaternion);
|
||||
var f2 = entity.yBodyRot;
|
||||
var f3 = entity.getYRot();
|
||||
var f4 = entity.getXRot();
|
||||
var f5 = entity.yHeadRotO;
|
||||
var f6 = entity.yHeadRot;
|
||||
entity.yBodyRot = 180.0F + f * 20.0F;
|
||||
entity.setYRot(180.0F + f * 40.0F);
|
||||
entity.setXRot(-f1 * 20.0F);
|
||||
entity.yHeadRot = entity.getYRot();
|
||||
entity.yHeadRotO = entity.getYRot();
|
||||
Lighting.setupForEntityInInventory();
|
||||
var entityrenderermanager = Minecraft.getInstance().getEntityRenderDispatcher();
|
||||
quaternion1.conj();
|
||||
entityrenderermanager.overrideCameraOrientation(quaternion1);
|
||||
entityrenderermanager.setRenderShadow(false);
|
||||
IRenderTypeBuffer.Impl buff = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||
entityrenderermanager.renderEntityStatic(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
|
||||
buff.finish();
|
||||
var buff = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
entityrenderermanager.render(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
|
||||
buff.endBatch();
|
||||
entityrenderermanager.setRenderShadow(true);
|
||||
entity.renderYawOffset = f2;
|
||||
entity.rotationYaw = f3;
|
||||
entity.rotationPitch = f4;
|
||||
entity.prevRotationYawHead = f5;
|
||||
entity.rotationYawHead = f6;
|
||||
RenderSystem.popMatrix();
|
||||
entity.yBodyRot = f2;
|
||||
entity.setYRot(f3);
|
||||
entity.setXRot(f4);
|
||||
entity.yHeadRotO = f5;
|
||||
entity.yHeadRot = f6;
|
||||
posestack.popPose();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
Lighting.setupFor3DItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,8 +91,8 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18n.format("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
|
||||
public Component getTitle() {
|
||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,38 +108,37 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
@Override
|
||||
public void setIngredients(AnimalSpawnerRecipe animalSpawnerRecipe, IIngredients iIngredients) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for (Ingredient ing : animalSpawnerRecipe.ingredients)
|
||||
builder.add(ing.getMatchingStacks());
|
||||
for (var ing : animalSpawnerRecipe.ingredients)
|
||||
builder.add(ing.getItems());
|
||||
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(SpawnEggItem.getEgg(animalSpawnerRecipe.entity)));
|
||||
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(ForgeSpawnEggItem.fromEntityType(animalSpawnerRecipe.entity)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout iRecipeLayout, AnimalSpawnerRecipe recipe, IIngredients iIngredients) {
|
||||
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
|
||||
for (int i = 0; i < recipe.ingredients.length; i++) {
|
||||
var group = iRecipeLayout.getItemStacks();
|
||||
for (var i = 0; i < recipe.ingredients.length; i++) {
|
||||
group.init(i, true, i * 18, 68);
|
||||
group.set(i, Arrays.asList(recipe.ingredients[i].getMatchingStacks()));
|
||||
group.set(i, Arrays.asList(recipe.ingredients[i].getItems()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(AnimalSpawnerRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
Entity entity = this.entityCache.get(recipe.entity);
|
||||
public void draw(AnimalSpawnerRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
var entity = this.entityCache.get(recipe.entity);
|
||||
if (entity == null) {
|
||||
entity = recipe.makeEntity(minecraft.level, BlockPos.ZERO);
|
||||
this.entityCache.put(recipe.entity, entity);
|
||||
}
|
||||
|
||||
matrixStack.push();
|
||||
float size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
|
||||
matrixStack.pushPose();
|
||||
var size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
|
||||
renderEntity(matrixStack, 35, 55, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
|
||||
matrixStack.pop();
|
||||
matrixStack.popPose();
|
||||
|
||||
String name = recipe.entity.getName().getString();
|
||||
minecraft.fontRenderer.drawStringWithShadow(matrixStack, name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
|
||||
var name = recipe.entity.getDescription().getString();
|
||||
minecraft.font.drawShadow(matrixStack, name, 36 - minecraft.font.width(name) / 2F, 55, 0xFFFFFF);
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
/*
|
||||
package de.ellpeck.naturesaura.compat.jei;
|
||||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
||||
import de.ellpeck.naturesaura.items.ItemEffectPowder;
|
||||
|
@ -11,16 +9,14 @@ import de.ellpeck.naturesaura.items.ModItems;
|
|||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.JeiPlugin;
|
||||
import mezz.jei.api.helpers.IGuiHelper;
|
||||
import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter;
|
||||
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter;
|
||||
import mezz.jei.api.registration.IRecipeCatalystRegistration;
|
||||
import mezz.jei.api.registration.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.registration.IRecipeRegistration;
|
||||
import mezz.jei.api.registration.ISubtypeRegistration;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
@JeiPlugin
|
||||
public class JEINaturesAuraPlugin implements IModPlugin {
|
||||
|
@ -37,7 +33,7 @@ public class JEINaturesAuraPlugin implements IModPlugin {
|
|||
|
||||
@Override
|
||||
public void registerCategories(IRecipeCategoryRegistration registry) {
|
||||
IGuiHelper helper = registry.getJeiHelpers().getGuiHelper();
|
||||
var helper = registry.getJeiHelpers().getGuiHelper();
|
||||
registry.addRecipeCategories(
|
||||
new TreeRitualCategory(helper),
|
||||
new AltarCategory(helper),
|
||||
|
@ -48,14 +44,14 @@ public class JEINaturesAuraPlugin implements IModPlugin {
|
|||
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistration registration) {
|
||||
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, stack -> ItemEffectPowder.getEffect(stack).toString());
|
||||
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, stack -> ItemAuraBottle.getType(stack).getName().toString());
|
||||
registration.registerSubtypeInterpreter(ModItems.EFFECT_POWDER, (stack, context) -> ItemEffectPowder.getEffect(stack).toString());
|
||||
registration.registerSubtypeInterpreter(ModItems.AURA_BOTTLE, (stack, context) -> ItemAuraBottle.getType(stack).getName().toString());
|
||||
|
||||
ISubtypeInterpreter auraInterpreter = stack -> {
|
||||
IAuraContainer container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
||||
var auraInterpreter = (IIngredientSubtypeInterpreter<ItemStack>) (stack, context) -> {
|
||||
var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
||||
if (container != null)
|
||||
return String.valueOf(container.getStoredAura());
|
||||
return ISubtypeInterpreter.NONE;
|
||||
return IIngredientSubtypeInterpreter.NONE;
|
||||
};
|
||||
registration.registerSubtypeInterpreter(ModItems.AURA_CACHE, auraInterpreter);
|
||||
registration.registerSubtypeInterpreter(ModItems.AURA_TROVE, auraInterpreter);
|
||||
|
@ -72,11 +68,10 @@ public class JEINaturesAuraPlugin implements IModPlugin {
|
|||
|
||||
@Override
|
||||
public void registerRecipes(IRecipeRegistration registration) {
|
||||
RecipeManager manager = Minecraft.getInstance().level.getRecipeManager();
|
||||
registration.addRecipes(manager.getRecipes(ModRecipes.TREE_RITUAL_TYPE, null, null), TREE_RITUAL);
|
||||
registration.addRecipes(manager.getRecipes(ModRecipes.ALTAR_TYPE, null, null), ALTAR);
|
||||
registration.addRecipes(manager.getRecipes(ModRecipes.OFFERING_TYPE, null, null), OFFERING);
|
||||
registration.addRecipes(manager.getRecipes(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null), SPAWNER);
|
||||
var manager = Minecraft.getInstance().level.getRecipeManager();
|
||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.TREE_RITUAL_TYPE), TREE_RITUAL);
|
||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.ALTAR_TYPE), ALTAR);
|
||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.OFFERING_TYPE), OFFERING);
|
||||
registration.addRecipes(manager.getAllRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE), SPAWNER);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*
|
||||
package de.ellpeck.naturesaura.compat.jei;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -11,9 +10,10 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
|||
import mezz.jei.api.helpers.IGuiHelper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -36,8 +36,8 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18n.format("container." + JEINaturesAuraPlugin.OFFERING + ".name");
|
||||
public Component getTitle() {
|
||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.OFFERING + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +53,8 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
|
|||
@Override
|
||||
public void setIngredients(OfferingRecipe offeringRecipe, IIngredients iIngredients) {
|
||||
iIngredients.setInputs(VanillaTypes.ITEM, ImmutableList.<ItemStack>builder()
|
||||
.add(offeringRecipe.input.getMatchingStacks())
|
||||
.add(offeringRecipe.startItem.getMatchingStacks()).build());
|
||||
.add(offeringRecipe.input.getItems())
|
||||
.add(offeringRecipe.startItem.getItems()).build());
|
||||
iIngredients.setOutput(VanillaTypes.ITEM, offeringRecipe.output);
|
||||
}
|
||||
|
||||
|
@ -62,11 +62,10 @@ public class OfferingCategory implements IRecipeCategory<OfferingRecipe> {
|
|||
public void setRecipe(IRecipeLayout recipeLayout, OfferingRecipe recipe, IIngredients ingredients) {
|
||||
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
||||
group.init(0, true, 0, 14);
|
||||
group.set(0, Arrays.asList(recipe.input.getMatchingStacks()));
|
||||
group.set(0, Arrays.asList(recipe.input.getItems()));
|
||||
group.init(1, false, 65, 14);
|
||||
group.set(1, recipe.output);
|
||||
group.init(2, true, 27, 0);
|
||||
group.set(2, Arrays.asList(recipe.startItem.getMatchingStacks()));
|
||||
group.set(2, Arrays.asList(recipe.startItem.getItems()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*
|
||||
package de.ellpeck.naturesaura.compat.jei;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -7,14 +6,13 @@ import de.ellpeck.naturesaura.recipes.TreeRitualRecipe;
|
|||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||
import mezz.jei.api.helpers.IGuiHelper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -37,8 +35,8 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualRecipe> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18n.format("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
|
||||
public Component getTitle() {
|
||||
return new TranslatableComponent("container." + JEINaturesAuraPlugin.TREE_RITUAL + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,28 +52,27 @@ public class TreeRitualCategory implements IRecipeCategory<TreeRitualRecipe> {
|
|||
@Override
|
||||
public void setIngredients(TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for (Ingredient ing : treeRitualRecipe.ingredients)
|
||||
builder.add(ing.getMatchingStacks());
|
||||
builder.add(treeRitualRecipe.saplingType.getMatchingStacks());
|
||||
for (var ing : treeRitualRecipe.ingredients)
|
||||
builder.add(ing.getItems());
|
||||
builder.add(treeRitualRecipe.saplingType.getItems());
|
||||
iIngredients.setInputs(VanillaTypes.ITEM, builder.build());
|
||||
iIngredients.setOutput(VanillaTypes.ITEM, treeRitualRecipe.result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout iRecipeLayout, TreeRitualRecipe treeRitualRecipe, IIngredients iIngredients) {
|
||||
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
|
||||
var group = iRecipeLayout.getItemStacks();
|
||||
|
||||
group.init(0, true, 34, 34);
|
||||
group.set(0, Arrays.asList(treeRitualRecipe.saplingType.getMatchingStacks()));
|
||||
group.set(0, Arrays.asList(treeRitualRecipe.saplingType.getItems()));
|
||||
|
||||
group.init(1, true, 124, 34);
|
||||
group.set(1, treeRitualRecipe.result);
|
||||
|
||||
int[][] positions = new int[][]{{35, 1}, {35, 69}, {1, 35}, {69, 35}, {12, 12}, {58, 58}, {58, 12}, {12, 58}};
|
||||
for (int i = 0; i < treeRitualRecipe.ingredients.length; i++) {
|
||||
var positions = new int[][]{{35, 1}, {35, 69}, {1, 35}, {69, 35}, {12, 12}, {58, 58}, {58, 12}, {12, 58}};
|
||||
for (var i = 0; i < treeRitualRecipe.ingredients.length; i++) {
|
||||
group.init(i + 2, true, positions[i][0] - 1, positions[i][1] - 1);
|
||||
group.set(i + 2, Arrays.asList(treeRitualRecipe.ingredients[i].getMatchingStacks()));
|
||||
group.set(i + 2, Arrays.asList(treeRitualRecipe.ingredients[i].getItems()));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -138,7 +138,7 @@ public class PatchouliCompat implements ICompat {
|
|||
var r = ((info.color() >> 16) & 255) / 255F;
|
||||
var g = ((info.color() >> 8) & 255) / 255F;
|
||||
var b = (info.color() & 255) / 255F;
|
||||
// TODO apply leaf color?
|
||||
// TODO apply leaf color, we probably have to blit manually using the texture + color shader
|
||||
//RenderSystem.color3f(r, g, b);
|
||||
Screen.blit(event.getPoseStack(), x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue