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

Open
wants to merge 5 commits into
base: 1.20
Choose a base branch
from
Open
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,4 +1,4 @@
// 1.20.1 2024-03-17T12:41:58.4723472 Ars Nouveau Item Models
// 1.20.1 2024-03-19T21:28:53.3708933 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 @@ -82,6 +82,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 Expand Up @@ -185,6 +186,7 @@ cf45679e2952eb1de07d205a1eb8362774620fb7 assets/ars_nouveau/models/item/smooth_s
43615342494eb429314512444d35e2cd50c566c6 assets/ars_nouveau/models/item/smooth_sourcestone_small_bricks_slab.json
7337e37689d7db3ed020e04974c30d0d06c6c366 assets/ars_nouveau/models/item/smooth_sourcestone_small_bricks_stairs.json
1904ab3c884664130d6126629eaaf6ad5960c8b2 assets/ars_nouveau/models/item/smooth_sourcestone_stairs.json
f433c503db1699241353f198a0d427f708716930 assets/ars_nouveau/models/item/source_gem_block.json
7a6dbdbbeacc27e17ba070cbf5c0658793b9e68a assets/ars_nouveau/models/item/sourceberry_sack.json
4872637ae7f0ea6401d85bfb8e345286ed5438e6 assets/ars_nouveau/models/item/sourcestone.json
e93914b4ab0533dd0fd5062d9010292fe776809f assets/ars_nouveau/models/item/sourcestone_alternating.json
Expand All @@ -205,7 +207,6 @@ fad002103bb7ccaea2998a2fe617fcf5fd54d416 assets/ars_nouveau/models/item/sourcest
6ef6a6b58d3b8fbc449f5f376d432eb4a8fb605e assets/ars_nouveau/models/item/sourcestone_small_bricks_slab.json
b476712880e974a70c1fadea694f0d61adb9c291 assets/ars_nouveau/models/item/sourcestone_small_bricks_stairs.json
a7b3f41fce153ebc7540a0dfbe855fc724f521b1 assets/ars_nouveau/models/item/sourcestone_stairs.json
f433c503db1699241353f198a0d427f708716930 assets/ars_nouveau/models/item/source_gem_block.json
9d2205eb9012b0585bff4adaf4c02419b2f01d9a assets/ars_nouveau/models/item/spell_sensor.json
1a921e2809c2a9588e7e8f5fbe4556f5f6729487 assets/ars_nouveau/models/item/stripped_blue_archwood_log.json
1205608f4c722986291eb4255ad2e405715515cf assets/ars_nouveau/models/item/stripped_blue_archwood_wood.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2024-03-17T12:41:58.4808622 Languages: en_us
5a1796360e3700adbac3707bab62698f1eb2b79f assets/ars_nouveau/lang/en_us.json
// 1.20.1 2024-03-19T21:28:53.377542083 Languages: en_us
19c514c4697b7fda0634b99f96a84ae2c3f3f18c assets/ars_nouveau/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2024-03-17T12:41:58.4753429 Patchouli
// 1.20.1 2024-03-19T21:28:53.374923134 Patchouli
d5f03c259d2af4f5e8e286639783f4fc833b1076 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/aqua_affinity.json
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
Expand Down Expand Up @@ -115,6 +115,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 Expand Up @@ -192,9 +193,9 @@ eb9ec934fad69de9859f3ea369e0b425e5f49a8e assets/ars_nouveau/patchouli_books/worn
2cd9fc82feaf6ce609abcf49183c5211b4d9e832 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/repository.json
6706644869dc084dfb5b0e2140702bae084e7c65 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/ritual_brazier.json
68a05b40e14eb4556f0353f8a69477230b616461 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/scribes_block.json
9ea03a0bf9efe62392c5f2739a3689fdc39c31de assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/scryer_scroll.json
8ab5a8da4ca767b38afd42f1992ab17de84014e6 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/scryers_crystal.json
343b90150349cbdba99d647b63912f48967fecda assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/scryers_oculus.json
9ea03a0bf9efe62392c5f2739a3689fdc39c31de assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/scryer_scroll.json
7be64662ebd5e76cdc477b564d6554127f1f41a0 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/storage_lectern.json
e797ff6d4a79504b65178376196d5442fed62f42 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/machines/warp_portal.json
9b4e79632022441481188de75ca691f0bdba400f assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/mana_boost.json
Expand Down
2 changes: 2 additions & 0 deletions src/generated/resources/assets/ars_nouveau/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,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.",
"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 @@ -336,6 +337,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
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
Expand Up @@ -6,6 +6,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.GhostWeaveTile;
import com.hollingsworth.arsnouveau.common.block.tile.SkyBlockTile;
import com.hollingsworth.arsnouveau.common.spell.casters.ReactiveCaster;
Expand All @@ -17,12 +18,10 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterClientTooltipComponentFactoriesEvent;
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
import net.minecraftforge.client.event.RenderHighlightEvent;
import net.minecraftforge.client.event.RenderTooltipEvent;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

