-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from enjarai/improved-capitalism
Squishy
- Loading branch information
Showing
32 changed files
with
509 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/main/generated/.cache/27614340de28b382d5f7ae74366bcf39e2ac3aeb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// 1.21 2024-07-15T21:34:42.9793041 Trickster/Model Definitions | ||
b9b893ec0a8cd31d7398651d871e15a392ea76b2 assets\trickster\models\item\spell_resonator.json | ||
9d5d343103d621d1a2f492cec156c06274efdc15 assets\trickster\blockstates\spell_resonator.json | ||
// 1.21 2024-08-22T17:14:21.48955409 Trickster/Model Definitions | ||
b9b893ec0a8cd31d7398651d871e15a392ea76b2 assets/trickster/models/item/spell_resonator.json | ||
9d5d343103d621d1a2f492cec156c06274efdc15 assets/trickster/blockstates/spell_resonator.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/dev/enjarai/trickster/mixin/AnvilScreenHandlerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package dev.enjarai.trickster.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalIntRef; | ||
import dev.enjarai.trickster.item.component.ModComponents; | ||
import net.minecraft.entity.player.PlayerInventory; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.screen.*; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.Slice; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(AnvilScreenHandler.class) | ||
public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler { | ||
public AnvilScreenHandlerMixin(@Nullable ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) { | ||
super(type, syncId, playerInventory, context); | ||
} | ||
|
||
@Inject( | ||
method = "updateResult", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/component/type/ItemEnchantmentsComponent;getEnchantmentEntries()Ljava/util/Set;") | ||
) | ||
private void enableSpellTransfer(CallbackInfo ci, @Local(ordinal = 0) LocalIntRef i, @Local(ordinal = 1) LocalBooleanRef bl2) { | ||
var left = this.input.getStack(0); | ||
var middle = this.input.getStack(1); | ||
|
||
if (middle.contains(ModComponents.SPELL) && left.getCount() <= 1 && !left.isOf(Items.BOOK)) { | ||
i.set(i.get() + 1); | ||
bl2.set(true); | ||
} | ||
} | ||
|
||
@ModifyArg( | ||
method = "updateResult", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/inventory/CraftingResultInventory;setStack(ILnet/minecraft/item/ItemStack;)V"), | ||
index = 1 | ||
) | ||
private ItemStack applySpell(ItemStack stack) { | ||
var spellComponent = this.input.getStack(1).get(ModComponents.SPELL); | ||
|
||
if (spellComponent != null) { | ||
stack.set(ModComponents.SPELL, spellComponent); | ||
} | ||
|
||
return stack; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package dev.enjarai.trickster.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import dev.enjarai.trickster.SpellTooltipData; | ||
import dev.enjarai.trickster.item.ModItems; | ||
import dev.enjarai.trickster.item.component.ModComponents; | ||
import dev.enjarai.trickster.item.component.SpellComponent; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.tooltip.TooltipData; | ||
import net.minecraft.item.tooltip.TooltipType; | ||
import net.minecraft.text.Style; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Mixin(Item.class) | ||
public abstract class ItemMixin { | ||
@ModifyReturnValue( | ||
method = "hasGlint", | ||
at = @At("RETURN") | ||
) | ||
private boolean spellGlint(boolean original, ItemStack stack) { | ||
return original | ||
|| (stack.get(ModComponents.SPELL) instanceof SpellComponent spellComponent) | ||
&& !spellComponent.spell().isEmpty() | ||
&& !stack.isIn(ModItems.NO_SPELL_GLINT); | ||
} | ||
|
||
@Inject( | ||
method = "appendTooltip", | ||
at = @At("HEAD") | ||
) | ||
private void addGarble(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type, CallbackInfo ci) { | ||
var spellComponent = stack.get(ModComponents.SPELL); | ||
|
||
if (spellComponent != null && /*!spellComponent.spell().isEmpty() &&*/ spellComponent.closed()) { | ||
tooltip.add(spellComponent.name() | ||
.flatMap(str -> Optional.of(Text.literal(str))) | ||
.orElse(Text.literal("Mortal eyes upon my carvings").setStyle(Style.EMPTY.withObfuscated(true)))); | ||
} | ||
} | ||
|
||
@Inject( | ||
method = "getTooltipData", | ||
at = @At("HEAD"), | ||
cancellable = true | ||
) | ||
private void trickster$getSpellTooltipData(ItemStack stack, CallbackInfoReturnable<Optional<TooltipData>> cir) { | ||
var spellComponent = stack.get(ModComponents.SPELL); | ||
|
||
if (spellComponent != null && !spellComponent.spell().isEmpty() && !spellComponent.closed()) { | ||
cir.setReturnValue(Optional.of(new SpellTooltipData(spellComponent.spell()))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
src/main/java/dev/enjarai/trickster/mixin/event/EntityMixin.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.