-
Notifications
You must be signed in to change notification settings - Fork 3
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
5 changed files
with
73 additions
and
3 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
34 changes: 34 additions & 0 deletions
34
...et/aspw/viaforgeplus/injection/forge/mixins/packets/MixinC0FPacketConfirmTransaction.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,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); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...et/aspw/viaforgeplus/injection/forge/mixins/packets/MixinS32PacketConfirmTransaction.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,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(); | ||
} | ||
} | ||
} |
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