Fix empty slot icon and sieve mesh textures

This commit is contained in:
thedarkcolour 2026-05-14 19:37:34 -07:00
parent 064e6d785d
commit d2ad996a5b
12 changed files with 59 additions and 13 deletions

View File

@ -136,7 +136,7 @@ dependencies {
//implementation("dev.latvian.mods:kubejs-neoforge:${kubejs_version}")
// ModKit DEV ONLY
implementation('com.github.thedarkcolour:ModKit:d801a318cf')
implementation('com.github.thedarkcolour:ModKit:944589c2a7')
// Core mod
implementation(project(':coremod'))

View File

@ -0,0 +1,3 @@
// 26.1.1 2026-05-14T19:12:42.901284802 atlases generator for exdeorum
26af1814d32fa6b215fbd918b14fe1c65d9e1eb9 assets/minecraft/atlases/blocks.json
3737d1173220d03819c78453e07b289e4c5f8881 assets/minecraft/atlases/gui.json

View File

@ -0,0 +1,9 @@
{
"sources": [
{
"type": "minecraft:directory",
"prefix": "",
"source": "item/mesh"
}
]
}

View File

@ -0,0 +1,9 @@
{
"sources": [
{
"type": "minecraft:directory",
"prefix": "",
"source": "gui/sprites"
}
]
}

View File

@ -40,15 +40,12 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
import org.joml.Vector3f;
import thedarkcolour.exdeorum.ExDeorum;
import org.jspecify.annotations.Nullable;
import thedarkcolour.exdeorum.client.ter.SieveRenderer;
import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.Map;
public class RenderUtil {
private static final Map<Block, RenderFace> TOP_FACES = new HashMap<>();
@ -164,7 +161,7 @@ public class RenderUtil {
// Renders a sprite (y should be between 0 and 1)
@SuppressWarnings("DuplicatedCode")
public static void renderFlatSprite(VertexConsumer builder, PoseStack stack, float y, int r, int g, int b, TextureAtlasSprite sprite, int light, float edge) {
public static void renderFlatSprite(VertexConsumer builder, PoseStack stack, float y, int r, int g, int b, @Nullable TextureAtlasSprite sprite, int light, float edge) {
if (sprite == null) return;
var pose = stack.last().pose();
var normal = stack.last().normal().transform(new Vector3f(0, 1, 0));
@ -186,7 +183,7 @@ public class RenderUtil {
builder.addVertex(pose, edgeMax, y, edgeMin).setColor(r, g, b, 255).setUv(uMax, vMin).setUv1(0, 10).setLight(light).setNormal(normal.x, normal.y, normal.z);
}
public static void renderFlatSprite(VertexConsumer builder, PoseStack.Pose pose, float y, int r, int g, int b, TextureAtlasSprite sprite, int light, float edge) {
public static void renderFlatSprite(VertexConsumer builder, PoseStack.Pose pose, float y, int r, int g, int b, @Nullable TextureAtlasSprite sprite, int light, float edge) {
if (sprite == null) return;
var normal = pose.normal().transform(new Vector3f(0, 1, 0));
float edgeMin = edge / 16.0f;

View File

@ -25,13 +25,13 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.client.renderer.state.level.CameraRenderState;
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.Identifier;
import net.minecraft.util.Mth;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import org.jspecify.annotations.Nullable;
import thedarkcolour.exdeorum.blockentity.EBlockEntity;
import thedarkcolour.exdeorum.blockentity.logic.SieveLogic;
import thedarkcolour.exdeorum.client.RenderFace;
@ -81,7 +81,7 @@ public class SieveRenderer<T extends EBlockEntity & SieveLogic.Owner> implements
state.meshSprite = MESH_TEXTURES.get(meshItem);
} else {
Identifier registryName = BuiltInRegistries.ITEM.getKey(meshItem);
var sprite = RenderUtil.getBlockSprite(registryName.withPrefix("item/mesh/"));
var sprite = RenderUtil.getBlockSprite(registryName);
if (RenderUtil.isMissingTexture(sprite)) {
sprite = RenderUtil.getBlockSprite(registryName.withPrefix("item/"));
}
@ -131,9 +131,11 @@ public class SieveRenderer<T extends EBlockEntity & SieveLogic.Owner> implements
}
public static class SieveRenderState extends BlockEntityRenderState {
@Nullable
public RenderFace contentsFace;
public float contentsPercentage;
public boolean renderContents3d;
@Nullable
public TextureAtlasSprite meshSprite;
public boolean meshHasFoil;
}

View File

@ -0,0 +1,25 @@
package thedarkcolour.exdeorum.data;
import net.minecraft.client.renderer.texture.atlas.sources.DirectoryLister;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.AtlasIds;
import net.minecraft.data.PackOutput;
import net.neoforged.neoforge.client.data.SpriteSourceProvider;
import thedarkcolour.exdeorum.ExDeorum;
import java.util.concurrent.CompletableFuture;
class Atlases extends SpriteSourceProvider {
public Atlases(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(output, lookupProvider, ExDeorum.ID);
}
@Override
protected void gather() {
SourceList gui = atlas(AtlasIds.GUI);
gui.addSource(new DirectoryLister("gui/sprites", ""));
SourceList blocks = atlas(AtlasIds.BLOCKS);
blocks.addSource(new DirectoryLister("item/mesh", ""));
}
}

View File

@ -46,5 +46,6 @@ public class Data {
gen.addProvider(true, new Advancements(output, registries));
gen.addProvider(true, new Sounds(output));
gen.addProvider(true, new LootModifiers(output, registries));
gen.addProvider(true, new Atlases(output, registries));
}
}

View File

@ -30,7 +30,7 @@ import thedarkcolour.exdeorum.registry.EMenus;
import thedarkcolour.exdeorum.tag.EItemTags;
public class MechanicalHammerMenu extends AbstractMachineMenu<MechanicalHammerBlockEntity> {
private static final Identifier EMPTY_SLOT_HAMMER = ExDeorum.loc("item/empty_slot_hammer");
private static final Identifier EMPTY_SLOT_HAMMER = ExDeorum.loc("container/slot/empty_slot_hammer");
private static final int NUM_SLOTS = 3;
public MechanicalHammerMenu(int containerId, Inventory playerInventory, FriendlyByteBuf data) {

View File

@ -28,7 +28,7 @@ import thedarkcolour.exdeorum.blockentity.MechanicalSieveBlockEntity;
import thedarkcolour.exdeorum.registry.EMenus;
public class MechanicalSieveMenu extends AbstractMachineMenu<MechanicalSieveBlockEntity> {
private static final Identifier EMPTY_SLOT_MESH = ExDeorum.loc("item/empty_slot_mesh");
private static final Identifier EMPTY_SLOT_MESH = ExDeorum.loc("container/slot/empty_slot_mesh");
private static final int NUM_SLOTS = 22; // input + mesh, 20 output slots
public MechanicalSieveMenu(int containerId, Inventory playerInventory, FriendlyByteBuf data) {