Skip to content

Commit

Permalink
Add lang file entries for beacon conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
YocyCraft committed Dec 18, 2024
1 parent 74f2def commit 176b103
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 22 deletions.
3 changes: 3 additions & 0 deletions src/generated/resources/assets/anvilcraft/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@
"entity.anvilcraft.floating_block": "ʞɔoןᗺ buıʇɐoןℲ",
"entity.minecraft.villager.anvilcraft.jeweler": "ɹǝןǝʍǝſ",
"gui.anvilcraft.category.average_output": "%s :ǝbɐɹǝʌⱯ",
"gui.anvilcraft.category.beacon_conversion": "uoısɹǝʌuoƆ uoɔɐǝᗺ",
"gui.anvilcraft.category.beacon_conversion.activate": "uoɔɐǝq ǝʇɐʌıʇɔɐ oʇ ɯǝʇı sıɥʇ ǝs∩",
"gui.anvilcraft.category.beacon_conversion.beacon_base": "ǝsɐq uoɔɐǝq sɐ ʞɔoןq sıɥʇ ǝs∩",
"gui.anvilcraft.category.block_compress": "ssǝɹdɯoƆ ʞɔoןᗺ",
"gui.anvilcraft.category.block_crush": "ɥsnɹƆ ʞɔoןᗺ",
"gui.anvilcraft.category.boiling": "buıןıoᗺ",
Expand Down
3 changes: 3 additions & 0 deletions src/generated/resources/assets/anvilcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@
"entity.anvilcraft.floating_block": "Floating Block",
"entity.minecraft.villager.anvilcraft.jeweler": "Jeweler",
"gui.anvilcraft.category.average_output": "Average: %s",
"gui.anvilcraft.category.beacon_conversion": "Beacon Conversion",
"gui.anvilcraft.category.beacon_conversion.activate": "Use this item to activate beacon",
"gui.anvilcraft.category.beacon_conversion.beacon_base": "Use this block as beacon base",
"gui.anvilcraft.category.block_compress": "Block Compress",
"gui.anvilcraft.category.block_crush": "Block Crush",
"gui.anvilcraft.category.boiling": "Boiling",
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/dubhe/anvilcraft/data/lang/JeiLang.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public static void init(RegistrateLangProvider provider) {
provider.add("gui.anvilcraft.category.end_portal_conversion", "Falling Block Through End Portal");
provider.add("gui.anvilcraft.category.end_portal_conversion.fall_through", "Converted when fall through end portal");

provider.add("gui.anvilcraft.category.beacon_conversion", "Beacon Conversion");
provider.add("gui.anvilcraft.category.beacon_conversion.activate", "Use this item to activate beacon");
provider.add("gui.anvilcraft.category.beacon_conversion.beacon_base", "Use this block as beacon base");

provider.add("jei.anvilcraft.info.geode_1", "Finds Amethyst Geodes nearby when using.");
provider.add("jei.anvilcraft.info.geode_2", "Dropped by Budding Amethyst blocks.");
provider.add("jei.anvilcraft.info.geode_3", "You can also find it in the Bonus Chest");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
Expand All @@ -44,6 +45,8 @@ public class BeaconConversionCategory implements IRecipeCategory<BeaconConversio
private final IDrawable slot;
private final IDrawable progressArrow;
private final Component title;
private final Component activateTooltip;
private final Component beaconBaseTooltip;
private final IDrawable arrowIn;

private final Map<BeaconConversionRecipe, LevelLike> cache = new HashMap<>();
Expand All @@ -52,6 +55,10 @@ public BeaconConversionCategory(IGuiHelper helper) {
background = Lazy.of(() -> helper.createBlankDrawable(WIDTH, HEIGHT));
slot = helper.getSlotDrawable();
title = Component.translatable("gui.anvilcraft.category.beacon_conversion");
activateTooltip = Component.translatable("gui.anvilcraft.category.beacon_conversion.activate")
.withStyle(ChatFormatting.GOLD);
beaconBaseTooltip = Component.translatable("gui.anvilcraft.category.beacon_conversion.beacon_base")
.withStyle(ChatFormatting.GOLD);
progressArrow = helper.drawableBuilder(TextureConstants.PROGRESS, 0, 0, 24, 16)
.setTextureSize(24, 16)
.build();
Expand Down Expand Up @@ -84,11 +91,15 @@ public IDrawable getBackground() {
@Override
public void setRecipe(
IRecipeLayoutBuilder builder, BeaconConversionRecipe recipe, IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 10, 12)
.addItemStack(ModItems.CURSED_GOLD_INGOT.asStack());
builder.addSlot(RecipeIngredientRole.CATALYST, 10, 32)
.addItemStack(ModBlocks.CURSED_GOLD_BLOCK.asStack(recipe.cursedGoldBlockCount));
builder.addSlot(RecipeIngredientRole.INPUT, 10, 96)
builder.addSlot(RecipeIngredientRole.INPUT, 48, 8)
.addItemStack(ModItems.CURSED_GOLD_INGOT.asStack())
.addRichTooltipCallback((recipeSlotView, tooltip) ->
tooltip.add(activateTooltip));
builder.addSlot(RecipeIngredientRole.CATALYST, 10, 110)
.addItemStack(ModBlocks.CURSED_GOLD_BLOCK.asStack(recipe.cursedGoldBlockCount))
.addRichTooltipCallback((recipeSlotView, tooltip) ->
tooltip.add(beaconBaseTooltip));
builder.addSlot(RecipeIngredientRole.INPUT, 10, 92)
.addItemStack(Blocks.BEACON.asItem().getDefaultInstance());
IRecipeSlotBuilder slot = builder.addSlot(RecipeIngredientRole.OUTPUT, 130, 96)
.addItemStack(ModBlocks.CORRUPTED_BEACON.asStack());
Expand Down Expand Up @@ -123,15 +134,15 @@ public void draw(
level = beaconBase;
}

RenderHelper.renderLevelLike(level, guiGraphics, 100, 50, 80);
RenderHelper.renderLevelLike(level, guiGraphics, 90, 50, 90);

slot.draw(guiGraphics, 9, 11);
slot.draw(guiGraphics, 9, 31);
slot.draw(guiGraphics, 9, 95);
slot.draw(guiGraphics, 47, 7);
slot.draw(guiGraphics, 9, 109);
slot.draw(guiGraphics, 9, 91);
if (recipe.chance < 1.0f) slot.draw(guiGraphics, 111, 95);
slot.draw(guiGraphics, 129, 95);

arrowIn.draw(guiGraphics, 30, 18);
arrowIn.draw(guiGraphics, 66, 14);
progressArrow.draw(guiGraphics, 60, 96);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class EndPortalConversionCategory implements IRecipeCategory<EndPortalCon
private final IDrawable slot;
private final IDrawable preRenderedEndPortal;
private final Component title;
private final Component fallThroughTooltip;

private final IDrawable arrowIn;
private final IDrawable arrowOut;
Expand All @@ -43,8 +44,9 @@ public EndPortalConversionCategory(IGuiHelper helper) {
background = Lazy.of(() -> helper.createBlankDrawable(WIDTH, HEIGHT));
slot = helper.getSlotDrawable();
preRenderedEndPortal = helper.drawableBuilder(TextureConstants.PRE_RENDERED_END_PORTAL,
0, 0, 500, 312).setTextureSize(500, 312).build();
0, 0, 400, 300).setTextureSize(400, 300).build();
title = Component.translatable("gui.anvilcraft.category.end_portal_conversion");
fallThroughTooltip = Component.translatable("gui.anvilcraft.category.end_portal_conversion.fall_through");

arrowIn = helper.createDrawable(TextureConstants.ANVIL_CRAFT_SPRITES, 0, 31, 16, 8);
arrowOut = helper.createDrawable(TextureConstants.ANVIL_CRAFT_SPRITES, 0, 40, 16, 10);
Expand Down Expand Up @@ -87,7 +89,7 @@ public void draw(
PoseStack pose = guiGraphics.pose();
pose.pushPose();
pose.scale(0.1f, 0.1f, 1.0f);
preRenderedEndPortal.draw(guiGraphics, 570, 350);
preRenderedEndPortal.draw(guiGraphics, 600, 350);
pose.popPose();
arrowIn.draw(guiGraphics, 54, 32);
arrowOut.draw(guiGraphics, 92, 31);
Expand All @@ -103,9 +105,9 @@ public void getTooltip(
IRecipeSlotsView recipeSlotsView,
double mouseX,
double mouseY) {
if (mouseX >= 57 && mouseX <= 107) {
if (mouseY >= 35 && mouseY <= 66) {
tooltip.add(Component.translatable("gui.anvilcraft.category.end_portal_conversion.fall_through"));
if (mouseX >= 60 && mouseX <= 102) {
if (mouseY >= 35 && mouseY <= 65) {
tooltip.add(fallThroughTooltip);
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/dev/dubhe/anvilcraft/util/RenderHelper.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.dubhe.anvilcraft.util;

import com.mojang.blaze3d.platform.Lighting;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.VertexMultiConsumer;
Expand All @@ -14,13 +13,11 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.block.LiquidBlockRenderer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
Expand All @@ -44,16 +41,13 @@
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.StainedGlassPaneBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.FluidState;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import net.minecraft.world.level.material.Fluids;
import net.neoforged.neoforge.client.model.data.ModelData;
import org.joml.Vector3f;

Expand Down Expand Up @@ -186,7 +180,15 @@ public static void renderLevelLike(

pose.translate(offsetX, 0, offsetZ);

Iterable<BlockPos> iter = BlockPos.betweenClosed(BlockPos.ZERO, new BlockPos(sizeX - 1, sizeY - 1, sizeX - 1));
Iterable<BlockPos> iter;
if (level.isAllLayersVisible()) {
iter = BlockPos.betweenClosed(BlockPos.ZERO, new BlockPos(sizeX - 1, sizeY - 1, sizeX - 1));
} else {
int visibleLayer = level.getCurrentVisibleLayer();
iter = BlockPos.betweenClosed(
BlockPos.ZERO.atY(visibleLayer), new BlockPos(sizeX - 1, visibleLayer, sizeX - 1));
}
pose.pushPose();
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
pose.translate(0, 0, -1);
MultiBufferSource.BufferSource buffers = minecraft.renderBuffers().bufferSource();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 176b103

Please sign in to comment.