Skip to content

Commit

Permalink
Version 1.1.3
Browse files Browse the repository at this point in the history
* Fixed combineStacks and hopefully few other bugs with the queue system
  • Loading branch information
Siphalor committed May 5, 2019
1 parent 488fedb commit d277678
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G

# Mod Properties
mod_id = mousewheelie
mod_version = 1.1.2+1.14
mod_version = 1.1.3+1.14
maven_group = de.siphalor
archives_base_name = mousewheelie

Expand Down
18 changes: 8 additions & 10 deletions src/main/java/de/siphalor/mousewheelie/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ public class Core {
public static boolean sending = false;

public static void push(InteractionEvent interactionEvent) {
if(!sending)
interactionEvent.send();
else
interactionEventQueue.push(interactionEvent);
interactionEventQueue.add(interactionEvent);
if(!sending)
triggerSend();
}

public static void pushClickEvent(int containerSyncId, int slotId, int buttonId, SlotActionType slotAction) {
Expand All @@ -26,17 +25,15 @@ public static void pushClickEvent(int containerSyncId, int slotId, int buttonId,
}

public static void triggerSend() {
if(interactionEventQueue.size() > 0 && sending) {
while(interactionEventQueue.removeLast().send()) {
if(interactionEventQueue.size() > 0) {
while(interactionEventQueue.pop().send()) {
if(interactionEventQueue.isEmpty()) {
sending = false;
break;
}
}
} else {
if(sending)
sending = false;
}
} else
sending = false;
}

public static void stopSending() {
Expand Down Expand Up @@ -67,6 +64,7 @@ public ClickEvent(int containerSyncId, int slotId, int buttonId, SlotActionType

@Override
public boolean send() {
System.out.println(slotId + ": " + slotAction.name());
sending = true;
MinecraftClient.getInstance().interactionManager.method_2906(containerSyncId, slotId, buttonId, slotAction, MinecraftClient.getInstance().player);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public class MixinClientPlayNetworkHandler {
@Inject(method = "onGuiActionConfirm", at = @At("RETURN"))
public void onGuiActionConfirmed(ConfirmGuiActionS2CPacket packet, CallbackInfo callbackInfo) {
Core.triggerSend();
if(Core.sending)
Core.triggerSend();
}
}

0 comments on commit d277678

Please sign in to comment.