Skip to content

Commit

Permalink
dwa
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed May 17, 2024
1 parent 43dba01 commit 7eb9ece
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ okhttp_version=4.9.1
snake_yml_version=2.2
slf4j_version=2.0.12

viaversion_version=4.10.2
viabackwards_version=4.10.2
viaversion_version=4.10.3-SNAPSHOT
viabackwards_version=4.10.3-SNAPSHOT
viarewind_version=3.1.2
vialoader_version=2.2.14-SNAPSHOT
vialegacy_version=2.2.23-SNAPSHOT
2 changes: 1 addition & 1 deletion src/main/java/net/aspw/viaforgeplus/ProtocolInject.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import net.aspw.viaforgeplus.network.APIConnecter

object ProtocolInject {

const val modVersion = "1.0.5"
const val modVersion = "1.0.6"

lateinit var eventManager: EventManager

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.aspw.viaforgeplus.injection.forge.mixins.packets;

import net.aspw.viaforgeplus.api.ProtocolFixer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(C0FPacketConfirmTransaction.class)
public class MixinC0FPacketConfirmTransaction {

@Shadow
private int windowId;
@Shadow
private short uid;
@Shadow
private boolean accepted;

/**
* @author FlorianMichael
* @reason 1.17+ Transaction Fix
*/
@Overwrite
public void writePacketData(PacketBuffer buf) {
if (ProtocolFixer.newerThanOrEqualsTo1_17())
buf.writeInt(this.windowId);
else {
buf.writeByte(this.windowId);
buf.writeShort(this.uid);
buf.writeByte(this.accepted ? 1 : 0);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.aspw.viaforgeplus.injection.forge.mixins.packets;

import net.aspw.viaforgeplus.api.ProtocolFixer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(S32PacketConfirmTransaction.class)
public class MixinS32PacketConfirmTransaction {

@Shadow
private int windowId;
@Shadow
private short actionNumber;
@Shadow
private boolean field_148893_c;

/**
* @author FlorianMichael
* @reason 1.17+ Transaction Fix
*/
@Overwrite
public void readPacketData(PacketBuffer buf) {
if (ProtocolFixer.newerThanOrEqualsTo1_17())
this.windowId = buf.readInt();
else {
this.windowId = buf.readUnsignedByte();
this.actionNumber = buf.readShort();
this.field_148893_c = buf.readBoolean();
}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/viaforgeplus.forge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"network.MixinNetworkManager",
"network.MixinNetworkManager$5",
"network.MixinServerData",
"packets.MixinC0FPacketConfirmTransaction",
"packets.MixinC00Handshake",
"packets.MixinS32PacketConfirmTransaction",
"render.MixinEntityRenderer",
"render.MixinLayerArmorBase",
"render.MixinModelBiped"
Expand Down

0 comments on commit 7eb9ece

Please sign in to comment.