Skip to content

Commit

Permalink
remove redundant type parameters from BotaniaPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
Abbie5 authored and artemisSystem committed Nov 12, 2024
1 parent f79236d commit c3b8a31
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import net.minecraft.network.protocol.common.custom.CustomPacketPayload;

import io.netty.buffer.ByteBuf;
import vazkii.botania.api.BotaniaAPI;

public interface BotaniaPacket<B extends ByteBuf, T extends BotaniaPacket<B, T>> extends CustomPacketPayload {
public interface BotaniaPacket extends CustomPacketPayload {
static <T extends CustomPacketPayload> Type<T> createType(String path) {
return new Type<>(BotaniaAPI.botaniaRL(path));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import vazkii.botania.common.item.rod.SkiesRodItem;
import vazkii.botania.network.BotaniaPacket;

public record AvatarSkiesRodPacket(boolean elytra) implements BotaniaPacket<ByteBuf, AvatarSkiesRodPacket> {
public record AvatarSkiesRodPacket(boolean elytra) implements BotaniaPacket {
public static final Type<AvatarSkiesRodPacket> ID = BotaniaPacket.createType("atr");
public static final StreamCodec<ByteBuf, AvatarSkiesRodPacket> STREAM_CODEC = ByteBufCodecs.BOOL
.map(AvatarSkiesRodPacket::new, AvatarSkiesRodPacket::elytra);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

// Prefer using World.addBlockEvent/Block.eventReceived/TileEntity.receiveClientEvent where possible
// as those use less network bandwidth (~14 bytes), vs 26+ bytes here
public record BotaniaEffectPacket(EffectType effectType, double x, double y, double z, int... args) implements BotaniaPacket<ByteBuf, BotaniaEffectPacket> {
public record BotaniaEffectPacket(EffectType effectType, double x, double y, double z, int... args) implements BotaniaPacket {

public static final Type<BotaniaEffectPacket> ID = BotaniaPacket.createType("eff");
private static final int MAX_VARIABLE_ARGS = 128;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import vazkii.botania.client.core.SkyblockWorldInfo;
import vazkii.botania.network.BotaniaPacket;

public class GogWorldPacket implements BotaniaPacket<ByteBuf, GogWorldPacket> {
public class GogWorldPacket implements BotaniaPacket {
public static final GogWorldPacket INSTANCE = new GogWorldPacket();
public static final Type<GogWorldPacket> ID = BotaniaPacket.createType("gog");
public static final StreamCodec<ByteBuf, GogWorldPacket> STREAM_CODEC = StreamCodec.unit(INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import vazkii.botania.network.BotaniaPacket;
import vazkii.botania.xplat.XplatAbstractions;

public record ItemAgePacket(int entityId, int timeCounter) implements BotaniaPacket<ByteBuf, ItemAgePacket> {
public record ItemAgePacket(int entityId, int timeCounter) implements BotaniaPacket {

public static final Type<ItemAgePacket> ID = BotaniaPacket.createType("ia");
public static final StreamCodec<ByteBuf, ItemAgePacket> STREAM_CODEC = StreamCodec.composite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.UUID;

public record SpawnGaiaGuardianPacket(ClientboundAddEntityPacket inner, int playerCount, boolean hardMode,
BlockPos source, UUID bossInfoId) implements BotaniaPacket<RegistryFriendlyByteBuf, SpawnGaiaGuardianPacket> {
BlockPos source, UUID bossInfoId) implements BotaniaPacket {

public static final Type<SpawnGaiaGuardianPacket> ID = BotaniaPacket.createType("spg");
public static final StreamCodec<RegistryFriendlyByteBuf, SpawnGaiaGuardianPacket> STREAM_CODEC = StreamCodec.composite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import java.util.Optional;

public record UpdateItemsRemainingPacket(ItemStack stack, int count, @Nullable Component tooltip) implements BotaniaPacket<RegistryFriendlyByteBuf, UpdateItemsRemainingPacket> {
public record UpdateItemsRemainingPacket(ItemStack stack, int count, @Nullable Component tooltip) implements BotaniaPacket {

public static final Type<UpdateItemsRemainingPacket> ID = BotaniaPacket.createType("rem");
public static final StreamCodec<RegistryFriendlyByteBuf, UpdateItemsRemainingPacket> STREAM_CODEC = StreamCodec.composite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import vazkii.botania.common.item.equipment.bauble.RingOfDexterousMotionItem;
import vazkii.botania.network.BotaniaPacket;

public class DodgePacket implements BotaniaPacket<ByteBuf, DodgePacket> {
public class DodgePacket implements BotaniaPacket {
public static final DodgePacket INSTANCE = new DodgePacket();
public static final Type<DodgePacket> ID = BotaniaPacket.createType("do");
public static final StreamCodec<ByteBuf, DodgePacket> STREAM_CODEC = StreamCodec.unit(INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import vazkii.botania.common.block.block_entity.corporea.CorporeaIndexBlockEntity;
import vazkii.botania.network.BotaniaPacket;

public record IndexKeybindRequestPacket(ItemStack stack) implements BotaniaPacket<RegistryFriendlyByteBuf, IndexKeybindRequestPacket> {
public record IndexKeybindRequestPacket(ItemStack stack) implements BotaniaPacket {
public static final Type<IndexKeybindRequestPacket> ID = BotaniaPacket.createType("idx");
public static final StreamCodec<RegistryFriendlyByteBuf, IndexKeybindRequestPacket> STREAM_CODEC = ItemStack.STREAM_CODEC
.map(IndexKeybindRequestPacket::new, IndexKeybindRequestPacket::stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import vazkii.botania.common.block.block_entity.corporea.CorporeaIndexBlockEntity;
import vazkii.botania.network.BotaniaPacket;

public record IndexStringRequestPacket(String message) implements BotaniaPacket<ByteBuf, IndexStringRequestPacket> {
public record IndexStringRequestPacket(String message) implements BotaniaPacket {
public static final Type<IndexStringRequestPacket> ID = BotaniaPacket.createType("idxs");
public static final StreamCodec<ByteBuf, IndexStringRequestPacket> STREAM_CODEC = ByteBufCodecs.STRING_UTF8
.map(IndexStringRequestPacket::new, IndexStringRequestPacket::message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import vazkii.botania.common.item.equipment.bauble.CirrusAmuletItem;
import vazkii.botania.network.BotaniaPacket;

public class JumpPacket implements BotaniaPacket<ByteBuf, JumpPacket> {
public class JumpPacket implements BotaniaPacket {
public static final JumpPacket INSTANCE = new JumpPacket();
public static final Type<JumpPacket> ID = BotaniaPacket.createType("jmp");
public static final StreamCodec<ByteBuf, JumpPacket> STREAM_CODEC = StreamCodec.unit(INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import vazkii.botania.common.item.equipment.tool.terrasteel.TerraBladeItem;
import vazkii.botania.network.BotaniaPacket;

public class LeftClickPacket implements BotaniaPacket<ByteBuf, LeftClickPacket> {
public class LeftClickPacket implements BotaniaPacket {
public static final LeftClickPacket INSTANCE = new LeftClickPacket();
public static final Type<LeftClickPacket> ID = BotaniaPacket.createType("lc");
public static final StreamCodec<ByteBuf, LeftClickPacket> STREAM_CODEC = StreamCodec.unit(INSTANCE);
Expand Down

0 comments on commit c3b8a31

Please sign in to comment.