Merge branch 'main' into famos-amos

because i'm too clever, who the hell knows what SYN/ACK means
This commit is contained in:
petrak@ 2023-04-27 21:37:06 -05:00
commit 19f35e1205
32 changed files with 134 additions and 131 deletions

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.api.casting package at.petrak.hexcasting.api.casting
import at.petrak.hexcasting.api.pigment.FrozenPigment import at.petrak.hexcasting.api.pigment.FrozenPigment
import at.petrak.hexcasting.common.network.MsgCastParticleAck import at.petrak.hexcasting.common.msgs.MsgCastParticleS2C
import at.petrak.hexcasting.xplat.IXplatAbstractions import at.petrak.hexcasting.xplat.IXplatAbstractions
import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerLevel
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
@ -24,6 +24,6 @@ data class ParticleSpray(val pos: Vec3, val vel: Vec3, val fuzziness: Double, va
} }
fun sprayParticles(world: ServerLevel, color: FrozenPigment) { fun sprayParticles(world: ServerLevel, color: FrozenPigment) {
IXplatAbstractions.INSTANCE.sendPacketNear(this.pos, 128.0, world, MsgCastParticleAck(this, color)) IXplatAbstractions.INSTANCE.sendPacketNear(this.pos, 128.0, world, MsgCastParticleS2C(this, color))
} }
} }

View file

