-
Notifications
You must be signed in to change notification settings - Fork 11
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
20 changed files
with
133 additions
and
218 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
common/src/main/java/org/popcraft/chunkyborder/util/ClientBorder.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,6 @@ | ||
package org.popcraft.chunkyborder.util; | ||
|
||
import org.popcraft.chunkyborder.shape.BorderShape; | ||
|
||
public record ClientBorder(String worldKey, BorderShape borderShape) { | ||
} |
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
41 changes: 41 additions & 0 deletions
41
fabric/src/main/java/org/popcraft/chunkyborder/packet/BorderPayload.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,41 @@ | ||
package org.popcraft.chunkyborder.packet; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.packet.CustomPayload; | ||
import org.popcraft.chunky.platform.World; | ||
import org.popcraft.chunky.shape.Shape; | ||
import org.popcraft.chunkyborder.util.ClientBorder; | ||
import org.popcraft.chunkyborder.util.PluginMessage; | ||
|
||
public class BorderPayload implements CustomPayload { | ||
public static final CustomPayload.Id<BorderPayload> ID = CustomPayload.id("chunky:border"); | ||
private World world; | ||
private Shape shape; | ||
private ClientBorder border; | ||
|
||
public BorderPayload(final World world, final Shape shape) { | ||
this.world = world; | ||
this.shape = shape; | ||
} | ||
|
||
public BorderPayload(final PacketByteBuf buf) { | ||
final ByteBuf unwrapped = buf.unwrap(); | ||
final byte[] bytes = new byte[unwrapped.readableBytes()]; | ||
unwrapped.readBytes(bytes); | ||
this.border = PluginMessage.readBorder(bytes); | ||
} | ||
|
||
public void write(final PacketByteBuf buf) { | ||
buf.writeBytes(PluginMessage.writeBorder(world, shape)); | ||
} | ||
|
||
public ClientBorder getBorder() { | ||
return border; | ||
} | ||
|
||
@Override | ||
public CustomPayload.Id<BorderPayload> getId() { | ||
return ID; | ||
} | ||
} |
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
Oops, something went wrong.