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

Context Escape #1081

Open
wants to merge 9 commits into
base: 1.20
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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 2023-07-09T20:17:45.7295007 Ars Nouveau Item Models
// 1.20.1 2023-08-23T17:56:20.253984 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 @@ -36,12 +36,14 @@ af33ffce50ea2887f7d0077adc78b9bf386b4bd1 assets/ars_nouveau/models/item/gilded_s
928a556e4a323a8f1675b3d12a9f824e1f25fb7f assets/ars_nouveau/models/item/glyph_accelerate.json
0b970e2a75901a3042dacfcd1a263ceab9a58207 assets/ars_nouveau/models/item/glyph_amplify.json
e90b0d3b7816c04c63969ee51f69f521d44d5444 assets/ars_nouveau/models/item/glyph_animate_block.json
283e2b8e253750a57f18f4fbece565643b7769bf assets/ars_nouveau/models/item/glyph_an_example_filter.json
1c1ed0488d4ff12373d07e7b17b99b17d81e9714 assets/ars_nouveau/models/item/glyph_aoe.json
8ad4f1e52ce9f588136032f323a0d76fc4849101 assets/ars_nouveau/models/item/glyph_blink.json
7441fa49080a68e1d9dfdaeb277d9b17229aac87 assets/ars_nouveau/models/item/glyph_bounce.json
c3de1abdd00608d7f5b4b71953119d218787f318 assets/ars_nouveau/models/item/glyph_break.json
25e3368d3a84c449ff2d6c7ca27f76377fa2b3a7 assets/ars_nouveau/models/item/glyph_cold_snap.json
715f6e40e53b95cd4c4bd566ab43e226872ed02b assets/ars_nouveau/models/item/glyph_conjure_water.json
f5d91a4d26b6d06a0b9a593f2109714e388352a4 assets/ars_nouveau/models/item/glyph_context_escape.json
f72d7e2b785b1eb940997edfedb3edf7386cc026 assets/ars_nouveau/models/item/glyph_craft.json
b4e6a1291bc03fe1e9ffcf78c5a8360c443fc67e assets/ars_nouveau/models/item/glyph_crush.json
53a812ac2b161a979ccfe98a8775572a823eb157 assets/ars_nouveau/models/item/glyph_cut.json
Expand All @@ -50,6 +52,7 @@ b4e6a1291bc03fe1e9ffcf78c5a8360c443fc67e assets/ars_nouveau/models/item/glyph_cr
210c0c73a22a120955905ed8988bbd693a40f7c9 assets/ars_nouveau/models/item/glyph_delay.json
b54e84e6f0c091648fe3d6602805d9383c4e12c2 assets/ars_nouveau/models/item/glyph_dispel.json
2bd57a51ea648ff766c3895f7a6fe2373baa7912 assets/ars_nouveau/models/item/glyph_duration_down.json
03abae333f96a718145e735c60e08811816b7710 assets/ars_nouveau/models/item/glyph_else.json
118233d436c4f3c21daeb945c671c8f8582de00e assets/ars_nouveau/models/item/glyph_ender_inventory.json
0159c5cd5f684c5951fdfc8c43a6beeaa6e396fd assets/ars_nouveau/models/item/glyph_evaporate.json
8c4eb3caeb78fb0b5a536bc83eadf2872e7be4be assets/ars_nouveau/models/item/glyph_exchange.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-07-09T20:46:15.9749455 Languages: en_us
af25abec896a259934fa27799e1b9a468686f13f assets/ars_nouveau/lang/en_us.json
// 1.20.1 2023-08-23T17:44:41.6664047 Languages: en_us
91301d0f0e275ad203331c4607695027d2fa87c5 assets/ars_nouveau/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-07-09T20:26:02.0288592 Patchouli
// 1.20.1 2023-08-23T17:44:41.652443 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 @@ -92,12 +92,15 @@ a09f89d0ec927fce49d1736c39305bcfeac052cf assets/ars_nouveau/patchouli_books/worn
d564542da87aab218e93bcd361c0a011877b00c2 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/getting_started/upgrades.json
521277fbf32424a30a8be24b137c786dc0b89cdc assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/getting_started/world_generation.json
a80d0aabd3eff91451b0e80fb34514c5ce57eadf assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_amplify.json
cdec30a22e785c496d07d9b15b47cc0cfe7e8c46 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_an_example_filter.json
e6a01dcd171d462c0eb988478f64f994c63180f0 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_bounce.json
7d579e642d5c9a7c5dba516e1eadca7d87f9ad56 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_break.json
8ace192f87227510940e10068e7aadacb7442166 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_context_escape.json
82768fc93e42445de3bc7bb16615dc28f7f11533 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_craft.json
399cd02e6fb2950c465d058cdc470ca0082c58e1 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_cut.json
13799a3efaff17fa0a56d7de80276bd9a43aa278 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_delay.json
694d3ccabcb3655d2a253cf60f9add0a8fe1cef7 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_dispel.json
a1e09422f05f26ad8c0b1bf3a9497b8154768fd5 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_else.json
f7ceec5276f7b095abd92a70c2e970247d09893c assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_evaporate.json
d424b2cededb3497cf8a94451ce6d4e9bec78842 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_fell.json
0e3d480a8d74426a62bbc2796e2133001f49e5e3 assets/ars_nouveau/patchouli_books/worn_notebook/en_us/entries/glyphs_1/glyph_freeze.json
Expand Down
10 changes: 10 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 @@ -196,13 +196,15 @@
"ars_nouveau.glyph_desc.burst": "Resolves the spell in a spherical area around the target. Augment with Sensitive to target blocks instead of entities and Dampen to make an empty sphere. Augment with AOE to increase the radius. ",
"ars_nouveau.glyph_desc.glyph_accelerate": "Increases the speed of projectile spells.",
"ars_nouveau.glyph_desc.glyph_amplify": "Additively increases the power of most spell effects. Can increase the harvest level of Break and increases the damage of spells.",
"ars_nouveau.glyph_desc.glyph_an_example_filter": "",
"ars_nouveau.glyph_desc.glyph_animate_block": "Animates a block to fight for you. The animated block will convert to a falling block when it dies. Costs a large amount of mana, but does not grant Summoning Sickness",
"ars_nouveau.glyph_desc.glyph_aoe": "Spells will affect a larger area around a targeted block.",
"ars_nouveau.glyph_desc.glyph_blink": "Teleports the caster to a location. If an entity is hit and the caster is holding a Warp Scroll in the offhand, the entity will be warped to the location on the Warp Scroll. When used on Self, the caster blinks forward. Spell Turrets and Runes can warp entities using Warp Scrolls from adjacent inventories without consuming the scroll.",
"ars_nouveau.glyph_desc.glyph_bounce": "Gives players the Bounce effect, causing them to bounce upwards upon falling. Amplification of Bounce will preserve additional forward facing motion per bounce.",
"ars_nouveau.glyph_desc.glyph_break": "A spell you start with. Breaks blocks of an average hardness. Can be amplified to increase the harvest level. Sensitive will simulate breaking blocks with Shears instead of a pickaxe.",
"ars_nouveau.glyph_desc.glyph_cold_snap": "Snares and causes a burst of damage to an entity that is afflicted by slowness, freezing, or is wet. Nearby enemies that are not afflicted by Slow will be slowed. Nearby Enemies afflicted by Slow or wetness will also be hit by Cold Snap. Can be augmented using Amplify, Extend Time, and AOE.",
"ars_nouveau.glyph_desc.glyph_conjure_water": "Places water at a location or extinguishes entities on fire.",
"ars_nouveau.glyph_desc.glyph_context_escape": "Allows you to exit the context made by the most recent context creating glyph, such as linger or burst.",
"ars_nouveau.glyph_desc.glyph_craft": "Opens the crafting menu.",
"ars_nouveau.glyph_desc.glyph_crush": "Turns stone into gravel, and gravel into sand. Will also crush flowers into bonus dye. Need Sensitive to work on items. For full recipe support, see JEI. Will also harm entities and deals bonus damage to entities that are swimming.",
"ars_nouveau.glyph_desc.glyph_cut": "Simulates using shears on entities and blocks, or damages non-shearable entities for a small amount. Amplify will simulate using an Axe instead of Shears. For simulating breaking with shears, see Break and Sensitive. Costs nothing.",
Expand All @@ -211,6 +213,7 @@
"ars_nouveau.glyph_desc.glyph_delay": "Delays the resolution of effects placed to the right of this spell for a few moments. The delay may be increased with the Extend Time augment, or decreased with Duration Down.",
"ars_nouveau.glyph_desc.glyph_dispel": "Removes any potion effects on the target. When used on a witch at half health, the witch will vanish in return for a Wixie shard. Will also dispel tamed summons back into their charm.",
"ars_nouveau.glyph_desc.glyph_duration_down": "Reduces the duration of spells like potion effects, delay, redstone signal, and others.",
"ars_nouveau.glyph_desc.glyph_else": "",
"ars_nouveau.glyph_desc.glyph_ender_inventory": "Opens your personal ender chest inventory from anywhere.",
"ars_nouveau.glyph_desc.glyph_evaporate": "Deletes fluids in an area. Can be expanded with AOE.",
"ars_nouveau.glyph_desc.glyph_exchange": "When used on blocks, exchanges the blocks in the players hotbar for the blocks hit as if they were mined with silk touch. Can be augmented with AOE, and Amplify is required for swapping blocks of higher hardness. When used on entities, the locations of the caster and the entity hit are swapped.",
Expand Down Expand Up @@ -273,13 +276,15 @@
"ars_nouveau.glyph_name.burst": "Burst",
"ars_nouveau.glyph_name.glyph_accelerate": "Accelerate",
"ars_nouveau.glyph_name.glyph_amplify": "Amplify",
"ars_nouveau.glyph_name.glyph_an_example_filter": "Example Filter",
"ars_nouveau.glyph_name.glyph_animate_block": "Animate Block",
"ars_nouveau.glyph_name.glyph_aoe": "AOE",
"ars_nouveau.glyph_name.glyph_blink": "Blink",
"ars_nouveau.glyph_name.glyph_bounce": "Bounce",
"ars_nouveau.glyph_name.glyph_break": "Break",
"ars_nouveau.glyph_name.glyph_cold_snap": "Cold Snap",
"ars_nouveau.glyph_name.glyph_conjure_water": "Conjure Water",
"ars_nouveau.glyph_name.glyph_context_escape": "Escape Context",
"ars_nouveau.glyph_name.glyph_craft": "Craft",
"ars_nouveau.glyph_name.glyph_crush": "Crush",
"ars_nouveau.glyph_name.glyph_cut": "Cut",
Expand All @@ -288,6 +293,7 @@
"ars_nouveau.glyph_name.glyph_delay": "Delay",
"ars_nouveau.glyph_name.glyph_dispel": "Dispel",
"ars_nouveau.glyph_name.glyph_duration_down": "Duration Down",
"ars_nouveau.glyph_name.glyph_else": "Else",
"ars_nouveau.glyph_name.glyph_ender_inventory": "Access Ender Inventory",
"ars_nouveau.glyph_name.glyph_evaporate": "Evaporate",
"ars_nouveau.glyph_name.glyph_exchange": "Exchange",
Expand Down Expand Up @@ -748,6 +754,8 @@
"ars_nouveau.spell.validation.adding.glyph_occurrences_policy": "%s has appeared its maximum number of times.",
"ars_nouveau.spell.validation.adding.glyph_tier": "%s is too powerful for your current spell book.",
"ars_nouveau.spell.validation.adding.invalid_combination_policy": "%s cannot be used with %s",
"ars_nouveau.spell.validation.adding.invalid_context_escape": "you need a context entering glyph before %s",
"ars_nouveau.spell.validation.adding.invalid_nesting_combination": "%s cannot be nested with %s",
"ars_nouveau.spell.validation.adding.max_one_cast_method": "The spell already has a form glyph.",
"ars_nouveau.spell.validation.adding.non_empty_spell": "The spell may not be empty.",
"ars_nouveau.spell.validation.adding.starting_cast_method": "The spell must start with a form glyph.",
Expand All @@ -760,6 +768,8 @@
"ars_nouveau.spell.validation.exists.glyph_occurrences_policy": "%s appears too many times.",
"ars_nouveau.spell.validation.exists.glyph_tier": "%s is too powerful for your current spell book.",
"ars_nouveau.spell.validation.exists.invalid_combination_policy": "%s cannot be used with %s",
"ars_nouveau.spell.validation.exists.invalid_context_escape": "you need a context entering glyph before %s",
"ars_nouveau.spell.validation.exists.invalid_nesting_combination": "%s cannot be nested with %s",
"ars_nouveau.spell.validation.exists.max_one_cast_method": "The spell has an extra form glyph: %s",
"ars_nouveau.spell.validation.exists.non_empty_spell": "The spell may not be empty.",
"ars_nouveau.spell.validation.exists.starting_cast_method": "The spell does not start with a form glyph.",
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/an_example_filter"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "ars_nouveau:item/context_escape"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "ars_nouveau:item/else"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category": "ars_nouveau:glyphs_1",
"icon": "ars_nouveau:glyph_an_example_filter",
"name": "ars_nouveau.glyph_name.glyph_an_example_filter",
"pages": [
{
"type": "patchouli:text",
"text": "ars_nouveau.glyph_desc.glyph_an_example_filter"
},
{
"type": "ars_nouveau:glyph_recipe",
"recipe": "ars_nouveau:glyph_an_example_filter"
}
],
"sortnum": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category": "ars_nouveau:glyphs_1",
"icon": "ars_nouveau:glyph_context_escape",
"name": "ars_nouveau.glyph_name.glyph_context_escape",
"pages": [
{
"type": "patchouli:text",
"text": "ars_nouveau.glyph_desc.glyph_context_escape"
},
{
"type": "ars_nouveau:glyph_recipe",
"recipe": "ars_nouveau:glyph_context_escape"
}
],
"sortnum": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category": "ars_nouveau:glyphs_1",
"icon": "ars_nouveau:glyph_else",
"name": "ars_nouveau.glyph_name.glyph_else",
"pages": [
{
"type": "patchouli:text",
"text": "ars_nouveau.glyph_desc.glyph_else"
},
{
"type": "ars_nouveau:glyph_recipe",
"recipe": "ars_nouveau:glyph_else"
}
],
"sortnum": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.hollingsworth.arsnouveau.common.block.tile.ModdedTile;
import com.hollingsworth.arsnouveau.common.util.RegistryWrapper;
import com.mojang.datafixers.util.Pair;
dkmk100 marked this conversation as resolved.
Show resolved Hide resolved
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.block.entity.BlockEntityType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
/**
* Base class for interfacing with filter glyphs from addons and making your own. Based off TooManyGlyphs.
*/
public abstract class AbstractFilter extends AbstractEffect implements IFilter {
public abstract class AbstractFilter extends AbstractEffect implements IFilter, IContextManipulator {

public AbstractFilter(ResourceLocation registryName, String name) {
super(registryName, name);
}

@Override
public boolean isEscapable() {
return true;
}

@Override
public int getDefaultManaCost() {
return 0;
Expand All @@ -32,12 +37,32 @@ protected Set<AbstractAugment> getCompatibleAugments() {

@Override
public void onResolveEntity(EntityHitResult rayTraceResult, Level world, @NotNull LivingEntity shooter, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) {
if (!shouldResolveOnEntity(rayTraceResult)) spellContext.setCanceled(true);
spellContext.prepareContextForManipulation();
SpellContext yesContext = spellContext.getInnerContext();
SpellContext noContext = spellContext.getConditionalInnerContext();

if (shouldResolveOnEntity(rayTraceResult)){
resolver.getNewResolver(yesContext).onResolveEffect(world,rayTraceResult);
}
else{
resolver.getNewResolver(noContext).onResolveEffect(world,rayTraceResult);
}
spellContext.setPostContext();
}

@Override
public void onResolveBlock(BlockHitResult rayTraceResult, Level world, @NotNull LivingEntity shooter, SpellStats spellStats, SpellContext spellContext, SpellResolver resolver) {
if (!shouldResolveOnBlock(rayTraceResult)) spellContext.setCanceled(true);
spellContext.prepareContextForManipulation();
SpellContext yesContext = spellContext.getInnerContext();
SpellContext noContext = spellContext.getConditionalInnerContext();

if (shouldResolveOnBlock(rayTraceResult)){
resolver.getNewResolver(yesContext).onResolveEffect(world,rayTraceResult);
}
else{
resolver.getNewResolver(noContext).onResolveEffect(world,rayTraceResult);
}
spellContext.setPostContext();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public ResourceLocation getRegistryName() {
*/
public Set<ResourceLocation> invalidCombinations = ConcurrentHashMap.newKeySet();

/**
* A list of context manipulating glyphs that cannot be nested with this glyph
* Useful to prevent something being inside linger or burst, without banning them from a spell entirely
* Note: you can add a glyph to it's own invalid nestings, which in some cases is preferable to a max count
*/
public Set<ResourceLocation> invalidNestings = ConcurrentHashMap.newKeySet();

public AbstractSpellPart(String registryName, String name) {
this(new ResourceLocation(ArsNouveau.MODID, registryName), name);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.hollingsworth.arsnouveau.api.spell;

/**
* An interface for conditional context escapes, that have two inner contexts.
*/
public interface IConditionalContextEscape extends IContextEscape {
/**
* the spell for the second inner condition. Should return
* @param context the spell context calling this
* @param posInRecipe the position of this glyph in the recipe
* @return
*/
Spell getSecondConditionSpell(SpellContext context, int posInRecipe);

/**
* allows the context escape to modify the second context
* @param context
*/
default void modifySecondContext(SpellContext context){

}
}
Loading