PartitionData stuff

This commit is contained in:
XevianLight
2026-02-08 17:03:11 -07:00
parent ff08a51540
commit bc8bb4ee05
7 changed files with 710 additions and 18 deletions

View File

@@ -54,6 +54,7 @@ public class AphelionDebugOverlay {
// event.getLeft().add(" Sky: " + rendererSummary); // event.getLeft().add(" Sky: " + rendererSummary);
event.getLeft().add(" Station: " + x + " " + z + " ID: " + SpacePartitionSavedData.pack(x,z)); event.getLeft().add(" Station: " + x + " " + z + " ID: " + SpacePartitionSavedData.pack(x,z));
event.getLeft().add(" Station Destination:" + PartitionClientState.lastData().getDestination()); event.getLeft().add(" Station Destination:" + PartitionClientState.lastData().getDestination());
event.getLeft().add(" Station Owner:" + PartitionClientState.lastData().getOwner());
var server = mc.getSingleplayerServer(); var server = mc.getSingleplayerServer();
ServerLevel singlePlayerLevel; ServerLevel singlePlayerLevel;
if (server != null) { if (server != null) {

View File

@@ -1,5 +1,6 @@
package net.xevianlight.aphelion.commands; package net.xevianlight.aphelion.commands;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.LongArgumentType; import com.mojang.brigadier.arguments.LongArgumentType;
@@ -10,6 +11,7 @@ import net.minecraft.commands.arguments.*;
import net.minecraft.commands.arguments.coordinates.BlockPosArgument; import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
import net.minecraft.commands.arguments.coordinates.ColumnPosArgument; import net.minecraft.commands.arguments.coordinates.ColumnPosArgument;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.UUIDUtil;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.*; import net.minecraft.network.chat.*;
@@ -22,6 +24,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.xevianlight.aphelion.Aphelion; import net.xevianlight.aphelion.Aphelion;
import net.xevianlight.aphelion.core.saveddata.SpacePartitionSavedData; import net.xevianlight.aphelion.core.saveddata.SpacePartitionSavedData;
import net.xevianlight.aphelion.core.saveddata.types.PartitionData;
import net.xevianlight.aphelion.entites.vehicles.RocketEntity; import net.xevianlight.aphelion.entites.vehicles.RocketEntity;
import net.xevianlight.aphelion.planet.Planet; import net.xevianlight.aphelion.planet.Planet;
import net.xevianlight.aphelion.util.RocketStructure; import net.xevianlight.aphelion.util.RocketStructure;
@@ -29,7 +32,9 @@ import net.xevianlight.aphelion.util.SpacePartitionHelper;
import net.xevianlight.aphelion.util.registries.ModRegistries; import net.xevianlight.aphelion.util.registries.ModRegistries;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.UUID;
public class AphelionCommand { public class AphelionCommand {
@@ -246,16 +251,21 @@ public class AphelionCommand {
) )
) )
.then(Commands.literal("destination") .then(Commands.literal("destination")
.then(Commands.literal("set").then( .then(Commands.literal("set")
Commands.argument("pos", ColumnPosArgument.columnPos()) .then(Commands.argument("pos", ColumnPosArgument.columnPos())
.then(Commands.argument("id", ResourceLocationArgument.id()) .then(Commands.argument("id", ResourceLocationArgument.id())
.executes(context -> { .executes(context -> {
int x = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").x()); int px = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").x());
int z = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").z()); int pz = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").z());
ResourceLocation orbit = ResourceLocationArgument.getId(context, "id"); ResourceLocation orbit = ResourceLocationArgument.getId(context, "id");
ServerLevel level = context.getSource().getLevel(); ServerLevel level = context.getSource().getLevel();
SpacePartitionSavedData.get(level).getData(x,z).setDestination(orbit); PartitionData data = SpacePartitionSavedData.get(level).getData(px, pz);
if (data == null) {
context.getSource().sendFailure(Component.translatable("command.aphelion.station.invalid"));
return 1;
}
data.setDestination(orbit);
return 1; return 1;
}) })
@@ -263,6 +273,67 @@ public class AphelionCommand {
) )
) )
) )
.then(Commands.literal("owner")
.then(Commands.literal("get")
.then(Commands.argument("pos", ColumnPosArgument.columnPos())
.executes(context -> {
int px = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").x());
int pz = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").z());
ServerLevel level = context.getSource().getLevel();
PartitionData data = SpacePartitionSavedData.get(level).getData(px, pz);
var cache = level.getServer().getProfileCache();
if (data == null) {
context.getSource().sendFailure(Component.translatable("command.aphelion.station.invalid"));
return 1;
}
if (cache == null) {
return 0;
}
UUID uuid = data.getOwner();
if (uuid == null) {
context.getSource().sendSuccess(() -> Component.translatable("command.aphelion.station.owner.unset"), true);
return 1;
}
String name = cache.get(uuid).map(GameProfile::getName).orElse(null);
context.getSource().sendSuccess(() -> Component.translatable("command.aphelion.station.owner.get", px, pz, name), true);
return 1;
})
)
)
.then(Commands.literal("set")
.then(Commands.argument("pos", ColumnPosArgument.columnPos())
.then(Commands.argument("player", GameProfileArgument.gameProfile())
.executes(context -> {
int px = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").x());
int pz = SpacePartitionHelper.get(ColumnPosArgument.getColumnPos(context, "pos").z());
ServerLevel level = context.getSource().getLevel();
PartitionData data = SpacePartitionSavedData.get(level).getData(px, pz);
if (data == null) {
context.getSource().sendFailure(Component.translatable("command.aphelion.station.invalid"));
return 1;
}
Collection<GameProfile> profiles =
GameProfileArgument.getGameProfiles(context, "player");
if (profiles.size() != 1) {
context.getSource().sendFailure(Component.translatable("command.aphelion.player.invalid"));
return 0;
}
GameProfile profile = profiles.iterator().next();
UUID uuid = profile.getId();
data.setOwner(uuid);
context.getSource().sendSuccess(() -> Component.translatable("command.aphelion.station.owner.set.success", px, pz, profile.getName()), true);
return 1;
})
)
)
)
)
) )
.then(Commands.literal("planet") .then(Commands.literal("planet")
.then(Commands.literal("tp") .then(Commands.literal("tp")

View File

@@ -60,6 +60,18 @@ public class SpacePartitionSavedData extends SavedData {
pd.setDistanceToDest(e.getDouble("DistanceToDest")); pd.setDistanceToDest(e.getDouble("DistanceToDest"));
} }
if (e.hasUUID("Owner")) {
pd.setOwner(e.getUUID("Owner"));
}
if (e.contains("Generated", CompoundTag.TAG_BYTE)) {
pd.setGenerated(e.getBoolean("Generated"));
}
if (e.contains("LandingPads", CompoundTag.TAG_LONG_ARRAY)) {
pd.setLandingPadContollersFromArray(e.getLongArray("LandingPads"));
}
data.map.put(key, pd); data.map.put(key, pd);
} }
@@ -93,6 +105,14 @@ public class SpacePartitionSavedData extends SavedData {
e.putDouble("DistanceTraveled", pd.getDistanceTraveled()); e.putDouble("DistanceTraveled", pd.getDistanceTraveled());
e.putDouble("DistanceToDest", pd.getDistanceToDest()); e.putDouble("DistanceToDest", pd.getDistanceToDest());
if (pd.getOwner() != null) {
e.putUUID("Owner", pd.getOwner());
}
e.putBoolean("Generated", pd.isGenerated());
e.putLongArray("LandingPads", pd.getLandingPadContollersAsArray());
entries.add(e); entries.add(e);
}); });
@@ -137,6 +157,12 @@ public class SpacePartitionSavedData extends SavedData {
} }
} }
/**
* Gets the mutable PartitionData object stored at px, pz
* @param px
* @param pz
* @return
*/
public @Nullable PartitionData getData(int px, int pz) { public @Nullable PartitionData getData(int px, int pz) {
long key = pack(px, pz); long key = pack(px, pz);
PartitionData data = map.get(key); PartitionData data = map.get(key);
@@ -154,7 +180,7 @@ public class SpacePartitionSavedData extends SavedData {
boolean changed = false; boolean changed = false;
for (var entry : map.long2ObjectEntrySet()) { for (var entry : map.long2ObjectEntrySet()) {
if(!orbit.equals(entry.getValue())) { if(!orbit.equals(entry.getValue().getOrbit())) {
entry.getValue().setOrbit(orbit); entry.getValue().setOrbit(orbit);
changed = true; changed = true;
} }

View File

@@ -1,20 +1,32 @@
package net.xevianlight.aphelion.core.saveddata.types; package net.xevianlight.aphelion.core.saveddata.types;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.core.BlockPos;
import net.minecraft.core.UUIDUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.xevianlight.aphelion.util.BigCodec;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.UUID;
public class PartitionData { public class PartitionData {
public static final int MAX_PADS = 64;
private static final StreamCodec<ByteBuf, List<BlockPos>> BLOCKPOS_LIST_CODEC = BlockPos.STREAM_CODEC.apply(ByteBufCodecs.list(MAX_PADS));
@Nullable private ResourceLocation orbit; @Nullable private ResourceLocation orbit;
@Nullable private ResourceLocation destination; @Nullable private ResourceLocation destination;
private boolean traveling; private boolean traveling;
private double distanceTraveled; private double distanceTraveled;
private double distanceToDest; private double distanceToDest;
private boolean generated;
private UUID owner;
private List<BlockPos> landingPadControllers;
public PartitionData(@Nullable ResourceLocation orbit) { public PartitionData(@Nullable ResourceLocation orbit) {
this.orbit = orbit; this.orbit = orbit;
@@ -22,6 +34,9 @@ public class PartitionData {
this.traveling = false; this.traveling = false;
this.distanceTraveled = 0; this.distanceTraveled = 0;
this.distanceToDest = 0; this.distanceToDest = 0;
this.generated = false;
this.owner = null;
this.landingPadControllers = List.of();
} }
public PartitionData(PartitionData other) { public PartitionData(PartitionData other) {
@@ -30,10 +45,13 @@ public class PartitionData {
this.traveling = other.traveling; this.traveling = other.traveling;
this.distanceTraveled = other.distanceTraveled; this.distanceTraveled = other.distanceTraveled;
this.distanceToDest = other.distanceToDest; this.distanceToDest = other.distanceToDest;
this.generated = other.generated;
this.owner = other.owner;
this.landingPadControllers = other.landingPadControllers;
} }
public static final StreamCodec<ByteBuf, PartitionData> STREAM_CODEC = public static final StreamCodec<ByteBuf, PartitionData> STREAM_CODEC =
StreamCodec.composite( BigCodec.composite(
// orbit is nullable -> optional codec // orbit is nullable -> optional codec
ByteBufCodecs.optional(ResourceLocation.STREAM_CODEC), ByteBufCodecs.optional(ResourceLocation.STREAM_CODEC),
d -> Optional.ofNullable(d.getOrbit()), d -> Optional.ofNullable(d.getOrbit()),
@@ -51,12 +69,24 @@ public class PartitionData {
ByteBufCodecs.DOUBLE, ByteBufCodecs.DOUBLE,
PartitionData::getDistanceToDest, PartitionData::getDistanceToDest,
(orbitOpt, destOpt, traveling, distTraveled, distToDest) -> { ByteBufCodecs.optional(UUIDUtil.STREAM_CODEC),
d -> Optional.ofNullable(d.getOwner()),
ByteBufCodecs.BOOL,
PartitionData::isGenerated,
BLOCKPOS_LIST_CODEC,
PartitionData::getLandingPadControllers,
(orbitOpt, destOpt, traveling, distTraveled, distToDest, ownerOpt, generated, controllers) -> {
PartitionData data = new PartitionData(orbitOpt.orElse(null)); PartitionData data = new PartitionData(orbitOpt.orElse(null));
data.destination = destOpt.orElse(null); data.destination = destOpt.orElse(null);
data.traveling = traveling; data.traveling = traveling;
data.distanceTraveled = distTraveled; data.distanceTraveled = distTraveled;
data.distanceToDest = distToDest; data.distanceToDest = distToDest;
data.owner = ownerOpt.orElse(null);
data.generated = generated;
data.landingPadControllers = controllers;
return data; return data;
} }
); );
@@ -65,7 +95,7 @@ public class PartitionData {
return this.orbit; return this.orbit;
} }
public void setOrbit(ResourceLocation orbit) { public void setOrbit(@Nullable ResourceLocation orbit) {
this.orbit = orbit; this.orbit = orbit;
} }
@@ -105,6 +135,42 @@ public class PartitionData {
distanceTraveled = Math.min( distanceTraveled + distance, distanceToDest); distanceTraveled = Math.min( distanceTraveled + distance, distanceToDest);
} }
public boolean isGenerated() {
return generated;
}
public void setGenerated(boolean generated) {
this.generated = generated;
}
public @Nullable UUID getOwner() {
return owner;
}
public void setOwner(@Nullable UUID owner) {
this.owner = owner;
}
public List<BlockPos> getLandingPadControllers() {
return landingPadControllers;
}
public void setLandingPadControllers(List<BlockPos> landingPadControllers) {
this.landingPadControllers = landingPadControllers;
}
public boolean addLandingPadController(BlockPos pos) {
if (!landingPadControllers.contains(pos)) {
landingPadControllers.add(pos);
return true;
}
return false;
}
public boolean removeLandingPadController(BlockPos pos) {
return landingPadControllers.remove(pos);
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) return true; if (this == obj) return true;
@@ -116,6 +182,28 @@ public class PartitionData {
&& Objects.equals(this.destination, that.destination) && Objects.equals(this.destination, that.destination)
&& this.traveling == that.traveling && this.traveling == that.traveling
&& Double.compare(this.distanceTraveled, that.distanceTraveled) == 0 && Double.compare(this.distanceTraveled, that.distanceTraveled) == 0
&& Double.compare(this.distanceToDest, that.distanceToDest) == 0; && Double.compare(this.distanceToDest, that.distanceToDest) == 0
&& this.generated == that.generated
&& Objects.equals(this.owner, that.owner);
}
public long[] getLandingPadContollersAsArray() {
long[] out = new long[landingPadControllers.size()];
int i = 0;
for (BlockPos pos : landingPadControllers) {
out[i] = pos.asLong();
i++;
}
return out;
}
public void setLandingPadContollersFromArray(long[] in) {
List<BlockPos> newList = new java.util.ArrayList<>(List.of());
int i = 0;
for (Long packedPos : in) {
newList.add(BlockPos.of(packedPos));
i++;
}
setLandingPadControllers(newList);
} }
} }

View File

@@ -6,6 +6,7 @@ import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.xevianlight.aphelion.Aphelion; import net.xevianlight.aphelion.Aphelion;
import net.xevianlight.aphelion.core.saveddata.types.PartitionData; import net.xevianlight.aphelion.core.saveddata.types.PartitionData;
import org.jetbrains.annotations.NotNull;
import java.util.Objects; import java.util.Objects;
@@ -21,7 +22,7 @@ public record PartitionPayload(PartitionData partitionData) implements CustomPac
); );
@Override @Override
public Type<? extends CustomPacketPayload> type() { public @NotNull Type<? extends CustomPacketPayload> type() {
return TYPE; return TYPE;
} }

View File

@@ -0,0 +1,500 @@
package net.xevianlight.aphelion.util;
import com.mojang.datafixers.util.*;
import net.minecraft.network.codec.StreamCodec;
import org.jetbrains.annotations.NotNull;
import java.util.function.Function;
/**
* Since mojang only wanted to implement codecs up to 6 types, here's all the codecs 7-16. You're welcome.
* @param <B>
* @param <V>
*/
public interface BigCodec<B, V> extends StreamCodec<B, V> {
// ---------- 7 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final Function7<T1, T2, T3, T4, T5, T6, T7, C> factory
) {
return new StreamCodec<B, C>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
}
};
}
// ---------- 8 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final Function8<T1, T2, T3, T4, T5, T6, T7, T8, C> factory
) {
return new StreamCodec<B, C>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
}
};
}
// ---------- 9 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
Function9<T1, T2, T3, T4, T5, T6, T7, T8, T9, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
}
};
}
// ---------- 10 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
Function10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
}
};
}
// ---------- 11 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
final StreamCodec<? super B, T11> c11, final Function<C, T11> g11,
Function11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
T11 t11 = (T11)c11.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
c11.encode(b, g11.apply(v));
}
};
}
// ---------- 12 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
final StreamCodec<? super B, T11> c11, final Function<C, T11> g11,
final StreamCodec<? super B, T12> c12, final Function<C, T12> g12,
Function12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
T11 t11 = (T11)c11.decode(b);
T12 t12 = (T12)c12.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
c11.encode(b, g11.apply(v));
c12.encode(b, g12.apply(v));
}
};
}
// ---------- 13 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
final StreamCodec<? super B, T11> c11, final Function<C, T11> g11,
final StreamCodec<? super B, T12> c12, final Function<C, T12> g12,
final StreamCodec<? super B, T13> c13, final Function<C, T13> g13,
Function13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
T11 t11 = (T11)c11.decode(b);
T12 t12 = (T12)c12.decode(b);
T13 t13 = (T13)c13.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
c11.encode(b, g11.apply(v));
c12.encode(b, g12.apply(v));
c13.encode(b, g13.apply(v));
}
};
}
// ---------- 14 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
final StreamCodec<? super B, T11> c11, final Function<C, T11> g11,
final StreamCodec<? super B, T12> c12, final Function<C, T12> g12,
final StreamCodec<? super B, T13> c13, final Function<C, T13> g13,
final StreamCodec<? super B, T14> c14, final Function<C, T14> g14,
Function14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
T11 t11 = (T11)c11.decode(b);
T12 t12 = (T12)c12.decode(b);
T13 t13 = (T13)c13.decode(b);
T14 t14 = (T14)c14.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
c11.encode(b, g11.apply(v));
c12.encode(b, g12.apply(v));
c13.encode(b, g13.apply(v));
c14.encode(b, g14.apply(v));
}
};
}
// ---------- 15 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
final StreamCodec<? super B, T11> c11, final Function<C, T11> g11,
final StreamCodec<? super B, T12> c12, final Function<C, T12> g12,
final StreamCodec<? super B, T13> c13, final Function<C, T13> g13,
final StreamCodec<? super B, T14> c14, final Function<C, T14> g14,
final StreamCodec<? super B, T15> c15, final Function<C, T15> g15,
Function15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
T11 t11 = (T11)c11.decode(b);
T12 t12 = (T12)c12.decode(b);
T13 t13 = (T13)c13.decode(b);
T14 t14 = (T14)c14.decode(b);
T15 t15 = (T15)c15.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
c11.encode(b, g11.apply(v));
c12.encode(b, g12.apply(v));
c13.encode(b, g13.apply(v));
c14.encode(b, g14.apply(v));
c15.encode(b, g15.apply(v));
}
};
}
// ---------- 16 ----------
static <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> StreamCodec<B, C> composite(
final StreamCodec<? super B, T1> c1, final Function<C, T1> g1,
final StreamCodec<? super B, T2> c2, final Function<C, T2> g2,
final StreamCodec<? super B, T3> c3, final Function<C, T3> g3,
final StreamCodec<? super B, T4> c4, final Function<C, T4> g4,
final StreamCodec<? super B, T5> c5, final Function<C, T5> g5,
final StreamCodec<? super B, T6> c6, final Function<C, T6> g6,
final StreamCodec<? super B, T7> c7, final Function<C, T7> g7,
final StreamCodec<? super B, T8> c8, final Function<C, T8> g8,
final StreamCodec<? super B, T9> c9, final Function<C, T9> g9,
final StreamCodec<? super B, T10> c10, final Function<C, T10> g10,
final StreamCodec<? super B, T11> c11, final Function<C, T11> g11,
final StreamCodec<? super B, T12> c12, final Function<C, T12> g12,
final StreamCodec<? super B, T13> c13, final Function<C, T13> g13,
final StreamCodec<? super B, T14> c14, final Function<C, T14> g14,
final StreamCodec<? super B, T15> c15, final Function<C, T15> g15,
final StreamCodec<? super B, T16> c16, final Function<C, T16> g16,
Function16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, C> factory
) {
return new StreamCodec<>() {
public @NotNull C decode(@NotNull B b) {
T1 t1 = (T1)c1.decode(b);
T2 t2 = (T2)c2.decode(b);
T3 t3 = (T3)c3.decode(b);
T4 t4 = (T4)c4.decode(b);
T5 t5 = (T5)c5.decode(b);
T6 t6 = (T6)c6.decode(b);
T7 t7 = (T7)c7.decode(b);
T8 t8 = (T8)c8.decode(b);
T9 t9 = (T9)c9.decode(b);
T10 t10 = (T10)c10.decode(b);
T11 t11 = (T11)c11.decode(b);
T12 t12 = (T12)c12.decode(b);
T13 t13 = (T13)c13.decode(b);
T14 t14 = (T14)c14.decode(b);
T15 t15 = (T15)c15.decode(b);
T16 t16 = (T16)c16.decode(b);
return (C)factory.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16);
}
public void encode(@NotNull B b, @NotNull C v) {
c1.encode(b, g1.apply(v));
c2.encode(b, g2.apply(v));
c3.encode(b, g3.apply(v));
c4.encode(b, g4.apply(v));
c5.encode(b, g5.apply(v));
c6.encode(b, g6.apply(v));
c7.encode(b, g7.apply(v));
c8.encode(b, g8.apply(v));
c9.encode(b, g9.apply(v));
c10.encode(b, g10.apply(v));
c11.encode(b, g11.apply(v));
c12.encode(b, g12.apply(v));
c13.encode(b, g13.apply(v));
c14.encode(b, g14.apply(v));
c15.encode(b, g15.apply(v));
c16.encode(b, g16.apply(v));
}
};
}
}

View File

@@ -54,5 +54,10 @@
"command.aphelion.rocket.get_pos.success": "Target position of rocket is %s", "command.aphelion.rocket.get_pos.success": "Target position of rocket is %s",
"command.aphelion.rocket.get_pos.success.null": "Target position of rocket is not set", "command.aphelion.rocket.get_pos.success.null": "Target position of rocket is not set",
"command.aphelion.rocket.disassemble.success": "Rocket disassembled", "command.aphelion.rocket.disassemble.success": "Rocket disassembled",
"command.aphelion.rocket.disassemble.failure": "Could not disassemble rocket" "command.aphelion.rocket.disassemble.failure": "Could not disassemble rocket",
"command.aphelion.station.invalid": "Station is invalid!",
"command.aphelion.station.owner.unset": "Station has no owner",
"command.aphelion.station.owner.get": "Station (%s %s) belongs to %s",
"command.aphelion.station.owner.set.success": "Set station (%s %s)'s owner to %s",
"command.aphelion.player.invalid": "Player is invalid"
} }