Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pantomime! #1249

Merged
merged 10 commits into from
Sep 25, 2024
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// 1.21.1 2024-09-22T10:22:33.0106432 Languages: en_us for mod: ars_nouveau
8e5ab95c04a148effb3f1b943177896ef20e787f assets/ars_nouveau/lang/en_us.json

// 1.21.1 2024-09-24T20:41:46.115647 Languages: en_us for mod: ars_nouveau
0b7ebd4efe064f1cc6745f6a05dea6a6f50d185f assets/ars_nouveau/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-09-11T20:19:28.5400526 Ars Nouveau Item Models
// 1.21.1 2024-09-24T20:09:13.9792381 Ars Nouveau Item Models
11ee554b11a3a830e89b742762e5b754c2ecb5ee assets/ars_nouveau/models/item/agronomic_sourcelink.json
339a05323ebef7efc5c70db708a2e7a24708e9bc assets/ars_nouveau/models/item/alchemical_sourcelink.json
a0214090201827dd5f954d0b33e64e4df6e53764 assets/ars_nouveau/models/item/alchemists_crown.json
Expand Down Expand Up @@ -83,6 +83,7 @@ e7f54893e02f4e74cfb8d6942c3e334e46b46cbe assets/ars_nouveau/models/item/glyph_li
01efb621125fc242e1a803e81a8bf9e219e71984 assets/ars_nouveau/models/item/glyph_linger.json
fbfe10752f07a26aebd57e6484d5f00a053c4636 assets/ars_nouveau/models/item/glyph_name.json
3a292eab2d9aca2dbdc6267d346c0261d7476dce assets/ars_nouveau/models/item/glyph_orbit.json
b348998e3b6f8de7e17e910fa81ddcf3b4809476 assets/ars_nouveau/models/item/glyph_pantomime.json
65a10959b3e356b62f457e98109dfe3b06a179d1 assets/ars_nouveau/models/item/glyph_phantom_block.json
1c5bddc31dfc2beb8898de056ec11219e5fb64a1 assets/ars_nouveau/models/item/glyph_pickup.json
0b8d3bc964187373a08a2f9ca02665f5485eb410 assets/ars_nouveau/models/item/glyph_pierce.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-09-11T20:30:24.4012426 Patchouli
// 1.21.1 2024-09-24T20:09:13.9852472 Patchouli
2ec536fea831588201432d61d70af61385882054 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/armor/alteration_table.json
a82f4fc73946d228b1e3f5e03d0ecef46f33cdfb assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/armor/applying_perks.json
8ce1d8e886b45066bc5c1d9d8e87bdabbb27ae27 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/armor/armor.json
Expand Down Expand Up @@ -107,6 +107,7 @@ b76616cf71ff62944c11560b2915d6600683f696 assets/ars_nouveau/patchouli_books/worn
589e170f6a45abd57d82f0a31d3153bbd92c778e assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_launch.json
64aaae029f866e7e288d3f69239e9ff9f5043d68 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_leap.json
0251ef29596c07db5958dcaf3131407c1e97eef7 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_light.json
de57d3e446040e4dd9d50dc754930c50a66041a1 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_pantomime.json
1990bd69025686c60aecee87d2c95a2c477b72fe assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_phantom_block.json
9fe654f846500785f20e623c2ce2ed95696849df assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_pickup.json
e1c2bb82ba84d8b9dc8e609b4ec02d021f51832a assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_place_block.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-08-17T10:54:39.1642564 Glyph Recipes
// 1.21.1 2024-09-24T20:47:30.7198603 Glyph Recipes
231d9f126c606465601e36e83948dda99a508834 data/ars_nouveau/recipe/glyph_accelerate.json
dbad772acd31382cfcf19c7f276da5f91354dfcf data/ars_nouveau/recipe/glyph_amplify.json
1a8499b67d1ce8614ef1d420106d32d27567eeb9 data/ars_nouveau/recipe/glyph_animate_block.json
Expand Down Expand Up @@ -49,6 +49,7 @@ b4d02e99a79be1d9f2a1f134a68a8b891e3cd46a data/ars_nouveau/recipe/glyph_lightning
2df04f2acf02666969cb91de1041ef827f009f16 data/ars_nouveau/recipe/glyph_linger.json
a33daf748ab3dab2279e9a2da7c984c53f3e3e12 data/ars_nouveau/recipe/glyph_name.json
7911daac7df742c40d4fde6edc370d58c331461c data/ars_nouveau/recipe/glyph_orbit.json
1e8cfd09d0a8886145eb70a721274d477f40d500 data/ars_nouveau/recipe/glyph_pantomime.json
395c37ef2bc2ec7a1195e046f0bf2ea575a05675 data/ars_nouveau/recipe/glyph_phantom_block.json
18f917d7d13955d3fe0a7a37181e6825c0186da4 data/ars_nouveau/recipe/glyph_pickup.json
2fbf32d7c45ee4783d83e24ffc87ee8702372415 data/ars_nouveau/recipe/glyph_pierce.json
Expand Down
4 changes: 3 additions & 1 deletion src/generated/resources/assets/ars_nouveau/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
"ars_nouveau.glyph_desc.glyph_linger": "Creates a lingering field that applies spells on nearby entities for a short time. Applying Sensitive will make this spell target blocks instead. AOE will expand the effective range, Accelerate will cast spells faster, Dampen will ignore gravity, and Extend Time will increase the duration.",
"ars_nouveau.glyph_desc.glyph_name": "Names an entity after the set Spell Name. Targeting a block will name nearby entities or name inventory blocks directly if possible. Targeting with Self will name the held offhand item. Can be overridden with a name tag in the hotbar.",
"ars_nouveau.glyph_desc.glyph_orbit": "Summons three orbiting projectiles around the target that will cast a spell on any entities it may hit. Additional projectiles, their speed, radius, and duration may be augmented. Sensitive will cause Orbit to hit blocks.",
"ars_nouveau.glyph_desc.glyph_pantomime": "Applies spells to the nearest block in your line of sight. Dampen will reduce the distance, Amplify will increase it. Sensitive will highlight the selected block.",
"ars_nouveau.glyph_desc.glyph_phantom_block": "Creates a temporary block that will disappear after a short time. Amplify will cause the block to be permanent. Dispelling this block will destroy it instantly.",
"ars_nouveau.glyph_desc.glyph_pickup": "Picks up nearby items in a medium radius where this spell is activated. The range may be expanded with AOE.",
"ars_nouveau.glyph_desc.glyph_pierce": "When applied to the Projectile spell, projectiles may continue through their path an additional time after hitting a mob or block. Causes certain effects to also target the block behind them, like Break. Combines with AOE to provide depth.",
Expand Down Expand Up @@ -343,6 +344,7 @@
"ars_nouveau.glyph_name.glyph_linger": "Linger",
"ars_nouveau.glyph_name.glyph_name": "Name",
"ars_nouveau.glyph_name.glyph_orbit": "Orbit",
"ars_nouveau.glyph_name.glyph_pantomime": "Pantomime",
"ars_nouveau.glyph_name.glyph_phantom_block": "Conjure Mageblock",
"ars_nouveau.glyph_name.glyph_pickup": "Item Pickup",
"ars_nouveau.glyph_name.glyph_pierce": "Pierce",
Expand Down Expand Up @@ -453,7 +455,7 @@
"ars_nouveau.page.brazier_relay": "Allows the users to bind a Ritual Brazier ritual to a new location. Multiple rituals can be connected to the same brazier relay. To connect, use the Dominion Wand on your Ritual Brazier, then the relay. Source is consumed at the original braziers location. Can be bound within 15 blocks.",
"ars_nouveau.page.crystallizer1": "The crystallizer provides a renewable source of Source Gems by condensing source over time. The Crystallizer can work passively at a very slow rate, or it may be given source from adjacent jars and create Source Gems as a much faster rate. The Crystallizer may also be accessed by Hoppers and Starbuncles.",
"ars_nouveau.page.decorative": "Decorative Blocks",
"ars_nouveau.page.dominion_wand": "A tool for configuring Source Relays and automation entities. To set a transfer path, use the wand on the object that you would like to take source from, and then use it on the block you would like to send source to. For example: Source Jar to Source Relay, Source Relay to Source Relay, or Source Relay to Source Jar. To clear connections, sneak and use this wand on a relay. If you sneak-use it on the air it will switch to Strict mode, allowing to specify the side of the blocks to use.",
"ars_nouveau.page.dominion_wand": "A tool for configuring Source Relays and automation entities. To set a transfer path, use the wand on the object that you would like to take source from, and then use it on the block you would like to send source to. For example: Source Jar to Source Relay, Source Relay to Source Relay, or Source Relay to Source Jar. To clear connections, sneak and use this wand on a relay. You can switch into Strict mode using the radial menu, allowing to specify the side of the blocks to use.",
"ars_nouveau.page.dowsing_rod": "A Dowsing Rod provides the user a short duration of Scrying for Budding Amethyst and Magic Find, which will cause magical creatures to glow within 75 blocks of you. The Dowsing Rod has a limited number of uses.",
"ars_nouveau.page.enchanters_eye": "A caster tool that can cast inscribed spells remotely through a Scry Crystal. Use the eye on a Scry Crystal to bind the location, or hold a bound Scry Parchment in the offhand. Spells will be cast through the eye similar to a Spell Turret, but you are considered the caster for all effects. Useful for remote teleportation or item movement.",
"ars_nouveau.page.enchanters_mirror": "Applies a self spell to the user. Spells cast with this mirror are discounted and gain additional bonus duration to all glyphs. Apply a spell at the Scribe's table that DOES NOT contain a form such as Heal -> Amplify.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "ars_nouveau:item/pantomime"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category": "ars_nouveau:glyphs_1",
"icon": "ars_nouveau:glyph_pantomime",
"name": "ars_nouveau.glyph_name.glyph_pantomime",
"pages": [
{
"type": "patchouli:text",
"text": "ars_nouveau.glyph_desc.glyph_pantomime"
},
{
"type": "ars_nouveau:glyph_recipe",
"recipe": "ars_nouveau:glyph_pantomime"
}
],
"sortnum": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"type": "ars_nouveau:glyph",
"exp": 27,
"inputs": [
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
},
{
"tag": "c:glass_blocks"
}
],
"output": {
"count": 1,
"id": "ars_nouveau:glyph_pantomime"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.hollingsworth.arsnouveau.client.gui.PatchouliTooltipEvent;
import com.hollingsworth.arsnouveau.client.gui.SpellTooltip;
import com.hollingsworth.arsnouveau.client.gui.radial_menu.GuiRadialMenu;
import com.hollingsworth.arsnouveau.client.renderer.world.PantomimeRenderer;
import com.hollingsworth.arsnouveau.common.block.tile.ArchwoodChestTile;
import com.hollingsworth.arsnouveau.common.block.tile.GhostWeaveTile;
import com.hollingsworth.arsnouveau.common.block.tile.SkyBlockTile;
Expand All @@ -21,18 +22,17 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RegisterClientTooltipComponentFactoriesEvent;
import net.neoforged.neoforge.client.event.RenderGuiLayerEvent;
import net.neoforged.neoforge.client.event.RenderHighlightEvent;
import net.neoforged.neoforge.client.event.RenderTooltipEvent;
import net.neoforged.neoforge.client.event.*;
import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions;
import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent;
import net.neoforged.neoforge.client.gui.VanillaGuiLayers;
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;
import org.jetbrains.annotations.NotNull;


@EventBusSubscriber(value = Dist.CLIENT, modid = ArsNouveau.MODID)
public class ClientEvents {

Expand All @@ -43,6 +43,7 @@ public static void registerTooltipFactory(RegisterClientTooltipComponentFactorie
event.register(SpellTooltip.class, SpellTooltip.SpellTooltipRenderer::new);
}


@SubscribeEvent
public static void registerClientExtensions(RegisterClientExtensionsEvent event) {
event.registerItem(new IClientItemExtensions() {
Expand All @@ -64,6 +65,13 @@ public void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext t
}
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void renderWorldLastEvent(final RenderLevelStageEvent event) {
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_TRIPWIRE_BLOCKS) {
PantomimeRenderer.renderOutline(event.getPoseStack());
}
}

@SubscribeEvent
public static void TooltipEvent(RenderTooltipEvent.Pre e) {
try {
Expand Down Expand Up @@ -111,5 +119,4 @@ public static Component localize(String key, Object... params) {
return Component.translatable(key, params);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.hollingsworth.arsnouveau.client.renderer.world;

import com.hollingsworth.arsnouveau.api.item.ICasterTool;
import com.hollingsworth.arsnouveau.api.registry.SpellCasterRegistry;
import com.hollingsworth.arsnouveau.api.spell.Spell;
import com.hollingsworth.arsnouveau.api.spell.SpellContext;
import com.hollingsworth.arsnouveau.api.spell.SpellStats;
import com.hollingsworth.arsnouveau.common.spell.method.MethodPantomime;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.OutlineBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.util.FastColor;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec3;

public class PantomimeRenderer {
public static void renderOutline(PoseStack poseStack) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null) return;
ItemStack heldItem = player.getItemInHand(InteractionHand.MAIN_HAND);

if (!(player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ICasterTool)) return;

var caster = SpellCasterRegistry.from(heldItem);
if(caster == null)
return;
Spell selectedSpell = caster.getSpell();

if (!(selectedSpell.getCastMethod() instanceof MethodPantomime pantomime)) return;
SpellStats stats = new SpellStats.Builder()
.setAugments(selectedSpell.getAugments(0, player))
.addItemsFromEntity(player)
.build(MethodPantomime.INSTANCE, null, player.level, player, SpellContext.fromEntity(selectedSpell, player, heldItem));
if(!stats.isSensitive()){
return;
}
BlockPos pos = pantomime.findPosition(player, stats).getBlockPos();
poseStack.pushPose();
Vec3 projectedView = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition();
poseStack.translate(-projectedView.x, -projectedView.y, -projectedView.z);
poseStack.translate(pos.getX(), pos.getY(), pos.getZ());

RenderType lineType = RenderType.lines();
OutlineBufferSource buffer = Minecraft.getInstance().renderBuffers().outlineBufferSource();
VertexConsumer lines = buffer.getBuffer(lineType);
int color = selectedSpell.color().getColor();
LevelRenderer.renderLineBox(poseStack, lines, 0, 0, 0, 1, 1, 1, FastColor.ARGB32.red(color) / 255F, FastColor.ARGB32.green(color) / 255F, FastColor.ARGB32.blue(color) / 255F, 1);

poseStack.popPose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.hollingsworth.arsnouveau.common.crafting.recipes.GlyphRecipe;
import com.hollingsworth.arsnouveau.common.spell.augment.*;
import com.hollingsworth.arsnouveau.common.spell.effect.*;
import com.hollingsworth.arsnouveau.common.spell.method.MethodProjectile;
import com.hollingsworth.arsnouveau.common.spell.method.MethodSelf;
import com.hollingsworth.arsnouveau.common.spell.method.MethodTouch;
import com.hollingsworth.arsnouveau.common.spell.method.MethodUnderfoot;
import com.hollingsworth.arsnouveau.common.spell.method.*;
import com.hollingsworth.arsnouveau.setup.registry.BlockRegistry;
import com.hollingsworth.arsnouveau.setup.registry.ItemsRegistry;
import com.mojang.serialization.JsonOps;
Expand Down Expand Up @@ -127,6 +124,7 @@ public void collectJsons(CachedOutput pOutput) {
add(get(EffectReset.INSTANCE).withItem(Items.TARGET, 1));
add(get(EffectWololo.INSTANCE).withItem(ItemsRegistry.ABJURATION_ESSENCE).withIngredient(Ingredient.of(Tags.Items.DYES), 3));
add(get(EffectRewind.INSTANCE).withItem(ItemsRegistry.MANIPULATION_ESSENCE).withItem(Items.CLOCK, 3));
add(get(MethodPantomime.INSTANCE).withIngredient(Tags.Items.GLASS_BLOCKS, 8));
for (GlyphRecipe recipe : recipes) {
Path path = getScribeGlyphPath(output, recipe.output.getItem());
saveStable(pOutput, GlyphRecipe.CODEC.encodeStart(JsonOps.INSTANCE, recipe).getOrThrow(), path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class GlyphLib {
public static final String MethodProjectileID = prependGlyph("projectile");
public static final String MethodTouchID = prependGlyph("touch");
public static final String MethodSelfID = prependGlyph("self");
public static final String MethodPantomimeID = prependGlyph("pantomime");
public static final String EffectRuneID = prependGlyph("rune");

public static final String EffectBreakID = prependGlyph("break");
Expand Down
Loading