Expand All @@ -39,6 +38,12 @@ public static void registerTooltipFactory(RegisterClientTooltipComponentFactorie
}
}

@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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.hollingsworth.arsnouveau.client.renderer.world;

import com.hollingsworth.arsnouveau.api.item.ICasterTool;
import com.hollingsworth.arsnouveau.api.spell.ISpellCaster;
import com.hollingsworth.arsnouveau.api.spell.Spell;
import com.hollingsworth.arsnouveau.api.util.CasterUtil;
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;

ISpellCaster caster = CasterUtil.getCaster(heldItem);
Spell selectedSpell = caster.getSpell();

if (!(selectedSpell.getCastMethod() instanceof MethodPantomime pantomime)) return;

BlockPos pos = pantomime.findPosition(player).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,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
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.hollingsworth.arsnouveau.common.spell.method;


import com.hollingsworth.arsnouveau.api.spell.*;
import com.hollingsworth.arsnouveau.common.lib.GlyphLib;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;

public class MethodPantomime extends AbstractCastMethod {
public static MethodPantomime INSTANCE = new MethodPantomime();

public MethodPantomime() {
super(GlyphLib.MethodPantomimeID, "Pantomime");
}

public BlockHitResult findPosition(LivingEntity shooter) {
Vec3 eyes = shooter.getEyePosition(1.0f);
float viewXRot = shooter.getViewXRot(1.0f);
double dist = viewXRot < 45.0f ? 1 : 2;
Vec3 to = eyes.add(shooter.getViewVector(1.0f).scale(dist));
BlockPos toPos = BlockPos.containing(to);
return new BlockHitResult(eyes, Direction.getNearest(to.x, to.y, to.z).getOpposite(), toPos, true);
}

public CastResolveType getTarget(Level world, LivingEntity shooter, SpellResolver resolver) {
BlockHitResult res = findPosition(shooter);

if (res == null) return CastResolveType.FAILURE;

resolver.onResolveEffect(world, res);
return CastResolveType.SUCCESS;
}

@Override
public CastResolveType onCast(@Nullable ItemStack stack, LivingEntity playerEntity, Level world, SpellStats spellStats, SpellContext context, SpellResolver resolver) {
return getTarget(world, playerEntity, resolver);
}

@Override
public CastResolveType onCastOnBlock(UseOnContext context, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) {
return getTarget(context.getLevel(), context.getPlayer(), resolver);
}

@Override
public CastResolveType onCastOnBlock(BlockHitResult blockRayTraceResult, LivingEntity caster, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) {
return getTarget(caster.getCommandSenderWorld(), caster, resolver);
}

@Override
public CastResolveType onCastOnEntity(@Nullable ItemStack stack, LivingEntity caster, Entity target, InteractionHand hand, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) {
return getTarget(caster.level(), caster, resolver);
}

@Override
protected int getDefaultManaCost() {
return 5;
}

@Override
protected @NotNull Set<AbstractAugment> getCompatibleAugments() {
return augmentSetOf();
}

@Override
public String getBookDescription() {
return "Applies spells to the nearest block in your line of sight.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
import com.hollingsworth.arsnouveau.common.ritual.*;
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 net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
Expand All @@ -47,6 +44,7 @@ public static void setup() {
registerSpell(MethodProjectile.INSTANCE);
registerSpell(MethodTouch.INSTANCE);
registerSpell(MethodSelf.INSTANCE);
registerSpell(MethodPantomime.INSTANCE);
registerSpell(EffectBreak.INSTANCE);
registerSpell(EffectHarm.INSTANCE);
registerSpell(EffectIgnite.INSTANCE);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.