aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/network
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2021-12-04 21:27:28 -0800
committerAnthony Hilyard <anthony.hilyard@gmail.com>2021-12-04 21:27:28 -0800
commitf5d35697f524cda1736740e739f8afd902651c53 (patch)
tree1b582f6420418f62fbef9755434fbaebe7644ff6 /src/main/java/com/anthonyhilyard/iceberg/network
parent36a1f98bba70892f4e06c3df8b2b0bb4d0d5fe03 (diff)
downloadIceberg-f5d35697f524cda1736740e739f8afd902651c53.tar.gz
Iceberg-f5d35697f524cda1736740e739f8afd902651c53.tar.bz2
Iceberg-f5d35697f524cda1736740e739f8afd902651c53.zip
Initial 1.18 port. Overhauled tooltip handling, added color code item
color support.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/network')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/network/IcebergNetworkProtocol.java30
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/network/NewItemPickupEventPacket.java45
2 files changed, 0 insertions, 75 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/network/IcebergNetworkProtocol.java b/src/main/java/com/anthonyhilyard/iceberg/network/IcebergNetworkProtocol.java
deleted file mode 100644
index 4b5db06..0000000
--- a/src/main/java/com/anthonyhilyard/iceberg/network/IcebergNetworkProtocol.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.anthonyhilyard.iceberg.network;
-
-import com.anthonyhilyard.iceberg.Loader;
-
-import net.minecraft.resources.ResourceLocation;
-import net.minecraftforge.fmllegacy.network.NetworkRegistry;
-import net.minecraftforge.fmllegacy.network.simple.SimpleChannel;
-
-public class IcebergNetworkProtocol
-{
- private static final String NETWORK_PROTOCOL_VERSION = "1";
-
- public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel(
- new ResourceLocation(Loader.MODID, "main"), () -> NETWORK_PROTOCOL_VERSION,
- NETWORK_PROTOCOL_VERSION::equals, NETWORK_PROTOCOL_VERSION::equals
- );
-
- public static final void register()
- {
- int messageID = 0;
-
- CHANNEL.registerMessage(
- messageID++,
- NewItemPickupEventPacket.class,
- NewItemPickupEventPacket::encode,
- NewItemPickupEventPacket::decode,
- NewItemPickupEventPacket::handle
- );
- }
-}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/network/NewItemPickupEventPacket.java b/src/main/java/com/anthonyhilyard/iceberg/network/NewItemPickupEventPacket.java
deleted file mode 100644
index b99a36d..0000000
--- a/src/main/java/com/anthonyhilyard/iceberg/network/NewItemPickupEventPacket.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.anthonyhilyard.iceberg.network;
-
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.network.FriendlyByteBuf;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fmllegacy.network.NetworkEvent;
-
-import java.util.UUID;
-import java.util.function.Supplier;
-
-import com.anthonyhilyard.iceberg.events.NewItemPickupEvent;
-
-
-public final class NewItemPickupEventPacket
-{
- private final UUID playerUUID;
- private final ItemStack item;
-
- public NewItemPickupEventPacket(final UUID playerUUID, final ItemStack item)
- {
- this.playerUUID = playerUUID;
- this.item = item;
- }
-
- public static void encode(final NewItemPickupEventPacket msg, final FriendlyByteBuf packetBuffer)
- {
- packetBuffer.writeUUID(msg.playerUUID);
- packetBuffer.writeItem(msg.item);
- }
-
- public static NewItemPickupEventPacket decode(final FriendlyByteBuf packetBuffer)
- {
- return new NewItemPickupEventPacket(packetBuffer.readUUID(), packetBuffer.readItem());
- }
-
- public static void handle(final NewItemPickupEventPacket msg, final Supplier<NetworkEvent.Context> contextSupplier)
- {
- final NetworkEvent.Context context = contextSupplier.get();
- context.enqueueWork(() -> {
- MinecraftForge.EVENT_BUS.post(new NewItemPickupEvent(msg.playerUUID, msg.item));
- });
- context.setPacketHandled(true);
- }
-
-} \ No newline at end of file