mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 06:24:29 +01:00
Merge branch 'mc1.18/dev' into mc1.18/global-railways
Conflicts: gradle.properties src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java
This commit is contained in:
commit
fcb5267ae0
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -49,6 +49,7 @@ body:
|
||||
label: Mod Version
|
||||
description: The version of the mod you were using when the bug occured
|
||||
options:
|
||||
- "0.4.0d"
|
||||
- "0.4.0c"
|
||||
- "0.4.0b"
|
||||
- "0.4.0a"
|
||||
|
@ -27,10 +27,10 @@ boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equal
|
||||
// The project is named Flywheel-Forge, but sub-projects are named by folder.
|
||||
boolean inWorkspace = findProject(':Flywheel') != null
|
||||
|
||||
ext.buildnumber = 0
|
||||
project.buildnumber = System.getenv('BUILD_NUMBER') != null ? System.getenv('BUILD_NUMBER') : 'custom'
|
||||
ext.buildNumber = System.getenv('BUILD_NUMBER')
|
||||
if (buildNumber == null) buildNumber = 'custom'
|
||||
|
||||
version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildnumber.equals('custom') ? "+${buildnumber}" : '')
|
||||
version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildNumber.equals('custom') ? "+${buildNumber}" : '')
|
||||
group = 'com.simibubi.create'
|
||||
archivesBaseName = 'create'
|
||||
|
||||
|
@ -19,9 +19,9 @@ parchment_version = 2022.01.23
|
||||
|
||||
# dependency versions
|
||||
registrate_version = MC1.18-1.0.21
|
||||
flywheel_version = 1.18-0.6.1.57
|
||||
flywheel_version = 1.18-0.6.1.62
|
||||
jei_minecraft_version = 1.18.1
|
||||
jei_version = 9.2.1.69
|
||||
jei_version = 9.3.2.92
|
||||
|
||||
# curseforge information
|
||||
projectId = 328085
|
||||
|
@ -289,16 +289,17 @@ public class AllItems {
|
||||
|
||||
public static final ItemEntry<PotatoCannonItem> POTATO_CANNON =
|
||||
REGISTRATE.item("potato_cannon", PotatoCannonItem::new)
|
||||
.properties(p -> p.stacksTo(1))
|
||||
.model(AssetLookup.itemModelWithPartials())
|
||||
.register();
|
||||
|
||||
public static final ItemEntry<ExtendoGripItem> EXTENDO_GRIP = REGISTRATE.item("extendo_grip", ExtendoGripItem::new)
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.model(AssetLookup.itemModelWithPartials())
|
||||
.register();
|
||||
|
||||
public static final ItemEntry<SymmetryWandItem> WAND_OF_SYMMETRY =
|
||||
REGISTRATE.item("wand_of_symmetry", SymmetryWandItem::new)
|
||||
.properties(p -> p.stacksTo(1).rarity(Rarity.UNCOMMON))
|
||||
.model(AssetLookup.itemModelWithPartials())
|
||||
.register();
|
||||
|
||||
|
@ -110,6 +110,7 @@ public class CreateClient {
|
||||
public static void invalidateRenderers() {
|
||||
BUFFER_CACHE.invalidate();
|
||||
|
||||
SCHEMATIC_HANDLER.updateRenderers();
|
||||
ContraptionRenderDispatcher.reset();
|
||||
}
|
||||
|
||||
|
@ -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,10 +22,16 @@ 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)
|
||||
.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
|
||||
|
@ -42,7 +42,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
@ -96,7 +95,6 @@ public class KineticTileEntity extends SmartTileEntity
|
||||
effects.tick();
|
||||
|
||||
if (level.isClientSide) {
|
||||
cachedBoundingBox = null; // cache the bounding box for every frame between ticks
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio());
|
||||
return;
|
||||
}
|
||||
@ -570,20 +568,6 @@ public class KineticTileEntity extends SmartTileEntity
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this));
|
||||
}
|
||||
|
||||
protected AABB cachedBoundingBox;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (cachedBoundingBox == null) {
|
||||
cachedBoundingBox = makeRenderBoundingBox();
|
||||
}
|
||||
return cachedBoundingBox;
|
||||
}
|
||||
|
||||
protected AABB makeRenderBoundingBox() {
|
||||
return super.getRenderBoundingBox();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void tickAudio() {
|
||||
float componentSpeed = Math.abs(getSpeed());
|
||||
|
@ -1,17 +1,13 @@
|
||||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.CachedRenderBBTileEntity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class HarvesterTileEntity extends SyncedTileEntity {
|
||||
|
||||
private static final AABB RENDER_BOX = new AABB(0, 0, 0, 1, 1, 1);
|
||||
public class HarvesterTileEntity extends CachedRenderBBTileEntity {
|
||||
|
||||
// For simulations such as Ponder
|
||||
private float manuallyAnimatedSpeed;
|
||||
@ -21,9 +17,8 @@ public class HarvesterTileEntity extends SyncedTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
return RENDER_BOX.move(worldPosition);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition);
|
||||
}
|
||||
|
||||
public float getAnimatedSpeed() {
|
||||
|
@ -35,7 +35,8 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
|
||||
@Override
|
||||
protected void renderSafe(PortableStorageInterfaceTileEntity te, float partialTicks, PoseStack ms,
|
||||
MultiBufferSource buffer, int light, int overlay) {
|
||||
if (Backend.isOn()) return;
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
float progress = te.getExtensionDistance(partialTicks);
|
||||
|
@ -15,8 +15,6 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity {
|
||||
|
||||
@ -134,15 +132,9 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
|
||||
return powered;
|
||||
}
|
||||
|
||||
protected AABB cachedBoundingBox;
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (cachedBoundingBox == null) {
|
||||
cachedBoundingBox = super.getRenderBoundingBox().inflate(2);
|
||||
}
|
||||
return cachedBoundingBox;
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(2);
|
||||
}
|
||||
|
||||
public boolean isTransferring() {
|
||||
|
@ -231,7 +231,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
||||
processingEntity.setPos(entityOutPos.x, entityOutPos.y, entityOutPos.z);
|
||||
}
|
||||
}
|
||||
processingEntity.hurt(CrushingWheelTileEntity.damageSource, crusherDamage);
|
||||
processingEntity.hurt(CrushingWheelTileEntity.DAMAGE_SOURCE, crusherDamage);
|
||||
if (!processingEntity.isAlive()) {
|
||||
processingEntity.setPos(entityOutPos.x, entityOutPos.y, entityOutPos.z);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
@EventBusSubscriber
|
||||
public class CrushingWheelTileEntity extends KineticTileEntity {
|
||||
|
||||
public static DamageSource damageSource = new DamageSource("create.crush").bypassArmor()
|
||||
public static final DamageSource DAMAGE_SOURCE = new DamageSource("create.crush").bypassArmor()
|
||||
.setScalesWithDifficulty();
|
||||
|
||||
public CrushingWheelTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
@ -40,7 +40,7 @@ public class CrushingWheelTileEntity extends KineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).inflate(1);
|
||||
}
|
||||
|
||||
@ -52,14 +52,14 @@ public class CrushingWheelTileEntity extends KineticTileEntity {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void crushingIsFortunate(LootingLevelEvent event) {
|
||||
if (event.getDamageSource() != damageSource)
|
||||
if (event.getDamageSource() != DAMAGE_SOURCE)
|
||||
return;
|
||||
event.setLootingLevel(2); //This does not currently increase mob drops. It seems like this only works for damage done by an entity.
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleCrushedMobDrops(LivingDropsEvent event) {
|
||||
if (event.getSource() != CrushingWheelTileEntity.damageSource)
|
||||
if (event.getSource() != CrushingWheelTileEntity.DAMAGE_SOURCE)
|
||||
return;
|
||||
Vec3 outSpeed = Vec3.ZERO;
|
||||
for (ItemEntity outputItem : event.getDrops()) {
|
||||
|
@ -9,7 +9,8 @@ import com.jozufozu.flywheel.core.Materials;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||
@ -30,7 +31,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class DeployerActorInstance extends ActorInstance {
|
||||
|
||||
private final MatrixTransformStack stack = new MatrixTransformStack();
|
||||
private final PoseStack stack = new PoseStack();
|
||||
Direction facing;
|
||||
boolean stationaryTimer;
|
||||
|
||||
@ -94,27 +95,29 @@ public class DeployerActorInstance extends ActorInstance {
|
||||
|
||||
Vec3 offset = Vec3.atLowerCornerOf(facing.getNormal()).scale(factor);
|
||||
|
||||
stack.setIdentity()
|
||||
.translate(context.localPos)
|
||||
TransformStack tstack = TransformStack.cast(stack);
|
||||
stack.setIdentity();
|
||||
tstack.translate(context.localPos)
|
||||
.translate(offset);
|
||||
|
||||
transformModel(stack, pole, hand, yRot, xRot, zRot);
|
||||
}
|
||||
|
||||
static void transformModel(MatrixTransformStack msr, ModelData pole, ModelData hand, float yRot, float xRot, float zRot) {
|
||||
static void transformModel(PoseStack stack, ModelData pole, ModelData hand, float yRot, float xRot, float zRot) {
|
||||
TransformStack tstack = TransformStack.cast(stack);
|
||||
|
||||
msr.centre();
|
||||
msr.rotate(Direction.UP, (float) ((yRot) / 180 * Math.PI));
|
||||
msr.rotate(Direction.EAST, (float) ((xRot) / 180 * Math.PI));
|
||||
tstack.centre();
|
||||
tstack.rotate(Direction.UP, (float) ((yRot) / 180 * Math.PI));
|
||||
tstack.rotate(Direction.EAST, (float) ((xRot) / 180 * Math.PI));
|
||||
|
||||
msr.pushPose();
|
||||
msr.rotate(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
|
||||
msr.unCentre();
|
||||
pole.setTransform(msr.unwrap());
|
||||
msr.popPose();
|
||||
stack.pushPose();
|
||||
tstack.rotate(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
|
||||
tstack.unCentre();
|
||||
pole.setTransform(stack);
|
||||
stack.popPose();
|
||||
|
||||
msr.unCentre();
|
||||
tstack.unCentre();
|
||||
|
||||
hand.setTransform(msr.unwrap());
|
||||
hand.setTransform(stack);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import static com.simibubi.create.content.contraptions.base.DirectionalKineticBl
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
@ -197,7 +197,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||
float time = AnimationTickHolder.getRenderTime(context.world) / 20;
|
||||
float angle = (time * speed) % 360;
|
||||
|
||||
new MatrixTransformStack(m)
|
||||
TransformStack.cast(m)
|
||||
.centre()
|
||||
.rotateY(axis == Axis.Z ? 90 : 0)
|
||||
.rotateZ(axis.isHorizontal() ? 90 : 0)
|
||||
|
@ -388,8 +388,8 @@ public class DeployerTileEntity extends KineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
return super.makeRenderBoundingBox().inflate(3);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,8 +50,8 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
return super.makeRenderBoundingBox().inflate(2);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,8 +14,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class EngineTileEntity extends SmartTileEntity {
|
||||
|
||||
@ -31,14 +29,9 @@ public class EngineTileEntity extends SmartTileEntity {
|
||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||
}
|
||||
|
||||
protected AABB cachedBoundingBox;
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (cachedBoundingBox == null) {
|
||||
cachedBoundingBox = super.getRenderBoundingBox().inflate(1.5f);
|
||||
}
|
||||
return cachedBoundingBox;
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,7 +91,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).expandTowards(0, -1.5, 0);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).expandTowards(0, -1.5, 0)
|
||||
.expandTowards(0, 1, 0);
|
||||
}
|
||||
|
@ -73,8 +73,6 @@ import net.minecraftforge.items.IItemHandler;
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
||||
|
||||
private static final AABB RENDER_BOX = new AABB(0, 0, 0, 1, 1, 1);
|
||||
|
||||
private static final Object cuttingRecipesKey = new Object();
|
||||
public static final Supplier<RecipeType<?>> woodcuttingRecipeType =
|
||||
Suppliers.memoize(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting")));
|
||||
@ -125,9 +123,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AABB makeRenderBoundingBox() {
|
||||
return RENDER_BOX.inflate(.125f)
|
||||
.move(worldPosition);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).inflate(.125f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.simibubi.create.content.contraptions.components.structureMovement.interaction.controls;
|
||||
|
||||
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
@ -41,7 +41,8 @@ public class ControlsRenderer {
|
||||
float vAngle = (float) Mth.clamp(first ? firstLever * 70 - 25 : secondLever * 15, -45, 45);
|
||||
SuperByteBuffer lever = CachedBufferer.partial(AllBlockPartials.TRAIN_CONTROLS_LEVER, state);
|
||||
ms.pushPose();
|
||||
new MatrixTransformStack(ms).centre()
|
||||
TransformStack.cast(ms)
|
||||
.centre()
|
||||
.rotateY(hAngle)
|
||||
.translate(0, 0, 4 / 16f)
|
||||
.rotateX(vAngle - 45)
|
||||
|
@ -34,8 +34,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
return super.makeRenderBoundingBox().expandTowards(0, -offset, 0);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().expandTowards(0, -offset, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,6 +43,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
||||
super.tick();
|
||||
if (isVirtual())
|
||||
prevAnimatedOffset = offset;
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).inflate(1);
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,6 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@ -99,9 +97,8 @@ public class HosePulleyTileEntity extends KineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
return super.getRenderBoundingBox().expandTowards(0, -offset.getValue(), 0);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().expandTowards(0, -offset.getValue(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,6 +119,7 @@ public class HosePulleyTileEntity extends KineticTileEntity {
|
||||
isMoving = false;
|
||||
|
||||
offset.setValue(newOffset);
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,8 +33,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@ -56,14 +54,9 @@ public class SpoutTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||
processingTicks = -1;
|
||||
}
|
||||
|
||||
protected AABB cachedBoundingBox;
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (cachedBoundingBox == null)
|
||||
cachedBoundingBox = super.getRenderBoundingBox().expandTowards(0, -2, 0);
|
||||
return cachedBoundingBox;
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().expandTowards(0, -2, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,8 +25,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
@ -58,7 +56,6 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||
|
||||
// For rendering purposes only
|
||||
private InterpolatedChasingValue fluidLevel;
|
||||
private AABB renderBoundingBox;
|
||||
|
||||
public FluidTankTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
@ -123,7 +120,7 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||
super.initialize();
|
||||
sendData();
|
||||
if (level.isClientSide)
|
||||
updateRenderBoundingBox();
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
|
||||
private void onPositionChanged() {
|
||||
@ -304,20 +301,12 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||
return isController() ? worldPosition : controller;
|
||||
}
|
||||
|
||||
public void updateRenderBoundingBox() {
|
||||
if (isController())
|
||||
renderBoundingBox = super.getRenderBoundingBox().expandTowards(width - 1, height - 1, width - 1);
|
||||
else
|
||||
renderBoundingBox = super.getRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (renderBoundingBox == null) {
|
||||
renderBoundingBox = super.getRenderBoundingBox();
|
||||
}
|
||||
return renderBoundingBox;
|
||||
protected AABB createRenderBoundingBox() {
|
||||
if (isController())
|
||||
return super.createRenderBoundingBox().expandTowards(width - 1, height - 1, width - 1);
|
||||
else
|
||||
return super.createRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -380,7 +369,7 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
|
||||
level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 16);
|
||||
if (isController())
|
||||
tankInventory.setCapacity(getCapacityMultiplier() * getTotalTankSize());
|
||||
updateRenderBoundingBox();
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
if (isController()) {
|
||||
float fillState = getFillState();
|
||||
|
@ -126,6 +126,7 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||
lighter = new BeltLighter();
|
||||
}
|
||||
});
|
||||
invalidateRenderBoundingBox();
|
||||
|
||||
getInventory().tick();
|
||||
|
||||
@ -160,11 +161,11 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
public AABB createRenderBoundingBox() {
|
||||
if (!isController())
|
||||
return super.makeRenderBoundingBox();
|
||||
return super.createRenderBoundingBox();
|
||||
else
|
||||
return super.makeRenderBoundingBox().inflate(beltLength + 1);
|
||||
return super.createRenderBoundingBox().inflate(beltLength + 1);
|
||||
}
|
||||
|
||||
protected void initializeItemHandler() {
|
||||
|
@ -17,7 +17,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB makeRenderBoundingBox() {
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).inflate(1);
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,6 @@ import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public enum AllArmorMaterials implements ArmorMaterial {
|
||||
|
||||
@ -30,47 +28,54 @@ public enum AllArmorMaterials implements ArmorMaterial {
|
||||
private final float knockbackResistance;
|
||||
private final Supplier<Ingredient> repairMaterial;
|
||||
|
||||
private AllArmorMaterials(String p_i231593_3_, int p_i231593_4_, int[] p_i231593_5_, int p_i231593_6_,
|
||||
SoundEvent p_i231593_7_, float p_i231593_8_, float p_i231593_9_, Supplier<Ingredient> p_i231593_10_) {
|
||||
this.name = p_i231593_3_;
|
||||
this.maxDamageFactor = p_i231593_4_;
|
||||
this.damageReductionAmountArray = p_i231593_5_;
|
||||
this.enchantability = p_i231593_6_;
|
||||
this.soundEvent = p_i231593_7_;
|
||||
this.toughness = p_i231593_8_;
|
||||
this.knockbackResistance = p_i231593_9_;
|
||||
this.repairMaterial = Suppliers.memoize(p_i231593_10_::get);
|
||||
private AllArmorMaterials(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
|
||||
SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) {
|
||||
this.name = name;
|
||||
this.maxDamageFactor = maxDamageFactor;
|
||||
this.damageReductionAmountArray = damageReductionAmountArray;
|
||||
this.enchantability = enchantability;
|
||||
this.soundEvent = soundEvent;
|
||||
this.toughness = toughness;
|
||||
this.knockbackResistance = knockbackResistance;
|
||||
this.repairMaterial = Suppliers.memoize(repairMaterial::get);
|
||||
}
|
||||
|
||||
public int getDurabilityForSlot(EquipmentSlot p_200896_1_) {
|
||||
return MAX_DAMAGE_ARRAY[p_200896_1_.getIndex()] * this.maxDamageFactor;
|
||||
@Override
|
||||
public int getDurabilityForSlot(EquipmentSlot slot) {
|
||||
return MAX_DAMAGE_ARRAY[slot.getIndex()] * this.maxDamageFactor;
|
||||
}
|
||||
|
||||
public int getDefenseForSlot(EquipmentSlot p_200902_1_) {
|
||||
return this.damageReductionAmountArray[p_200902_1_.getIndex()];
|
||||
@Override
|
||||
public int getDefenseForSlot(EquipmentSlot slot) {
|
||||
return this.damageReductionAmountArray[slot.getIndex()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentValue() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getEquipSound() {
|
||||
return this.soundEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ingredient getRepairIngredient() {
|
||||
return this.repairMaterial.get();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getToughness() {
|
||||
return this.toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getKnockbackResistance() {
|
||||
return this.knockbackResistance;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CustomRotationParticle extends SimpleAnimatedParticle {
|
||||
float maxU = mirror ? getU0() : getU1();
|
||||
float minV = getV0();
|
||||
float maxV = getV1();
|
||||
int brightness = OptifineHandler.usingShaders() ? LightTexture.pack(12, 15 ) : getLightColor(partialTicks);
|
||||
int brightness = OptifineHandler.isUsingShaders() ? LightTexture.pack(12, 15) : getLightColor(partialTicks);
|
||||
builder.vertex(vertices[0].x(), vertices[0].y(), vertices[0].z()).uv(maxU, maxV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
|
||||
builder.vertex(vertices[1].x(), vertices[1].y(), vertices[1].z()).uv(maxU, minV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
|
||||
builder.vertex(vertices[2].x(), vertices[2].y(), vertices[2].z()).uv(minU, minV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
|
||||
|
@ -32,7 +32,6 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@ -57,8 +56,7 @@ public class SymmetryWandItem extends Item {
|
||||
private static final String ENABLE = "enable";
|
||||
|
||||
public SymmetryWandItem(Properties properties) {
|
||||
super(properties.stacksTo(1)
|
||||
.rarity(Rarity.UNCOMMON));
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -30,7 +30,6 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
@ -55,8 +54,6 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber
|
||||
public class ExtendoGripItem extends Item {
|
||||
private static DamageSource lastActiveDamageSource;
|
||||
|
||||
public static final int MAX_DAMAGE = 200;
|
||||
|
||||
public static final AttributeModifier singleRangeAttributeModifier =
|
||||
@ -66,19 +63,19 @@ public class ExtendoGripItem extends Item {
|
||||
new AttributeModifier(UUID.fromString("8f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 5,
|
||||
AttributeModifier.Operation.ADDITION);
|
||||
|
||||
static Supplier<Multimap<Attribute, AttributeModifier>> rangeModifier = Suppliers.memoize(() ->
|
||||
private static final Supplier<Multimap<Attribute, AttributeModifier>> rangeModifier = Suppliers.memoize(() ->
|
||||
// Holding an ExtendoGrip
|
||||
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier)
|
||||
);
|
||||
|
||||
static Supplier<Multimap<Attribute, AttributeModifier>> doubleRangeModifier = Suppliers.memoize(() ->
|
||||
private static final Supplier<Multimap<Attribute, AttributeModifier>> doubleRangeModifier = Suppliers.memoize(() ->
|
||||
// Holding two ExtendoGrips o.O
|
||||
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier)
|
||||
);
|
||||
|
||||
private static DamageSource lastActiveDamageSource;
|
||||
|
||||
public ExtendoGripItem(Properties properties) {
|
||||
super(properties.stacksTo(1)
|
||||
.rarity(Rarity.UNCOMMON));
|
||||
super(properties.defaultDurability(MAX_DAMAGE));
|
||||
}
|
||||
|
||||
public static final String EXTENDO_MARKER = "createExtendo";
|
||||
@ -194,10 +191,10 @@ public class ExtendoGripItem extends Item {
|
||||
findAndDamageExtendoGrip((Player) entity);
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public static void consumeDurabilityOnPlace(PlayerInteractEvent event) {
|
||||
// @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
// public static void consumeDurabilityOnPlace(PlayerInteractEvent event) {
|
||||
// findAndDamageExtendoGrip(event.getPlayer());
|
||||
}
|
||||
// }
|
||||
|
||||
private static void findAndDamageExtendoGrip(Player player) {
|
||||
if (player == null)
|
||||
@ -236,16 +233,6 @@ public class ExtendoGripItem extends Item {
|
||||
return AllConfigs.SERVER.curiosities.maxExtendoGripActions.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeDepleted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage(ItemStack stack) {
|
||||
return MAX_DAMAGE;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void bufferLivingAttackEvent(LivingAttackEvent event) {
|
||||
// Workaround for removed patch to get the attacking entity.
|
||||
|
@ -45,7 +45,7 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||
public class SandPaperItem extends Item implements CustomUseEffectsItem {
|
||||
|
||||
public SandPaperItem(Properties properties) {
|
||||
super(properties.durability(8));
|
||||
super(properties.defaultDurability(8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,6 +98,16 @@ public class BuiltinPotatoProjectileTypes {
|
||||
.soundPitch(1.25f)
|
||||
.registerAndAssign(Items.SWEET_BERRIES),
|
||||
|
||||
GLOW_BERRIES = create("glow_berry").damage(2)
|
||||
.reloadTicks(10)
|
||||
.knockback(0.05f)
|
||||
.velocity(1.05f)
|
||||
.renderTumbling()
|
||||
.splitInto(2)
|
||||
.soundPitch(1.2f)
|
||||
.onEntityHit(potion(MobEffects.GLOWING, 1, 200, false))
|
||||
.registerAndAssign(Items.GLOW_BERRIES),
|
||||
|
||||
CHOCOLATE_BERRIES = create("chocolate_berry").damage(4)
|
||||
.reloadTicks(10)
|
||||
.knockback(0.2f)
|
||||
@ -188,7 +198,7 @@ public class BuiltinPotatoProjectileTypes {
|
||||
.soundPitch(1.5f)
|
||||
.registerAndAssign(Items.MELON_SLICE),
|
||||
|
||||
GLISTENING_MELON = create("glistening_melon").damage(5)
|
||||
GLISTERING_MELON = create("glistering_melon").damage(5)
|
||||
.reloadTicks(8)
|
||||
.knockback(0.1f)
|
||||
.velocity(1.45f)
|
||||
@ -283,7 +293,7 @@ public class BuiltinPotatoProjectileTypes {
|
||||
};
|
||||
}
|
||||
|
||||
public static void applyEffect(LivingEntity entity, MobEffectInstance effect) {
|
||||
private static void applyEffect(LivingEntity entity, MobEffectInstance effect) {
|
||||
if (effect.getEffect().isInstantenous())
|
||||
effect.getEffect().applyInstantenousEffect(null, null, entity, effect.getDuration(), 1.0);
|
||||
else
|
||||
|
@ -53,7 +53,7 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
|
||||
public static final int MAX_DAMAGE = 100;
|
||||
|
||||
public PotatoCannonItem(Properties properties) {
|
||||
super(properties);
|
||||
super(properties.defaultDurability(MAX_DAMAGE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,11 +81,6 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
|
||||
return use(context.getLevel(), context.getPlayer(), context.getHand()).getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBarVisible(ItemStack stack) {
|
||||
return BackTankUtil.isBarVisible(stack, maxUses());
|
||||
@ -105,20 +100,10 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
|
||||
return AllConfigs.SERVER.curiosities.maxPotatoCannonShots.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeDepleted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCannon(ItemStack stack) {
|
||||
return stack.getItem() instanceof PotatoCannonItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage(ItemStack stack) {
|
||||
return MAX_DAMAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
@ -275,11 +260,6 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentValue() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntitySwing(ItemStack stack, LivingEntity entity) {
|
||||
return true;
|
||||
|
@ -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));
|
||||
|
@ -127,7 +127,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB getRenderBoundingBox() {
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition).expandTowards(0, -3, 0);
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class ArmTileEntity extends KineticTileEntity implements ITransformableTE {
|
||||
|
||||
@ -160,9 +158,8 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB makeRenderBoundingBox() {
|
||||
return super.makeRenderBoundingBox().inflate(3);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(3);
|
||||
}
|
||||
|
||||
private boolean checkForMusicAmong(List<ArmInteractionPoint> list) {
|
||||
|
@ -3,7 +3,8 @@ package com.simibubi.create.content.logistics.trains;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.jozufozu.flywheel.repack.joml.Math;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack.Pose;
|
||||
import com.simibubi.create.content.logistics.trains.track.TrackRenderer;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
@ -362,6 +363,8 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
if (bakedSegments != null)
|
||||
return bakedSegments;
|
||||
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack tstack = TransformStack.cast(poseStack);
|
||||
int segmentCount = getSegmentCount();
|
||||
bakedSegments = new SegmentAngles[segmentCount + 1];
|
||||
Couple<Vec3> previousOffsets = null;
|
||||
@ -389,15 +392,15 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
Vec3 tieAngles = TrackRenderer.getModelAngles(segment.normal, railMiddle.subtract(prevMiddle));
|
||||
angles.lightPosition = new BlockPos(railMiddle);
|
||||
|
||||
MatrixTransformStack mts = new MatrixTransformStack();
|
||||
mts.translate(prevMiddle)
|
||||
poseStack.pushPose();
|
||||
tstack.translate(prevMiddle)
|
||||
.rotateYRadians(tieAngles.y)
|
||||
.rotateXRadians(tieAngles.x)
|
||||
.rotateZRadians(tieAngles.z)
|
||||
.translate(-1 / 2f, -2 / 16f - 1 / 256f, 0);
|
||||
angles.tieTransform = mts.unwrap()
|
||||
.last();
|
||||
angles.tieTransform = poseStack.last();
|
||||
angles.railTransforms = Couple.create(null, null);
|
||||
poseStack.popPose();
|
||||
|
||||
// Rails
|
||||
float scale = end ? 2.2f : 2.1f;
|
||||
@ -407,15 +410,15 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
Vec3 diff = railI.subtract(prevI);
|
||||
Vec3 anglesI = TrackRenderer.getModelAngles(segment.normal, diff);
|
||||
|
||||
mts = new MatrixTransformStack();
|
||||
mts.translate(prevI)
|
||||
poseStack.pushPose();
|
||||
tstack.translate(prevI)
|
||||
.rotateYRadians(anglesI.y)
|
||||
.rotateXRadians(anglesI.x)
|
||||
.rotateZRadians(anglesI.z)
|
||||
.translate(0, -2 / 16f + (i % 2 == 0 ? 1 : -1) / 2048f - 1 / 256f, -1 / 32f)
|
||||
.scale(1, 1, (float) diff.length() * scale);
|
||||
angles.railTransforms.set(first, mts.unwrap()
|
||||
.last());
|
||||
angles.railTransforms.set(first, poseStack.last());
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
previousOffsets = railOffsets;
|
||||
@ -429,6 +432,8 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
if (bakedGirders != null)
|
||||
return bakedGirders;
|
||||
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack tstack = TransformStack.cast(poseStack);
|
||||
int segmentCount = getSegmentCount();
|
||||
bakedGirders = new GirderAngles[segmentCount + 1];
|
||||
Couple<Couple<Vec3>> previousOffsets = null;
|
||||
@ -482,15 +487,15 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
Vec3 beamDiff = currentBeam.subtract(previousBeam);
|
||||
Vec3 beamAngles = TrackRenderer.getModelAngles(segment.normal, beamDiff);
|
||||
|
||||
MatrixTransformStack mts = new MatrixTransformStack();
|
||||
mts.translate(previousBeam)
|
||||
poseStack.pushPose();
|
||||
tstack.translate(previousBeam)
|
||||
.rotateYRadians(beamAngles.y)
|
||||
.rotateXRadians(beamAngles.x)
|
||||
.rotateZRadians(beamAngles.z)
|
||||
.translate(0, 2 / 16f + (segment.index % 2 == 0 ? 1 : -1) / 2048f - 1 / 1024f, -1 / 32f)
|
||||
.scale(1, 1, (float) beamDiff.length() * scale);
|
||||
angles.beams.set(first, mts.unwrap()
|
||||
.last());
|
||||
angles.beams.set(first, poseStack.last());
|
||||
poseStack.popPose();
|
||||
|
||||
// Caps
|
||||
for (boolean top : Iterate.trueAndFalse) {
|
||||
@ -501,8 +506,8 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
Vec3 diff = current.subtract(previous);
|
||||
Vec3 capAngles = TrackRenderer.getModelAngles(segment.normal, diff);
|
||||
|
||||
mts = new MatrixTransformStack();
|
||||
mts.translate(previous)
|
||||
poseStack.pushPose();
|
||||
tstack.translate(previous)
|
||||
.rotateYRadians(capAngles.y)
|
||||
.rotateXRadians(capAngles.x)
|
||||
.rotateZRadians(capAngles.z)
|
||||
@ -510,8 +515,8 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
|
||||
.rotateZ(top ? 0 : 0)
|
||||
.scale(1, 1, (float) diff.length() * scale);
|
||||
angles.beamCaps.get(top)
|
||||
.set(first, mts.unwrap()
|
||||
.last());
|
||||
.set(first, poseStack.last());
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.simibubi.create.content.logistics.trains.entity;
|
||||
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntityRenderer;
|
||||
|
||||
@ -40,11 +40,11 @@ public class CarriageContraptionEntityRenderer extends ContraptionEntityRenderer
|
||||
return;
|
||||
|
||||
ms.pushPose();
|
||||
MatrixTransformStack msr = new MatrixTransformStack(ms);
|
||||
float viewYRot = entity.getViewYRot(partialTicks);
|
||||
float viewXRot = entity.getViewXRot(partialTicks);
|
||||
int bogeySpacing = carriage.bogeySpacing;
|
||||
msr.rotateY(viewYRot + 90)
|
||||
TransformStack.cast(ms)
|
||||
.rotateY(viewYRot + 90)
|
||||
.rotateX(-viewXRot)
|
||||
.rotateY(180)
|
||||
.translate(0, 0, first ? 0 : -bogeySpacing)
|
||||
|
@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@ -435,7 +435,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleContaine
|
||||
matrixStack.popPose();
|
||||
|
||||
if (xOffset + 16 > cardWidth - 26) {
|
||||
new MatrixTransformStack(matrixStack).rotateZ(-90);
|
||||
TransformStack.cast(matrixStack).rotateZ(-90);
|
||||
Matrix4f m = matrixStack.last()
|
||||
.pose();
|
||||
GuiUtils.drawGradientRect(m, 200, -cardHeight + 2, 18, -2 - cardHeader, 28, 0x44000000, 0x00000000);
|
||||
|
@ -41,6 +41,8 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class StationTileEntity extends SmartTileEntity {
|
||||
|
||||
@ -118,7 +120,7 @@ public class StationTileEntity extends SmartTileEntity {
|
||||
super.read(tag, clientPacket);
|
||||
if (tag.contains("ToMigrate"))
|
||||
toMigrate = tag.getCompound("ToMigrate");
|
||||
renderBounds = null;
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -511,17 +513,17 @@ public class StationTileEntity extends SmartTileEntity {
|
||||
sendData();
|
||||
}
|
||||
|
||||
// Render
|
||||
|
||||
private AABB renderBounds = null;
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (isAssembling())
|
||||
return INFINITE_EXTENT_AABB;
|
||||
if (renderBounds == null)
|
||||
renderBounds = new AABB(worldPosition, getTarget().getGlobalPosition()).inflate(2);
|
||||
return renderBounds;
|
||||
return super.getRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition, getTarget().getGlobalPosition()).inflate(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public class SignalTileEntity extends SmartTileEntity {
|
||||
id = tag.getUUID("Id");
|
||||
state = NBTHelper.readEnum(tag, "State", SignalState.class);
|
||||
overlay = NBTHelper.readEnum(tag, "Overlay", OverlayState.class);
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
|
||||
public boolean isPowered() {
|
||||
@ -210,15 +211,9 @@ public class SignalTileEntity extends SmartTileEntity {
|
||||
scheduleBlockTick();
|
||||
}
|
||||
|
||||
// Render
|
||||
|
||||
private AABB renderBounds = null;
|
||||
|
||||
@Override
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (renderBounds == null)
|
||||
renderBounds = new AABB(worldPosition, getTarget().getGlobalPosition()).inflate(2);
|
||||
return renderBounds;
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(worldPosition, getTarget().getGlobalPosition()).inflate(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
package com.simibubi.create.content.logistics.trains.track;
|
||||
|
||||
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.CachedRenderBBTileEntity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
public class StandardBogeyTileEntity extends SyncedTileEntity {
|
||||
public class StandardBogeyTileEntity extends CachedRenderBBTileEntity {
|
||||
|
||||
public StandardBogeyTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB getRenderBoundingBox() {
|
||||
return super.getRenderBoundingBox().inflate(2);
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
@ -348,7 +348,7 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public PartialModel prepareAssemblyOverlay(BlockGetter world, BlockPos pos, BlockState state, Direction direction,
|
||||
PoseStack ms) {
|
||||
new MatrixTransformStack(ms).rotateCentered(Direction.UP,
|
||||
TransformStack.cast(ms).rotateCentered(Direction.UP,
|
||||
AngleHelper.rad(AngleHelper.horizontalAngle(direction)));
|
||||
return AllBlockPartials.TRACK_ASSEMBLING_OVERLAY;
|
||||
}
|
||||
@ -365,7 +365,7 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
|
||||
Vec3 normal = getUpNormal(world, pos, state);
|
||||
Vec3 angles = TrackRenderer.getModelAngles(normal, directionVec);
|
||||
|
||||
new MatrixTransformStack(ms).centre()
|
||||
TransformStack.cast(ms).centre()
|
||||
.rotateYRadians(angles.y)
|
||||
.rotateXRadians(angles.x)
|
||||
.unCentre()
|
||||
|
@ -29,6 +29,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
public class TrackTileEntity extends SmartTileEntity implements ITransformableTE, IMergeableTE {
|
||||
@ -118,6 +119,7 @@ public class TrackTileEntity extends SmartTileEntity implements ITransformableTE
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
return INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
package com.simibubi.create.content.palettes;
|
||||
|
||||
import com.simibubi.create.foundation.block.render.IBlockVertexColor;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
||||
public class ScoriaVertexColor implements IBlockVertexColor {
|
||||
|
||||
public static final ScoriaVertexColor INSTANCE = new ScoriaVertexColor();
|
||||
|
||||
@Override
|
||||
public int getColor(float x, float y, float z) {
|
||||
float x2 = (float) Math.floor(z + x - y * .5);
|
||||
float y2 = (float) Math.floor(y * 1.5 + x * .5 - z);
|
||||
float z2 = (float) Math.floor(y - z * .5 - x);
|
||||
|
||||
Color color = new Color(0x448888);
|
||||
if (x2 % 2 == 0)
|
||||
color.modifyValue(v -> v | 0x0011ff);
|
||||
if (z2 % 2 == 0)
|
||||
color.modifyValue(v -> v | 0x888888);
|
||||
|
||||
color.mixWith(Color.rainbowColor((int) (x + y + z) * 170), .4f);
|
||||
|
||||
if ((x2 % 4 == 0) || (y2 % 4 == 0))
|
||||
color.mixWith(Color.WHITE, .8f);
|
||||
|
||||
return color.getRGB() & 0x00_ffffff;
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
@ -142,10 +143,15 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(LightLayer p_226658_1_, BlockPos p_226658_2_) {
|
||||
public int getBrightness(LightLayer lightLayer, BlockPos pos) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getShade(Direction face, boolean hasShade) {
|
||||
return 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LevelTickAccess<Block> getBlockTicks() {
|
||||
return BlackholeTickAccess.emptyLevelList();
|
||||
|
@ -55,6 +55,8 @@ import net.minecraft.world.level.block.state.properties.BedPart;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@ -812,6 +814,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
return INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
@ -211,6 +211,12 @@ public class SchematicHandler {
|
||||
|
||||
}
|
||||
|
||||
public void updateRenderers() {
|
||||
for (SchematicRenderer renderer : renderers) {
|
||||
renderer.update();
|
||||
}
|
||||
}
|
||||
|
||||
public IIngameOverlay getOverlayRenderer() {
|
||||
return overlayRenderer;
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
package com.simibubi.create.content.schematics.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.jozufozu.flywheel.core.model.ModelUtil;
|
||||
import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder;
|
||||
import com.jozufozu.flywheel.core.model.ShadeSeparatingVertexConsumer;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@ -22,17 +20,20 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.block.ModelBlockRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.RenderShape;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
|
||||
public class SchematicRenderer {
|
||||
|
||||
private static final ThreadLocal<ThreadLocalObjects> THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new);
|
||||
|
||||
private final Map<RenderType, SuperByteBuffer> bufferCache = new HashMap<>(getLayerCount());
|
||||
private final Set<RenderType> usedBlockRenderLayers = new HashSet<>(getLayerCount());
|
||||
private final Set<RenderType> startedBufferBuilders = new HashSet<>(getLayerCount());
|
||||
private boolean active;
|
||||
private boolean changed;
|
||||
protected SchematicWorld schematic;
|
||||
@ -64,76 +65,72 @@ public class SchematicRenderer {
|
||||
if (mc.level == null || mc.player == null || !changed)
|
||||
return;
|
||||
|
||||
redraw(mc);
|
||||
redraw();
|
||||
changed = false;
|
||||
}
|
||||
|
||||
public void render(PoseStack ms, SuperRenderTypeBuffer buffer) {
|
||||
public void render(PoseStack ms, SuperRenderTypeBuffer buffers) {
|
||||
if (!active)
|
||||
return;
|
||||
buffer.getBuffer(RenderType.solid());
|
||||
for (RenderType layer : RenderType.chunkBufferLayers()) {
|
||||
if (!usedBlockRenderLayers.contains(layer))
|
||||
continue;
|
||||
SuperByteBuffer superByteBuffer = bufferCache.get(layer);
|
||||
superByteBuffer.disableDiffuseMult();
|
||||
superByteBuffer.renderInto(ms, buffer.getBuffer(layer));
|
||||
}
|
||||
TileEntityRenderHelper.renderTileEntities(schematic, schematic.getRenderedTileEntities(), ms, buffer);
|
||||
}
|
||||
|
||||
protected void redraw(Minecraft minecraft) {
|
||||
usedBlockRenderLayers.clear();
|
||||
startedBufferBuilders.clear();
|
||||
|
||||
final SchematicWorld blockAccess = schematic;
|
||||
final BlockRenderDispatcher blockRendererDispatcher = minecraft.getBlockRenderer();
|
||||
|
||||
List<BlockState> blockstates = new LinkedList<>();
|
||||
Map<RenderType, BufferBuilder> buffers = new HashMap<>();
|
||||
PoseStack ms = new PoseStack();
|
||||
Random random = new Random();
|
||||
|
||||
BlockPos.betweenClosedStream(blockAccess.getBounds())
|
||||
.forEach(localPos -> {
|
||||
ms.pushPose();
|
||||
TransformStack.cast(ms)
|
||||
.translate(localPos);
|
||||
BlockPos pos = localPos.offset(anchor);
|
||||
BlockState state = blockAccess.getBlockState(pos);
|
||||
|
||||
for (RenderType blockRenderLayer : RenderType.chunkBufferLayers()) {
|
||||
if (!ItemBlockRenderTypes.canRenderInLayer(state, blockRenderLayer))
|
||||
continue;
|
||||
ForgeHooksClient.setRenderType(blockRenderLayer);
|
||||
if (!buffers.containsKey(blockRenderLayer))
|
||||
buffers.put(blockRenderLayer, new BufferBuilder(512));
|
||||
|
||||
BufferBuilder bufferBuilder = buffers.get(blockRenderLayer);
|
||||
if (startedBufferBuilders.add(blockRenderLayer))
|
||||
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
|
||||
BlockEntity tileEntity = blockAccess.getBlockEntity(localPos);
|
||||
|
||||
if (blockRendererDispatcher.renderBatched(state, pos, blockAccess, ms, bufferBuilder, true,
|
||||
random, tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE)) {
|
||||
usedBlockRenderLayers.add(blockRenderLayer);
|
||||
}
|
||||
blockstates.add(state);
|
||||
}
|
||||
|
||||
ForgeHooksClient.setRenderType(null);
|
||||
ms.popPose();
|
||||
bufferCache.forEach((layer, buffer) -> {
|
||||
buffer.renderInto(ms, buffers.getBuffer(layer));
|
||||
});
|
||||
|
||||
// finishDrawing
|
||||
for (RenderType layer : RenderType.chunkBufferLayers()) {
|
||||
if (!startedBufferBuilders.contains(layer))
|
||||
continue;
|
||||
BufferBuilder buf = buffers.get(layer);
|
||||
buf.end();
|
||||
bufferCache.put(layer, new SuperByteBuffer(buf));
|
||||
TileEntityRenderHelper.renderTileEntities(schematic, schematic.getRenderedTileEntities(), ms, buffers);
|
||||
}
|
||||
|
||||
protected void redraw() {
|
||||
bufferCache.clear();
|
||||
for (RenderType layer : RenderType.chunkBufferLayers()) {
|
||||
SuperByteBuffer buffer = drawLayer(layer);
|
||||
if (!buffer.isEmpty())
|
||||
bufferCache.put(layer, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
protected SuperByteBuffer drawLayer(RenderType layer) {
|
||||
BlockRenderDispatcher dispatcher = ModelUtil.VANILLA_RENDERER;
|
||||
ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get();
|
||||
|
||||
PoseStack poseStack = objects.poseStack;
|
||||
Random random = objects.random;
|
||||
BlockPos.MutableBlockPos mutableBlockPos = objects.mutableBlockPos;
|
||||
SchematicWorld renderWorld = schematic;
|
||||
BoundingBox bounds = renderWorld.getBounds();
|
||||
|
||||
ShadeSeparatingVertexConsumer shadeSeparatingWrapper = objects.shadeSeparatingWrapper;
|
||||
ShadeSeparatedBufferBuilder builder = new ShadeSeparatedBufferBuilder(512);
|
||||
BufferBuilder unshadedBuilder = objects.unshadedBuilder;
|
||||
|
||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
unshadedBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
shadeSeparatingWrapper.prepare(builder, unshadedBuilder);
|
||||
|
||||
ForgeHooksClient.setRenderType(layer);
|
||||
ModelBlockRenderer.enableCaching();
|
||||
for (BlockPos localPos : BlockPos.betweenClosed(bounds.minX(), bounds.minY(), bounds.minZ(), bounds.maxX(), bounds.maxY(), bounds.maxZ())) {
|
||||
BlockPos pos = mutableBlockPos.setWithOffset(localPos, anchor);
|
||||
BlockState state = renderWorld.getBlockState(pos);
|
||||
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(localPos.getX(), localPos.getY(), localPos.getZ());
|
||||
|
||||
if (state.getRenderShape() == RenderShape.MODEL && ItemBlockRenderTypes.canRenderInLayer(state, layer)) {
|
||||
BlockEntity tileEntity = renderWorld.getBlockEntity(localPos);
|
||||
dispatcher.renderBatched(state, pos, renderWorld, poseStack, shadeSeparatingWrapper, true, random,
|
||||
tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE);
|
||||
}
|
||||
|
||||
poseStack.popPose();
|
||||
}
|
||||
ModelBlockRenderer.clearCache();
|
||||
ForgeHooksClient.setRenderType(null);
|
||||
|
||||
shadeSeparatingWrapper.clear();
|
||||
unshadedBuilder.end();
|
||||
builder.appendUnshadedVertices(unshadedBuilder);
|
||||
builder.end();
|
||||
|
||||
return new SuperByteBuffer(builder);
|
||||
}
|
||||
|
||||
private static int getLayerCount() {
|
||||
@ -141,4 +138,12 @@ public class SchematicRenderer {
|
||||
.size();
|
||||
}
|
||||
|
||||
private static class ThreadLocalObjects {
|
||||
public final PoseStack poseStack = new PoseStack();
|
||||
public final Random random = new Random();
|
||||
public final BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||
public final ShadeSeparatingVertexConsumer shadeSeparatingWrapper = new ShadeSeparatingVertexConsumer();
|
||||
public final BufferBuilder unshadedBuilder = new BufferBuilder(512);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class SchematicItem extends Item {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public SchematicItem(Properties properties) {
|
||||
super(properties.stacksTo(1));
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public static ItemStack create(String schematic, String owner) {
|
||||
|
@ -1,76 +0,0 @@
|
||||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import com.mojang.blaze3d.vertex.VertexFormatElement;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.BakedModelWrapper;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
public class ColoredVertexModel extends BakedModelWrapper<BakedModel> {
|
||||
|
||||
private static final ModelProperty<BlockPos> POSITION_PROPERTY = new ModelProperty<>();
|
||||
private IBlockVertexColor color;
|
||||
|
||||
public ColoredVertexModel(BakedModel originalModel, IBlockVertexColor color) {
|
||||
super(originalModel);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
return new ModelDataMap.Builder().withInitial(POSITION_PROPERTY, pos).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, extraData);
|
||||
if (quads.isEmpty())
|
||||
return quads;
|
||||
if (!extraData.hasProperty(POSITION_PROPERTY))
|
||||
return quads;
|
||||
BlockPos data = extraData.getData(POSITION_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
|
||||
// Optifine might've rejigged vertex data
|
||||
VertexFormat format = DefaultVertexFormat.BLOCK;
|
||||
int colorIndex = 0;
|
||||
for (int elementId = 0; elementId < format.getElements().size(); elementId++) {
|
||||
VertexFormatElement element = format.getElements().get(elementId);
|
||||
if (element.getUsage() == VertexFormatElement.Usage.COLOR)
|
||||
colorIndex = elementId;
|
||||
}
|
||||
int colorOffset = format.getOffset(colorIndex) / 4;
|
||||
|
||||
for (int i = 0; i < quads.size(); i++) {
|
||||
BakedQuad quad = quads.get(i);
|
||||
|
||||
BakedQuad newQuad = QuadHelper.clone(quad);
|
||||
int[] vertexData = newQuad.getVertices();
|
||||
|
||||
for (int vertex = 0; vertex < vertexData.length; vertex += format.getIntegerSize()) {
|
||||
float x = Float.intBitsToFloat(vertexData[vertex]);
|
||||
float y = Float.intBitsToFloat(vertexData[vertex + 1]);
|
||||
float z = Float.intBitsToFloat(vertexData[vertex + 2]);
|
||||
int color = this.color.getColor(x + data.getX(), y + data.getY(), z + data.getZ());
|
||||
vertexData[vertex + colorOffset] = color;
|
||||
}
|
||||
|
||||
quads.set(i, newQuad);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IBlockVertexColor {
|
||||
|
||||
public int getColor(float x, float y, float z);
|
||||
|
||||
}
|
@ -19,8 +19,6 @@ public class CClient extends ConfigBase {
|
||||
public final ConfigFloat filterItemRenderDistance = f(10f, 1, "filterItemRenderDistance", Comments.filterItemRenderDistance);
|
||||
public final ConfigBool rainbowDebug = b(true, "enableRainbowDebug",
|
||||
Comments.rainbowDebug);
|
||||
public final ConfigBool experimentalRendering = b(true, "experimentalRendering",
|
||||
Comments.experimentalRendering);
|
||||
public final ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume",
|
||||
Comments.maxContraptionLightVolume);
|
||||
// no group
|
||||
@ -95,7 +93,6 @@ public class CClient extends ConfigBase {
|
||||
"Maximum Distance to the player at which items in Blocks' filter slots will be displayed"
|
||||
};
|
||||
static String rainbowDebug = "Show colourful debug information while the F3-Menu is open.";
|
||||
static String experimentalRendering = "Use modern OpenGL features to drastically increase performance.";
|
||||
static String maxContraptionLightVolume = "The maximum amount of blocks for which to try and calculate dynamic contraption lighting. Decrease if large contraption cause too much lag";
|
||||
static String[] mainMenuConfigButtonRow = new String[]{
|
||||
"Choose the menu row that the Create config button appears on in the main menu",
|
||||
|
@ -18,8 +18,6 @@ import com.simibubi.create.content.contraptions.fluids.VirtualFluid;
|
||||
import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
|
||||
import com.simibubi.create.foundation.block.render.ColoredVertexModel;
|
||||
import com.simibubi.create.foundation.block.render.IBlockVertexColor;
|
||||
import com.tterrag.registrate.AbstractRegistrate;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory;
|
||||
@ -198,10 +196,6 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
||||
return entry -> onClient(() -> () -> registerCasingConnectivity(entry, consumer));
|
||||
}
|
||||
|
||||
public static <T extends Block> NonNullConsumer<? super T> blockVertexColors(IBlockVertexColor colorFunc) {
|
||||
return entry -> onClient(() -> () -> registerBlockVertexColor(entry, colorFunc));
|
||||
}
|
||||
|
||||
public static <T extends Block> NonNullConsumer<? super T> blockModel(
|
||||
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
|
||||
return entry -> onClient(() -> () -> registerBlockModel(entry, func));
|
||||
@ -229,12 +223,6 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
||||
consumer.accept(entry, CreateClient.CASING_CONNECTIVITY);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void registerBlockVertexColor(Block entry, IBlockVertexColor colorFunc) {
|
||||
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
|
||||
.register(entry.delegate, model -> new ColoredVertexModel(model, colorFunc));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void registerBlockModel(Block entry,
|
||||
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
|
||||
|
@ -33,8 +33,8 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.BaseFireBlock;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.FireBlock;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
@ -208,7 +208,7 @@ public class GuiGameElement {
|
||||
@Override
|
||||
protected void renderModel(BlockRenderDispatcher blockRenderer, MultiBufferSource.BufferSource buffer,
|
||||
RenderType renderType, VertexConsumer vb, PoseStack ms) {
|
||||
if (blockState.getBlock() instanceof FireBlock) {
|
||||
if (blockState.getBlock() instanceof BaseFireBlock) {
|
||||
Lighting.setupForFlatItems();
|
||||
blockRenderer.renderSingleBlock(blockState, ms, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY,
|
||||
VirtualEmptyModelData.INSTANCE);
|
||||
|
@ -18,6 +18,7 @@ import javax.annotation.Nullable;
|
||||
import org.apache.commons.lang3.mutable.MutableDouble;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
|
||||
import com.jozufozu.flywheel.util.DiffuseLightCalculator;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
@ -31,6 +32,7 @@ import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
|
||||
import com.simibubi.create.foundation.ponder.instruction.HideAllInstruction;
|
||||
import com.simibubi.create.foundation.ponder.instruction.PonderInstruction;
|
||||
import com.simibubi.create.foundation.ponder.ui.PonderUI;
|
||||
import com.simibubi.create.foundation.render.ForcedDiffuseState;
|
||||
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
@ -224,6 +226,7 @@ public class PonderScene {
|
||||
}
|
||||
|
||||
public void renderScene(SuperRenderTypeBuffer buffer, PoseStack ms, float pt) {
|
||||
ForcedDiffuseState.pushCalculator(DiffuseLightCalculator.DEFAULT);
|
||||
ms.pushPose();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Entity prevRVE = mc.cameraEntity;
|
||||
@ -242,6 +245,7 @@ public class PonderScene {
|
||||
outliner.renderOutlines(ms, buffer, pt);
|
||||
|
||||
ms.popPose();
|
||||
ForcedDiffuseState.popCalculator();
|
||||
}
|
||||
|
||||
public void renderOverlay(PonderUI screen, PoseStack ms, float partialTicks) {
|
||||
|
@ -7,6 +7,9 @@ import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.jozufozu.flywheel.core.model.ModelUtil;
|
||||
import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder;
|
||||
import com.jozufozu.flywheel.core.model.ShadeSeparatingVertexConsumer;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
@ -32,6 +35,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.block.ModelBlockRenderer;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
@ -57,6 +61,8 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||
public static final SuperByteBufferCache.Compartment<Pair<Integer, Integer>> DOC_WORLD_SECTION =
|
||||
new SuperByteBufferCache.Compartment<>();
|
||||
|
||||
private static final ThreadLocal<ThreadLocalObjects> THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new);
|
||||
|
||||
List<BlockEntity> renderedTileEntities;
|
||||
List<Pair<BlockEntity, Consumer<Level>>> tickableTileEntities;
|
||||
Selection section;
|
||||
@ -298,13 +304,6 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||
tileEntity.getBlockPos(), tileEntity.getBlockState(), tileEntity)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderLayer(PonderWorld world, MultiBufferSource buffer, RenderType type, PoseStack ms, float fade,
|
||||
float pt) {
|
||||
transformMS(ms, pt);
|
||||
renderStructure(world, ms, buffer, type, fade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFirst(PonderWorld world, MultiBufferSource buffer, PoseStack ms, float fade, float pt) {
|
||||
int light = -1;
|
||||
@ -342,8 +341,7 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||
.pose(),
|
||||
overlayMS.last()
|
||||
.normal());
|
||||
Minecraft.getInstance()
|
||||
.getBlockRenderer()
|
||||
ModelUtil.VANILLA_RENDERER
|
||||
.renderBatched(world.getBlockState(pos), pos, world, ms, builder, true, new Random(),
|
||||
EmptyModelData.INSTANCE);
|
||||
ms.popPose();
|
||||
@ -352,13 +350,15 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
protected void renderStructure(PonderWorld world, PoseStack ms, MultiBufferSource buffer, RenderType type,
|
||||
float fade) {
|
||||
@Override
|
||||
protected void renderLayer(PonderWorld world, MultiBufferSource buffer, RenderType type, PoseStack ms, float fade,
|
||||
float pt) {
|
||||
SuperByteBufferCache bufferCache = CreateClient.BUFFER_CACHE;
|
||||
int code = hashCode() ^ world.hashCode();
|
||||
|
||||
int code = hashCode() ^ world.hashCode();
|
||||
Pair<Integer, Integer> key = Pair.of(code, RenderType.chunkBufferLayers()
|
||||
.indexOf(type));
|
||||
|
||||
if (redraw)
|
||||
bufferCache.invalidate(DOC_WORLD_SECTION, key);
|
||||
SuperByteBuffer contraptionBuffer =
|
||||
@ -366,8 +366,10 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||
if (contraptionBuffer.isEmpty())
|
||||
return;
|
||||
|
||||
transformMS(contraptionBuffer.getTransforms(), pt);
|
||||
int light = lightCoordsFromFade(fade);
|
||||
contraptionBuffer.light(light)
|
||||
contraptionBuffer
|
||||
.light(light)
|
||||
.renderInto(ms, buffer.getBuffer(type));
|
||||
}
|
||||
|
||||
@ -404,38 +406,57 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||
}
|
||||
|
||||
private SuperByteBuffer buildStructureBuffer(PonderWorld world, RenderType layer) {
|
||||
ForgeHooksClient.setRenderType(layer);
|
||||
BlockRenderDispatcher dispatcher = Minecraft.getInstance()
|
||||
.getBlockRenderer();
|
||||
PoseStack ms = new PoseStack();
|
||||
Random random = new Random();
|
||||
BufferBuilder builder = new BufferBuilder(512);
|
||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
world.setMask(this.section);
|
||||
BlockRenderDispatcher dispatcher = ModelUtil.VANILLA_RENDERER;
|
||||
ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get();
|
||||
|
||||
PoseStack poseStack = objects.poseStack;
|
||||
Random random = objects.random;
|
||||
ShadeSeparatingVertexConsumer shadeSeparatingWrapper = objects.shadeSeparatingWrapper;
|
||||
ShadeSeparatedBufferBuilder builder = new ShadeSeparatedBufferBuilder(512);
|
||||
BufferBuilder unshadedBuilder = objects.unshadedBuilder;
|
||||
|
||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
unshadedBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
shadeSeparatingWrapper.prepare(builder, unshadedBuilder);
|
||||
|
||||
world.setMask(this.section);
|
||||
ForgeHooksClient.setRenderType(layer);
|
||||
ModelBlockRenderer.enableCaching();
|
||||
section.forEach(pos -> {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
FluidState ifluidstate = world.getFluidState(pos);
|
||||
FluidState fluidState = world.getFluidState(pos);
|
||||
|
||||
ms.pushPose();
|
||||
ms.translate(pos.getX(), pos.getY(), pos.getZ());
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
if (state.getRenderShape() == RenderShape.MODEL && ItemBlockRenderTypes.canRenderInLayer(state, layer)) {
|
||||
BlockEntity tileEntity = world.getBlockEntity(pos);
|
||||
dispatcher.renderBatched(state, pos, world, ms, builder, true, random,
|
||||
dispatcher.renderBatched(state, pos, world, poseStack, shadeSeparatingWrapper, true, random,
|
||||
tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE);
|
||||
}
|
||||
|
||||
if (!ifluidstate.isEmpty() && ItemBlockRenderTypes.canRenderInLayer(ifluidstate, layer))
|
||||
dispatcher.renderLiquid(pos, world, builder, ifluidstate);
|
||||
if (!fluidState.isEmpty() && ItemBlockRenderTypes.canRenderInLayer(fluidState, layer))
|
||||
dispatcher.renderLiquid(pos, world, builder, fluidState);
|
||||
|
||||
ms.popPose();
|
||||
poseStack.popPose();
|
||||
});
|
||||
|
||||
world.clearMask();
|
||||
builder.end();
|
||||
ModelBlockRenderer.clearCache();
|
||||
ForgeHooksClient.setRenderType(null);
|
||||
world.clearMask();
|
||||
|
||||
shadeSeparatingWrapper.clear();
|
||||
unshadedBuilder.end();
|
||||
builder.appendUnshadedVertices(unshadedBuilder);
|
||||
builder.end();
|
||||
|
||||
return new SuperByteBuffer(builder);
|
||||
}
|
||||
|
||||
private static class ThreadLocalObjects {
|
||||
public final PoseStack poseStack = new PoseStack();
|
||||
public final Random random = new Random();
|
||||
public final ShadeSeparatingVertexConsumer shadeSeparatingWrapper = new ShadeSeparatingVertexConsumer();
|
||||
public final BufferBuilder unshadedBuilder = new BufferBuilder(512);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.jozufozu.flywheel.util.DiffuseLightCalculator;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public final class ForcedDiffuseState {
|
||||
private static final ThreadLocal<ObjectArrayList<DiffuseLightCalculator>> FORCED_DIFFUSE = ThreadLocal.withInitial(ObjectArrayList::new);
|
||||
|
||||
private ForcedDiffuseState() {
|
||||
}
|
||||
|
||||
public static void pushCalculator(DiffuseLightCalculator calculator) {
|
||||
FORCED_DIFFUSE.get().push(calculator);
|
||||
}
|
||||
|
||||
public static void popCalculator() {
|
||||
FORCED_DIFFUSE.get().pop();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DiffuseLightCalculator getForcedCalculator() {
|
||||
ObjectArrayList<DiffuseLightCalculator> stack = FORCED_DIFFUSE.get();
|
||||
if (stack.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return stack.top();
|
||||
}
|
||||
}
|
@ -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,22 +39,23 @@ 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()
|
||||
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
|
||||
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)
|
||||
.setCullState(cull ? CULL : NO_CULL)
|
||||
.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(NEW_ENTITY_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(NEW_ENTITY_SHADER)
|
||||
.setShaderState(GLOWING_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
|
||||
.setCullState(NO_CULL)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
@ -92,7 +103,7 @@ public class RenderTypes extends RenderStateShard {
|
||||
false, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_ENTITY_SOLID_SHADER)
|
||||
.setTextureState(BLOCK_SHEET)
|
||||
.setTransparencyState(NO_TRANSPARENCY)
|
||||
.setCullState(CULL)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
.setOverlayState(OVERLAY)
|
||||
.createCompositeState(true));
|
||||
@ -103,7 +114,7 @@ public class RenderTypes extends RenderStateShard {
|
||||
|
||||
private static final RenderType ITEM_PARTIAL_TRANSLUCENT = RenderType.create(createLayerName("item_partial_translucent"),
|
||||
DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, RenderType.CompositeState.builder()
|
||||
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
|
||||
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_CULL_SHADER)
|
||||
.setTextureState(BLOCK_SHEET)
|
||||
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
@ -115,8 +126,8 @@ 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()
|
||||
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
|
||||
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)
|
||||
.setLightmapState(LIGHTMAP)
|
||||
@ -136,4 +147,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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import java.util.function.IntPredicate;
|
||||
|
||||
import com.jozufozu.flywheel.api.vertex.ShadedVertexList;
|
||||
import com.jozufozu.flywheel.api.vertex.VertexList;
|
||||
import com.jozufozu.flywheel.backend.OptifineHandler;
|
||||
import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder;
|
||||
import com.jozufozu.flywheel.core.vertex.BlockVertexList;
|
||||
import com.jozufozu.flywheel.util.DiffuseLightCalculator;
|
||||
import com.jozufozu.flywheel.util.transform.TStack;
|
||||
import com.jozufozu.flywheel.util.transform.Transform;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
@ -27,11 +32,11 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
|
||||
public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<SuperByteBuffer> {
|
||||
|
||||
private final VertexList template;
|
||||
private final IntPredicate shadedPredicate;
|
||||
|
||||
// Vertex Position
|
||||
private final PoseStack transforms;
|
||||
@ -40,13 +45,14 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
private boolean shouldColor;
|
||||
private int r, g, b, a;
|
||||
private boolean disableDiffuseMult;
|
||||
private DiffuseLightCalculator diffuseCalculator;
|
||||
|
||||
// Vertex Texture Coords
|
||||
private SpriteShiftFunc spriteShiftFunc;
|
||||
|
||||
// Vertex Overlay Color
|
||||
private boolean hasOverlay;
|
||||
private int overlay = OverlayTexture.NO_OVERLAY;;
|
||||
private int overlay = OverlayTexture.NO_OVERLAY;
|
||||
|
||||
// Vertex Lighting
|
||||
private boolean useWorldLight;
|
||||
@ -62,7 +68,14 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
private static final Long2IntMap WORLD_LIGHT_CACHE = new Long2IntOpenHashMap();
|
||||
|
||||
public SuperByteBuffer(BufferBuilder buf) {
|
||||
if (buf instanceof ShadeSeparatedBufferBuilder separated) {
|
||||
ShadedVertexList template = new BlockVertexList.Shaded(separated);
|
||||
shadedPredicate = template::isShaded;
|
||||
this.template = template;
|
||||
} else {
|
||||
template = new BlockVertexList(buf);
|
||||
shadedPredicate = index -> true;
|
||||
}
|
||||
transforms = new PoseStack();
|
||||
transforms.pushPose();
|
||||
}
|
||||
@ -95,8 +108,16 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
final Vector3f normal = new Vector3f();
|
||||
final Vector4f lightPos = new Vector4f();
|
||||
|
||||
float f = .5f;
|
||||
int vertexCount = template.getVertexCount();
|
||||
DiffuseLightCalculator diffuseCalculator = ForcedDiffuseState.getForcedCalculator();
|
||||
final boolean disableDiffuseMult = this.disableDiffuseMult || (OptifineHandler.isUsingShaders() && diffuseCalculator == null);
|
||||
if (diffuseCalculator == null) {
|
||||
diffuseCalculator = this.diffuseCalculator;
|
||||
if (diffuseCalculator == null) {
|
||||
diffuseCalculator = DiffuseLightCalculator.forCurrentLevel();
|
||||
}
|
||||
}
|
||||
|
||||
final int vertexCount = template.getVertexCount();
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float x = template.getX(i);
|
||||
float y = template.getY(i);
|
||||
@ -128,10 +149,10 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
b = template.getB(i);
|
||||
a = template.getA(i);
|
||||
}
|
||||
if (disableDiffuseMult || OptifineHandler.usingShaders()) {
|
||||
if (disableDiffuseMult) {
|
||||
builder.color(r, g, b, a);
|
||||
} else {
|
||||
float instanceDiffuse = LightUtil.diffuseLight(nx, ny, nz);
|
||||
float instanceDiffuse = diffuseCalculator.getDiffuse(nx, ny, nz, shadedPredicate.test(i));
|
||||
int colorR = transformColor(r, instanceDiffuse);
|
||||
int colorG = transformColor(g, instanceDiffuse);
|
||||
int colorB = transformColor(b, instanceDiffuse);
|
||||
@ -152,7 +173,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
|
||||
int light;
|
||||
if (useWorldLight) {
|
||||
lightPos.set(((x - f) * 15 / 16f) + f, (y - f) * 15 / 16f + f, (z - f) * 15 / 16f + f, 1F);
|
||||
lightPos.set(((x - .5f) * 15 / 16f) + .5f, (y - .5f) * 15 / 16f + .5f, (z - .5f) * 15 / 16f + .5f, 1f);
|
||||
lightPos.transform(localTransforms);
|
||||
if (lightTransform != null) {
|
||||
lightPos.transform(lightTransform);
|
||||
@ -193,6 +214,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
b = 0;
|
||||
a = 0;
|
||||
disableDiffuseMult = false;
|
||||
diffuseCalculator = null;
|
||||
spriteShiftFunc = null;
|
||||
hasOverlay = false;
|
||||
overlay = OverlayTexture.NO_OVERLAY;
|
||||
@ -209,6 +231,10 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
return template.isEmpty();
|
||||
}
|
||||
|
||||
public PoseStack getTransforms() {
|
||||
return transforms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperByteBuffer translate(double x, double y, double z) {
|
||||
transforms.translate(x, y, z);
|
||||
@ -310,6 +336,11 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuperByteBuffer diffuseCalculator(DiffuseLightCalculator diffuseCalculator) {
|
||||
this.diffuseCalculator = diffuseCalculator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuperByteBuffer shiftUV(SpriteShiftEntry entry) {
|
||||
this.spriteShiftFunc = (builder, u, v) -> {
|
||||
float targetU = entry.getTarget()
|
||||
@ -441,8 +472,8 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IVertexLighter {
|
||||
public int getPackedLight(float x, float y, float z);
|
||||
public interface VertexLighter {
|
||||
int getPackedLight(float x, float y, float z);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import net.minecraft.client.resources.model.ModelBakery;
|
||||
|
||||
public class SuperRenderTypeBuffer implements MultiBufferSource {
|
||||
|
||||
private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer();;
|
||||
private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer();
|
||||
|
||||
public static SuperRenderTypeBuffer getInstance() {
|
||||
return INSTANCE;
|
||||
|
@ -77,9 +77,9 @@ public class TileEntityRenderHelper {
|
||||
} catch (Exception e) {
|
||||
iterator.remove();
|
||||
|
||||
String message = "TileEntity " + tileEntity.getType()
|
||||
String message = "BlockEntity " + tileEntity.getType()
|
||||
.getRegistryName()
|
||||
.toString() + " didn't want to render while moved.\n";
|
||||
.toString() + " could not be rendered virtually.";
|
||||
if (AllConfigs.CLIENT.explainRenderErrors.get())
|
||||
Create.LOGGER.error(message, e);
|
||||
else
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.simibubi.create.foundation.tileEntity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class CachedRenderBBTileEntity extends SyncedTileEntity {
|
||||
|
||||
private AABB renderBoundingBox;
|
||||
|
||||
public CachedRenderBBTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AABB getRenderBoundingBox() {
|
||||
if (renderBoundingBox == null) {
|
||||
renderBoundingBox = createRenderBoundingBox();
|
||||
}
|
||||
return renderBoundingBox;
|
||||
}
|
||||
|
||||
protected void invalidateRenderBoundingBox() {
|
||||
renderBoundingBox = null;
|
||||
}
|
||||
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.getRenderBoundingBox();
|
||||
}
|
||||
|
||||
}
|
@ -23,7 +23,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
||||
public abstract class SmartTileEntity extends SyncedTileEntity implements IPartialSafeNBT, IInteractionChecker {
|
||||
public abstract class SmartTileEntity extends CachedRenderBBTileEntity implements IPartialSafeNBT, IInteractionChecker {
|
||||
|
||||
private final Map<BehaviourType<?>, TileEntityBehaviour> behaviours = new HashMap<>();
|
||||
private boolean initialized = false;
|
||||
|
@ -10,11 +10,11 @@ import net.minecraft.world.level.LevelAccessor;
|
||||
public class AnimationTickHolder {
|
||||
|
||||
private static int ticks;
|
||||
private static int paused_ticks;
|
||||
private static int pausedTicks;
|
||||
|
||||
public static void reset() {
|
||||
ticks = 0;
|
||||
paused_ticks = 0;
|
||||
pausedTicks = 0;
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
@ -22,7 +22,7 @@ public class AnimationTickHolder {
|
||||
.isPaused()) {
|
||||
ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision
|
||||
} else {
|
||||
paused_ticks = (paused_ticks + 1) % 1_728_000;
|
||||
pausedTicks = (pausedTicks + 1) % 1_728_000;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public class AnimationTickHolder {
|
||||
}
|
||||
|
||||
public static int getTicks(boolean includePaused) {
|
||||
return includePaused ? ticks + paused_ticks : ticks;
|
||||
return includePaused ? ticks + pausedTicks : ticks;
|
||||
}
|
||||
|
||||
public static float getRenderTime() {
|
||||
|
@ -9,7 +9,7 @@ import net.minecraft.util.Mth;
|
||||
// InterpolatedChasingValue, InterpolatedValue, InterpolatedChasingAngle, InterpolatedAngle
|
||||
public class LerpedFloat {
|
||||
|
||||
protected Interpolater interpolater;
|
||||
protected Interpolator interpolator;
|
||||
protected float previousValue;
|
||||
protected float value;
|
||||
|
||||
@ -19,8 +19,8 @@ public class LerpedFloat {
|
||||
|
||||
protected boolean forcedSync;
|
||||
|
||||
public LerpedFloat(Interpolater interpolater) {
|
||||
this.interpolater = interpolater;
|
||||
public LerpedFloat(Interpolator interpolator) {
|
||||
this.interpolator = interpolator;
|
||||
startWithValue(0);
|
||||
forcedSync = true;
|
||||
}
|
||||
@ -79,7 +79,7 @@ public class LerpedFloat {
|
||||
}
|
||||
|
||||
public float getValue(float partialTicks) {
|
||||
return interpolater.interpolate(partialTicks, previousValue, value);
|
||||
return interpolator.interpolate(partialTicks, previousValue, value);
|
||||
}
|
||||
|
||||
public boolean settled() {
|
||||
@ -117,7 +117,7 @@ public class LerpedFloat {
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Interpolater {
|
||||
public interface Interpolator {
|
||||
float interpolate(double progress, double current, double target);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#use "flywheel:context/fog.glsl"
|
||||
#use "flywheel:core/diffuse.glsl"
|
||||
|
||||
uniform sampler3D uLightVolume;
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -13,7 +13,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -139,7 +139,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 6, 6],
|
||||
"to": [10, 10, 16],
|
||||
"shade": false,
|
||||
"rotation": {"angle": 22.5, "axis": "z", "origin": [8, 8, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1_1"},
|
||||
|
@ -14,7 +14,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#axis"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#axis"},
|
||||
|
@ -185,7 +185,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -27,7 +27,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 6, 0],
|
||||
"to": [10, 10, 16],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1_1"},
|
||||
"east": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#1_0"},
|
||||
|
@ -36,7 +36,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -25,7 +25,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"},
|
||||
|
@ -36,7 +36,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -11,7 +11,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 5, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 5], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 5], "rotation": 180, "texture": "#0"},
|
||||
|
@ -13,7 +13,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 6, 11],
|
||||
"to": [10, 10, 16],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"east": {"uv": [6, 0, 10, 5], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [6, 6, 10, 10], "texture": "#1"},
|
||||
|
@ -27,7 +27,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -14,7 +14,6 @@
|
||||
"name": "Axle",
|
||||
"from": [6, 6, 0],
|
||||
"to": [10, 10, 4],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "texture": "#0"},
|
||||
"east": {"uv": [6, 12, 10, 16], "rotation": 90, "texture": "#1"},
|
||||
|
@ -17,7 +17,6 @@
|
||||
"name": "Axle",
|
||||
"from": [6, 6, 0],
|
||||
"to": [10, 10, 4],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "texture": "#0"},
|
||||
"east": {"uv": [6, 12, 10, 16], "rotation": 90, "texture": "#1"},
|
||||
|
@ -11,7 +11,6 @@
|
||||
"name": "MixerCenter",
|
||||
"from": [7, -4.5, 7],
|
||||
"to": [9, 7.5, 9],
|
||||
"shade": false,
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 12, 12, 14], "rotation": 90, "texture": "#6"},
|
||||
|
@ -121,7 +121,6 @@
|
||||
"name": "MixerCenter",
|
||||
"from": [7, -4.5, 7],
|
||||
"to": [9, 7.5, 9],
|
||||
"shade": false,
|
||||
"rotation": {"angle": 22.5, "axis": "y", "origin": [8, 7, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 12, 12, 14], "rotation": 90, "texture": "#6"},
|
||||
|
@ -94,7 +94,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 8, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 8, 10, 16], "rotation": 180, "texture": "#1_0"},
|
||||
"east": {"uv": [6, 8, 10, 16], "rotation": 180, "texture": "#1_0"},
|
||||
|
@ -11,7 +11,6 @@
|
||||
"name": "Axis",
|
||||
"from": [ 6.0, 0.0, 6.0 ],
|
||||
"to": [ 10.0, 16.0, 10.0 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] },
|
||||
"east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] },
|
||||
|
@ -11,7 +11,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 6, 8],
|
||||
"to": [10, 10, 16],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"},
|
||||
"east": {"uv": [6, 0, 10, 8], "rotation": 270, "texture": "#0"},
|
||||
|
@ -15,7 +15,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 7, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 9, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 9, 10, 16], "texture": "#0"},
|
||||
|
@ -14,7 +14,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#axis"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#axis"},
|
||||
|
@ -13,7 +13,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -13,7 +13,6 @@
|
||||
"name": "Axis",
|
||||
"from": [6, 0, 6],
|
||||
"to": [10, 16, 10],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
|
||||
|
@ -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 New Issue
Block a user