-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from Gilly7CE/gilly7ce-update-to-1.20.2
Update to 1.20.2
- Loading branch information
Showing
15 changed files
with
89 additions
and
288 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.2-SNAPSHOT' | ||
id 'fabric-loom' version '1.3-SNAPSHOT' | ||
id 'maven-publish' | ||
} | ||
|
||
|
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
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: 26 additions & 0 deletions
26
...in/java/carpetaddonsnotfound/mixins/network/CustomPayloadS2CPacket_CustomPacketMixin.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,26 @@ | ||
package carpetaddonsnotfound.mixins.network; | ||
|
||
import carpetaddonsnotfound.network.CarpetAddonsNotFoundClient; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.CustomPayload; | ||
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket; | ||
import net.minecraft.util.Identifier; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(CustomPayloadS2CPacket.class) | ||
public abstract class CustomPayloadS2CPacket_CustomPacketMixin { | ||
@Inject(method = "readPayload", at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;readUnknownPayload(Lnet/minecraft/util/Identifier;Lnet/minecraft/network/PacketByteBuf;)Lnet/minecraft/network/packet/UnknownCustomPayload;"), | ||
cancellable = true) | ||
private static void onCustomPayload(Identifier resourceLocation, PacketByteBuf friendlyByteBuf, CallbackInfoReturnable<CustomPayload> cir) | ||
{ | ||
if (resourceLocation.equals(CarpetAddonsNotFoundClient.CARPET_ADDONS_NOT_FOUND_CHANNEL)) | ||
{ | ||
cir.setReturnValue(new CarpetAddonsNotFoundClient.CarpetAddonsNotFoundPayload(friendlyByteBuf)); | ||
} | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
...java/carpetaddonsnotfound/mixins/network/ServerPlayNetworkHandler_CustomPacketsMixin.java
This file was deleted.
Oops, something went wrong.
39 changes: 14 additions & 25 deletions
39
src/main/java/carpetaddonsnotfound/network/CarpetAddonsNotFoundClient.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 |
---|---|---|
@@ -1,40 +1,29 @@ | ||
package carpetaddonsnotfound.network; | ||
|
||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.CustomPayload; | ||
import net.minecraft.util.Identifier; | ||
|
||
/** | ||
* Client for the mod. Most of this is taken from CarpetClient | ||
*/ | ||
public final class CarpetAddonsNotFoundClient { | ||
public static final int DATA = 1; | ||
public static final int HI = 2; | ||
public static final int HELLO = 3; | ||
public static final Identifier CARPET_ADDONS_NOT_FOUND_CHANNEL = new Identifier("carpet-addons-not-found"); | ||
|
||
private static ClientPlayerEntity clientPlayer = null; | ||
private static boolean isServerCarpet = false; | ||
|
||
public static void gameJoined(ClientPlayerEntity player) { | ||
clientPlayer = player; | ||
} | ||
|
||
public static void disconnect() { | ||
if (!isServerCarpet) // multiplayer connection | ||
{ | ||
return; | ||
public record CarpetAddonsNotFoundPayload(NbtCompound data) implements CustomPayload { | ||
public CarpetAddonsNotFoundPayload(PacketByteBuf input) { | ||
this(input.readNbt()); | ||
} | ||
|
||
// singleplayer disconnect | ||
isServerCarpet = false; | ||
clientPlayer = null; | ||
} | ||
|
||
public static void setCarpet() { | ||
isServerCarpet = true; | ||
} | ||
@Override | ||
public void write(PacketByteBuf output) { | ||
output.writeNbt(data); | ||
} | ||
|
||
public static ClientPlayerEntity getPlayer() { | ||
return clientPlayer; | ||
@Override | ||
public Identifier id() { | ||
return CARPET_ADDONS_NOT_FOUND_CHANNEL; | ||
} | ||
} | ||
} |
Oops, something went wrong.