Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris committed Jun 13, 2024
1 parent fdd816d commit 0e4ecb5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ loom {

dependencies {
//to change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:1.20.5")
minecraft("com.mojang:minecraft:1.21")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:0.15.10")
modImplementation("net.fabricmc:fabric-loader:0.15.11")

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation("net.fabricmc.fabric-api:fabric-api:0.97.6+1.20.5")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.100.1+1.21")

// Base Floodgate
implementation("org.geysermc.floodgate:core:2.2.3-20240508.151752-4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import org.checkerframework.checker.nullness.qual.NonNull;

public record FormPayload(byte[] data) implements CustomPacketPayload {
public static final StreamCodec<FriendlyByteBuf, FormPayload> STREAM_CODEC = CustomPacketPayload.codec(FormPayload::write, FormPayload::new);
public static final CustomPacketPayload.Type<FormPayload> TYPE = CustomPacketPayload.createType("floodgate:form");
public static final CustomPacketPayload.Type<FormPayload> TYPE = new Type<>(ResourceLocation.parse("floodgate:form"));

private FormPayload(FriendlyByteBuf friendlyByteBuf) {
this(friendlyByteBuf.readByteArray());
Expand All @@ -17,11 +18,8 @@ private void write(FriendlyByteBuf friendlyByteBuf) {
friendlyByteBuf.writeByteArray(this.data);
}

@Override
public CustomPacketPayload.@NonNull Type<FormPayload> type() {
return TYPE;
}

public byte[] data() {
return this.data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import org.checkerframework.checker.nullness.qual.NonNull;

public record PacketPayload(byte[] data) implements CustomPacketPayload {
public static final StreamCodec<FriendlyByteBuf, PacketPayload> STREAM_CODEC = CustomPacketPayload.codec(PacketPayload::write, PacketPayload::new);
public static final CustomPacketPayload.Type<PacketPayload> TYPE = CustomPacketPayload.createType("floodgate:packet");
public static final CustomPacketPayload.Type<PacketPayload> TYPE = new Type<>(ResourceLocation.parse("floodgate:packet"));

private PacketPayload(FriendlyByteBuf friendlyByteBuf) {
this(friendlyByteBuf.readByteArray());
Expand All @@ -17,11 +18,8 @@ private void write(FriendlyByteBuf friendlyByteBuf) {
friendlyByteBuf.writeByteArray(this.data);
}

@Override
public CustomPacketPayload.@NonNull Type<PacketPayload> type() {
return TYPE;
}

public byte[] data() {
return this.data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import org.checkerframework.checker.nullness.qual.NonNull;

public record SkinPayload(byte[] data) implements CustomPacketPayload {
public static final StreamCodec<FriendlyByteBuf, SkinPayload> STREAM_CODEC = CustomPacketPayload.codec(SkinPayload::write, SkinPayload::new);
public static final CustomPacketPayload.Type<SkinPayload> TYPE = CustomPacketPayload.createType("floodgate:skin");
public static final CustomPacketPayload.Type<SkinPayload> TYPE = new Type<>(ResourceLocation.parse("floodgate:skin"));

private SkinPayload(FriendlyByteBuf friendlyByteBuf) {
this(friendlyByteBuf.readByteArray());
Expand All @@ -17,11 +18,8 @@ private void write(FriendlyByteBuf friendlyByteBuf) {
friendlyByteBuf.writeByteArray(this.data);
}

@Override
public CustomPacketPayload.@NonNull Type<SkinPayload> type() {
return TYPE;
}

public byte[] data() {
return this.data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import org.checkerframework.checker.nullness.qual.NonNull;

public record TransferPayload(byte[] data) implements CustomPacketPayload {
public static final StreamCodec<FriendlyByteBuf, TransferPayload> STREAM_CODEC = CustomPacketPayload.codec(TransferPayload::write, TransferPayload::new);
public static final CustomPacketPayload.Type<TransferPayload> TYPE = CustomPacketPayload.createType("floodgate:transfer");
public static final CustomPacketPayload.Type<TransferPayload> TYPE = new Type<>(ResourceLocation.parse("floodgate:transfer"));

private TransferPayload(FriendlyByteBuf friendlyByteBuf) {
this(friendlyByteBuf.readByteArray());
Expand All @@ -17,11 +18,8 @@ private void write(FriendlyByteBuf friendlyByteBuf) {
friendlyByteBuf.writeByteArray(this.data);
}

@Override
public CustomPacketPayload.@NonNull Type<TransferPayload> type() {
return TYPE;
}

public byte[] data() {
return this.data;
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"floodgate.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.10",
"fabricloader": ">=0.15.11",
"fabric": "*",
"minecraft": ">=1.20.5"
"minecraft": ">=1.21"
}
}
2 changes: 1 addition & 1 deletion src/main/resources/floodgate.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "org.geysermc.floodgate.mixin",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_21",
"mixins": [
"ChunkMapMixin",
"ClientIntentionPacketMixin",
Expand Down

0 comments on commit 0e4ecb5

Please sign in to comment.