diff --git a/src/generated/resources/assets/malum/blockstates/soulwoven_banner_horns.json b/src/generated/resources/assets/malum/blockstates/soulwoven_banner_horns.json new file mode 100644 index 000000000..ef7d0c73a --- /dev/null +++ b/src/generated/resources/assets/malum/blockstates/soulwoven_banner_horns.json @@ -0,0 +1,27 @@ +{ + "variants": { + "banner_type=hanging_x": { + "model": "malum:block/soulwoven_banner", + "y": 90 + }, + "banner_type=hanging_z": { + "model": "malum:block/soulwoven_banner", + "y": 180 + }, + "banner_type=mounted_east": { + "model": "malum:block/soulwoven_banner_mounted", + "y": 270 + }, + "banner_type=mounted_north": { + "model": "malum:block/soulwoven_banner_mounted", + "y": 180 + }, + "banner_type=mounted_south": { + "model": "malum:block/soulwoven_banner_mounted" + }, + "banner_type=mounted_west": { + "model": "malum:block/soulwoven_banner_mounted", + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/blockstates/soulwoven_banner_sigil.json b/src/generated/resources/assets/malum/blockstates/soulwoven_banner_sigil.json new file mode 100644 index 000000000..ef7d0c73a --- /dev/null +++ b/src/generated/resources/assets/malum/blockstates/soulwoven_banner_sigil.json @@ -0,0 +1,27 @@ +{ + "variants": { + "banner_type=hanging_x": { + "model": "malum:block/soulwoven_banner", + "y": 90 + }, + "banner_type=hanging_z": { + "model": "malum:block/soulwoven_banner", + "y": 180 + }, + "banner_type=mounted_east": { + "model": "malum:block/soulwoven_banner_mounted", + "y": 270 + }, + "banner_type=mounted_north": { + "model": "malum:block/soulwoven_banner_mounted", + "y": 180 + }, + "banner_type=mounted_south": { + "model": "malum:block/soulwoven_banner_mounted" + }, + "banner_type=mounted_west": { + "model": "malum:block/soulwoven_banner_mounted", + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/lang/en_us.json b/src/generated/resources/assets/malum/lang/en_us.json index afb2796bf..eed81b9e7 100644 --- a/src/generated/resources/assets/malum/lang/en_us.json +++ b/src/generated/resources/assets/malum/lang/en_us.json @@ -214,6 +214,8 @@ "block.malum.soulwood_totem_base": "Soulwood Totem Base", "block.malum.soulwood_totem_pole": "Soulwood Totem Pole", "block.malum.soulwood_trapdoor": "Soulwood Trapdoor", + "block.malum.soulwoven_banner_horns": "Soulwoven Banner Horns", + "block.malum.soulwoven_banner_sigil": "Soulwoven Banner Sigil", "block.malum.spirit_altar": "Spirit Altar", "block.malum.spirit_catalyzer": "Spirit Catalyzer", "block.malum.spirit_catalyzer_component": "Spirit Catalyzer Component", @@ -572,9 +574,9 @@ "item.malum.soul_stained_steel_shovel": "Soulstained Steel Shovel", "item.malum.soul_stained_steel_sword": "Soulstained Steel Sword", "item.malum.soulwood_boat": "Soulwood Boat", + "item.malum.soulwoven_silk": "Soulwoven Silk", "item.malum.spectral_lens": "Spectral Lens", "item.malum.spectral_optic": "Spectral Optic", - "item.malum.spirit_fabric": "Spirit Fabric", "item.malum.spirit_pouch": "Spirit Pouch", "item.malum.splash_of_gluttony": "Splash of Gluttony", "item.malum.staff_of_the_auric_flame": "Staff of the Auric Flame", diff --git a/src/generated/resources/assets/malum/models/item/soulwoven_banner_horns.json b/src/generated/resources/assets/malum/models/item/soulwoven_banner_horns.json new file mode 100644 index 000000000..dc095e4d4 --- /dev/null +++ b/src/generated/resources/assets/malum/models/item/soulwoven_banner_horns.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "malum:item/soulwoven_banner_horns" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/models/item/soulwoven_banner_sigil.json b/src/generated/resources/assets/malum/models/item/soulwoven_banner_sigil.json new file mode 100644 index 000000000..1db2a2f5b --- /dev/null +++ b/src/generated/resources/assets/malum/models/item/soulwoven_banner_sigil.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "malum:item/soulwoven_banner_sigil" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/malum/models/item/spirit_fabric.json b/src/generated/resources/assets/malum/models/item/soulwoven_silk.json similarity index 60% rename from src/generated/resources/assets/malum/models/item/spirit_fabric.json rename to src/generated/resources/assets/malum/models/item/soulwoven_silk.json index 42c445c1b..898851a36 100644 --- a/src/generated/resources/assets/malum/models/item/spirit_fabric.json +++ b/src/generated/resources/assets/malum/models/item/soulwoven_silk.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/generated", "textures": { - "layer0": "malum:item/spirit_fabric" + "layer0": "malum:item/soulwoven_silk" } } \ No newline at end of file diff --git a/src/generated/resources/data/malum/advancement/recipes/misc/spirit_pouch.json b/src/generated/resources/data/malum/advancement/recipes/misc/spirit_pouch.json index e5f91da69..e3309bfe0 100644 --- a/src/generated/resources/data/malum/advancement/recipes/misc/spirit_pouch.json +++ b/src/generated/resources/data/malum/advancement/recipes/misc/spirit_pouch.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "items": "malum:spirit_fabric" + "items": "malum:soulwoven_silk" } ] }, diff --git a/src/generated/resources/data/malum/advancement/recipes/spirit_infusion/spirit_fabric.json b/src/generated/resources/data/malum/advancement/recipes/spirit_infusion/soulwoven_silk.json similarity index 79% rename from src/generated/resources/data/malum/advancement/recipes/spirit_infusion/spirit_fabric.json rename to src/generated/resources/data/malum/advancement/recipes/spirit_infusion/soulwoven_silk.json index cb164704e..599770996 100644 --- a/src/generated/resources/data/malum/advancement/recipes/spirit_infusion/spirit_fabric.json +++ b/src/generated/resources/data/malum/advancement/recipes/spirit_infusion/soulwoven_silk.json @@ -3,7 +3,7 @@ "criteria": { "has_the_recipe": { "conditions": { - "recipe": "malum:spirit_fabric" + "recipe": "malum:soulwoven_silk" }, "trigger": "minecraft:recipe_unlocked" } @@ -15,7 +15,7 @@ ], "rewards": { "recipes": [ - "malum:spirit_fabric" + "malum:soulwoven_silk" ] } } \ No newline at end of file diff --git a/src/generated/resources/data/malum/loot_table/blocks/soulwoven_banner_horns.json b/src/generated/resources/data/malum/loot_table/blocks/soulwoven_banner_horns.json new file mode 100644 index 000000000..0570dca25 --- /dev/null +++ b/src/generated/resources/data/malum/loot_table/blocks/soulwoven_banner_horns.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "malum:soulwoven_banner_horns" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "malum:blocks/soulwoven_banner_horns" +} \ No newline at end of file diff --git a/src/generated/resources/data/malum/loot_table/blocks/soulwoven_banner_sigil.json b/src/generated/resources/data/malum/loot_table/blocks/soulwoven_banner_sigil.json new file mode 100644 index 000000000..6b9ed6cad --- /dev/null +++ b/src/generated/resources/data/malum/loot_table/blocks/soulwoven_banner_sigil.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "malum:soulwoven_banner_sigil" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "malum:blocks/soulwoven_banner_sigil" +} \ No newline at end of file diff --git a/src/generated/resources/data/malum/recipe/soul_hunter_boots.json b/src/generated/resources/data/malum/recipe/soul_hunter_boots.json index fdeaaf71a..d66352543 100644 --- a/src/generated/resources/data/malum/recipe/soul_hunter_boots.json +++ b/src/generated/resources/data/malum/recipe/soul_hunter_boots.json @@ -3,7 +3,7 @@ "extraIngredients": [ { "count": 4, - "item": "malum:spirit_fabric" + "item": "malum:soulwoven_silk" }, { "count": 4, diff --git a/src/generated/resources/data/malum/recipe/soul_hunter_cloak.json b/src/generated/resources/data/malum/recipe/soul_hunter_cloak.json index c5b15bef7..021ced917 100644 --- a/src/generated/resources/data/malum/recipe/soul_hunter_cloak.json +++ b/src/generated/resources/data/malum/recipe/soul_hunter_cloak.json @@ -3,7 +3,7 @@ "extraIngredients": [ { "count": 4, - "item": "malum:spirit_fabric" + "item": "malum:soulwoven_silk" }, { "count": 4, diff --git a/src/generated/resources/data/malum/recipe/soul_hunter_leggings.json b/src/generated/resources/data/malum/recipe/soul_hunter_leggings.json index 987bdfdeb..f613ae187 100644 --- a/src/generated/resources/data/malum/recipe/soul_hunter_leggings.json +++ b/src/generated/resources/data/malum/recipe/soul_hunter_leggings.json @@ -3,7 +3,7 @@ "extraIngredients": [ { "count": 4, - "item": "malum:spirit_fabric" + "item": "malum:soulwoven_silk" }, { "count": 4, diff --git a/src/generated/resources/data/malum/recipe/soul_hunter_robe.json b/src/generated/resources/data/malum/recipe/soul_hunter_robe.json index e72458cd0..6f8c245f2 100644 --- a/src/generated/resources/data/malum/recipe/soul_hunter_robe.json +++ b/src/generated/resources/data/malum/recipe/soul_hunter_robe.json @@ -3,7 +3,7 @@ "extraIngredients": [ { "count": 4, - "item": "malum:spirit_fabric" + "item": "malum:soulwoven_silk" }, { "count": 4, diff --git a/src/generated/resources/data/malum/recipe/spirit_fabric.json b/src/generated/resources/data/malum/recipe/soulwoven_silk.json similarity index 93% rename from src/generated/resources/data/malum/recipe/spirit_fabric.json rename to src/generated/resources/data/malum/recipe/soulwoven_silk.json index baec29752..d5c07fc2a 100644 --- a/src/generated/resources/data/malum/recipe/spirit_fabric.json +++ b/src/generated/resources/data/malum/recipe/soulwoven_silk.json @@ -16,7 +16,7 @@ }, "output": { "count": 4, - "id": "malum:spirit_fabric" + "id": "malum:soulwoven_silk" }, "spirits": [ { diff --git a/src/generated/resources/data/malum/recipe/spirit_crucible/repair/soul_hunter_armor.json b/src/generated/resources/data/malum/recipe/spirit_crucible/repair/soul_hunter_armor.json index 6385f5ae0..1178d72b7 100644 --- a/src/generated/resources/data/malum/recipe/spirit_crucible/repair/soul_hunter_armor.json +++ b/src/generated/resources/data/malum/recipe/spirit_crucible/repair/soul_hunter_armor.json @@ -9,7 +9,7 @@ ], "repairMaterial": { "count": 2, - "item": "malum:spirit_fabric" + "item": "malum:soulwoven_silk" }, "spirits": [ { diff --git a/src/generated/resources/data/malum/recipe/spirit_pouch.json b/src/generated/resources/data/malum/recipe/spirit_pouch.json index b192f5ae1..c8766c755 100644 --- a/src/generated/resources/data/malum/recipe/spirit_pouch.json +++ b/src/generated/resources/data/malum/recipe/spirit_pouch.json @@ -6,7 +6,7 @@ "tag": "c:strings" }, "Y": { - "item": "malum:spirit_fabric" + "item": "malum:soulwoven_silk" }, "Z": { "tag": "minecraft:soul_fire_base_blocks" diff --git a/src/generated/resources/data/minecraft/tags/block/mineable/axe.json b/src/generated/resources/data/minecraft/tags/block/mineable/axe.json index f47591e13..7dc29d4da 100644 --- a/src/generated/resources/data/minecraft/tags/block/mineable/axe.json +++ b/src/generated/resources/data/minecraft/tags/block/mineable/axe.json @@ -12,6 +12,8 @@ "malum:runewood_totem_pole", "malum:soulwood_totem_base", "malum:soulwood_totem_pole", + "malum:soulwoven_banner_sigil", + "malum:soulwoven_banner_horns", "malum:stripped_runewood_log", "malum:runewood_log", "malum:stripped_runewood", diff --git a/src/main/java/com/sammy/malum/client/renderer/block/SoulwovenBannerRenderer.java b/src/main/java/com/sammy/malum/client/renderer/block/SoulwovenBannerRenderer.java new file mode 100644 index 000000000..4ccde3785 --- /dev/null +++ b/src/main/java/com/sammy/malum/client/renderer/block/SoulwovenBannerRenderer.java @@ -0,0 +1,67 @@ +package com.sammy.malum.client.renderer.block; + +import com.mojang.blaze3d.vertex.*; +import com.mojang.math.*; +import com.sammy.malum.*; +import com.sammy.malum.client.*; +import com.sammy.malum.common.block.curiosities.banner.*; +import com.sammy.malum.common.block.curiosities.mana_mote.*; +import com.sammy.malum.core.systems.spirit.*; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.blockentity.*; +import net.minecraft.core.*; +import net.minecraft.util.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import org.joml.*; +import team.lodestar.lodestone.registry.client.*; +import team.lodestar.lodestone.systems.rendering.*; +import team.lodestar.lodestone.systems.rendering.rendeertype.*; + +import java.lang.Math; + +import static com.sammy.malum.client.RenderUtils.*; + + +public class SoulwovenBannerRenderer implements BlockEntityRenderer { + + public SoulwovenBannerRenderer(BlockEntityRendererProvider.Context context) { + } + + @Override + public void render(SoulwovenBannerBlockEntity blockEntityIn, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + var blockState = blockEntityIn.getBlockState(); + if (!(blockState.getBlock() instanceof SoulwovenBannerBlock block)) { + return; + } + var pos = blockEntityIn.getBlockPos(); + var type = blockState.getValue(SoulwovenBannerBlock.BANNER_TYPE); + var direction = type.direction.getAxis().isVertical() ? type.equals(SoulwovenBannerBlock.BannerType.HANGING_Z) ? Direction.NORTH : Direction.WEST : type.direction; + var builder = VFXBuilders.createWorld() + .setRenderType(LodestoneRenderTypes.TRANSPARENT_TEXTURE.applyWithModifierAndCache(RenderTypeToken.createCachedToken(block.texture), b -> b.setCullState(RenderStateShard.NO_CULL))); + float sway = ((float) Math.floorMod((pos.getX() * 7L + pos.getY() * 9L + pos.getZ() * 13L) + blockEntityIn.getLevel().getGameTime(), 100L) + partialTicks) / 100.0F; + float swayRotation = (0.01F * Mth.cos((float) (Math.PI * 2) * sway)) * (float) Math.PI; + + poseStack.pushPose(); + poseStack.translate(0.5f, 0.5f, 0.5f); + poseStack.mulPose(Axis.YN.rotationDegrees(direction.toYRot())); + poseStack.translate(-0.5f, -0.5f, -0.5f); + if (type.direction.getAxis().isHorizontal()) { + poseStack.translate(0, -0.25f, 0.0625f); + swayRotation -= 0.0125f; + } else { + poseStack.translate(0, 0, 0.5f); + swayRotation = swayRotation - 0.0157f; + } + poseStack.translate(0, 1f, 0); + poseStack.mulPose(Axis.XP.rotation(swayRotation)); + float xStart = 0; + float xEnd = 1; + float yStart = -2; + float yEnd = 0; + Vector3f[] vertices = new Vector3f[]{new Vector3f(xEnd, yStart, 0), new Vector3f(xStart, yStart, 0), new Vector3f(xStart, yEnd, 0), new Vector3f(xEnd, yEnd, 0)}; + builder.renderQuad(poseStack, vertices, 1f); + + poseStack.popPose(); + } +} \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/client/screen/codex/ArcanaCodexHelper.java b/src/main/java/com/sammy/malum/client/screen/codex/ArcanaCodexHelper.java index c15c45413..9cbf65ee8 100644 --- a/src/main/java/com/sammy/malum/client/screen/codex/ArcanaCodexHelper.java +++ b/src/main/java/com/sammy/malum/client/screen/codex/ArcanaCodexHelper.java @@ -307,7 +307,7 @@ public static Runnable renderItemFrames(GuiGraphics guiGraphics, @Nullable Compo return () -> { if (hoverComponent != null) { if (isHovering(mouseX, mouseY, crownLeft + 3, plaqueTop + 2, 10, 11)) { - guiGraphics.renderTooltip(Minecraft.getInstance().font, hoverComponent, (int) mouseX, (int) mouseY); + guiGraphics.renderComponentTooltip(Minecraft.getInstance().font, wrapComponent(hoverComponent, 180), (int) mouseX, (int) mouseY); } } }; @@ -385,9 +385,33 @@ public static MutableComponent convertToComponent(String text, UnaryOperator lines = wrapText(text, width); + for (int i = 0; i < lines.size(); i++) { + String currentLine = lines.get(i); + renderRawText(guiGraphics, currentLine, x, y + i * (font.lineHeight + 1), 0.2f); + } + } + public static List wrapComponent(String text, int width) { + return wrapText(text, width).stream().map(Component::literal).map(Component.class::cast).toList(); + } + public static List wrapComponent(Component component, int width) { + return wrapText(component, width).stream().map(Component::literal).map(Component.class::cast).toList(); + } + public static List wrapText(String text, int width) { + return wrapText(Component.translatable(text), width); + } + public static List wrapText(Component component, int width) { Font font = Minecraft.getInstance().font; - text = Component.translatable(text).getString() + "\n"; + String text = component.getString() + "\n"; List lines = new ArrayList<>(); boolean italic = false; @@ -402,7 +426,7 @@ public static void renderWrappingText(GuiGraphics guiGraphics, String text, int char chr = text.charAt(i); if (chr == ' ' || chr == '\n') { if (!word.isEmpty()) { - if (font.width(line.toString()) + font.width(word.toString()) > w) { + if (font.width(line.toString()) + font.width(word.toString()) > width) { line = newLine(lines, italic, bold, strikethrough, underline, obfuscated, line); } line.append(word).append(' '); @@ -463,11 +487,7 @@ public static void renderWrappingText(GuiGraphics guiGraphics, String text, int word.append(chr); } } - - for (int i = 0; i < lines.size(); i++) { - String currentLine = lines.get(i); - renderRawText(guiGraphics, currentLine, x, y + i * (font.lineHeight + 1), 0.2f); - } + return lines; } private static StringBuilder commitComponent(MutableComponent component, boolean italic, boolean bold, boolean strikethrough, boolean underline, boolean obfuscated, StringBuilder line, UnaryOperator