Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.petrak.hexcasting.common.lib.HexRegistries
import at.petrak.hexcasting.common.lib.hex.HexImageComponents
import at.petrak.hexcasting.xplat.IXplatAbstractions
import com.mojang.serialization.Codec
import io.netty.buffer.ByteBuf
import net.minecraft.Util
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.network.codec.ByteBufCodecs
Expand All @@ -27,7 +28,7 @@ import net.minecraft.network.codec.StreamCodec
*/
class ImageComponentType<T : Any>(
val dataCodec: Codec<T>,
val dataStreamCodec: StreamCodec<RegistryFriendlyByteBuf, T>,
val dataStreamCodec: StreamCodec<out ByteBuf, T>,
val transient: Boolean = false
) {
override fun toString(): String = Util.getRegisteredName(HexImageComponents.REGISTRY, this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class CodecUtils {
* plus the map-encoding system from {@link net.minecraft.network.codec.ByteBufCodecs#map}.
*/
public static <B extends ByteBuf, K, V> StreamCodec<B, Map<K, V>> streamCodecDispatchedMap(
IntFunction<Map<K, V>> mapCreator, StreamCodec<B, K> keyCodec,
Function<K, StreamCodec<B, ? extends V>> valueCodecGetter
IntFunction<Map<K, V>> mapCreator, StreamCodec<? super B, K> keyCodec,
Function<K, StreamCodec<? super B, ? extends V>> valueCodecGetter
) {
return new StreamCodec<>() {
public Map<K, V> decode(B stream) {
Expand Down Expand Up @@ -50,7 +50,7 @@ public void encode(B stream, Map<K, V> map) {
}

@SuppressWarnings("unchecked")
private <V2 extends V> void encodeCasted(StreamCodec<B, V2> codec, B stream, V value) {
private <V2 extends V> void encodeCasted(StreamCodec<? super B, V2> codec, B stream, V value) {
codec.encode(stream, (V2) value);
}
};
Expand Down
Loading