JEI and glowing fixes
- Fix sequenced assembly scene in newer JEI versions; Fix #2779 - Fix inconsistent JEI fan scenes; Fix #2748 - Fix glowing RenderTypes not respecting lightmap values
This commit is contained in:
parent
3aa0644426
commit
160e823282
12 changed files with 257 additions and 205 deletions
|
@ -21,7 +21,7 @@ parchment_version = 2022.01.23
|
|||
registrate_version = MC1.18-1.0.21
|
||||
flywheel_version = 1.18-0.6.1.60
|
||||
jei_minecraft_version = 1.18.1
|
||||
jei_version = 9.2.1.69
|
||||
jei_version = 9.3.2.92
|
||||
|
||||
# curseforge information
|
||||
projectId = 328085
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -21,16 +22,17 @@ public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderAttachedBlock(PoseStack matrixStack) {
|
||||
matrixStack.pushPose();
|
||||
protected AllGuiTextures getBlockShadow() {
|
||||
return AllGuiTextures.JEI_LIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderAttachedBlock(PoseStack matrixStack) {
|
||||
GuiGameElement.of(Fluids.LAVA)
|
||||
.scale(24)
|
||||
.scale(SCALE)
|
||||
.atLocal(0, 0, 2)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
package com.simibubi.create.compat.jei.category;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.content.contraptions.components.fan.HauntingRecipe;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class FanHauntingCategory extends ProcessingViaFanCategory<HauntingRecipe> {
|
||||
public class FanHauntingCategory extends ProcessingViaFanCategory.MultiOutput<HauntingRecipe> {
|
||||
|
||||
public FanHauntingCategory() {
|
||||
super(185, doubleItemIcon(AllItems.PROPELLER.get(), Items.SOUL_CAMPFIRE));
|
||||
super(doubleItemIcon(AllItems.PROPELLER.get(), Items.SOUL_CAMPFIRE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,76 +22,17 @@ public class FanHauntingCategory extends ProcessingViaFanCategory<HauntingRecipe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(HauntingRecipe recipe, IIngredients ingredients) {
|
||||
ingredients.setInputIngredients(recipe.getIngredients());
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getRollableResultsAsItemStacks());
|
||||
protected AllGuiTextures getBlockShadow() {
|
||||
return AllGuiTextures.JEI_LIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, HauntingRecipe recipe, IIngredients ingredients) {
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
List<ProcessingOutput> results = recipe.getRollableResults();
|
||||
int xOffsetGlobal = 8 * (3 - Math.min(3, results.size()));
|
||||
|
||||
itemStacks.init(0, true, xOffsetGlobal + 12, 47);
|
||||
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
|
||||
.get(0)
|
||||
.getItems()));
|
||||
|
||||
boolean single = results.size() == 1;
|
||||
boolean excessive = results.size() > 9;
|
||||
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
|
||||
int xOffset = (outputIndex % 3) * 19;
|
||||
int yOffset = (outputIndex / 3) * -19;
|
||||
|
||||
itemStacks.init(outputIndex + 1, false, xOffsetGlobal + (single ? 126 : 126 + xOffset),
|
||||
47 + yOffset + (excessive ? 8 : 0));
|
||||
itemStacks.set(outputIndex + 1, results.get(outputIndex)
|
||||
.getStack());
|
||||
}
|
||||
|
||||
addStochasticTooltip(itemStacks, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWidgets(PoseStack matrixStack, HauntingRecipe recipe, double mouseX, double mouseY) {
|
||||
int size = recipe.getRollableResultsAsItemStacks()
|
||||
.size();
|
||||
int xOffsetGlobal = 8 * (3 - Math.min(3, size));
|
||||
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, xOffsetGlobal + 12, 47);
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 47 + 4, 29);
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 66 + 4, 39);
|
||||
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, xOffsetGlobal + 42, 51);
|
||||
|
||||
if (size == 1) {
|
||||
getRenderedSlot(recipe, 0).render(matrixStack, xOffsetGlobal + 126, 47);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
int xOffset = (i % 3) * 19;
|
||||
int yOffset = (i / 3) * -19 + (size > 9 ? 8 : 0);
|
||||
getRenderedSlot(recipe, i).render(matrixStack, xOffsetGlobal + 126 + xOffset, 47 + yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void translateFan(PoseStack ms) {
|
||||
ms.translate(56 + 4, 33, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderAttachedBlock(PoseStack matrixStack) {
|
||||
matrixStack.pushPose();
|
||||
|
||||
protected void renderAttachedBlock(PoseStack matrixStack) {
|
||||
GuiGameElement.of(Blocks.SOUL_FIRE.defaultBlockState())
|
||||
.scale(24)
|
||||
.scale(SCALE)
|
||||
.atLocal(0, 0, 2)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.simibubi.create.compat.jei.category;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -20,11 +22,17 @@ public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderAttachedBlock(PoseStack matrixStack) {
|
||||
protected AllGuiTextures getBlockShadow() {
|
||||
return AllGuiTextures.JEI_LIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderAttachedBlock(PoseStack matrixStack) {
|
||||
GuiGameElement.of(Blocks.FIRE.defaultBlockState())
|
||||
.scale(24)
|
||||
.atLocal(0, 0, 2)
|
||||
.render(matrixStack);
|
||||
.scale(SCALE)
|
||||
.atLocal(0, 0, 2)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +1,18 @@
|
|||
package com.simibubi.create.compat.jei.category;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
||||
public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe> {
|
||||
public class FanWashingCategory extends ProcessingViaFanCategory.MultiOutput<SplashingRecipe> {
|
||||
|
||||
public FanWashingCategory() {
|
||||
super(185, doubleItemIcon(AllItems.PROPELLER.get(), Items.WATER_BUCKET));
|
||||
super(doubleItemIcon(AllItems.PROPELLER.get(), Items.WATER_BUCKET));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,76 +21,12 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(SplashingRecipe recipe, IIngredients ingredients) {
|
||||
ingredients.setInputIngredients(recipe.getIngredients());
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getRollableResultsAsItemStacks());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, SplashingRecipe recipe, IIngredients ingredients) {
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
List<ProcessingOutput> results = recipe.getRollableResults();
|
||||
int xOffsetGlobal = 8 * (3 - Math.min(3, results.size()));
|
||||
|
||||
itemStacks.init(0, true, xOffsetGlobal + 12, 47);
|
||||
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
|
||||
.get(0)
|
||||
.getItems()));
|
||||
|
||||
boolean single = results.size() == 1;
|
||||
boolean excessive = results.size() > 9;
|
||||
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
|
||||
int xOffset = (outputIndex % 3) * 19;
|
||||
int yOffset = (outputIndex / 3) * -19;
|
||||
|
||||
itemStacks.init(outputIndex + 1, false, xOffsetGlobal + (single ? 126 : 126 + xOffset),
|
||||
47 + yOffset + (excessive ? 8 : 0));
|
||||
itemStacks.set(outputIndex + 1, results.get(outputIndex)
|
||||
.getStack());
|
||||
}
|
||||
|
||||
addStochasticTooltip(itemStacks, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWidgets(PoseStack matrixStack, SplashingRecipe recipe, double mouseX, double mouseY) {
|
||||
int size = recipe.getRollableResultsAsItemStacks()
|
||||
.size();
|
||||
int xOffsetGlobal = 8 * (3 - Math.min(3, size));
|
||||
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, xOffsetGlobal + 12, 47);
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 47 + 4, 29);
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 66 + 4, 39);
|
||||
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, xOffsetGlobal + 42, 51);
|
||||
|
||||
if (size == 1) {
|
||||
getRenderedSlot(recipe, 0).render(matrixStack, xOffsetGlobal + 126, 47);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
int xOffset = (i % 3) * 19;
|
||||
int yOffset = (i / 3) * -19 + (size > 9 ? 8 : 0);
|
||||
getRenderedSlot(recipe, i).render(matrixStack, xOffsetGlobal + 126 + xOffset, 47 + yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void translateFan(PoseStack ms) {
|
||||
ms.translate(56 + 4, 33, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderAttachedBlock(PoseStack matrixStack) {
|
||||
matrixStack.pushPose();
|
||||
|
||||
protected void renderAttachedBlock(PoseStack matrixStack) {
|
||||
GuiGameElement.of(Fluids.WATER)
|
||||
.scale(24)
|
||||
.scale(SCALE)
|
||||
.atLocal(0, 0, 2)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.simibubi.create.compat.jei.category;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
|
@ -23,18 +23,14 @@ import net.minecraft.world.item.crafting.Recipe;
|
|||
|
||||
public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends CreateRecipeCategory<T> {
|
||||
|
||||
protected static final int SCALE = 24;
|
||||
|
||||
public ProcessingViaFanCategory(IDrawable icon) {
|
||||
this(177, icon);
|
||||
this(178, icon);
|
||||
}
|
||||
|
||||
protected ProcessingViaFanCategory(int width, IDrawable icon) {
|
||||
super(icon, emptyBackground(width, 71));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(T recipe, IIngredients ingredients) {
|
||||
ingredients.setInputIngredients(recipe.getIngredients());
|
||||
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
|
||||
public ProcessingViaFanCategory(int width, IDrawable icon) {
|
||||
super(icon, emptyBackground(width, 72));
|
||||
}
|
||||
|
||||
public static Supplier<ItemStack> getFan(String name) {
|
||||
|
@ -43,56 +39,123 @@ public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends Crea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, T recipe, @Nullable IIngredients ingredients) {
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
itemStacks.init(0, true, 20, 47);
|
||||
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
|
||||
.get(0)
|
||||
.getItems()));
|
||||
|
||||
itemStacks.init(1, false, 139, 47);
|
||||
itemStacks.set(1, recipe.getResultItem());
|
||||
}
|
||||
|
||||
protected void renderWidgets(PoseStack matrixStack, T recipe, double mouseX, double mouseY) {
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, 20, 47);
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, 139, 47);
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 47, 29);
|
||||
AllGuiTextures.JEI_LIGHT.render(matrixStack, 66, 39);
|
||||
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, 53, 51);
|
||||
public void setIngredients(T recipe, IIngredients ingredients) {
|
||||
ingredients.setInputIngredients(recipe.getIngredients());
|
||||
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@Nullable T recipe, @Nullable PoseStack matrixStack, double mouseX, double mouseY) {
|
||||
if (matrixStack == null)
|
||||
return;
|
||||
public void setRecipe(IRecipeLayout recipeLayout, T recipe, IIngredients ingredients) {
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 20, 47);
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, false, 140, 47);
|
||||
itemStacks.set(1, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(T recipe, PoseStack matrixStack, double mouseX, double mouseY) {
|
||||
renderWidgets(matrixStack, recipe, mouseX, mouseY);
|
||||
|
||||
matrixStack.pushPose();
|
||||
translateFan(matrixStack);
|
||||
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-12.5f));
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 24;
|
||||
|
||||
AnimatedKinetics.defaultBlockElement(AllBlockPartials.ENCASED_FAN_INNER)
|
||||
.rotateBlock(180, 0, AnimatedKinetics.getCurrentAngle() * 16)
|
||||
.scale(scale)
|
||||
.scale(SCALE)
|
||||
.render(matrixStack);
|
||||
|
||||
AnimatedKinetics.defaultBlockElement(AllBlocks.ENCASED_FAN.getDefaultState())
|
||||
.rotateBlock(0, 180, 0)
|
||||
.atLocal(0, 0, 0)
|
||||
.scale(scale)
|
||||
.scale(SCALE)
|
||||
.render(matrixStack);
|
||||
|
||||
renderAttachedBlock(matrixStack);
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
protected void renderWidgets(PoseStack matrixStack, T recipe, double mouseX, double mouseY) {
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 46, 29);
|
||||
getBlockShadow().render(matrixStack, 65, 39);
|
||||
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, 54, 51);
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, 20, 47);
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, 140, 47);
|
||||
}
|
||||
|
||||
protected AllGuiTextures getBlockShadow() {
|
||||
return AllGuiTextures.JEI_SHADOW;
|
||||
}
|
||||
|
||||
protected void translateFan(PoseStack matrixStack) {
|
||||
matrixStack.translate(56, 33, 0);
|
||||
}
|
||||
|
||||
public abstract void renderAttachedBlock(PoseStack matrixStack);
|
||||
protected abstract void renderAttachedBlock(PoseStack matrixStack);
|
||||
|
||||
public static abstract class MultiOutput<T extends ProcessingRecipe<?>> extends ProcessingViaFanCategory<T> {
|
||||
|
||||
public MultiOutput(IDrawable icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
public MultiOutput(int width, IDrawable icon) {
|
||||
super(width, icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(T recipe, IIngredients ingredients) {
|
||||
ingredients.setInputIngredients(recipe.getIngredients());
|
||||
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getRollableResultsAsItemStacks());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, T recipe, IIngredients ingredients) {
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
List<ProcessingOutput> results = recipe.getRollableResults();
|
||||
int xOffsetAmount = 1 - Math.min(3, results.size());
|
||||
|
||||
itemStacks.init(0, true, 5 * xOffsetAmount + 20, 47);
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
int xOffsetOutput = 9 * xOffsetAmount;
|
||||
boolean excessive = results.size() > 9;
|
||||
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
|
||||
int xOffset = (outputIndex % 3) * 19 + xOffsetOutput;
|
||||
int yOffset = (outputIndex / 3) * -19 + (excessive ? 8 : 0);
|
||||
|
||||
itemStacks.init(outputIndex + 1, false, 140 + xOffset, 47 + yOffset);
|
||||
itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack());
|
||||
}
|
||||
|
||||
addStochasticTooltip(itemStacks, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderWidgets(PoseStack matrixStack, T recipe, double mouseX, double mouseY) {
|
||||
int size = recipe.getRollableResultsAsItemStacks()
|
||||
.size();
|
||||
int xOffsetAmount = 1 - Math.min(3, size);
|
||||
|
||||
AllGuiTextures.JEI_SHADOW.render(matrixStack, 46, 29);
|
||||
getBlockShadow().render(matrixStack, 65, 39);
|
||||
AllGuiTextures.JEI_LONG_ARROW.render(matrixStack, 7 * xOffsetAmount + 54, 51);
|
||||
AllGuiTextures.JEI_SLOT.render(matrixStack, 5 * xOffsetAmount + 20, 47);
|
||||
|
||||
int xOffsetOutput = 9 * xOffsetAmount;
|
||||
boolean excessive = size > 9;
|
||||
for (int i = 0; i < size; i++) {
|
||||
int xOffset = (i % 3) * 19 + xOffsetOutput;
|
||||
int yOffset = (i / 3) * -19 + (excessive ? 8 : 0);
|
||||
getRenderedSlot(recipe, i).render(matrixStack, 140 + xOffset, 47 + yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,6 +127,8 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
|
|||
public void draw(SequencedAssemblyRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
|
||||
Font font = Minecraft.getInstance().font;
|
||||
|
||||
matrixStack.pushPose();
|
||||
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(0, 15, 0);
|
||||
boolean singleOutput = recipe.getOutputChance() == 1;
|
||||
|
@ -171,6 +173,8 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
|
|||
matrixStack.translate(subWidth + margin, 0, 0);
|
||||
}
|
||||
matrixStack.popPose();
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,9 +37,11 @@ public class WorldshaperItemRenderer extends ZapperItemRenderer<WorldshaperModel
|
|||
float animation = getAnimationProgress(pt, leftHanded, mainHand);
|
||||
|
||||
// Core glows
|
||||
float multiplier = Mth.sin(worldTime * 5);
|
||||
float multiplier;
|
||||
if (mainHand || offHand)
|
||||
multiplier = animation;
|
||||
else
|
||||
multiplier = Mth.sin(worldTime * 5);
|
||||
|
||||
int lightItensity = (int) (15 * Mth.clamp(multiplier, 0, 1));
|
||||
int glowLight = LightTexture.pack(lightItensity, max(lightItensity, 4));
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
|
@ -7,20 +9,29 @@ import com.simibubi.create.Create;
|
|||
|
||||
import net.minecraft.client.renderer.RenderStateShard;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterShadersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
// TODO 1.17: use custom shaders instead of vanilla ones
|
||||
public class RenderTypes extends RenderStateShard {
|
||||
|
||||
public static final RenderStateShard.ShaderStateShard GLOWING_SHADER = new RenderStateShard.ShaderStateShard(() -> Shaders.glowingShader);
|
||||
|
||||
private static final RenderType OUTLINE_SOLID =
|
||||
RenderType.create(createLayerName("outline_solid"), DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true,
|
||||
RenderType.create(createLayerName("outline_solid"), DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, false,
|
||||
false, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_ENTITY_SOLID_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(AllSpecialTextures.BLANK.getLocation(), false, false))
|
||||
.setCullState(CULL)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
.createCompositeState(false));
|
||||
|
||||
public static RenderType getOutlineSolid() {
|
||||
return OUTLINE_SOLID;
|
||||
|
@ -28,7 +39,7 @@ public class RenderTypes extends RenderStateShard {
|
|||
|
||||
public static RenderType getOutlineTranslucent(ResourceLocation texture, boolean cull) {
|
||||
return RenderType.create(createLayerName("outline_translucent" + (cull ? "_cull" : "")),
|
||||
DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, RenderType.CompositeState.builder()
|
||||
DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, false, true, RenderType.CompositeState.builder()
|
||||
.setShaderState(cull ? RENDERTYPE_ENTITY_TRANSLUCENT_CULL_SHADER : RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
|
||||
|
@ -36,14 +47,15 @@ public class RenderTypes extends RenderStateShard {
|
|||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.setWriteMaskState(COLOR_WRITE)
|
||||
.createCompositeState(true));
|
||||
.createCompositeState(false));
|
||||
}
|
||||
|
||||
public static RenderType getGlowingSolid(ResourceLocation texture) {
|
||||
return RenderType.create(createLayerName("glowing_solid"), DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256,
|
||||
true, false, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_BEACON_BEAM_SHADER)
|
||||
.setShaderState(GLOWING_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||
.setCullState(CULL)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
|
@ -58,10 +70,9 @@ public class RenderTypes extends RenderStateShard {
|
|||
public static RenderType getGlowingTranslucent(ResourceLocation texture) {
|
||||
return RenderType.create(createLayerName("glowing_translucent"), DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS,
|
||||
256, true, true, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_BEACON_BEAM_SHADER)
|
||||
.setShaderState(GLOWING_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
|
||||
.setCullState(NO_CULL)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
|
@ -78,6 +89,7 @@ public class RenderTypes extends RenderStateShard {
|
|||
false, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_ENTITY_SOLID_SHADER)
|
||||
.setTextureState(BLOCK_SHEET)
|
||||
.setCullState(CULL)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
|
@ -100,7 +112,7 @@ public class RenderTypes extends RenderStateShard {
|
|||
}
|
||||
|
||||
private static final RenderType FLUID = RenderType.create(createLayerName("fluid"),
|
||||
DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, RenderType.CompositeState.builder()
|
||||
DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, false, true, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_CULL_SHADER)
|
||||
.setTextureState(BLOCK_SHEET_MIPPED)
|
||||
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
|
||||
|
@ -121,4 +133,15 @@ public class RenderTypes extends RenderStateShard {
|
|||
super(null, null, null);
|
||||
}
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
|
||||
private static class Shaders {
|
||||
private static ShaderInstance glowingShader;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterShaders(RegisterShadersEvent event) throws IOException {
|
||||
ResourceManager resourceManager = event.getResourceManager();
|
||||
event.registerShader(new ShaderInstance(resourceManager, Create.asResource("glowing_shader"), DefaultVertexFormat.NEW_ENTITY), shader -> glowingShader = shader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#version 150
|
||||
|
||||
#moj_import <fog.glsl>
|
||||
|
||||
uniform sampler2D Sampler0;
|
||||
|
||||
uniform vec4 ColorModulator;
|
||||
uniform float FogStart;
|
||||
uniform float FogEnd;
|
||||
uniform vec4 FogColor;
|
||||
uniform float GameTime;
|
||||
|
||||
in float vertexDistance;
|
||||
in vec4 vertexColor;
|
||||
in vec4 lightMapColor;
|
||||
in vec2 texCoord0;
|
||||
in vec4 normal;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
|
||||
color *= lightMapColor;
|
||||
fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "srcalpha",
|
||||
"dstrgb": "1-srcalpha"
|
||||
},
|
||||
"vertex": "create:glowing_shader",
|
||||
"fragment": "create:glowing_shader",
|
||||
"attributes": [
|
||||
"Position",
|
||||
"Color",
|
||||
"UV0",
|
||||
"UV1",
|
||||
"UV2",
|
||||
"Normal"
|
||||
],
|
||||
"samplers": [
|
||||
{ "name": "Sampler0" },
|
||||
{ "name": "Sampler2" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
|
||||
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
|
||||
{ "name": "IViewRotMat", "type": "matrix3x3", "count": 9, "values": [ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 ] },
|
||||
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
|
||||
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
|
||||
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
|
||||
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
|
||||
]
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#version 150
|
||||
|
||||
#moj_import <fog.glsl>
|
||||
|
||||
in vec3 Position;
|
||||
in vec4 Color;
|
||||
in vec2 UV0;
|
||||
in vec2 UV1;
|
||||
in ivec2 UV2;
|
||||
in vec3 Normal;
|
||||
|
||||
uniform sampler2D Sampler1;
|
||||
uniform sampler2D Sampler2;
|
||||
|
||||
uniform mat4 ModelViewMat;
|
||||
uniform mat4 ProjMat;
|
||||
uniform mat3 IViewRotMat;
|
||||
|
||||
out float vertexDistance;
|
||||
out vec4 vertexColor;
|
||||
out vec4 lightMapColor;
|
||||
out vec2 texCoord0;
|
||||
out vec2 texCoord1;
|
||||
out vec4 normal;
|
||||
|
||||
void main() {
|
||||
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
||||
|
||||
vertexDistance = cylindrical_distance(ModelViewMat, IViewRotMat * Position);
|
||||
vertexColor = Color;
|
||||
lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
|
||||
texCoord0 = UV0;
|
||||
texCoord1 = UV1;
|
||||
normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
|
||||
}
|
Loading…
Reference in a new issue