-
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.
- Loading branch information
Showing
26 changed files
with
343 additions
and
40 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
26 changes: 0 additions & 26 deletions
26
src/client/java/dev/enjarai/trickster/mixin/client/ExampleClientMixin.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
src/client/java/dev/enjarai/trickster/mixin/client/HeldItemRendererMixin.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,29 @@ | ||
package dev.enjarai.trickster.mixin.client; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import dev.enjarai.trickster.item.ModItems; | ||
import net.minecraft.client.render.item.HeldItemRenderer; | ||
import net.minecraft.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(HeldItemRenderer.class) | ||
public class HeldItemRendererMixin { | ||
@WrapOperation( | ||
method = "updateHeldItems", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/item/ItemStack;areEqual(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z" | ||
) | ||
) | ||
private boolean cancelItemSwapAnimation(ItemStack left, ItemStack right, Operation<Boolean> original) { | ||
var originalValue = original.call(left, right); | ||
|
||
if (left.isIn(ModItems.HOLDABLE_HAT) && right.isIn(ModItems.HOLDABLE_HAT)) { | ||
return true; | ||
} | ||
|
||
return originalValue; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/client/java/dev/enjarai/trickster/mixin/client/MouseMixin.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,27 @@ | ||
package dev.enjarai.trickster.mixin.client; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import dev.enjarai.trickster.ModKeyBindings; | ||
import dev.enjarai.trickster.screen.SpellCircleScreen; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.Mouse; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.entity.player.PlayerInventory; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Mouse.class) | ||
public class MouseMixin { | ||
@WrapWithCondition( | ||
method = "onMouseScroll", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/entity/player/PlayerInventory;scrollInHotbar(D)V" | ||
) | ||
) | ||
private boolean interceptMouseScroll(PlayerInventory instance, double scrollAmount) { | ||
return !ModKeyBindings.interceptScroll((float) scrollAmount); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"required": true, | ||
"package": "dev.enjarai.trickster.mixin.client", | ||
"compatibilityLevel": "JAVA_21", | ||
"client": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
"required": true, | ||
"package": "dev.enjarai.trickster.mixin.client", | ||
"compatibilityLevel": "JAVA_21", | ||
"client": [ | ||
"HeldItemRendererMixin", | ||
"MouseMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/enjarai/trickster/item/component/SelectedSlotComponent.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,11 @@ | ||
package dev.enjarai.trickster.item.component; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
|
||
public record SelectedSlotComponent(int slot, int maxSlot) { | ||
public static final Codec<SelectedSlotComponent> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
Codec.INT.fieldOf("slot").forGetter(SelectedSlotComponent::slot), | ||
Codec.INT.fieldOf("max_slot").forGetter(SelectedSlotComponent::maxSlot) | ||
).apply(instance, SelectedSlotComponent::new)); | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/java/dev/enjarai/trickster/net/ScrollInGamePacket.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,4 @@ | ||
package dev.enjarai.trickster.net; | ||
|
||
public record ScrollInGamePacket(float amount) { | ||
} |
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
Oops, something went wrong.