mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-04 09:19:33 +01:00
Updated Via API usage
This commit is contained in:
parent
9aaae4c74c
commit
9fcc8a1c17
@ -18,8 +18,8 @@ raknet_transport_version=1.0.0.CR1-SNAPSHOT
|
|||||||
classic4j_version=2.0.1
|
classic4j_version=2.0.1
|
||||||
|
|
||||||
# viaversion (and required) libs
|
# viaversion (and required) libs
|
||||||
viaversion_version=4.9.0-23w41a-SNAPSHOT
|
viaversion_version=4.9.0-23w42a-SNAPSHOT
|
||||||
viabackwards_version=4.9.0-23w41a-SNAPSHOT
|
viabackwards_version=4.9.0-23w42a-SNAPSHOT
|
||||||
|
|
||||||
vialoader_version=2.2.11-SNAPSHOT
|
vialoader_version=2.2.11-SNAPSHOT
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
|||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
|
||||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||||
import net.raphimc.vialoader.util.VersionEnum;
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.model.ClassicLevel;
|
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.model.ClassicLevel;
|
||||||
@ -73,8 +73,8 @@ public class ClassicWorldHeightInjection {
|
|||||||
|
|
||||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||||
wrapper.resetReader();
|
wrapper.resetReader();
|
||||||
final Chunk chunk = wrapper.read(new Chunk1_17Type(16));
|
final Chunk chunk = wrapper.read(new ChunkType1_17(16));
|
||||||
wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk);
|
wrapper.write(new ChunkType1_17(chunk.getSections().length), chunk);
|
||||||
|
|
||||||
final ClassicWorldHeightProvider heightProvider = Via.getManager().getProviders().get(ClassicWorldHeightProvider.class);
|
final ClassicWorldHeightProvider heightProvider = Via.getManager().getProviders().get(ClassicWorldHeightProvider.class);
|
||||||
if (chunk.getSections().length < heightProvider.getMaxChunkSectionCount(wrapper.user())) { // Increase available sections to match new world height
|
if (chunk.getSections().length < heightProvider.getMaxChunkSectionCount(wrapper.user())) { // Increase available sections to match new world height
|
||||||
|
@ -33,7 +33,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
* Fixes https://github.com/ViaVersion/ViaFabricPlus/issues/209
|
* Fixes https://github.com/ViaVersion/ViaFabricPlus/issues/209
|
||||||
*/
|
*/
|
||||||
@Pseudo
|
@Pseudo
|
||||||
@Mixin(targets = "org.anti_ad.mc.ipnext.event.AutoRefillHandler$ItemSlotMonitor")
|
@Mixin(targets = "org.anti_ad.mc.ipnext.event.AutoRefillHandler$ItemSlotMonitor", remap = false)
|
||||||
public class MixinAutoRefillHandler_ItemSlotMonitor {
|
public class MixinAutoRefillHandler_ItemSlotMonitor {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion;
|
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.NamedCompoundTagType;
|
import com.viaversion.viaversion.api.type.types.misc.NamedCompoundTagType;
|
||||||
import com.viaversion.viaversion.libs.opennbt.tag.limiter.TagLimiter;
|
import com.viaversion.viaversion.libs.opennbt.tag.limiter.TagLimiter;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_9_1to1_9;
|
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_9_1to1_9;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
|
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types.Chunk1_9_1_2Type;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -34,7 +34,7 @@ public class MixinProtocol1_9_1To1_9 extends AbstractProtocol<ClientboundPackets
|
|||||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||||
public void clearInputBuffer(CallbackInfo ci) {
|
public void clearInputBuffer(CallbackInfo ci) {
|
||||||
registerClientbound(ClientboundPackets1_9.CHUNK_DATA, wrapper -> {
|
registerClientbound(ClientboundPackets1_9.CHUNK_DATA, wrapper -> {
|
||||||
wrapper.passthrough(new Chunk1_9_1_2Type(wrapper.user().get(ClientWorld.class)));
|
wrapper.passthrough(new ChunkType1_9_1(wrapper.user().get(ClientWorld.class)));
|
||||||
wrapper.clearInputBuffer();
|
wrapper.clearInputBuffer();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protoco
|
|||||||
|
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.*;
|
import com.viaversion.viaversion.api.minecraft.chunks.*;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.types.Chunk1_8Type;
|
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_8;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -28,15 +28,15 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@Mixin(value = Chunk1_8Type.class, remap = false)
|
@Mixin(value = ChunkType1_8.class, remap = false)
|
||||||
public abstract class MixinChunk1_8Type {
|
public abstract class MixinChunkType1_8 {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public static Chunk deserialize(int chunkX, int chunkZ, boolean fullChunk, boolean skyLight, int bitmask, byte[] data) {
|
public static Chunk deserialize(int chunkX, int chunkZ, boolean fullChunk, boolean skyLight, int bitmask, byte[] data) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "read(Lio/netty/buffer/ByteBuf;Lcom/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/storage/ClientWorld;)Lcom/viaversion/viaversion/api/minecraft/chunks/Chunk;", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/protocol1_9to1_8/types/Chunk1_8Type;deserialize(IIZZI[B)Lcom/viaversion/viaversion/api/minecraft/chunks/Chunk;"))
|
@Redirect(method = "read(Lio/netty/buffer/ByteBuf;Lcom/viaversion/viaversion/api/minecraft/ClientWorld;)Lcom/viaversion/viaversion/api/minecraft/chunks/Chunk;", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/type/types/chunk/ChunkType1_8;deserialize(IIZZI[B)Lcom/viaversion/viaversion/api/minecraft/chunks/Chunk;"))
|
||||||
private Chunk fixAegis(int chunkX, int chunkZ, boolean fullChunk, boolean skyLight, int bitmask, byte[] data) {
|
private Chunk fixAegis(int chunkX, int chunkZ, boolean fullChunk, boolean skyLight, int bitmask, byte[] data) {
|
||||||
try {
|
try {
|
||||||
return deserialize(chunkX, chunkZ, fullChunk, skyLight, bitmask, data);
|
return deserialize(chunkX, chunkZ, fullChunk, skyLight, bitmask, data);
|
@ -33,6 +33,7 @@ public class PackFormatsMappings {
|
|||||||
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
|
registerVersion(VersionEnum.r1_20_3, 19, "23w42a");
|
||||||
registerVersion(VersionEnum.r1_20_2, 18, "1.20.2");
|
registerVersion(VersionEnum.r1_20_2, 18, "1.20.2");
|
||||||
registerVersion(VersionEnum.r1_20tor1_20_1, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care...
|
registerVersion(VersionEnum.r1_20tor1_20_1, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care...
|
||||||
registerVersion(VersionEnum.r1_19_4, 13, "1.19.4");
|
registerVersion(VersionEnum.r1_19_4, 13, "1.19.4");
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
"fixes.viaversion.protocol1_19_3to1_19_1.MixinProtocol1_19_3To1_19_1",
|
"fixes.viaversion.protocol1_19_3to1_19_1.MixinProtocol1_19_3To1_19_1",
|
||||||
"fixes.viaversion.protocol1_19to1_18_2.MixinWorldPackets",
|
"fixes.viaversion.protocol1_19to1_18_2.MixinWorldPackets",
|
||||||
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9",
|
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9",
|
||||||
"fixes.viaversion.protocol1_9to1_8.MixinChunk1_8Type",
|
"fixes.viaversion.protocol1_9to1_8.MixinChunkType1_8",
|
||||||
"fixes.viaversion.protocol1_9to1_8.MixinCommandBlockProvider",
|
"fixes.viaversion.protocol1_9to1_8.MixinCommandBlockProvider",
|
||||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityPackets_6_1",
|
"fixes.viaversion.protocol1_9to1_8.MixinEntityPackets_6_1",
|
||||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9",
|
"fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9",
|
||||||
|
Loading…
Reference in New Issue
Block a user