From f3e34143cf943a72bc150221f2a3c4208b55bcaa Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 25 Jul 2023 14:12:29 +0200 Subject: [PATCH] various small fixes --- src/main/java/de/ellpeck/naturesaura/Helper.java | 3 ++- .../de/ellpeck/naturesaura/blocks/BlockWoodStand.java | 3 ++- .../ellpeck/naturesaura/blocks/multi/Multiblocks.java | 2 +- .../blocks/tiles/BlockEntityAnimalSpawner.java | 2 +- .../blocks/tiles/BlockEntityNatureAltar.java | 2 +- .../blocks/tiles/BlockEntityOfferingTable.java | 3 ++- .../de/ellpeck/naturesaura/events/ClientEvents.java | 11 ++++++----- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index d3654b0b..104f0aad 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -1,6 +1,5 @@ package de.ellpeck.naturesaura; -import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.VertexConsumer; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; @@ -128,6 +127,7 @@ public final class Helper { poseStack.pushPose(); poseStack.translate(x, y, 0); poseStack.scale(scale, scale, scale); + graphics.setColor(1, 1, 1, 1); graphics.renderItem(stack, 0, 0); graphics.renderItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null); poseStack.popPose(); @@ -373,4 +373,5 @@ public final class Helper { player.level().playSound(null, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.65F, 1F); return true; } + } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java index 5f887f4c..2ac85e2f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java @@ -61,7 +61,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider< if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) { var saplingStack = new ItemStack(level.getBlockState(pos).getBlock()); if (!saplingStack.isEmpty()) { - for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null)) { + for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, (Level) level)) { if (recipe.saplingType.test(saplingStack)) { List required = new ArrayList<>(Arrays.asList(recipe.ingredients)); var toPick = new MutableObject(); @@ -114,4 +114,5 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider< public void registerTESR() { BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new); } + } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java index 1e9abb81..807449bb 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java @@ -42,7 +42,7 @@ public final class Multiblocks { // try-catch to prevent blocks that need to have been placed crashing here try { var stack = new ItemStack(state.getBlock()); - return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack)); + return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, level).stream().anyMatch(r -> r.saplingType.test(stack)); } catch (Exception e) { return false; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityAnimalSpawner.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityAnimalSpawner.java index db7e5ed8..4437cd27 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityAnimalSpawner.java @@ -70,7 +70,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab var items = this.level.getEntitiesOfClass(ItemEntity.class, new AABB(this.worldPosition).inflate(2)); - for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null)) { + for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE, null, this.level)) { if (recipe.ingredients.length != items.size()) continue; List required = new ArrayList<>(Arrays.asList(recipe.ingredients)); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityNatureAltar.java index 9e05c878..2942a886 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityNatureAltar.java @@ -198,7 +198,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable } private AltarRecipe getRecipeForInput(ItemStack input) { - for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ALTAR_TYPE, null, null)) { + for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ALTAR_TYPE, null, this.level)) { if (recipe.input.test(input)) { if (recipe.catalyst == Ingredient.EMPTY) return recipe; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityOfferingTable.java index ab7029c9..e064a7f5 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/BlockEntityOfferingTable.java @@ -38,7 +38,7 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab } private OfferingRecipe getRecipe(ItemStack input) { - for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.OFFERING_TYPE, null, null)) + for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.OFFERING_TYPE, null, this.level)) if (recipe.input.test(input)) return recipe; return null; @@ -139,4 +139,5 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab public IItemHandlerModifiable getItemHandler() { return this.items; } + } diff --git a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java index cff9077b..c43e1ab1 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java @@ -269,7 +269,7 @@ public class ClientEvents { stack.pushPose(); var color = container.getAuraColor(); - RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1); + graphics.setColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1); if (width < 80) graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256); if (width > 0) @@ -282,7 +282,7 @@ public class ClientEvents { graphics.drawString(mc.font, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color, true); stack.popPose(); - RenderSystem.setShaderColor(1F, 1F, 1F, 1); + graphics.setColor(1F, 1F, 1F, 1); stack.pushPose(); } @@ -292,7 +292,7 @@ public class ClientEvents { int conf = ModConfig.instance.auraBarLocation.get(); if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) { var color = IAuraType.forLevel(mc.level).getColor(); - RenderSystem.setShaderColor((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1); + graphics.setColor((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1); var totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.blockPosition(), 35); var totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F); @@ -417,7 +417,7 @@ public class ClientEvents { } } - RenderSystem.setShaderColor(1F, 1F, 1F, 1); + graphics.setColor(1F, 1F, 1F, 1); stack.popPose(); } @@ -443,7 +443,7 @@ public class ClientEvents { } private void drawContainerInfo(GuiGraphics graphics, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) { - RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1); + graphics.setColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1); var x = res.getGuiScaledWidth() / 2 - 40; var y = res.getGuiScaledHeight() / 2 + yOffset; @@ -459,4 +459,5 @@ public class ClientEvents { if (textBelow != null) graphics.drawString(mc.font, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color, true); } + }