The packets and the bees

- Fix some packets
- Remove unused import in multiple packets
- Fix improper data reading
This commit is contained in:
IThundxr 2025-01-09 11:56:12 -05:00
parent d5ef7e5147
commit 43f33c4345
Failed to generate hash of commit
70 changed files with 42 additions and 64 deletions

View file

@ -35,7 +35,7 @@ jei_minecraft_version = 1.21
jei_version = 19.5.0.33
curios_minecraft_version = 1.21.1
curios_version = 9.0.15
catnip_version = 0.8.44
catnip_version = 0.8.45
ponder_version = 0.8.7
catnip_and_ponder_mc_ver = 1.21.1

View file

@ -15,7 +15,9 @@ import net.createmod.catnip.utility.Pair;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public class TrainMapSyncPacket implements ClientboundPacketPayload {
public static final StreamCodec<FriendlyByteBuf, TrainMapSyncPacket> STREAM_CODEC = StreamCodec.composite(
@ -41,6 +43,7 @@ public class TrainMapSyncPacket implements ClientboundPacketPayload {
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
TrainMapSyncClient.receive(this);
}

View file

@ -6,7 +6,6 @@ import net.createmod.catnip.net.base.ServerboundPacketPayload;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public class TrainMapSyncRequestPacket implements ServerboundPacketPayload {
public static final TrainMapSyncRequestPacket INSTANCE = new TrainMapSyncRequestPacket();

View file

@ -12,7 +12,6 @@ import net.minecraft.world.level.block.state.BlockState;
import io.netty.buffer.ByteBuf;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionBlockChangedPacket(int entityId, BlockPos localPos, BlockState newState) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionBlockChangedPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -12,7 +12,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionColliderLockPacket(int contraption, double offset, int sender) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionColliderLockPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -9,7 +9,6 @@ import net.minecraft.network.codec.StreamCodec;
import io.netty.buffer.ByteBuf;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionDisassemblyPacket(int entityId, StructureTransform transform) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionDisassemblyPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -9,7 +9,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionRelocationPacket(int entityId) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionRelocationPacket> STREAM_CODEC = ByteBufCodecs.INT.map(

View file

@ -9,7 +9,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionStallPacket(int entityId, double x, double y, double z, float angle) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionStallPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -12,7 +12,6 @@ import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record TrainCollisionPacket(int damage, int contraptionEntityId) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, TrainCollisionPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -13,7 +13,9 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record ContraptionDisableActorPacket(int entityId, ItemStack filter, boolean enable) implements ClientboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, ContraptionDisableActorPacket> STREAM_CODEC = StreamCodec.composite(
@ -24,6 +26,7 @@ public record ContraptionDisableActorPacket(int entityId, ItemStack filter, bool
);
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
Entity entityByID = player.clientLevel.getEntity(entityId);
if (!(entityByID instanceof AbstractContraptionEntity ace))

View file

@ -17,7 +17,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ControlsInputPacket(List<Integer> activatedButtons, boolean press, int contraptionEntityId,
BlockPos controlsPos, boolean stopControlling) implements ServerboundPacketPayload {

View file

@ -8,7 +8,6 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public enum ControlsStopControllingPacket implements ClientboundPacketPayload {
INSTANCE;

View file

@ -19,7 +19,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ElevatorFloorListPacket(int entityId, List<IntAttached<Couple<String>>> floors) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ElevatorFloorListPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -12,7 +12,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ElevatorTargetFloorPacket(int entityId, int targetY) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ElevatorTargetFloorPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -9,7 +9,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record GantryContraptionUpdatePacket(int entityID, double coord, double motion, double sequenceLimit) implements ClientboundPacketPayload {
public static StreamCodec<ByteBuf, GantryContraptionUpdatePacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -11,7 +11,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record GlueEffectPacket(BlockPos pos, Direction direction, boolean fullBlock) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, GlueEffectPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -10,7 +10,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SuperGlueRemovalPacket(int entityId, BlockPos soundSource) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, SuperGlueRemovalPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -11,7 +11,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import java.util.Set;

View file

@ -7,7 +7,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record CouplingCreationPacket(int id1, int id2) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, CouplingCreationPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -21,7 +21,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record MinecartControllerUpdatePacket(int entityId, @Nullable CompoundTag nbt) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, MinecartControllerUpdatePacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -9,7 +9,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ClientMotionPacket(Vec3 motion, boolean onGround, float limbSwing) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ClientMotionPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -13,7 +13,6 @@ import net.minecraft.world.entity.Entity;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionFluidPacket(int entityId, BlockPos localPos, FluidStack fluid) implements ClientboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, ContraptionFluidPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -16,7 +16,6 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.phys.AABB;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionInteractionPacket(InteractionHand hand, int target, BlockPos localPos, Direction face) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionInteractionPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -18,7 +18,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ContraptionSeatMappingPacket(int entityId, Map<UUID, Integer> mapping, int dismountedId) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, ContraptionSeatMappingPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -14,7 +14,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record LimbSwingUpdatePacket(int entityId, Vec3 position, float limbSwing) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, LimbSwingUpdatePacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -11,7 +11,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SoulPulseEffectPacket(BlockPos pos, int distance, boolean canOverlap) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, SoulPulseEffectPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -6,7 +6,6 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record BlueprintAssignCompleteRecipePacket(ResourceLocation recipeId) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, BlueprintAssignCompleteRecipePacket> STREAM_CODEC = ResourceLocation.STREAM_CODEC.map(

View file

@ -12,7 +12,6 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ExtendoGripInteractionPacket(InteractionHand hand, int target, Vec3 point) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ExtendoGripInteractionPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -27,7 +27,6 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public class PotatoProjectileTypeManager {

View file

@ -11,7 +11,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ConfigureSymmetryWandPacket(InteractionHand hand, SymmetryMirror mirror) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ConfigureSymmetryWandPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -13,7 +13,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SymmetryEffectPacket(BlockPos mirror, List<BlockPos> positions) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, SymmetryEffectPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -8,6 +8,9 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record KnockbackPacket(float yRot, float strength) implements ClientboundPacketPayload {
public static StreamCodec<ByteBuf, KnockbackPacket> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.FLOAT, KnockbackPacket::yRot,
@ -21,6 +24,7 @@ public record KnockbackPacket(float yRot, float strength) implements Clientbound
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
if (player != null)
CardboardSwordItem.knockback(player, strength, yRot);

View file

@ -15,7 +15,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.neoforge.items.ItemHandlerHelper;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ToolboxDisposeAllPacket(BlockPos toolboxPos) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ToolboxDisposeAllPacket> STREAM_CODEC = BlockPos.STREAM_CODEC.map(

View file

@ -15,7 +15,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.neoforge.items.ItemHandlerHelper;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ToolboxEquipPacket(BlockPos toolboxPos, int slot, int hotbarSlot) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ToolboxEquipPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -6,7 +6,6 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class ConfigureZapperPacket implements ServerboundPacketPayload {
protected final InteractionHand hand;

View file

@ -10,7 +10,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class ShootGadgetPacket implements ClientboundPacketPayload {
protected final Vec3 location;

View file

@ -12,7 +12,6 @@ import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record FluidSplashPacket(BlockPos pos, FluidStack fluid) implements ClientboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, FluidSplashPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -14,6 +14,9 @@ import net.minecraft.core.UUIDUtil;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record ClientboundChainConveyorRidingPacket(Collection<UUID> uuids) implements ClientboundPacketPayload {
public static StreamCodec<ByteBuf, ClientboundChainConveyorRidingPacket> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.collection(HashSet::new, UUIDUtil.STREAM_CODEC), ClientboundChainConveyorRidingPacket::uuids,
@ -26,6 +29,7 @@ public record ClientboundChainConveyorRidingPacket(Collection<UUID> uuids) imple
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
PlayerSkyhookRenderer.updatePlayerList(this.uuids);
}

View file

@ -17,7 +17,6 @@ import java.util.stream.Collectors;
import com.simibubi.create.AllBlocks;
import net.createmod.catnip.utility.Iterate;
import net.createmod.catnip.utility.NBTHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
@ -225,7 +224,7 @@ public class ConnectedInputHandler {
isController = nbt.getBoolean("Controller");
data.clear();
nbt.getList("Data", Tag.TAG_COMPOUND)
.forEach(inbt -> data.add(NbtUtils.readBlockPos((CompoundTag) inbt, "Pos").orElseThrow()));
.forEach(inbt -> NbtUtils.readBlockPos((CompoundTag) inbt, "Pos").ifPresent(data::add));
// nbt got wiped -> reset
if (data.isEmpty()) {

View file

@ -18,7 +18,6 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ArmPlacementPacket(ListTag tag, BlockPos pos) implements ServerboundPacketPayload {
public static final StreamCodec<FriendlyByteBuf, ArmPlacementPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -15,6 +15,9 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record PackageDestroyPacket(Vec3 location, ItemStack box) implements ClientboundPacketPayload {
public static StreamCodec<RegistryFriendlyByteBuf, PackageDestroyPacket> STREAM_CODEC = StreamCodec.composite(
CatnipStreamCodecs.VEC3, PackageDestroyPacket::location,
@ -28,6 +31,7 @@ public record PackageDestroyPacket(Vec3 location, ItemStack box) implements Clie
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
ClientLevel level = Minecraft.getInstance().level;
Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, level.getRandom(), .125f);

View file

@ -9,7 +9,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record EjectorElytraPacket(BlockPos pos) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, EjectorElytraPacket> STREAM_CODEC = BlockPos.STREAM_CODEC.map(

View file

@ -17,7 +17,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record EjectorPlacementPacket(int h, int v, BlockPos pos, Direction facing) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, EjectorPlacementPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -13,6 +13,9 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record FactoryPanelEffectPacket(FactoryPanelPosition fromPos, FactoryPanelPosition toPos, boolean success) implements ClientboundPacketPayload {
public static StreamCodec<ByteBuf, FactoryPanelEffectPacket> STREAM_CODEC = StreamCodec.composite(
FactoryPanelPosition.STREAM_CODEC, FactoryPanelEffectPacket::fromPos,
@ -27,6 +30,7 @@ public record FactoryPanelEffectPacket(FactoryPanelPosition fromPos, FactoryPane
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
ClientLevel level = Minecraft.getInstance().level;
BlockState blockState = level.getBlockState(fromPos.pos());

View file

@ -132,7 +132,10 @@ public class FactoryPanelSupportBehaviour extends BlockEntityBehaviour {
@Override
public void read(CompoundTag nbt, HolderLookup.Provider registries, boolean clientPacket) {
linkedPanels.clear();
linkedPanels.addAll(CatnipCodecUtils.decodeOrThrow(Codec.list(FactoryPanelPosition.CODEC), nbt.get("LinkedGauges")));
List<FactoryPanelPosition> list = CatnipCodecUtils.decode(Codec.list(FactoryPanelPosition.CODEC), nbt.get("LinkedGauges"));
if (list != null)
linkedPanels.addAll(list);
}
@Override

View file

@ -9,6 +9,9 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record PackagerLinkEffectPacket(BlockPos pos) implements ClientboundPacketPayload {
public static StreamCodec<ByteBuf, PackagerLinkEffectPacket> STREAM_CODEC = StreamCodec.composite(
BlockPos.STREAM_CODEC, PackagerLinkEffectPacket::pos,
@ -21,6 +24,7 @@ public record PackagerLinkEffectPacket(BlockPos pos) implements ClientboundPacke
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
if (Minecraft.getInstance().level.getBlockEntity(pos) instanceof PackagerLinkBlockEntity plbe)
plbe.playEffect();

View file

@ -10,6 +10,9 @@ import net.minecraft.core.BlockPos;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record RedstoneRequesterEffectPacket(BlockPos pos, boolean success) implements ClientboundPacketPayload {
public static StreamCodec<ByteBuf, RedstoneRequesterEffectPacket> STREAM_CODEC = StreamCodec.composite(
BlockPos.STREAM_CODEC, RedstoneRequesterEffectPacket::pos,
@ -23,6 +26,7 @@ public record RedstoneRequesterEffectPacket(BlockPos pos, boolean success) imple
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
if (Minecraft.getInstance().level.getBlockEntity(pos) instanceof RedstoneRequesterBlockEntity plbe)
plbe.playEffect(success);

View file

@ -14,6 +14,9 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public record LogisticalStockResponsePacket(boolean lastPacket, BlockPos pos, List<BigItemStack> items) implements ClientboundPacketPayload {
public static StreamCodec<RegistryFriendlyByteBuf, LogisticalStockResponsePacket> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.BOOL, LogisticalStockResponsePacket::lastPacket,
@ -28,6 +31,7 @@ public record LogisticalStockResponsePacket(boolean lastPacket, BlockPos pos, Li
}
@Override
@OnlyIn(Dist.CLIENT)
public void handle(LocalPlayer player) {
if (Minecraft.getInstance().level.getBlockEntity(pos) instanceof StockTickerBlockEntity stbe)
stbe.receiveStockPacket(items, lastPacket);

View file

@ -10,7 +10,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class LinkedControllerPacketBase implements ServerboundPacketPayload {
@Nullable

View file

@ -12,7 +12,6 @@ import net.minecraft.server.level.ServerPlayer;
import com.simibubi.create.infrastructure.codec.CreateStreamCodecs;
import io.netty.buffer.ByteBuf;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ConfigureSchematicannonPacket(Option option, boolean set) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, ConfigureSchematicannonPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -9,7 +9,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record InstantSchematicPacket(String name, BlockPos origin, BlockPos bounds) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, InstantSchematicPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -12,7 +12,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SchematicPlacePacket(ItemStack stack) implements ServerboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, SchematicPlacePacket> STREAM_CODEC = ItemStack.STREAM_CODEC.map(

View file

@ -16,7 +16,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SchematicSyncPacket(int slot, boolean deployed, BlockPos anchor, Rotation rotation, Mirror mirror) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, SchematicSyncPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -16,7 +16,6 @@ import net.minecraft.server.level.ServerPlayer;
import com.simibubi.create.infrastructure.codec.CreateStreamCodecs;
import io.netty.buffer.ByteBuf;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SchematicUploadPacket(int code, long size, String schematic, byte[] data) implements ServerboundPacketPayload {

View file

@ -20,7 +20,6 @@ import net.minecraft.server.level.ServerPlayer;
import io.netty.buffer.ByteBuf;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class HonkPacket implements CustomPacketPayload {
protected final UUID trainId;

View file

@ -24,7 +24,6 @@ import com.simibubi.create.infrastructure.codec.CreateStreamCodecs;
import io.netty.buffer.ByteBuf;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class TrainHUDUpdatePacket implements CustomPacketPayload {
protected final UUID trainId;

View file

@ -9,7 +9,6 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record AddTrainPacket(Train train) implements ClientboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, AddTrainPacket> STREAM_CODEC = Train.STREAM_CODEC.map(AddTrainPacket::new, AddTrainPacket::train);

View file

@ -9,7 +9,6 @@ import net.createmod.catnip.net.base.ClientboundPacketPayload;
import io.netty.buffer.ByteBuf;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.UUIDUtil;
import net.minecraft.network.codec.StreamCodec;

View file

@ -12,7 +12,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record TrainPromptPacket(Component text, boolean shadow) implements ClientboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, TrainPromptPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -9,7 +9,6 @@ import net.createmod.catnip.net.base.ClientboundPacketPayload;
import net.minecraft.client.player.LocalPlayer;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class TrackGraphPacket implements ClientboundPacketPayload {

View file

@ -8,7 +8,6 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record TrackGraphRequestPacket(int netId) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, TrackGraphRequestPacket> STREAM_CODEC = ByteBufCodecs.INT.map(

View file

@ -23,7 +23,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record TrackGraphRollCallPacket(List<Entry> entries) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, TrackGraphRollCallPacket> STREAM_CODEC = CatnipStreamCodecBuilders.list(Entry.STREAM_CODEC).map(

View file

@ -9,7 +9,6 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record ScheduleEditPacket(Schedule schedule) implements ServerboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, ScheduleEditPacket> STREAM_CODEC = Schedule.STREAM_CODEC.map(

View file

@ -18,7 +18,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record SignalEdgeGroupPacket(List<UUID> ids, List<EdgeGroupColor> colors, boolean add) implements ClientboundPacketPayload {
public static final StreamCodec<FriendlyByteBuf, SignalEdgeGroupPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -23,7 +23,6 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public abstract class TrainEditPacket implements CustomPacketPayload {
protected final UUID id;

View file

@ -11,7 +11,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record PlaceExtendedCurvePacket(boolean mainHand, boolean ctrlDown) implements ServerboundPacketPayload {
public static final StreamCodec<ByteBuf, PlaceExtendedCurvePacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -6,7 +6,6 @@ import net.createmod.catnip.net.base.ServerboundPacketPayload;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public enum ClearMenuPacket implements ServerboundPacketPayload {
INSTANCE;

View file

@ -11,7 +11,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record GhostItemSubmitPacket(ItemStack item, int slot) implements ServerboundPacketPayload {
public static final StreamCodec<RegistryFriendlyByteBuf, GhostItemSubmitPacket> STREAM_CODEC = StreamCodec.composite(

View file

@ -13,7 +13,6 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.codec.StreamCodec;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public class ServerSpeedProvider {
private static final LerpedFloat modifier = LerpedFloat.linear();

View file

@ -12,7 +12,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.phys.shapes.Shapes;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext;
public record HighlightPacket(BlockPos pos) implements ClientboundPacketPayload {
public static final StreamCodec<ByteBuf, HighlightPacket> STREAM_CODEC = BlockPos.STREAM_CODEC.map(HighlightPacket::new, p -> p.pos);