various small fixes

This commit is contained in:
Ell 2023-07-25 14:12:29 +02:00
parent 778398186c
commit f3e34143cf
7 changed files with 15 additions and 11 deletions

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura; package de.ellpeck.naturesaura;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
@ -128,6 +127,7 @@ public final class Helper {
poseStack.pushPose(); poseStack.pushPose();
poseStack.translate(x, y, 0); poseStack.translate(x, y, 0);
poseStack.scale(scale, scale, scale); poseStack.scale(scale, scale, scale);
graphics.setColor(1, 1, 1, 1);
graphics.renderItem(stack, 0, 0); graphics.renderItem(stack, 0, 0);
graphics.renderItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null); graphics.renderItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null);
poseStack.popPose(); 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); 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; return true;
} }
} }

View file

@ -61,7 +61,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) { if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) {
var saplingStack = new ItemStack(level.getBlockState(pos).getBlock()); var saplingStack = new ItemStack(level.getBlockState(pos).getBlock());
if (!saplingStack.isEmpty()) { 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)) { if (recipe.saplingType.test(saplingStack)) {
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients)); List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
var toPick = new MutableObject<BlockEntityWoodStand>(); var toPick = new MutableObject<BlockEntityWoodStand>();
@ -114,4 +114,5 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
public void registerTESR() { public void registerTESR() {
BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new); BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new);
} }
} }

View file

@ -42,7 +42,7 @@ public final class Multiblocks {
// try-catch to prevent blocks that need to have been placed crashing here // try-catch to prevent blocks that need to have been placed crashing here
try { try {
var stack = new ItemStack(state.getBlock()); 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) { } catch (Exception e) {
return false; return false;
} }

View file

@ -70,7 +70,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab
var items = this.level.getEntitiesOfClass(ItemEntity.class, var items = this.level.getEntitiesOfClass(ItemEntity.class,
new AABB(this.worldPosition).inflate(2)); 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()) if (recipe.ingredients.length != items.size())
continue; continue;
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients)); List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));

View file

@ -198,7 +198,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
} }
private AltarRecipe getRecipeForInput(ItemStack input) { 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.input.test(input)) {
if (recipe.catalyst == Ingredient.EMPTY) if (recipe.catalyst == Ingredient.EMPTY)
return recipe; return recipe;

View file

@ -38,7 +38,7 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
} }
private OfferingRecipe getRecipe(ItemStack input) { 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)) if (recipe.input.test(input))
return recipe; return recipe;
return null; return null;
@ -139,4 +139,5 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
public IItemHandlerModifiable getItemHandler() { public IItemHandlerModifiable getItemHandler() {
return this.items; return this.items;
} }
} }

View file

@ -269,7 +269,7 @@ public class ClientEvents {
stack.pushPose(); stack.pushPose();
var color = container.getAuraColor(); 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) if (width < 80)
graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256); graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256);
if (width > 0) 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); graphics.drawString(mc.font, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color, true);
stack.popPose(); stack.popPose();
RenderSystem.setShaderColor(1F, 1F, 1F, 1); graphics.setColor(1F, 1F, 1F, 1);
stack.pushPose(); stack.pushPose();
} }
@ -292,7 +292,7 @@ public class ClientEvents {
int conf = ModConfig.instance.auraBarLocation.get(); int conf = ModConfig.instance.auraBarLocation.get();
if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) { if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) {
var color = IAuraType.forLevel(mc.level).getColor(); 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 totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.blockPosition(), 35);
var totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F); 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(); 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) { 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 x = res.getGuiScaledWidth() / 2 - 40;
var y = res.getGuiScaledHeight() / 2 + yOffset; var y = res.getGuiScaledHeight() / 2 + yOffset;
@ -459,4 +459,5 @@ public class ClientEvents {
if (textBelow != null) if (textBelow != null)
graphics.drawString(mc.font, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color, true); graphics.drawString(mc.font, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color, true);
} }
} }