@ -9,8 +9,8 @@ import at.petrak.hexcasting.api.casting.iota.PatternIota;
import at.petrak.hexcasting.api.casting.math.HexCoord; import at.petrak.hexcasting.api.casting.math.HexCoord;
import at.petrak.hexcasting.api.mod.HexStatistics; import at.petrak.hexcasting.api.mod.HexStatistics;
import at.petrak.hexcasting.api.pigment.FrozenPigment; import at.petrak.hexcasting.api.pigment.FrozenPigment;
import at.petrak.hexcasting.common.network.MsgNewSpellPatternAck; import at.petrak.hexcasting.common.msgs.MsgNewSpellPatternC2S;
import at.petrak.hexcasting.common.network.MsgNewSpellPatternSyn; import at.petrak.hexcasting.common.msgs.MsgNewSpellPatternS2C;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
@ -67,7 +67,7 @@ public class StaffCastEnv extends PlayerBasedCastEnv {
return HexAPI.instance().getColorizer(this.caster); return HexAPI.instance().getColorizer(this.caster);
} }
public static void handleNewPatternOnServer(ServerPlayer sender, MsgNewSpellPatternSyn msg) { public static void handleNewPatternOnServer(ServerPlayer sender, MsgNewSpellPatternC2S msg) {
boolean cheatedPatternOverlap = false; boolean cheatedPatternOverlap = false;
List<ResolvedPattern> resolvedPatterns = msg.resolvedPatterns(); List<ResolvedPattern> resolvedPatterns = msg.resolvedPatterns();
@ -109,7 +109,7 @@ public class StaffCastEnv extends PlayerBasedCastEnv {
} }
IXplatAbstractions.INSTANCE.sendPacketToPlayer(sender, IXplatAbstractions.INSTANCE.sendPacketToPlayer(sender,
new MsgNewSpellPatternAck(clientInfo, resolvedPatterns.size() - 1)); new MsgNewSpellPatternS2C(clientInfo, resolvedPatterns.size() - 1));
if (clientInfo.getResolutionType().getSuccess()) { if (clientInfo.getResolutionType().getSuccess()) {
// Somehow we lost spraying particles on each new pattern, so do it here // Somehow we lost spraying particles on each new pattern, so do it here

View file

@ -2,7 +2,7 @@ package at.petrak.hexcasting.client;
import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.mod.HexConfig;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.network.MsgShiftScrollSyn; import at.petrak.hexcasting.common.msgs.MsgShiftScrollC2S;
import at.petrak.hexcasting.xplat.IClientXplatAbstractions; import at.petrak.hexcasting.xplat.IClientXplatAbstractions;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
@ -46,7 +46,7 @@ public class ShiftScrollListener {
public static void clientTickEnd() { public static void clientTickEnd() {
if (mainHandDelta != 0 || offHandDelta != 0) { if (mainHandDelta != 0 || offHandDelta != 0) {
IClientXplatAbstractions.INSTANCE.sendPacketToServer( IClientXplatAbstractions.INSTANCE.sendPacketToServer(
new MsgShiftScrollSyn(mainHandDelta, offHandDelta, Screen.hasControlDown(), new MsgShiftScrollC2S(mainHandDelta, offHandDelta, Screen.hasControlDown(),
HexConfig.client().invertSpellbookScrollDirection(), HexConfig.client().invertSpellbookScrollDirection(),
HexConfig.client().invertAbacusScrollDirection())); HexConfig.client().invertAbacusScrollDirection()));
mainHandDelta = 0; mainHandDelta = 0;

View file

@ -18,7 +18,7 @@ import at.petrak.hexcasting.client.ktxt.accumulatedScroll
import at.petrak.hexcasting.client.render.* import at.petrak.hexcasting.client.render.*
import at.petrak.hexcasting.client.sound.GridSoundInstance import at.petrak.hexcasting.client.sound.GridSoundInstance
import at.petrak.hexcasting.common.lib.HexSounds import at.petrak.hexcasting.common.lib.HexSounds
import at.petrak.hexcasting.common.network.MsgNewSpellPatternSyn import at.petrak.hexcasting.common.msgs.MsgNewSpellPatternC2S
import at.petrak.hexcasting.xplat.IClientXplatAbstractions import at.petrak.hexcasting.xplat.IClientXplatAbstractions
import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.PoseStack import com.mojang.blaze3d.vertex.PoseStack
@ -248,7 +248,7 @@ class GuiSpellcasting constructor(
this.usedSpots.addAll(pat.positions(start)) this.usedSpots.addAll(pat.positions(start))
IClientXplatAbstractions.INSTANCE.sendPacketToServer( IClientXplatAbstractions.INSTANCE.sendPacketToServer(
MsgNewSpellPatternSyn( MsgNewSpellPatternC2S(
this.handOpenedWith, this.handOpenedWith,
pat, pat,
this.patterns this.patterns

View file

@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.casting.castables.SpellAction
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.iota.Iota import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.common.network.MsgBeepAck import at.petrak.hexcasting.common.msgs.MsgBeepS2C
import at.petrak.hexcasting.xplat.IXplatAbstractions import at.petrak.hexcasting.xplat.IXplatAbstractions
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
import net.minecraft.world.level.gameevent.GameEvent import net.minecraft.world.level.gameevent.GameEvent
@ -34,7 +34,7 @@ object OpBeep : SpellAction {
private data class Spell(val target: Vec3, val note: Int, val instrument: NoteBlockInstrument) : RenderedSpell { private data class Spell(val target: Vec3, val note: Int, val instrument: NoteBlockInstrument) : RenderedSpell {
override fun cast(ctx: CastingEnvironment) { override fun cast(ctx: CastingEnvironment) {
IXplatAbstractions.INSTANCE.sendPacketNear(target, 128.0, ctx.world, MsgBeepAck(target, note, instrument)) IXplatAbstractions.INSTANCE.sendPacketNear(target, 128.0, ctx.world, MsgBeepS2C(target, note, instrument))
ctx.world.gameEvent(null, GameEvent.NOTE_BLOCK_PLAY, target) ctx.world.gameEvent(null, GameEvent.NOTE_BLOCK_PLAY, target)
} }
} }

View file

@ -12,7 +12,7 @@ import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity
import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.api.mod.HexConfig import at.petrak.hexcasting.api.mod.HexConfig
import at.petrak.hexcasting.api.mod.HexTags import at.petrak.hexcasting.api.mod.HexTags
import at.petrak.hexcasting.common.network.MsgBlinkAck import at.petrak.hexcasting.common.msgs.MsgBlinkS2C
import at.petrak.hexcasting.xplat.IXplatAbstractions import at.petrak.hexcasting.xplat.IXplatAbstractions
import net.minecraft.core.BlockPos import net.minecraft.core.BlockPos
import net.minecraft.server.level.ServerLevel import net.minecraft.server.level.ServerLevel
@ -136,7 +136,7 @@ object OpTeleport : SpellAction {
world.chunkSource.addRegionTicket(TicketType.POST_TELEPORT, chunkPos, 1, player.id) world.chunkSource.addRegionTicket(TicketType.POST_TELEPORT, chunkPos, 1, player.id)
player.connection.resetPosition() player.connection.resetPosition()
player.setPos(target) player.setPos(target)
IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, MsgBlinkAck(delta)) IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, MsgBlinkS2C(delta))
} }
} }
} }

View file

@ -7,8 +7,8 @@ import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.common.items.storage.ItemScroll; import at.petrak.hexcasting.common.items.storage.ItemScroll;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.common.lib.HexSounds;
import at.petrak.hexcasting.common.network.MsgNewWallScrollAck; import at.petrak.hexcasting.common.msgs.MsgNewWallScrollS2C;
import at.petrak.hexcasting.common.network.MsgRecalcWallScrollDisplayAck; import at.petrak.hexcasting.common.msgs.MsgRecalcWallScrollDisplayS2C;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -137,7 +137,7 @@ public class EntityWallScroll extends HangingEntity {
if (pPlayer.getLevel() instanceof ServerLevel slevel) { if (pPlayer.getLevel() instanceof ServerLevel slevel) {
IXplatAbstractions.INSTANCE.sendPacketNear(this.position(), 32.0, slevel, IXplatAbstractions.INSTANCE.sendPacketNear(this.position(), 32.0, slevel,
new MsgRecalcWallScrollDisplayAck(this.getId(), true)); new MsgRecalcWallScrollDisplayS2C(this.getId(), true));
} else { } else {
// Beat the packet roundtrip to the punch to get a quicker visual // Beat the packet roundtrip to the punch to get a quicker visual
this.recalculateDisplay(); this.recalculateDisplay();
@ -155,7 +155,7 @@ public class EntityWallScroll extends HangingEntity {
@Override @Override
public Packet<?> getAddEntityPacket() { public Packet<?> getAddEntityPacket() {
return IXplatAbstractions.INSTANCE.toVanillaClientboundPacket( return IXplatAbstractions.INSTANCE.toVanillaClientboundPacket(
new MsgNewWallScrollAck(new ClientboundAddEntityPacket(this), new MsgNewWallScrollS2C(new ClientboundAddEntityPacket(this),
pos, direction, scroll, getShowsStrokeOrder(), blockSize)); pos, direction, scroll, getShowsStrokeOrder(), blockSize));
} }

View file

@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.items;
import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.annotations.SoftImplement;
import at.petrak.hexcasting.api.misc.DiscoveryHandlers; import at.petrak.hexcasting.api.misc.DiscoveryHandlers;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.network.MsgUpdateComparatorVisualsAck; import at.petrak.hexcasting.common.msgs.MsgUpdateComparatorVisualsS2C;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -92,7 +92,8 @@ public class ItemLens extends Item implements Wearable {
if (state.is(Blocks.COMPARATOR)) { if (state.is(Blocks.COMPARATOR)) {
syncComparatorValue(player, pos, syncComparatorValue(player, pos,
state.getDirectSignal(player.level, pos, state.getValue(BlockStateProperties.HORIZONTAL_FACING)), bee); state.getDirectSignal(player.level, pos, state.getValue(BlockStateProperties.HORIZONTAL_FACING)),
bee);
} else if (state.hasAnalogOutputSignal()) { } else if (state.hasAnalogOutputSignal()) {
syncComparatorValue(player, pos, state.getAnalogOutputSignal(player.level, pos), bee); syncComparatorValue(player, pos, state.getAnalogOutputSignal(player.level, pos), bee);
} else { } else {
@ -110,13 +111,14 @@ public class ItemLens extends Item implements Wearable {
if (previousComparator != null || previousBee != null) { if (previousComparator != null || previousBee != null) {
comparatorDataMap.remove(player); comparatorDataMap.remove(player);
beeDataMap.remove(player); beeDataMap.remove(player);
IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsAck(null, -1, -1)); IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsS2C(null, -1, -1));
} }
} else if (previousComparator == null || !pos.equals(previousComparator.getFirst()) || comparator != previousComparator.getSecond() || } else if (previousComparator == null || !pos.equals(previousComparator.getFirst()) || comparator != previousComparator.getSecond() ||
previousBee == null || !pos.equals(previousBee.getFirst()) || bee != previousBee.getSecond()) { previousBee == null || !pos.equals(previousBee.getFirst()) || bee != previousBee.getSecond()) {
comparatorDataMap.put(player, new Pair<>(pos, comparator)); comparatorDataMap.put(player, new Pair<>(pos, comparator));
beeDataMap.put(player, new Pair<>(pos, bee)); beeDataMap.put(player, new Pair<>(pos, bee));
IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsAck(pos, comparator, bee)); IXplatAbstractions.INSTANCE.sendPacketToPlayer(player, new MsgUpdateComparatorVisualsS2C(pos, comparator,
bee));
} }
} }

View file

@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.items;
import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.common.lib.HexSounds;
import at.petrak.hexcasting.common.network.MsgOpenSpellGuiAck; import at.petrak.hexcasting.common.msgs.MsgOpenSpellGuiS2C;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
@ -38,7 +38,7 @@ public class ItemStaff extends Item {
var descs = harness.generateDescs(); var descs = harness.generateDescs();
IXplatAbstractions.INSTANCE.sendPacketToPlayer(serverPlayer, IXplatAbstractions.INSTANCE.sendPacketToPlayer(serverPlayer,
new MsgOpenSpellGuiAck(hand, patterns, descs.getFirst(), descs.getSecond(), new MsgOpenSpellGuiS2C(hand, patterns, descs.getFirst(), descs.getSecond(),
0)); // TODO: Fix! 0)); // TODO: Fix!
} }

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3;
import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.api.HexAPI.modLoc;
public record MsgBeepAck(Vec3 target, int note, NoteBlockInstrument instrument) implements IMessage { public record MsgBeepS2C(Vec3 target, int note, NoteBlockInstrument instrument) implements IMessage {
public static final ResourceLocation ID = modLoc("beep"); public static final ResourceLocation ID = modLoc("beep");
@Override @Override
@ -19,14 +19,14 @@ public record MsgBeepAck(Vec3 target, int note, NoteBlockInstrument instrument)
return ID; return ID;
} }
public static MsgBeepAck deserialize(ByteBuf buffer) { public static MsgBeepS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var x = buf.readDouble(); var x = buf.readDouble();
var y = buf.readDouble(); var y = buf.readDouble();
var z = buf.readDouble(); var z = buf.readDouble();
var note = buf.readInt(); var note = buf.readInt();
var instrument = buf.readEnum(NoteBlockInstrument.class); var instrument = buf.readEnum(NoteBlockInstrument.class);
return new MsgBeepAck(new Vec3(x, y, z), note, instrument); return new MsgBeepS2C(new Vec3(x, y, z), note, instrument);
} }
@Override @Override
@ -38,7 +38,7 @@ public record MsgBeepAck(Vec3 target, int note, NoteBlockInstrument instrument)
buf.writeEnum(instrument); buf.writeEnum(instrument);
} }
public static void handle(MsgBeepAck msg) { public static void handle(MsgBeepS2C msg) {
Minecraft.getInstance().execute(new Runnable() { Minecraft.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -11,7 +11,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent server->client to synchronize OpBlink when the target is a player. * Sent server->client to synchronize OpBlink when the target is a player.
*/ */
public record MsgBlinkAck(Vec3 addedPosition) implements IMessage { public record MsgBlinkS2C(Vec3 addedPosition) implements IMessage {
public static final ResourceLocation ID = modLoc("blink"); public static final ResourceLocation ID = modLoc("blink");
@Override @Override
@ -19,12 +19,12 @@ public record MsgBlinkAck(Vec3 addedPosition) implements IMessage {
return ID; return ID;
} }
public static MsgBlinkAck deserialize(ByteBuf buffer) { public static MsgBlinkS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var x = buf.readDouble(); var x = buf.readDouble();
var y = buf.readDouble(); var y = buf.readDouble();
var z = buf.readDouble(); var z = buf.readDouble();
return new MsgBlinkAck(new Vec3(x, y, z)); return new MsgBlinkS2C(new Vec3(x, y, z));
} }
@Override @Override
@ -34,7 +34,7 @@ public record MsgBlinkAck(Vec3 addedPosition) implements IMessage {
buf.writeDouble(this.addedPosition.z); buf.writeDouble(this.addedPosition.z);
} }
public static void handle(MsgBlinkAck self) { public static void handle(MsgBlinkS2C self) {
Minecraft.getInstance().execute(new Runnable() { Minecraft.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.casting.ParticleSpray; import at.petrak.hexcasting.api.casting.ParticleSpray;
import at.petrak.hexcasting.api.pigment.FrozenPigment; import at.petrak.hexcasting.api.pigment.FrozenPigment;
@ -18,7 +18,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent server->client to spray particles everywhere. * Sent server->client to spray particles everywhere.
*/ */
public record MsgCastParticleAck(ParticleSpray spray, FrozenPigment colorizer) implements IMessage { public record MsgCastParticleS2C(ParticleSpray spray, FrozenPigment colorizer) implements IMessage {
public static final ResourceLocation ID = modLoc("cprtcl"); public static final ResourceLocation ID = modLoc("cprtcl");
@Override @Override
@ -26,7 +26,7 @@ public record MsgCastParticleAck(ParticleSpray spray, FrozenPigment colorizer) i
return ID; return ID;
} }
public static MsgCastParticleAck deserialize(ByteBuf buffer) { public static MsgCastParticleS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var posX = buf.readDouble(); var posX = buf.readDouble();
var posY = buf.readDouble(); var posY = buf.readDouble();
@ -39,7 +39,7 @@ public record MsgCastParticleAck(ParticleSpray spray, FrozenPigment colorizer) i
var count = buf.readInt(); var count = buf.readInt();
var tag = buf.readAnySizeNbt(); var tag = buf.readAnySizeNbt();
var colorizer = FrozenPigment.fromNBT(tag); var colorizer = FrozenPigment.fromNBT(tag);
return new MsgCastParticleAck( return new MsgCastParticleS2C(
new ParticleSpray(new Vec3(posX, posY, posZ), new Vec3(velX, velY, velZ), fuzziness, spread, count), new ParticleSpray(new Vec3(posX, posY, posZ), new Vec3(velX, velY, velZ), fuzziness, spread, count),
colorizer); colorizer);
} }
@ -68,7 +68,7 @@ public record MsgCastParticleAck(ParticleSpray spray, FrozenPigment colorizer) i
return new Vec3(Math.sqrt(1.0 - z * z) * Math.cos(th), Math.sqrt(1.0 - z * z) * Math.sin(th), z); return new Vec3(Math.sqrt(1.0 - z * z) * Math.cos(th), Math.sqrt(1.0 - z * z) * Math.sin(th), z);
} }
public static void handle(MsgCastParticleAck msg) { public static void handle(MsgCastParticleS2C msg) {
Minecraft.getInstance().execute(new Runnable() { Minecraft.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern;
import at.petrak.hexcasting.api.casting.eval.env.StaffCastEnv; import at.petrak.hexcasting.api.casting.eval.env.StaffCastEnv;
@ -17,9 +17,9 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent client->server when the player finishes drawing a pattern. * Sent client->server when the player finishes drawing a pattern.
* Server will send back a {@link MsgNewSpellPatternAck} packet * Server will send back a {@link MsgNewSpellPatternS2C} packet
*/ */
public record MsgNewSpellPatternSyn(InteractionHand handUsed, HexPattern pattern, public record MsgNewSpellPatternC2S(InteractionHand handUsed, HexPattern pattern,
List<ResolvedPattern> resolvedPatterns) List<ResolvedPattern> resolvedPatterns)
implements IMessage { implements IMessage {
public static final ResourceLocation ID = modLoc("pat_cs"); public static final ResourceLocation ID = modLoc("pat_cs");
@ -29,7 +29,7 @@ public record MsgNewSpellPatternSyn(InteractionHand handUsed, HexPattern pattern
return ID; return ID;
} }
public static MsgNewSpellPatternSyn deserialize(ByteBuf buffer) { public static MsgNewSpellPatternC2S deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var hand = buf.readEnum(InteractionHand.class); var hand = buf.readEnum(InteractionHand.class);
var pattern = HexPattern.fromNBT(buf.readNbt()); var pattern = HexPattern.fromNBT(buf.readNbt());
@ -39,7 +39,7 @@ public record MsgNewSpellPatternSyn(InteractionHand handUsed, HexPattern pattern
for (int i = 0; i < resolvedPatternsLen; i++) { for (int i = 0; i < resolvedPatternsLen; i++) {
resolvedPatterns.add(ResolvedPattern.fromNBT(buf.readNbt())); resolvedPatterns.add(ResolvedPattern.fromNBT(buf.readNbt()));
} }
return new MsgNewSpellPatternSyn(hand, pattern, resolvedPatterns); return new MsgNewSpellPatternC2S(hand, pattern, resolvedPatterns);
} }
@Override @Override

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.casting.eval.ExecutionClientView; import at.petrak.hexcasting.api.casting.eval.ExecutionClientView;
import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType; import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType;
@ -16,7 +16,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent server->client when the player finishes casting a spell. * Sent server->client when the player finishes casting a spell.
*/ */
public record MsgNewSpellPatternAck(ExecutionClientView info, int index) implements IMessage { public record MsgNewSpellPatternS2C(ExecutionClientView info, int index) implements IMessage {
public static final ResourceLocation ID = modLoc("pat_sc"); public static final ResourceLocation ID = modLoc("pat_sc");
@Override @Override
@ -24,7 +24,7 @@ public record MsgNewSpellPatternAck(ExecutionClientView info, int index) impleme
return ID; return ID;
} }
public static MsgNewSpellPatternAck deserialize(ByteBuf buffer) { public static MsgNewSpellPatternS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var isStackEmpty = buf.readBoolean(); var isStackEmpty = buf.readBoolean();
@ -34,7 +34,7 @@ public record MsgNewSpellPatternAck(ExecutionClientView info, int index) impleme
var stack = buf.readList(FriendlyByteBuf::readNbt); var stack = buf.readList(FriendlyByteBuf::readNbt);
var raven = buf.readOptional(FriendlyByteBuf::readNbt).orElse(null); var raven = buf.readOptional(FriendlyByteBuf::readNbt).orElse(null);
return new MsgNewSpellPatternAck( return new MsgNewSpellPatternS2C(
new ExecutionClientView(isStackEmpty, resolutionType, stack, raven), index new ExecutionClientView(isStackEmpty, resolutionType, stack, raven), index
); );
} }
@ -49,7 +49,7 @@ public record MsgNewSpellPatternAck(ExecutionClientView info, int index) impleme
buf.writeOptional(Optional.ofNullable(this.info.getRavenmind()), FriendlyByteBuf::writeNbt); buf.writeOptional(Optional.ofNullable(this.info.getRavenmind()), FriendlyByteBuf::writeNbt);
} }
public static void handle(MsgNewSpellPatternAck self) { public static void handle(MsgNewSpellPatternS2C self) {
Minecraft.getInstance().execute(() -> { Minecraft.getInstance().execute(() -> {
var mc = Minecraft.getInstance(); var mc = Minecraft.getInstance();
if (self.info().isStackClear()) { if (self.info().isStackClear()) {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.utils.HexUtils; import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.common.entities.EntityWallScroll;
@ -13,7 +13,7 @@ import net.minecraft.world.item.ItemStack;
import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.api.HexAPI.modLoc;
// https://github.com/VazkiiMods/Botania/blob/1.18.x/Xplat/src/main/java/vazkii/botania/network/clientbound/PacketSpawnDoppleganger.java // https://github.com/VazkiiMods/Botania/blob/1.18.x/Xplat/src/main/java/vazkii/botania/network/clientbound/PacketSpawnDoppleganger.java
public record MsgNewWallScrollAck(ClientboundAddEntityPacket inner, BlockPos pos, Direction dir, ItemStack scrollItem, public record MsgNewWallScrollS2C(ClientboundAddEntityPacket inner, BlockPos pos, Direction dir, ItemStack scrollItem,
boolean showsStrokeOrder, int blockSize) implements IMessage { boolean showsStrokeOrder, int blockSize) implements IMessage {
public static final ResourceLocation ID = modLoc("wallscr"); public static final ResourceLocation ID = modLoc("wallscr");
@ -32,17 +32,17 @@ public record MsgNewWallScrollAck(ClientboundAddEntityPacket inner, BlockPos pos
buf.writeVarInt(blockSize); buf.writeVarInt(blockSize);
} }
public static MsgNewWallScrollAck deserialize(FriendlyByteBuf buf) { public static MsgNewWallScrollS2C deserialize(FriendlyByteBuf buf) {
var inner = new ClientboundAddEntityPacket(buf); var inner = new ClientboundAddEntityPacket(buf);
var pos = buf.readBlockPos(); var pos = buf.readBlockPos();
var dir = HexUtils.getSafe(Direction.values(), buf.readByte()); var dir = HexUtils.getSafe(Direction.values(), buf.readByte());
var scroll = buf.readItem(); var scroll = buf.readItem();
var strokeOrder = buf.readBoolean(); var strokeOrder = buf.readBoolean();
var blockSize = buf.readVarInt(); var blockSize = buf.readVarInt();
return new MsgNewWallScrollAck(inner, pos, dir, scroll, strokeOrder, blockSize); return new MsgNewWallScrollS2C(inner, pos, dir, scroll, strokeOrder, blockSize);
} }
public static void handle(MsgNewWallScrollAck self) { public static void handle(MsgNewWallScrollS2C self) {
Minecraft.getInstance().execute(new Runnable() { Minecraft.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern;
import at.petrak.hexcasting.client.gui.GuiSpellcasting; import at.petrak.hexcasting.client.gui.GuiSpellcasting;
@ -16,7 +16,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent server->client when the player opens the spell gui to request the server provide the current stack. * Sent server->client when the player opens the spell gui to request the server provide the current stack.
*/ */
public record MsgOpenSpellGuiAck(InteractionHand hand, List<ResolvedPattern> patterns, public record MsgOpenSpellGuiS2C(InteractionHand hand, List<ResolvedPattern> patterns,
List<CompoundTag> stack, List<CompoundTag> stack,
CompoundTag ravenmind, CompoundTag ravenmind,
int parenCount int parenCount
@ -29,7 +29,7 @@ public record MsgOpenSpellGuiAck(InteractionHand hand, List<ResolvedPattern> pat
return ID; return ID;
} }
public static MsgOpenSpellGuiAck deserialize(ByteBuf buffer) { public static MsgOpenSpellGuiS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var hand = buf.readEnum(InteractionHand.class); var hand = buf.readEnum(InteractionHand.class);
@ -41,7 +41,7 @@ public record MsgOpenSpellGuiAck(InteractionHand hand, List<ResolvedPattern> pat
var parenCount = buf.readVarInt(); var parenCount = buf.readVarInt();
return new MsgOpenSpellGuiAck(hand, patterns, stack, raven, parenCount); return new MsgOpenSpellGuiS2C(hand, patterns, stack, raven, parenCount);
} }
public void serialize(FriendlyByteBuf buf) { public void serialize(FriendlyByteBuf buf) {
@ -55,7 +55,7 @@ public record MsgOpenSpellGuiAck(InteractionHand hand, List<ResolvedPattern> pat
buf.writeVarInt(this.parenCount); buf.writeVarInt(this.parenCount);
} }
public static void handle(MsgOpenSpellGuiAck msg) { public static void handle(MsgOpenSpellGuiS2C msg) {
Minecraft.getInstance().execute(() -> { Minecraft.getInstance().execute(() -> {
var mc = Minecraft.getInstance(); var mc = Minecraft.getInstance();
mc.setScreen( mc.setScreen(

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.common.entities.EntityWallScroll; import at.petrak.hexcasting.common.entities.EntityWallScroll;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -11,14 +11,14 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent S->C to have a wall scroll recalculate its pattern, to get readability offset. * Sent S->C to have a wall scroll recalculate its pattern, to get readability offset.
*/ */
public record MsgRecalcWallScrollDisplayAck(int entityId, boolean showStrokeOrder) implements IMessage { public record MsgRecalcWallScrollDisplayS2C(int entityId, boolean showStrokeOrder) implements IMessage {
public static final ResourceLocation ID = modLoc("redoscroll"); public static final ResourceLocation ID = modLoc("redoscroll");
public static MsgRecalcWallScrollDisplayAck deserialize(ByteBuf buffer) { public static MsgRecalcWallScrollDisplayS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var id = buf.readVarInt(); var id = buf.readVarInt();
var showStrokeOrder = buf.readBoolean(); var showStrokeOrder = buf.readBoolean();
return new MsgRecalcWallScrollDisplayAck(id, showStrokeOrder); return new MsgRecalcWallScrollDisplayS2C(id, showStrokeOrder);
} }
@Override @Override
@ -32,7 +32,7 @@ public record MsgRecalcWallScrollDisplayAck(int entityId, boolean showStrokeOrde
return ID; return ID;
} }
public static void handle(MsgRecalcWallScrollDisplayAck msg) { public static void handle(MsgRecalcWallScrollDisplayS2C msg) {
Minecraft.getInstance().execute(new Runnable() { Minecraft.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.casting.iota.IotaType; import at.petrak.hexcasting.api.casting.iota.IotaType;
import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.api.utils.NBTHelper;
@ -24,7 +24,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
* Sent client->server when the client shift+scrolls with a shift-scrollable item * Sent client->server when the client shift+scrolls with a shift-scrollable item
* or scrolls in the spellcasting UI. * or scrolls in the spellcasting UI.
*/ */
public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boolean isCtrl, boolean invertSpellbook, public record MsgShiftScrollC2S(double mainHandDelta, double offHandDelta, boolean isCtrl, boolean invertSpellbook,
boolean invertAbacus) implements IMessage { boolean invertAbacus) implements IMessage {
public static final ResourceLocation ID = modLoc("scroll"); public static final ResourceLocation ID = modLoc("scroll");
@ -33,14 +33,14 @@ public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boole
return ID; return ID;
} }
public static MsgShiftScrollSyn deserialize(ByteBuf buffer) { public static MsgShiftScrollC2S deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
var mainHandDelta = buf.readDouble(); var mainHandDelta = buf.readDouble();
var offHandDelta = buf.readDouble(); var offHandDelta = buf.readDouble();
var isCtrl = buf.readBoolean(); var isCtrl = buf.readBoolean();
var invertSpellbook = buf.readBoolean(); var invertSpellbook = buf.readBoolean();
var invertAbacus = buf.readBoolean(); var invertAbacus = buf.readBoolean();
return new MsgShiftScrollSyn(mainHandDelta, offHandDelta, isCtrl, invertSpellbook, invertAbacus); return new MsgShiftScrollC2S(mainHandDelta, offHandDelta, isCtrl, invertSpellbook, invertAbacus);
} }
public void serialize(FriendlyByteBuf buf) { public void serialize(FriendlyByteBuf buf) {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.common.network; package at.petrak.hexcasting.common.msgs;
import at.petrak.hexcasting.api.client.ScryingLensOverlayRegistry; import at.petrak.hexcasting.api.client.ScryingLensOverlayRegistry;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -10,9 +10,10 @@ import net.minecraft.resources.ResourceLocation;
import static at.petrak.hexcasting.api.HexAPI.modLoc; import static at.petrak.hexcasting.api.HexAPI.modLoc;
/** /**
* Sent server->client when a player is looking at a block through a lens whose comparator value is not the same as what they last saw. * Sent server->client when a player is looking at a block through a lens whose comparator value is not the same as
* what they last saw.
*/ */
public record MsgUpdateComparatorVisualsAck(BlockPos pos, int comparator, int bee) implements IMessage { public record MsgUpdateComparatorVisualsS2C(BlockPos pos, int comparator, int bee) implements IMessage {
public static final ResourceLocation ID = modLoc("cmp"); public static final ResourceLocation ID = modLoc("cmp");
@Override @Override
@ -20,14 +21,14 @@ public record MsgUpdateComparatorVisualsAck(BlockPos pos, int comparator, int be
return ID; return ID;
} }
public static MsgUpdateComparatorVisualsAck deserialize(ByteBuf buffer) { public static MsgUpdateComparatorVisualsS2C deserialize(ByteBuf buffer) {
var buf = new FriendlyByteBuf(buffer); var buf = new FriendlyByteBuf(buffer);
int comparator = buf.readInt(); int comparator = buf.readInt();
int bee = buf.readInt(); int bee = buf.readInt();
BlockPos pos = comparator == -1 && bee == -1 ? null : buf.readBlockPos(); BlockPos pos = comparator == -1 && bee == -1 ? null : buf.readBlockPos();
return new MsgUpdateComparatorVisualsAck(pos, comparator, bee); return new MsgUpdateComparatorVisualsS2C(pos, comparator, bee);
} }
public void serialize(FriendlyByteBuf buf) { public void serialize(FriendlyByteBuf buf) {
@ -38,7 +39,7 @@ public record MsgUpdateComparatorVisualsAck(BlockPos pos, int comparator, int be
} }
} }
public static void handle(MsgUpdateComparatorVisualsAck msg) { public static void handle(MsgUpdateComparatorVisualsS2C msg) {
Minecraft.getInstance().execute(new Runnable() { Minecraft.getInstance().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.xplat; package at.petrak.hexcasting.xplat;
import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.item.ItemPropertyFunction; import net.minecraft.client.renderer.item.ItemPropertyFunction;

View file

@ -16,7 +16,7 @@ import at.petrak.hexcasting.api.pigment.FrozenPigment;
import at.petrak.hexcasting.api.player.AltioraAbility; import at.petrak.hexcasting.api.player.AltioraAbility;
import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.FlightAbility;
import at.petrak.hexcasting.api.player.Sentinel; import at.petrak.hexcasting.api.player.Sentinel;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.interop.pehkui.PehkuiInterop; import at.petrak.hexcasting.interop.pehkui.PehkuiInterop;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.fabric.network; package at.petrak.hexcasting.fabric.network;
import at.petrak.hexcasting.common.network.*; import at.petrak.hexcasting.common.msgs.*;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
@ -13,10 +13,10 @@ import java.util.function.Function;
public class FabricPacketHandler { public class FabricPacketHandler {
public static void init() { public static void init() {
ServerPlayNetworking.registerGlobalReceiver(MsgNewSpellPatternSyn.ID, ServerPlayNetworking.registerGlobalReceiver(MsgNewSpellPatternC2S.ID,
makeServerBoundHandler(MsgNewSpellPatternSyn::deserialize, MsgNewSpellPatternSyn::handle)); makeServerBoundHandler(MsgNewSpellPatternC2S::deserialize, MsgNewSpellPatternC2S::handle));
ServerPlayNetworking.registerGlobalReceiver( ServerPlayNetworking.registerGlobalReceiver(
MsgShiftScrollSyn.ID, makeServerBoundHandler(MsgShiftScrollSyn::deserialize, MsgShiftScrollSyn::handle)); MsgShiftScrollC2S.ID, makeServerBoundHandler(MsgShiftScrollC2S::deserialize, MsgShiftScrollC2S::handle));
} }
private static <T> ServerPlayNetworking.PlayChannelHandler makeServerBoundHandler( private static <T> ServerPlayNetworking.PlayChannelHandler makeServerBoundHandler(
@ -25,22 +25,22 @@ public class FabricPacketHandler {
} }
public static void initClient() { public static void initClient() {
ClientPlayNetworking.registerGlobalReceiver(MsgNewSpellPatternAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgNewSpellPatternS2C.ID,
makeClientBoundHandler(MsgNewSpellPatternAck::deserialize, MsgNewSpellPatternAck::handle)); makeClientBoundHandler(MsgNewSpellPatternS2C::deserialize, MsgNewSpellPatternS2C::handle));
ClientPlayNetworking.registerGlobalReceiver( ClientPlayNetworking.registerGlobalReceiver(
MsgBlinkAck.ID, makeClientBoundHandler(MsgBlinkAck::deserialize, MsgBlinkAck::handle)); MsgBlinkS2C.ID, makeClientBoundHandler(MsgBlinkS2C::deserialize, MsgBlinkS2C::handle));
ClientPlayNetworking.registerGlobalReceiver(MsgCastParticleAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgCastParticleS2C.ID,
makeClientBoundHandler(MsgCastParticleAck::deserialize, MsgCastParticleAck::handle)); makeClientBoundHandler(MsgCastParticleS2C::deserialize, MsgCastParticleS2C::handle));
ClientPlayNetworking.registerGlobalReceiver(MsgOpenSpellGuiAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgOpenSpellGuiS2C.ID,
makeClientBoundHandler(MsgOpenSpellGuiAck::deserialize, MsgOpenSpellGuiAck::handle)); makeClientBoundHandler(MsgOpenSpellGuiS2C::deserialize, MsgOpenSpellGuiS2C::handle));
ClientPlayNetworking.registerGlobalReceiver(MsgBeepAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgBeepS2C.ID,
makeClientBoundHandler(MsgBeepAck::deserialize, MsgBeepAck::handle)); makeClientBoundHandler(MsgBeepS2C::deserialize, MsgBeepS2C::handle));
ClientPlayNetworking.registerGlobalReceiver(MsgUpdateComparatorVisualsAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgUpdateComparatorVisualsS2C.ID,
makeClientBoundHandler(MsgUpdateComparatorVisualsAck::deserialize, MsgUpdateComparatorVisualsAck::handle)); makeClientBoundHandler(MsgUpdateComparatorVisualsS2C::deserialize, MsgUpdateComparatorVisualsS2C::handle));
ClientPlayNetworking.registerGlobalReceiver(MsgNewWallScrollAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgNewWallScrollS2C.ID,
makeClientBoundHandler(MsgNewWallScrollAck::deserialize, MsgNewWallScrollAck::handle)); makeClientBoundHandler(MsgNewWallScrollS2C::deserialize, MsgNewWallScrollS2C::handle));
ClientPlayNetworking.registerGlobalReceiver(MsgRecalcWallScrollDisplayAck.ID, ClientPlayNetworking.registerGlobalReceiver(MsgRecalcWallScrollDisplayS2C.ID,
makeClientBoundHandler(MsgRecalcWallScrollDisplayAck::deserialize, MsgRecalcWallScrollDisplayAck::handle)); makeClientBoundHandler(MsgRecalcWallScrollDisplayS2C::deserialize, MsgRecalcWallScrollDisplayS2C::handle));
} }
private static <T> ClientPlayNetworking.PlayChannelHandler makeClientBoundHandler( private static <T> ClientPlayNetworking.PlayChannelHandler makeClientBoundHandler(

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.fabric.xplat; package at.petrak.hexcasting.fabric.xplat;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.fabric.client.ExtendedTexture; import at.petrak.hexcasting.fabric.client.ExtendedTexture;
import at.petrak.hexcasting.fabric.interop.trinkets.TrinketsApiInterop; import at.petrak.hexcasting.fabric.interop.trinkets.TrinketsApiInterop;
import at.petrak.hexcasting.interop.HexInterop; import at.petrak.hexcasting.interop.HexInterop;

View file

@ -19,7 +19,7 @@ import at.petrak.hexcasting.api.player.AltioraAbility;
import at.petrak.hexcasting.api.player.FlightAbility; import at.petrak.hexcasting.api.player.FlightAbility;
import at.petrak.hexcasting.api.player.Sentinel; import at.petrak.hexcasting.api.player.Sentinel;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.fabric.cc.HexCardinalComponents; import at.petrak.hexcasting.fabric.cc.HexCardinalComponents;
import at.petrak.hexcasting.fabric.interop.gravity.GravityApiInterop; import at.petrak.hexcasting.fabric.interop.gravity.GravityApiInterop;
import at.petrak.hexcasting.fabric.interop.trinkets.TrinketsApiInterop; import at.petrak.hexcasting.fabric.interop.trinkets.TrinketsApiInterop;

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.forge.network; package at.petrak.hexcasting.forge.network;
import at.petrak.hexcasting.common.network.*; import at.petrak.hexcasting.common.msgs.*;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
@ -31,41 +31,41 @@ public class ForgePacketHandler {
int messageIdx = 0; int messageIdx = 0;
// Client -> server // Client -> server
NETWORK.registerMessage(messageIdx++, MsgNewSpellPatternSyn.class, MsgNewSpellPatternSyn::serialize, NETWORK.registerMessage(messageIdx++, MsgNewSpellPatternC2S.class, MsgNewSpellPatternC2S::serialize,
MsgNewSpellPatternSyn::deserialize, makeServerBoundHandler(MsgNewSpellPatternSyn::handle)); MsgNewSpellPatternC2S::deserialize, makeServerBoundHandler(MsgNewSpellPatternC2S::handle));
NETWORK.registerMessage(messageIdx++, MsgShiftScrollSyn.class, MsgShiftScrollSyn::serialize, NETWORK.registerMessage(messageIdx++, MsgShiftScrollC2S.class, MsgShiftScrollC2S::serialize,
MsgShiftScrollSyn::deserialize, makeServerBoundHandler(MsgShiftScrollSyn::handle)); MsgShiftScrollC2S::deserialize, makeServerBoundHandler(MsgShiftScrollC2S::handle));
// Server -> client // Server -> client
NETWORK.registerMessage(messageIdx++, MsgNewSpellPatternAck.class, MsgNewSpellPatternAck::serialize, NETWORK.registerMessage(messageIdx++, MsgNewSpellPatternS2C.class, MsgNewSpellPatternS2C::serialize,
MsgNewSpellPatternAck::deserialize, makeClientBoundHandler(MsgNewSpellPatternAck::handle)); MsgNewSpellPatternS2C::deserialize, makeClientBoundHandler(MsgNewSpellPatternS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgBlinkAck.class, MsgBlinkAck::serialize, NETWORK.registerMessage(messageIdx++, MsgBlinkS2C.class, MsgBlinkS2C::serialize,
MsgBlinkAck::deserialize, makeClientBoundHandler(MsgBlinkAck::handle)); MsgBlinkS2C::deserialize, makeClientBoundHandler(MsgBlinkS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgSentinelStatusUpdateAck.class, MsgSentinelStatusUpdateAck::serialize, NETWORK.registerMessage(messageIdx++, MsgSentinelStatusUpdateAck.class, MsgSentinelStatusUpdateAck::serialize,
MsgSentinelStatusUpdateAck::deserialize, makeClientBoundHandler(MsgSentinelStatusUpdateAck::handle)); MsgSentinelStatusUpdateAck::deserialize, makeClientBoundHandler(MsgSentinelStatusUpdateAck::handle));
NETWORK.registerMessage(messageIdx++, MsgColorizerUpdateAck.class, MsgColorizerUpdateAck::serialize, NETWORK.registerMessage(messageIdx++, MsgColorizerUpdateAck.class, MsgColorizerUpdateAck::serialize,
MsgColorizerUpdateAck::deserialize, makeClientBoundHandler(MsgColorizerUpdateAck::handle)); MsgColorizerUpdateAck::deserialize, makeClientBoundHandler(MsgColorizerUpdateAck::handle));
NETWORK.registerMessage(messageIdx++, MsgAltioraUpdateAck.class, MsgAltioraUpdateAck::serialize, NETWORK.registerMessage(messageIdx++, MsgAltioraUpdateAck.class, MsgAltioraUpdateAck::serialize,
MsgAltioraUpdateAck::deserialize, makeClientBoundHandler(MsgAltioraUpdateAck::handle)); MsgAltioraUpdateAck::deserialize, makeClientBoundHandler(MsgAltioraUpdateAck::handle));
NETWORK.registerMessage(messageIdx++, MsgCastParticleAck.class, MsgCastParticleAck::serialize, NETWORK.registerMessage(messageIdx++, MsgCastParticleS2C.class, MsgCastParticleS2C::serialize,
MsgCastParticleAck::deserialize, makeClientBoundHandler(MsgCastParticleAck::handle)); MsgCastParticleS2C::deserialize, makeClientBoundHandler(MsgCastParticleS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgOpenSpellGuiAck.class, MsgOpenSpellGuiAck::serialize, NETWORK.registerMessage(messageIdx++, MsgOpenSpellGuiS2C.class, MsgOpenSpellGuiS2C::serialize,
MsgOpenSpellGuiAck::deserialize, makeClientBoundHandler(MsgOpenSpellGuiAck::handle)); MsgOpenSpellGuiS2C::deserialize, makeClientBoundHandler(MsgOpenSpellGuiS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgBeepAck.class, MsgBeepAck::serialize, NETWORK.registerMessage(messageIdx++, MsgBeepS2C.class, MsgBeepS2C::serialize,
MsgBeepAck::deserialize, makeClientBoundHandler(MsgBeepAck::handle)); MsgBeepS2C::deserialize, makeClientBoundHandler(MsgBeepS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgBrainsweepAck.class, MsgBrainsweepAck::serialize, NETWORK.registerMessage(messageIdx++, MsgBrainsweepAck.class, MsgBrainsweepAck::serialize,
MsgBrainsweepAck::deserialize, makeClientBoundHandler(MsgBrainsweepAck::handle)); MsgBrainsweepAck::deserialize, makeClientBoundHandler(MsgBrainsweepAck::handle));
NETWORK.registerMessage(messageIdx++, MsgUpdateComparatorVisualsAck.class, NETWORK.registerMessage(messageIdx++, MsgUpdateComparatorVisualsS2C.class,
MsgUpdateComparatorVisualsAck::serialize, MsgUpdateComparatorVisualsS2C::serialize,
MsgUpdateComparatorVisualsAck::deserialize, MsgUpdateComparatorVisualsS2C::deserialize,
makeClientBoundHandler(MsgUpdateComparatorVisualsAck::handle)); makeClientBoundHandler(MsgUpdateComparatorVisualsS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgNewWallScrollAck.class, NETWORK.registerMessage(messageIdx++, MsgNewWallScrollS2C.class,
MsgNewWallScrollAck::serialize, MsgNewWallScrollS2C::serialize,
MsgNewWallScrollAck::deserialize, MsgNewWallScrollS2C::deserialize,
makeClientBoundHandler(MsgNewWallScrollAck::handle)); makeClientBoundHandler(MsgNewWallScrollS2C::handle));
NETWORK.registerMessage(messageIdx++, MsgRecalcWallScrollDisplayAck.class, NETWORK.registerMessage(messageIdx++, MsgRecalcWallScrollDisplayS2C.class,
MsgRecalcWallScrollDisplayAck::serialize, MsgRecalcWallScrollDisplayS2C::serialize,
MsgRecalcWallScrollDisplayAck::deserialize, makeClientBoundHandler(MsgRecalcWallScrollDisplayAck::handle)); MsgRecalcWallScrollDisplayS2C::deserialize, makeClientBoundHandler(MsgRecalcWallScrollDisplayS2C::handle));
} }
private static <T> BiConsumer<T, Supplier<NetworkEvent.Context>> makeServerBoundHandler( private static <T> BiConsumer<T, Supplier<NetworkEvent.Context>> makeServerBoundHandler(

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.forge.network; package at.petrak.hexcasting.forge.network;
import at.petrak.hexcasting.api.player.AltioraAbility; import at.petrak.hexcasting.api.player.AltioraAbility;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.forge.network; package at.petrak.hexcasting.forge.network;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.forge.network; package at.petrak.hexcasting.forge.network;
import at.petrak.hexcasting.api.pigment.FrozenPigment; import at.petrak.hexcasting.api.pigment.FrozenPigment;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.forge.network; package at.petrak.hexcasting.forge.network;
import at.petrak.hexcasting.api.player.Sentinel; import at.petrak.hexcasting.api.player.Sentinel;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.forge.xplat; package at.petrak.hexcasting.forge.xplat;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.forge.network.ForgePacketHandler; import at.petrak.hexcasting.forge.network.ForgePacketHandler;
import at.petrak.hexcasting.xplat.IClientXplatAbstractions; import at.petrak.hexcasting.xplat.IClientXplatAbstractions;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;

View file

@ -22,7 +22,7 @@ import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.lib.hex.HexEvalSounds; import at.petrak.hexcasting.common.lib.hex.HexEvalSounds;
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes; import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
import at.petrak.hexcasting.common.network.IMessage; import at.petrak.hexcasting.common.msgs.IMessage;
import at.petrak.hexcasting.forge.cap.CapSyncers; import at.petrak.hexcasting.forge.cap.CapSyncers;
import at.petrak.hexcasting.forge.cap.HexCapabilities; import at.petrak.hexcasting.forge.cap.HexCapabilities;
import at.petrak.hexcasting.forge.interop.curios.CuriosApiInterop; import at.petrak.hexcasting.forge.interop.curios.CuriosApiInterop;