-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Single player loads, server almost works.
- Loading branch information
Showing
33 changed files
with
442 additions
and
73 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
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
16 changes: 16 additions & 0 deletions
16
...ent/java/net/fabricmc/fabric/mixin/networking/client/ClientCommonNetworkHandlerMixin.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
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
37 changes: 37 additions & 0 deletions
37
.../src/main/java/net/fabricmc/fabric/impl/networking/LoginQueryRequestS2CPacketFactory.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,37 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.impl.networking; | ||
|
||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.s2c.login.LoginQueryRequestPayload; | ||
import net.minecraft.network.packet.s2c.login.LoginQueryRequestS2CPacket; | ||
import net.minecraft.util.Identifier; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; | ||
import net.fabricmc.fabric.impl.networking.payload.PacketByteBufLoginQueryRequestPayload; | ||
|
||
public class LoginQueryRequestS2CPacketFactory { | ||
public static LoginQueryRequestS2CPacket create(PacketByteBuf buf) { | ||
return new LoginQueryRequestS2CPacket(buf.readVarInt(), readPayload(buf.readIdentifier(), buf)); | ||
} | ||
|
||
private static LoginQueryRequestPayload readPayload(Identifier id, PacketByteBuf buf) { | ||
PacketByteBuf copy = PacketByteBufs.copy(buf); | ||
buf.skipBytes(buf.readableBytes()); | ||
return new PacketByteBufLoginQueryRequestPayload(id, copy); | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
.../main/java/net/fabricmc/fabric/impl/networking/PacketByteBufLoginQueryRequestPayload.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...v1/src/main/java/net/fabricmc/fabric/impl/networking/PacketByteBufLoginQueryResponse.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...orking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/PacketByteBufPayload.java
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...va/net/fabricmc/fabric/impl/networking/payload/PacketByteBufLoginQueryRequestPayload.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,28 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.impl.networking.payload; | ||
|
||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.s2c.login.LoginQueryRequestPayload; | ||
import net.minecraft.util.Identifier; | ||
|
||
public record PacketByteBufLoginQueryRequestPayload(Identifier id, PacketByteBuf data) implements LoginQueryRequestPayload { | ||
@Override | ||
public void write(PacketByteBuf buf) { | ||
buf.writeBytes(this.data()); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...ain/java/net/fabricmc/fabric/impl/networking/payload/PacketByteBufLoginQueryResponse.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,27 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.impl.networking.payload; | ||
|
||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.c2s.login.LoginQueryResponse; | ||
|
||
public record PacketByteBufLoginQueryResponse(PacketByteBuf data) implements LoginQueryResponse { | ||
@Override | ||
public void write(PacketByteBuf buf) { | ||
buf.writeBytes(this.data()); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...pi-v1/src/main/java/net/fabricmc/fabric/impl/networking/payload/PacketByteBufPayload.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,28 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.impl.networking.payload; | ||
|
||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.CustomPayload; | ||
import net.minecraft.util.Identifier; | ||
|
||
public record PacketByteBufPayload(Identifier id, PacketByteBuf data) implements CustomPayload { | ||
@Override | ||
public void write(PacketByteBuf buf) { | ||
buf.writeBytes(this.data()); | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
...pi-v1/src/main/java/net/fabricmc/fabric/mixin/networking/CustomPayloadC2SPacketMixin.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,44 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.mixin.networking; | ||
|
||
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; | ||
|
||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.CustomPayload; | ||
import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; | ||
import net.minecraft.util.Identifier; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; | ||
import net.fabricmc.fabric.impl.networking.payload.PacketByteBufPayload; | ||
|
||
@Mixin(CustomPayloadC2SPacket.class) | ||
public class CustomPayloadC2SPacketMixin { | ||
@Inject( | ||
method = "readPayload", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/common/CustomPayloadC2SPacket;readUnknownPayload(Lnet/minecraft/util/Identifier;Lnet/minecraft/network/PacketByteBuf;)Lnet/minecraft/network/packet/UnknownCustomPayload;"), | ||
cancellable = true | ||
) | ||
private static void readPayload(Identifier id, PacketByteBuf buf, CallbackInfoReturnable<CustomPayload> cir) { | ||
PacketByteBuf copy = PacketByteBufs.copy(buf); | ||
buf.skipBytes(buf.readableBytes()); | ||
cir.setReturnValue(new PacketByteBufPayload(id, copy)); | ||
} | ||
} |
Oops, something went wrong.