-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated Tweed * Updated Loom * Updated mappings + Added additional refill capturing + Added configuration for refill rules (#15) + Added ability to swap armor items via the hotbar
- Loading branch information
Showing
18 changed files
with
207 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
# suppress inspection "UnusedProperty" for whole file | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
# Fabric Properties | ||
# check these on https://fabricmc.net/use | ||
minecraft_version=1.14.2 | ||
minecraft_version=1.14.3-pre2 | ||
yarn_build=2 | ||
loader_version=0.4.8+build.154 | ||
|
||
# Mod Properties | ||
mod_id = mousewheelie | ||
mod_version = 1.2.2 | ||
mod_version = 1.2.3 | ||
maven_group = de.siphalor | ||
archives_base_name = mousewheelie | ||
|
||
# Dependencies | ||
tweed_version = 2.1.0-beta.7 | ||
tweed_version = 2.1.0-beta.9 | ||
clothconfig_version = 0.2.4.17 |
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
49 changes: 49 additions & 0 deletions
49
src/main/java/de/siphalor/mousewheelie/client/mixin/MixinContainer.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,49 @@ | ||
package de.siphalor.mousewheelie.client.mixin; | ||
|
||
import de.siphalor.mousewheelie.client.Config; | ||
import de.siphalor.mousewheelie.client.util.ISlot; | ||
import de.siphalor.mousewheelie.client.util.inventory.SlotRefiller; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.container.Container; | ||
import net.minecraft.container.PlayerContainer; | ||
import net.minecraft.container.Slot; | ||
import net.minecraft.entity.player.PlayerInventory; | ||
import net.minecraft.item.ItemStack; | ||
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.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(Container.class) | ||
public abstract class MixinContainer { | ||
@Shadow public abstract Slot getSlot(int int_1); | ||
|
||
private static boolean mouseWheelie_scheduleRefill = false; | ||
|
||
@Inject(method = "updateSlotStacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/container/Container;getSlot(I)Lnet/minecraft/container/Slot;", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILSOFT) | ||
public void onSlotUpdate(List<ItemStack> itemStacks, CallbackInfo callbackInfo, int index) { | ||
if((Object) this instanceof PlayerContainer && Config.otherRefill.value) { | ||
PlayerInventory inventory = MinecraftClient.getInstance().player.inventory; | ||
if(inventory.selectedSlot == ((ISlot) getSlot(index)).mouseWheelie_getInvSlot()) { | ||
ItemStack stack = inventory.getMainHandStack(); | ||
if (!stack.isEmpty() && itemStacks.get(index).isEmpty()) { | ||
mouseWheelie_scheduleRefill = true; | ||
SlotRefiller.set(inventory, stack.copy()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Inject(method = "updateSlotStacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/container/Slot;setStack(Lnet/minecraft/item/ItemStack;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILSOFT) | ||
public void onSlotUpdated(List<ItemStack> stacks, CallbackInfo callbackInfo, int index) { | ||
if(mouseWheelie_scheduleRefill) { | ||
mouseWheelie_scheduleRefill = false; | ||
SlotRefiller.refill(); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.