Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ repositories {
url = uri("https://maven.caffeinemc.net/releases")
}

exclusiveContent {
forRepository {
maven {
name = "Cassian's Maven"
url = uri("https://maven.cassian.cc")
}
}
filter {
includeGroupAndSubgroups("cc.cassian")
}
}

mavenLocal()
}

Expand All @@ -52,6 +64,9 @@ dependencies {
/*compileOnly(libs.emi)
localRuntime(libs.emi)*/

compileOnly(libs.rrv)
localRuntime(libs.rrv)

compileOnly(libs.modmenu)
localRuntime(libs.modmenu)

Expand Down
2 changes: 2 additions & 0 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ asm = "v2.3"
placeholder = "3.0.0-beta.2+26.1"
#polydex = "1.8.1+1.21.11"
# emi = "1.1.19+1.21.1"
rrv = "8.1.1+26.1.2"
modmenu = "18.0.0-alpha.6"
sodium = "0.8.9+mc26.1.1"

Expand All @@ -30,5 +31,6 @@ placeholder = { group = "eu.pb4", name = "placeholder-api", version.ref = "place
kaleidoConfig = { group = "folk.sisby", name = "kaleido-config", version.ref = "kaleidoConfig" }

# emi = { group = "dev.emi", name = "emi-fabric", version.ref = "emi" }
rrv = { group = "cc.cassian.rrv", name = "reliable-recipe-viewer-fabric", version.ref = "rrv" }
modmenu = { group = "com.terraformersmc", name = "modmenu", version.ref = "modmenu" }
sodium = { group = "net.caffeinemc", name = "sodium-fabric", version.ref = "sodium" }
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dev.hephaestus.glowcase.block.entity;

import dev.hephaestus.glowcase.Glowcase;
import dev.hephaestus.glowcase.client.GlowcaseClient;
import dev.hephaestus.glowcase.client.util.RRVClientUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.core.BlockPos;
Expand All @@ -25,9 +27,9 @@ public RecipeBlockEntity(BlockPos pos, BlockState state) {
@Environment(EnvType.CLIENT)
public void openRecipe() {
Identifier rid = Identifier.tryParse(recipe);
/*if (GlowcaseClient.EMI_LOADED) {
EmiClientUtils.displayRecipe(rid);
}*/
if (GlowcaseClient.RRV_LOADED) {
RRVClientUtils.displayRecipe(rid);
}
}

public void setRecipe(String newRecipe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import net.minecraft.world.item.ItemStack;

public class GlowcaseClient implements ClientModInitializer {
public static final Boolean EMI_LOADED = FabricLoader.getInstance().isModLoaded("emi");
public static final Boolean RRV_LOADED = FabricLoader.getInstance().isModLoaded("rrv");
public static final Identifier PROVIDER_CROSSHAIR_TEXTURE = Glowcase.id("hud/provider_crosshair");
public static final ScreenImageCache screenImageCache = new ScreenImageCache();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import dev.hephaestus.glowcase.client.GlowcaseClient;
import dev.hephaestus.glowcase.client.gui.widget.ingame.GlowcaseEditBox;
import dev.hephaestus.glowcase.client.gui.widget.ingame.SuggestionListWidget;
import dev.hephaestus.glowcase.client.util.EmiClientUtils;
import dev.hephaestus.glowcase.client.util.RRVClientUtils;
import dev.hephaestus.glowcase.packet.C2SEditRecipeBlock;
import dev.hephaestus.glowcase.util.EmiUtils;
import dev.hephaestus.glowcase.util.RequiresEmiLoaded;
import dev.hephaestus.glowcase.util.RRVUtils;
import dev.hephaestus.glowcase.util.RequiresRRVLoaded;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.EditBox;
Expand All @@ -35,7 +35,7 @@ public class RecipeBlockEditScreen extends GlowcaseScreen {

// Can't use GlowcaseWidgetHolder as that can crash if EMI is not present
@NotNull
private final AtomicReference<RequiresEmiLoaded> glowcaseWidgetHolder = new AtomicReference<>(null);
private final AtomicReference<RequiresRRVLoaded> glowcaseWidgetHolder = new AtomicReference<>(null);

private Button zOffsetToggle;
private int fontHeight = -1;
Expand All @@ -54,7 +54,7 @@ public void init() {

if (fontHeight == -1) {
fontHeight = this.minecraft.font.lineHeight;
baseY = height / 2 - ((2 * fontHeight + 95) / 2) + fontHeight - (GlowcaseClient.EMI_LOADED ? 46 : 0);
baseY = height / 2 - ((2 * fontHeight + 95) / 2) + fontHeight - (GlowcaseClient.RRV_LOADED ? 46 : 0);
}


Expand Down Expand Up @@ -97,10 +97,10 @@ public void init() {
this.recipeBlockEntity.recipe = this.recipeWidget.getValue();
}

if (GlowcaseClient.EMI_LOADED) {
suggestionWidget.updateSuggestions(EmiUtils.RECIPE_LIST.get(), text, false, this);
if (GlowcaseClient.RRV_LOADED) {
suggestionWidget.updateSuggestions(RRVUtils.RECIPE_LIST.get(), text, false, this);

EmiClientUtils.updateWidgetHolder(recipeWidget.getValue(), glowcaseWidgetHolder);
RRVClientUtils.updateWidgetHolder(recipeWidget.getValue(), glowcaseWidgetHolder);
}
});

Expand All @@ -109,8 +109,8 @@ public void init() {
this.addRenderableWidget(this.rotationYWidget);
this.addRenderableWidget(this.zOffsetToggle);

if (GlowcaseClient.EMI_LOADED && glowcaseWidgetHolder.get() == null) {
EmiClientUtils.updateWidgetHolder(recipeWidget.getValue(), glowcaseWidgetHolder);
if (GlowcaseClient.RRV_LOADED && glowcaseWidgetHolder.get() == null) {
RRVClientUtils.updateWidgetHolder(recipeWidget.getValue(), glowcaseWidgetHolder);
}
}

Expand Down Expand Up @@ -149,20 +149,20 @@ public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mo
// render the list over everything
suggestionWidget.extractRenderState(graphics, mouseX, mouseY, delta);

if (GlowcaseClient.EMI_LOADED && glowcaseWidgetHolder.get() != null) {
if (GlowcaseClient.RRV_LOADED && glowcaseWidgetHolder.get() != null) {
int baseYForRecipe = (baseY + fontHeight + 95);
int spaceForRecipe = height - baseYForRecipe;

RequiresEmiLoaded widgetHolder = glowcaseWidgetHolder.get();
RequiresRRVLoaded widgetHolder = glowcaseWidgetHolder.get();

int holderWidth = EmiClientUtils.getHolderWidth(widgetHolder);
int holderHeight = EmiClientUtils.getHolderHeight(widgetHolder);
int holderWidth = RRVClientUtils.getHolderWidth(widgetHolder);
int holderHeight = RRVClientUtils.getHolderHeight(widgetHolder);

Matrix3x2fStack matrixStack = graphics.pose();
matrixStack.pushMatrix();
matrixStack.translate(width / 2f - holderWidth / 2f, baseYForRecipe + spaceForRecipe / 2f - holderHeight / 2f);

EmiClientUtils.renderEmiRecipe(widgetHolder, graphics, delta);
RRVClientUtils.renderEmiRecipe(widgetHolder, graphics, delta);

matrixStack.popMatrix();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void extractRenderState(RecipeBlockEntity blockEntity, RecipeRenderState

@Override
public void submit(RecipeRenderState state, PoseStack poseStack, SubmitNodeCollector submitNodeCollector, CameraRenderState camera) {
if (BlockEntityRenderUtil.shouldRenderPlaceholder(state.blockPos)) {
// if (BlockEntityRenderUtil.shouldRenderPlaceholder(state.blockPos)) {
BlockEntityRenderUtil.renderPlaceholderWithBlockRotation(state, state.rotation16, ITEM_TEXTURE, 1F, poseStack, submitNodeCollector, state.zOffset == TextBlockEntity.ZOffset.CENTER ? 0.01F : state.zOffset == TextBlockEntity.ZOffset.FRONT ? 0.4F : -0.4F);
}
// }
}
// FIXME 26.1
// public void render(RecipeBlockEntity entity, float f, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay, Vec3 cameraPos) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package dev.hephaestus.glowcase.client.util;

import com.google.common.collect.Lists;
//import dev.emi.emi.api.widget.Widget;
//import dev.emi.emi.api.widget.WidgetHolder;
import dev.hephaestus.glowcase.util.RequiresEmiLoaded;
import dev.hephaestus.glowcase.util.RequiresRRVLoaded;

import java.util.List;

public class GlowcaseWidgetHolder implements /*WidgetHolder,*/ RequiresEmiLoaded {
public class GlowcaseWidgetHolder implements /*WidgetHolder,*/ RequiresRRVLoaded {
/*private final int width, height;
private final List<Widget> widgets = Lists.newArrayList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@
//import dev.emi.emi.api.recipe.EmiRecipe;
//import dev.emi.emi.api.widget.Widget;
//import dev.emi.emi.widget.RecipeBackground;
import dev.hephaestus.glowcase.util.RequiresEmiLoaded;
import cc.cassian.rrv.common.overlay.itemlist.view.ItemViewOverlay;
import dev.hephaestus.glowcase.util.RequiresRRVLoaded;
import java.util.concurrent.atomic.AtomicReference;

import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.resources.Identifier;

public class EmiClientUtils {
public class RRVClientUtils {
public static void displayRecipe(Identifier recipeId) {
/*if (recipeId == null) {
if (recipeId == null) {
return;
}
EmiRecipe recipe = EmiApi.getRecipeManager().getRecipe(recipeId);
if (recipe == null) {
return;
}
EmiApi.displayRecipe(recipe);*/
ItemViewOverlay.INSTANCE.openRecipeView(recipeId, false);
}

public static void updateWidgetHolder(String recipeId, AtomicReference<RequiresEmiLoaded> widgetHolder) {
public static void updateWidgetHolder(String recipeId, AtomicReference<RequiresRRVLoaded> widgetHolder) {
/*EmiRecipe recipe = EmiUtils.getRecipe(recipeId);

GlowcaseWidgetHolder glowcaseWidgetHolder = (GlowcaseWidgetHolder) widgetHolder.get();
Expand All @@ -46,20 +43,20 @@ public static void updateWidgetHolder(String recipeId, AtomicReference<RequiresE
recipe.addWidgets(glowcaseWidgetHolder);*/
}

public static void renderEmiRecipe(RequiresEmiLoaded widgetHolder, GuiGraphicsExtractor context, float delta) {
public static void renderEmiRecipe(RequiresRRVLoaded widgetHolder, GuiGraphicsExtractor context, float delta) {
/*GlowcaseWidgetHolder holder = (GlowcaseWidgetHolder) widgetHolder;

for (Widget widget : holder.getWidgets()) {
widget.render(context, -99, -99, delta);
}*/
}

public static int getHolderWidth(RequiresEmiLoaded widgetHolder) {
public static int getHolderWidth(RequiresRRVLoaded widgetHolder) {
//return ((GlowcaseWidgetHolder) widgetHolder).getWidth();
return 0;
}

public static int getHolderHeight(RequiresEmiLoaded widgetHolder) {
public static int getHolderHeight(RequiresRRVLoaded widgetHolder) {
//return ((GlowcaseWidgetHolder) widgetHolder).getHeight();
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,42 @@

//import dev.emi.emi.api.EmiApi;
//import dev.emi.emi.api.recipe.EmiRecipe;
import dev.hephaestus.glowcase.block.entity.RecipeBlockEntity;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import cc.cassian.rrv.api.recipe.ReliableClientRecipe;
import cc.cassian.rrv.client.recipe.ClientRecipeCache;
import net.minecraft.resources.Identifier;
import java.util.List;
import java.util.Objects;

public class EmiUtils {
public class RRVUtils {
public static final NotSoConstant<List<Identifier>> RECIPE_LIST = new NotSoConstant<>(() -> List.of()/*EmiApi.getRecipeManager().getRecipes().stream().map(EmiRecipe::getId).filter(Objects::nonNull).toList(), list -> !list.isEmpty()*/);

/*public static EmiRecipe getRecipe(String recipeString) {
public static ReliableClientRecipe getRecipe(String recipeString) {
Identifier recipeId = Identifier.tryParse(recipeString);

if (recipeId == null) {
return null;
}

return EmiApi.getRecipeManager().getRecipe(recipeId);
return ClientRecipeCache.INSTANCE.getRecipe(recipeId);
}

public static void registerDevCommands() {
/*
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(
CommandManager.literal("randomizerecipes").then(
CommandManager.argument("from", BlockPosArgumentType.blockPos()).then(
CommandManager.argument("to", BlockPosArgumentType.blockPos()).executes(context -> {
ServerCommandSource source = context.getSource();

List<Identifier> list = EmiUtils.RECIPE_LIST.get();
ServerWorld world = source.getWorld();
List<Identifier> list = ReliableRecipeViewerClient.LOCAL_RECIPES.values().stream().map(RecipeHolder::id).map(ResourceKey::identifier).toList();
ServerLevel world = source.getWorld();

BlockBox range = BlockBox.create(BlockPosArgumentType.getLoadedBlockPos(context, "from"), BlockPosArgumentType.getLoadedBlockPos(context, "to"));
for (BlockPos blockPos : BlockPos.iterate(range.getMinX(), range.getMinY(), range.getMinZ(), range.getMaxX(), range.getMaxY(), range.getMaxZ())) {
BlockEntity blockEntity = world.getBlockEntity(blockPos);
if (blockEntity instanceof RecipeBlockEntity recipeBlockEntity) {
recipeBlockEntity.setRecipe(list.get(world.random.nextInt(list.size())).toString());
recipeBlockEntity.setRecipe(list.get(world.getRandom().nextInt(list.size())).toString());
}
}

Expand All @@ -46,5 +47,6 @@ public static void registerDevCommands() {
)
);
});
}*/
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* Just a dummy class to make it harder to accidentally ClassCastException when passing to methods that expect a
* specific class that can't be explicitly specified due to it being optionally loaded.
*/
public interface RequiresEmiLoaded { }
public interface RequiresRRVLoaded { }
2 changes: 1 addition & 1 deletion src/main/resources/assets/glowcase/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"block.glowcase.popup_block.tooltip.0": "Displays formatted text when interacted",
"block.glowcase.popup_block.tooltip.1": "Supports Placeholder QuickText",
"block.glowcase.screen_block.tooltip.0": "Displays remotely configurable images",
"block.glowcase.recipe_block.tooltip.0": "Displays a recipe from EMI",
"block.glowcase.recipe_block.tooltip.0": "Displays a recipe from RRV",
"block.glowcase.sprite_block.tooltip.0": "Displays a sprite",
"block.glowcase.sprite_block.tooltip.1": "Can be extended with resource packs",
"block.glowcase.outline_block.tooltip.0": "Displays an outline",
Expand Down
Binary file modified src/main/resources/assets/glowcase/textures/item/recipe_block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading