updated ViaLoadingBase, remove unused code

This commit is contained in:
FlorianMichael 2023-03-01 16:29:01 +01:00
parent 0410f4b101
commit 4adda46d75
88 changed files with 196 additions and 225 deletions

View File

@ -5,11 +5,11 @@ minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5 yarn_mappings=1.19.3+build.5
loader_version=0.14.14 loader_version=0.14.14
mod_version=1.5.4 mod_version=1.5.5
maven_group=de.florianmichael maven_group=de.florianmichael
archives_base_name=viafabricplus archives_base_name=viafabricplus
vialoadingbase_version=8df0605c3d vialoadingbase_version=db24c2279c
viaversion_version=4.6.0-1.19.4-pre2-SNAPSHOT viaversion_version=4.6.0-1.19.4-pre2-SNAPSHOT
viabackwards_version=4.6.0-1.19.4-pre1-SNAPSHOT viabackwards_version=4.6.0-1.19.4-pre1-SNAPSHOT
vialegacy_version=cc56733803 vialegacy_version=cc56733803

View File

@ -86,35 +86,6 @@ public class ViaFabricPlus {
return MinecraftClient.getInstance().isInSingleplayer(); return MinecraftClient.getInstance().isInSingleplayer();
}); });
builder = builder.eventLoop(new DefaultEventLoop()); builder = builder.eventLoop(new DefaultEventLoop());
builder = builder.dumpSupplier(() -> {
final JsonObject parentNode = new JsonObject();
final JsonArray modsNode = new JsonArray();
for (ModContainer mod : FabricLoader.getInstance().getAllMods()) {
final JsonObject modNode = new JsonObject();
modNode.addProperty("id", mod.getMetadata().getId());
modNode.addProperty("name", mod.getMetadata().getName());
modNode.addProperty("version", mod.getMetadata().getVersion().getFriendlyString());
final JsonArray authorsNode = new JsonArray();
for (Person author : mod.getMetadata().getAuthors()) {
final JsonObject infoNode = new JsonObject();
final JsonObject contactNode = new JsonObject();
author.getContact().asMap().forEach(contactNode::addProperty);
if (contactNode.size() != 0) {
infoNode.add("contact", contactNode);
}
infoNode.addProperty("name", author.getName());
authorsNode.add(infoNode);
}
modNode.add("author", authorsNode);
modsNode.add(modNode);
}
parentNode.add("mods", modsNode);
parentNode.addProperty("native version", SharedConstants.getProtocolVersion());
return parentNode;
});
builder = builder.providers(providers -> { builder = builder.providers(providers -> {
providers.use(MovementTransmitterProvider.class, new ViaFabricPlusMovementTransmitterProvider()); providers.use(MovementTransmitterProvider.class, new ViaFabricPlusMovementTransmitterProvider());
providers.use(HandItemProvider.class, new ViaFabricPlusHandItemProvider()); providers.use(HandItemProvider.class, new ViaFabricPlusHandItemProvider());

View File

@ -65,7 +65,7 @@ public class PackFormatsDefinition {
} }
public static GameVersion current() { public static GameVersion current() {
final int targetVersion = ViaLoadingBase.getTargetVersion().getOriginalVersion(); final int targetVersion = ViaLoadingBase.getClassWrapper().getTargetVersion().getOriginalVersion();
if (!protocolMap.containsKey(targetVersion)) return SharedConstants.getGameVersion(); if (!protocolMap.containsKey(targetVersion)) return SharedConstants.getGameVersion();
return protocolMap.get(targetVersion); return protocolMap.get(targetVersion);
} }

View File

@ -34,7 +34,7 @@ public class ClassicWorldHeightInjection {
parentRemapper.handle(wrapper); parentRemapper.handle(wrapper);
if (wrapper.isCancelled()) return; if (wrapper.isCancelled()) return;
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
for (Tag dimension : wrapper.get(Type.NBT, 0).<CompoundTag>get("minecraft:dimension_type").<ListTag>get("value")) { for (Tag dimension : wrapper.get(Type.NBT, 0).<CompoundTag>get("minecraft:dimension_type").<ListTag>get("value")) {
changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element")); changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element"));
} }
@ -53,7 +53,7 @@ public class ClassicWorldHeightInjection {
parentRemapper.handle(wrapper); parentRemapper.handle(wrapper);
if (wrapper.isCancelled()) return; if (wrapper.isCancelled()) return;
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0)); changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0));
} }
}); });
@ -69,7 +69,7 @@ public class ClassicWorldHeightInjection {
parentRemapper.handle(wrapper); parentRemapper.handle(wrapper);
if (wrapper.isCancelled()) return; if (wrapper.isCancelled()) return;
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
wrapper.resetReader(); wrapper.resetReader();
final Chunk chunk = wrapper.read(new Chunk1_17Type(16)); final Chunk chunk = wrapper.read(new Chunk1_17Type(16));
wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk); wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk);
@ -163,7 +163,7 @@ public class ClassicWorldHeightInjection {
@Override @Override
public void register() { public void register() {
handler(wrapper -> { handler(wrapper -> {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
classicLightHandler.handle(wrapper); classicLightHandler.handle(wrapper);
} else { } else {
parentRemapper.handle(wrapper); parentRemapper.handle(wrapper);

View File

@ -37,7 +37,7 @@ public class MixinClientConnection implements IClientConnection {
@Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true) @Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true)
private void storeEncryptionCiphers(Cipher decryptionCipher, Cipher encryptionCipher, CallbackInfo ci) { private void storeEncryptionCiphers(Cipher decryptionCipher, Cipher encryptionCipher, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
ci.cancel(); ci.cancel();
this.viafabricplus_decryptionCipher = decryptionCipher; this.viafabricplus_decryptionCipher = decryptionCipher;
this.viafabricplus_encryptionCipher = encryptionCipher; this.viafabricplus_encryptionCipher = encryptionCipher;

View File

@ -6,8 +6,8 @@ import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
import de.florianmichael.viafabricplus.ViaFabricPlus; import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.platform.PreNettyConstants; import de.florianmichael.viafabricplus.platform.PreNettyConstants;
import de.florianmichael.vialoadingbase.ViaLoadingBase; import de.florianmichael.vialoadingbase.ViaLoadingBase;
import de.florianmichael.vialoadingbase.netty.CustomViaDecodeHandler; import de.florianmichael.vialoadingbase.netty.VLBViaDecodeHandler;
import de.florianmichael.vialoadingbase.netty.CustomViaEncodeHandler; import de.florianmichael.vialoadingbase.netty.VLBViaEncodeHandler;
import de.florianmichael.vialoadingbase.netty.NettyConstants; import de.florianmichael.vialoadingbase.netty.NettyConstants;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
@ -39,10 +39,10 @@ public class MixinClientConnection_1 {
new ProtocolPipelineImpl(user); new ProtocolPipelineImpl(user);
channel.pipeline().addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new CustomViaEncodeHandler(user)); channel.pipeline().addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new VLBViaDecodeHandler(user));
channel.pipeline().addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new CustomViaDecodeHandler(user)); channel.pipeline().addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new VLBViaEncodeHandler(user));
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE); user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE);
channel.pipeline().addBefore("prepender", PreNettyConstants.HANDLER_ENCODER_NAME, new PreNettyEncoder(user)); channel.pipeline().addBefore("prepender", PreNettyConstants.HANDLER_ENCODER_NAME, new PreNettyEncoder(user));

View File

@ -22,7 +22,7 @@ public class MixinClientLoginNetworkHandler {
@Inject(method = "joinServerSession", at = @At("HEAD"), cancellable = true) @Inject(method = "joinServerSession", at = @At("HEAD"), cancellable = true)
public void dontVerifySessionIfCracked(String serverId, CallbackInfoReturnable<Text> cir) { public void dontVerifySessionIfCracked(String serverId, CallbackInfoReturnable<Text> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
if (!connection.channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get().get(ProtocolMetadataStorage.class).authenticate) { if (!connection.channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get().get(ProtocolMetadataStorage.class).authenticate) {
cir.setReturnValue(null); cir.setReturnValue(null);
} }

View File

@ -32,24 +32,24 @@ public class MixinDebugHud {
final UserConnection userConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get(); final UserConnection userConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get();
information.add("Pipeline count: " + userConnection.getProtocolInfo().getPipeline().pipes().size()); information.add("Pipeline count: " + userConnection.getProtocolInfo().getPipeline().pipes().size());
information.add("Target version: " + ViaLoadingBase.getTargetVersion().getName() + " (" + ViaLoadingBase.getTargetVersion().getVersion() + ")"); information.add("Target version: " + ViaLoadingBase.getClassWrapper().getTargetVersion().getName() + " (" + ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() + ")");
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
final EntityTracker entityTracker1_7_10 = userConnection.get(EntityTracker.class); final EntityTracker entityTracker1_7_10 = userConnection.get(EntityTracker.class);
if (entityTracker1_7_10 != null) { if (entityTracker1_7_10 != null) {
information.add("Entity Tracker (" + ProtocolVersion.v1_7_6.getName() + "): " + entityTracker1_7_10.getTrackedEntities().size()); information.add("Entity Tracker (" + ProtocolVersion.v1_7_6.getName() + "): " + entityTracker1_7_10.getTrackedEntities().size());
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_5_2)) {
final net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker entityTracker1_5_2 = userConnection.get(net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker.class); final net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker entityTracker1_5_2 = userConnection.get(net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker.class);
if (entityTracker1_5_2 != null) { if (entityTracker1_5_2 != null) {
information.add("Entity Tracker (" + LegacyProtocolVersion.r1_5_2.getName() + "): " + entityTracker1_5_2.getTrackedEntities().size()); information.add("Entity Tracker (" + LegacyProtocolVersion.r1_5_2.getName() + "): " + entityTracker1_5_2.getTrackedEntities().size());
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) {
final net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker entityTracker1_2_4_5 = userConnection.get(net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker.class); final net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker entityTracker1_2_4_5 = userConnection.get(net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker.class);
if (entityTracker1_2_4_5 != null) { if (entityTracker1_2_4_5 != null) {
information.add("Entity Tracker (" + LegacyProtocolVersion.r1_2_4tor1_2_5.getName() + "): " + entityTracker1_2_4_5.getTrackedEntities().size()); information.add("Entity Tracker (" + LegacyProtocolVersion.r1_2_4tor1_2_5.getName() + "): " + entityTracker1_2_4_5.getTrackedEntities().size());
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_1)) {
final SeedStorage seedStorage = userConnection.get(SeedStorage.class); final SeedStorage seedStorage = userConnection.get(SeedStorage.class);
if (seedStorage != null) { if (seedStorage != null) {
information.add("World Seed (" + LegacyProtocolVersion.r1_1.getName() + "): " + seedStorage.seed); information.add("World Seed (" + LegacyProtocolVersion.r1_1.getName() + "): " + seedStorage.seed);

View File

@ -51,14 +51,14 @@ public abstract class MixinClientPlayNetworkHandler {
@Inject(method = "<init>", at = @At("RETURN")) @Inject(method = "<init>", at = @At("RETURN"))
public void fixPlayerListOrdering(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) { public void fixPlayerListOrdering(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
this.listedPlayerListEntries = new LinkedHashSet<>(); this.listedPlayerListEntries = new LinkedHashSet<>();
} }
} }
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true) @Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) { private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
return; return;
} }
@ -75,14 +75,14 @@ public abstract class MixinClientPlayNetworkHandler {
@Inject(method = "onChunkLoadDistance", at = @At("RETURN")) @Inject(method = "onChunkLoadDistance", at = @At("RETURN"))
public void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) { public void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17_1)) {
this.onSimulationDistance(new SimulationDistanceS2CPacket(packet.getDistance())); this.onSimulationDistance(new SimulationDistanceS2CPacket(packet.getDistance()));
} }
} }
@Inject(method = "onEntitySpawn", at = @At("TAIL")) @Inject(method = "onEntitySpawn", at = @At("TAIL"))
public void forceEntityVelocity(EntitySpawnS2CPacket packet, CallbackInfo ci) { public void forceEntityVelocity(EntitySpawnS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
if (packet.getEntityType() == EntityType.ITEM || packet.getEntityType() == EntityType.ARROW || packet.getEntityType() == EntityType.SPECTRAL_ARROW || packet.getEntityType() == EntityType.TRIDENT) { if (packet.getEntityType() == EntityType.ITEM || packet.getEntityType() == EntityType.ARROW || packet.getEntityType() == EntityType.SPECTRAL_ARROW || packet.getEntityType() == EntityType.TRIDENT) {
onEntityVelocityUpdate(new EntityVelocityUpdateS2CPacket(packet.getId(), new Vec3d(packet.getVelocityX(), packet.getVelocityY(), packet.getVelocityZ()))); onEntityVelocityUpdate(new EntityVelocityUpdateS2CPacket(packet.getId(), new Vec3d(packet.getVelocityX(), packet.getVelocityY(), packet.getVelocityZ())));
} }
@ -91,7 +91,7 @@ public abstract class MixinClientPlayNetworkHandler {
@Inject(method = { "onGameJoin", "onPlayerRespawn" }, at = @At("TAIL")) @Inject(method = { "onGameJoin", "onPlayerRespawn" }, at = @At("TAIL"))
private void injectOnOnGameJoinOrRespawn(CallbackInfo ci) { private void injectOnOnGameJoinOrRespawn(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
ClientPlayerEntity player = MinecraftClient.getInstance().player; ClientPlayerEntity player = MinecraftClient.getInstance().player;
assert player != null; assert player != null;
onEntityStatus(new EntityStatusS2CPacket(player, (byte) 28)); onEntityStatus(new EntityStatusS2CPacket(player, (byte) 28));
@ -100,14 +100,14 @@ public abstract class MixinClientPlayNetworkHandler {
@Redirect(method = "onPlayerSpawnPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;setReady()V")) @Redirect(method = "onPlayerSpawnPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;setReady()V"))
public void moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) { public void moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
instance.setReady(); instance.setReady();
} }
} }
@Inject(method = "onPlayerPositionLook", at = @At("RETURN")) @Inject(method = "onPlayerPositionLook", at = @At("RETURN"))
public void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) { public void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) {
MinecraftClient.getInstance().setScreen(null); MinecraftClient.getInstance().setScreen(null);
} }
} }
@ -115,7 +115,7 @@ public abstract class MixinClientPlayNetworkHandler {
@SuppressWarnings("InvalidInjectorMethodSignature") @SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class)) @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class))
public Class<?> dontChangePlayerYaw(Object entity, Class<?> constant) { public Class<?> dontChangePlayerYaw(Object entity, Class<?> constant) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
return Integer.class; return Integer.class;
} }
return constant; return constant;
@ -123,7 +123,7 @@ public abstract class MixinClientPlayNetworkHandler {
@Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) @Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
public void removeNewWarning(Logger instance, String s, Object o) { public void removeNewWarning(Logger instance, String s, Object o) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) {
instance.warn(s, o); instance.warn(s, o);
} }
} }

View File

@ -53,7 +53,7 @@ public abstract class MixinClientPlayerInteractionManager {
@Inject(method = "attackEntity", at = @At("HEAD")) @Inject(method = "attackEntity", at = @At("HEAD"))
private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) { private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && player instanceof IClientPlayerEntity) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && player instanceof IClientPlayerEntity) {
player.swingHand(Hand.MAIN_HAND); player.swingHand(Hand.MAIN_HAND);
((IClientPlayerEntity) player).viafabricplus_cancelSwingOnce(); ((IClientPlayerEntity) player).viafabricplus_cancelSwingOnce();
} }
@ -73,7 +73,7 @@ public abstract class MixinClientPlayerInteractionManager {
if (type == SlotActionType.QUICK_CRAFT) return true; if (type == SlotActionType.QUICK_CRAFT) return true;
// quick move always uses empty stack for verification since 1.12 // quick move always uses empty stack for verification since 1.12
if (type == SlotActionType.QUICK_MOVE && ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) return true; if (type == SlotActionType.QUICK_MOVE && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) return true;
// pickup with slot -999 (outside window) to throw items always uses empty stack for verification // pickup with slot -999 (outside window) to throw items always uses empty stack for verification
return type == SlotActionType.PICKUP && slot == -999; return type == SlotActionType.PICKUP && slot == -999;
@ -82,7 +82,7 @@ public abstract class MixinClientPlayerInteractionManager {
@Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V")) @Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V"))
private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) { private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
try { try {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
ItemStack slotItemBeforeModification; ItemStack slotItemBeforeModification;
if (this.protocolhack_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot())) if (this.protocolhack_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot()))
@ -119,7 +119,7 @@ public abstract class MixinClientPlayerInteractionManager {
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0))) to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0)))
private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet<?> packet) { private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet<?> packet) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
clientPlayNetworkHandler.sendPacket(packet); clientPlayNetworkHandler.sendPacket(packet);
} }
} }
@ -139,7 +139,7 @@ public abstract class MixinClientPlayerInteractionManager {
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true) @Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
public void cacheActionResult(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) { public void cacheActionResult(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
this.protocolhack_actionResult = this.interactBlockInternal(player, hand, hitResult); this.protocolhack_actionResult = this.interactBlockInternal(player, hand, hitResult);
if (this.protocolhack_actionResult == ActionResult.FAIL) { if (this.protocolhack_actionResult == ActionResult.FAIL) {
@ -150,7 +150,7 @@ public abstract class MixinClientPlayerInteractionManager {
@Redirect(method = "method_41933", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactBlockInternal(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;")) @Redirect(method = "method_41933", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactBlockInternal(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;"))
public ActionResult provideCachedResult(ClientPlayerInteractionManager instance, ClientPlayerEntity player, Hand hand, BlockHitResult hitResult) { public ActionResult provideCachedResult(ClientPlayerInteractionManager instance, ClientPlayerEntity player, Hand hand, BlockHitResult hitResult) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return this.protocolhack_actionResult; return this.protocolhack_actionResult;
} }
return interactBlockInternal(player, hand, hitResult); return interactBlockInternal(player, hand, hitResult);

View File

@ -41,7 +41,7 @@ public abstract class MixinMinecraftClient {
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;resetEquipProgress(Lnet/minecraft/util/Hand;)V", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;resetEquipProgress(Lnet/minecraft/util/Hand;)V", ordinal = 0))
private void redirectDoItemUse(HeldItemRenderer heldItemRenderer, Hand hand) { private void redirectDoItemUse(HeldItemRenderer heldItemRenderer, Hand hand) {
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8) || !(player.getStackInHand(hand).getItem() instanceof SwordItem)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8) || !(player.getStackInHand(hand).getItem() instanceof SwordItem)) {
heldItemRenderer.resetEquipProgress(hand); heldItemRenderer.resetEquipProgress(hand);
} }
} }
@ -50,7 +50,7 @@ public abstract class MixinMinecraftClient {
slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactEntity(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/Entity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactEntity(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/Entity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;isAccepted()Z", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;isAccepted()Z", ordinal = 0))
private boolean preventGenericInteract(ActionResult instance) { private boolean preventGenericInteract(ActionResult instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
return true; return true;
} }
@ -62,7 +62,7 @@ public abstract class MixinMinecraftClient {
*/ */
@Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1)) @Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1))
public int unwrapOperation(MinecraftClient instance) { public int unwrapOperation(MinecraftClient instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return 0; return 0;
} }
return attackCooldown; return attackCooldown;
@ -70,7 +70,7 @@ public abstract class MixinMinecraftClient {
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V", shift = At.Shift.BEFORE)) @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V", shift = At.Shift.BEFORE))
public void updateCooldown(CallbackInfo ci) { public void updateCooldown(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
if (this.attackCooldown > 0) { if (this.attackCooldown > 0) {
--this.attackCooldown; --this.attackCooldown;
} }
@ -91,7 +91,7 @@ public abstract class MixinMinecraftClient {
if (getNetworkHandler() != null && DebugSettings.getClassWrapper().sendOpenInventoryPacket.getValue()) { if (getNetworkHandler() != null && DebugSettings.getClassWrapper().sendOpenInventoryPacket.getValue()) {
final UserConnection viaConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get(); final UserConnection viaConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get();
if (viaConnection != null && ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) { if (viaConnection != null && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, viaConnection); final PacketWrapper clientStatus = PacketWrapper.create(ServerboundPackets1_9_3.CLIENT_STATUS, viaConnection);
clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement

View File

@ -17,7 +17,7 @@ public class MixinPlayerEntityRenderer {
@Inject(method = "getPositionOffset*", at = @At("RETURN"), cancellable = true) @Inject(method = "getPositionOffset*", at = @At("RETURN"), cancellable = true)
private void injectGetPositionOffset(AbstractClientPlayerEntity player, float delta, CallbackInfoReturnable<Vec3d> ci) { private void injectGetPositionOffset(AbstractClientPlayerEntity player, float delta, CallbackInfoReturnable<Vec3d> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
if (player.getSleepingDirection() != null) { if (player.getSleepingDirection() != null) {
ci.setReturnValue(ci.getReturnValue().subtract(player.getSleepingDirection().getOffsetX() * 0.4, 0, player.getSleepingDirection().getOffsetZ() * 0.4)); ci.setReturnValue(ci.getReturnValue().subtract(player.getSleepingDirection().getOffsetX() * 0.4, 0, player.getSleepingDirection().getOffsetZ() * 0.4));
} }
@ -27,6 +27,6 @@ public class MixinPlayerEntityRenderer {
@Redirect(method = "getPositionOffset(Lnet/minecraft/client/network/AbstractClientPlayerEntity;F)Lnet/minecraft/util/math/Vec3d;", @Redirect(method = "getPositionOffset(Lnet/minecraft/client/network/AbstractClientPlayerEntity;F)Lnet/minecraft/util/math/Vec3d;",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isInSneakingPose()Z")) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isInSneakingPose()Z"))
private boolean redirectGetPositionOffset(AbstractClientPlayerEntity player) { private boolean redirectGetPositionOffset(AbstractClientPlayerEntity player) {
return (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) && player.isInSneakingPose(); return (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) && player.isInSneakingPose();
} }
} }

View File

@ -18,7 +18,7 @@ public class MixinServerAddress {
@Inject(method = "parse", at = @At("RETURN"), cancellable = true) @Inject(method = "parse", at = @At("RETURN"), cancellable = true)
private static void fixAddress(String address, CallbackInfoReturnable<ServerAddress> cir) { private static void fixAddress(String address, CallbackInfoReturnable<ServerAddress> cir) {
if (!cir.getReturnValue().equals(INVALID) && ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (!cir.getReturnValue().equals(INVALID) && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
cir.setReturnValue(AllowedAddressResolver.DEFAULT.redirectResolver.lookupRedirect(cir.getReturnValue()).orElse(cir.getReturnValue())); cir.setReturnValue(AllowedAddressResolver.DEFAULT.redirectResolver.lookupRedirect(cir.getReturnValue()).orElse(cir.getReturnValue()));
} }
} }

View File

@ -37,10 +37,10 @@ public class MixinServerResourcePackProvider {
@Inject(method = "getDownloadHeaders", at = @At("TAIL"), cancellable = true) @Inject(method = "getDownloadHeaders", at = @At("TAIL"), cancellable = true)
private static void removeHeaders(CallbackInfoReturnable<Map<String, String>> cir) { private static void removeHeaders(CallbackInfoReturnable<Map<String, String>> cir) {
final LinkedHashMap<String, String> modifiableMap = new LinkedHashMap<>(cir.getReturnValue()); final LinkedHashMap<String, String> modifiableMap = new LinkedHashMap<>(cir.getReturnValue());
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_14)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_14)) {
modifiableMap.remove("X-Minecraft-Version-ID"); modifiableMap.remove("X-Minecraft-Version-ID");
} }
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) {
modifiableMap.remove("X-Minecraft-Pack-Format"); modifiableMap.remove("X-Minecraft-Pack-Format");
modifiableMap.remove("User-Agent"); modifiableMap.remove("User-Agent");
} }
@ -56,10 +56,10 @@ public class MixinServerResourcePackProvider {
@Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Lcom/google/common/hash/HashCode;toString()Ljava/lang/String;", remap = false)) @Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Lcom/google/common/hash/HashCode;toString()Ljava/lang/String;", remap = false))
public String revertHashAlgorithm(HashCode instance) { public String revertHashAlgorithm(HashCode instance) {
try { try {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
//noinspection deprecation //noinspection deprecation
return Hashing.sha1().hashBytes(Files.toByteArray(protocolhack_trackedFile)).toString(); return Hashing.sha1().hashBytes(Files.toByteArray(protocolhack_trackedFile)).toString();
} else if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_18)) { } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_18)) {
return DigestUtils.sha1Hex(new FileInputStream(protocolhack_trackedFile)); return DigestUtils.sha1Hex(new FileInputStream(protocolhack_trackedFile));
} }
} catch (IOException ignored) { } catch (IOException ignored) {
@ -69,7 +69,7 @@ public class MixinServerResourcePackProvider {
@Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Ljava/lang/String;toLowerCase(Ljava/util/Locale;)Ljava/lang/String;")) @Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Ljava/lang/String;toLowerCase(Ljava/util/Locale;)Ljava/lang/String;"))
public String disableIgnoreCase(String instance, Locale locale) { public String disableIgnoreCase(String instance, Locale locale) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return instance; return instance;
} }

View File

@ -24,25 +24,25 @@ public abstract class MixinAbstractBlock_AbstractBlockState {
public void changeHardness(BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) { public void changeHardness(BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) {
final BlockState state = this.asBlockState(); final BlockState state = this.asBlockState();
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
if (state.getBlock() instanceof InfestedBlock) { if (state.getBlock() instanceof InfestedBlock) {
cir.setReturnValue(0.75F); cir.setReturnValue(0.75F);
} }
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
if (state.getBlock() == Blocks.END_STONE_BRICKS || state.getBlock() == Blocks.END_STONE_BRICK_SLAB || state.getBlock() == Blocks.END_STONE_BRICK_STAIRS || state.getBlock() == Blocks.END_STONE_BRICK_WALL) { if (state.getBlock() == Blocks.END_STONE_BRICKS || state.getBlock() == Blocks.END_STONE_BRICK_SLAB || state.getBlock() == Blocks.END_STONE_BRICK_STAIRS || state.getBlock() == Blocks.END_STONE_BRICK_WALL) {
cir.setReturnValue(0.8F); cir.setReturnValue(0.8F);
} }
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
if (state.getBlock() == Blocks.PISTON || state.getBlock() == Blocks.STICKY_PISTON || state.getBlock() == Blocks.PISTON_HEAD) { if (state.getBlock() == Blocks.PISTON || state.getBlock() == Blocks.STICKY_PISTON || state.getBlock() == Blocks.PISTON_HEAD) {
cir.setReturnValue(0.5F); cir.setReturnValue(0.5F);
} }
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
if (state.getBlock() instanceof InfestedBlock) { if (state.getBlock() instanceof InfestedBlock) {
cir.setReturnValue(0F); cir.setReturnValue(0F);
} }

View File

@ -34,7 +34,7 @@ public class MixinAnvilBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(state.get(FACING).getAxis() == Direction.Axis.X ? viafabricplus_x_axis_shape_v1_12_2 : viafabricplus_z_axis_shape_v1_12_2); cir.setReturnValue(state.get(FACING).getAxis() == Direction.Axis.X ? viafabricplus_x_axis_shape_v1_12_2 : viafabricplus_z_axis_shape_v1_12_2);
} }
} }

View File

@ -16,7 +16,7 @@ public class MixinBambooBlock {
@Inject(method = "isShapeFullCube", at = @At("HEAD"), cancellable = true) @Inject(method = "isShapeFullCube", at = @At("HEAD"), cancellable = true)
public void changeFullCube(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) { public void changeFullCube(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) {
cir.setReturnValue(true); cir.setReturnValue(true);
} }
} }

View File

@ -25,7 +25,7 @@ public class MixinBedBlock {
@Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true) @Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true)
public void injectBounceEntity(Entity entity, CallbackInfo ci) { public void injectBounceEntity(Entity entity, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
ci.cancel(); ci.cancel();
} }
} }
@ -33,7 +33,7 @@ public class MixinBedBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getClassWrapper() != null) { if (ViaLoadingBase.getClassWrapper() != null) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
cir.setReturnValue(viafabricplus_bed_shape_v1_13_2); cir.setReturnValue(viafabricplus_bed_shape_v1_13_2);
} }
} }

View File

@ -17,19 +17,19 @@ public class MixinBlock {
private void modifyBlastResistance(CallbackInfoReturnable<Float> ci) { private void modifyBlastResistance(CallbackInfoReturnable<Float> ci) {
final Block block = ((Block) (Object) this); final Block block = ((Block) (Object) this);
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
if (block == Blocks.END_STONE_BRICKS || block == Blocks.END_STONE_BRICK_SLAB || block == Blocks.END_STONE_BRICK_STAIRS || block == Blocks.END_STONE_BRICK_WALL) { if (block == Blocks.END_STONE_BRICKS || block == Blocks.END_STONE_BRICK_SLAB || block == Blocks.END_STONE_BRICK_STAIRS || block == Blocks.END_STONE_BRICK_WALL) {
ci.setReturnValue(0.8F); ci.setReturnValue(0.8F);
} }
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
if (block == Blocks.PISTON || block == Blocks.STICKY_PISTON || block == Blocks.PISTON_HEAD) { if (block == Blocks.PISTON || block == Blocks.STICKY_PISTON || block == Blocks.PISTON_HEAD) {
ci.setReturnValue(0.5F); ci.setReturnValue(0.5F);
} }
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
if (block instanceof InfestedBlock) { if (block instanceof InfestedBlock) {
ci.setReturnValue(0.75F); ci.setReturnValue(0.75F);
} }

View File

@ -27,7 +27,7 @@ public class MixinBrewingStandBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(viafabricplus_base_shape_v1_12_2); cir.setReturnValue(viafabricplus_base_shape_v1_12_2);
} }
} }

View File

@ -31,7 +31,7 @@ public abstract class MixinCauldronBlock extends AbstractCauldronBlock {
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return viafabricplus_cauldron_shape_v1_12_2; return viafabricplus_cauldron_shape_v1_12_2;
} }
return super.getOutlineShape(state, world, pos, context); return super.getOutlineShape(state, world, pos, context);

View File

@ -35,10 +35,10 @@ public abstract class MixinEndPortalBlock extends BlockWithEntity {
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (MinecraftClient.getInstance() == null || MinecraftClient.getInstance().world == null) return; if (MinecraftClient.getInstance() == null || MinecraftClient.getInstance().world == null) return;
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
cir.setReturnValue(viafabricplus_shape_v1_8_x); cir.setReturnValue(viafabricplus_shape_v1_8_x);
} }
else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
cir.setReturnValue(viafabricplus_shape_v1_16_5); cir.setReturnValue(viafabricplus_shape_v1_16_5);
} }
} }

View File

@ -27,7 +27,7 @@ public class MixinEndPortalFrameBlock {
@Redirect(method = "getOutlineShape", at = @At(value = "FIELD", target = "Lnet/minecraft/block/EndPortalFrameBlock;FRAME_WITH_EYE_SHAPE:Lnet/minecraft/util/shape/VoxelShape;")) @Redirect(method = "getOutlineShape", at = @At(value = "FIELD", target = "Lnet/minecraft/block/EndPortalFrameBlock;FRAME_WITH_EYE_SHAPE:Lnet/minecraft/util/shape/VoxelShape;"))
public VoxelShape redirectGetOutlineShape() { public VoxelShape redirectGetOutlineShape() {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return VoxelShapes.union(FRAME_SHAPE, viafabricplus_eye_shape_v1_12_2); return VoxelShapes.union(FRAME_SHAPE, viafabricplus_eye_shape_v1_12_2);
} }
return FRAME_WITH_EYE_SHAPE; return FRAME_WITH_EYE_SHAPE;

View File

@ -33,7 +33,7 @@ public class MixinFarmlandBlock extends Block {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3)) {
cir.setReturnValue(viafabricplus_shape_v1_9_4); cir.setReturnValue(viafabricplus_shape_v1_9_4);
} }
} }

View File

@ -14,7 +14,7 @@ public class MixinFenceBlock {
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true) @Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
private void injectOnUse(CallbackInfoReturnable<ActionResult> ci) { private void injectOnUse(CallbackInfoReturnable<ActionResult> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) {
ci.setReturnValue(ActionResult.SUCCESS); ci.setReturnValue(ActionResult.SUCCESS);
} }
} }

View File

@ -19,7 +19,7 @@ public class MixinFireBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
cir.setReturnValue(VoxelShapes.empty()); cir.setReturnValue(VoxelShapes.empty());
} }
} }

View File

@ -22,7 +22,7 @@ public class MixinFlowerPotBlock {
@Inject(method = "onUse", at = @At(value = "FIELD", target = "Lnet/minecraft/block/FlowerPotBlock;content:Lnet/minecraft/block/Block;", ordinal = 0), cancellable = true) @Inject(method = "onUse", at = @At(value = "FIELD", target = "Lnet/minecraft/block/FlowerPotBlock;content:Lnet/minecraft/block/Block;", ordinal = 0), cancellable = true)
private void injectOnUse(CallbackInfoReturnable<ActionResult> ci) { private void injectOnUse(CallbackInfoReturnable<ActionResult> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) {
ci.setReturnValue(ActionResult.CONSUME); ci.setReturnValue(ActionResult.CONSUME);
} }
} }

View File

@ -31,14 +31,14 @@ public class MixinHopperBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(viafabricplus_hopper_shape_v1_12_2); cir.setReturnValue(viafabricplus_hopper_shape_v1_12_2);
} }
} }
@Inject(method = "getRaycastShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getRaycastShape", at = @At("HEAD"), cancellable = true)
public void injectGetRaycastShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetRaycastShape(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(viafabricplus_inside_shape_v1_12_2); cir.setReturnValue(viafabricplus_inside_shape_v1_12_2);
} }
} }

View File

@ -32,7 +32,7 @@ public class MixinLadderBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
private void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> ci) { private void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
switch (state.get(LadderBlock.FACING)) { switch (state.get(LadderBlock.FACING)) {
case NORTH -> ci.setReturnValue(viafabricplus_north_shape_v1_8_x); case NORTH -> ci.setReturnValue(viafabricplus_north_shape_v1_8_x);
case SOUTH -> ci.setReturnValue(viafabricplus_south_shape_v1_8_x); case SOUTH -> ci.setReturnValue(viafabricplus_south_shape_v1_8_x);

View File

@ -14,7 +14,7 @@ public class MixinLightBlock {
// Not relevant for GamePlay // Not relevant for GamePlay
@Redirect(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isCreativeLevelTwoOp()Z")) @Redirect(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isCreativeLevelTwoOp()Z"))
public boolean removeIf(PlayerEntity instance) { public boolean removeIf(PlayerEntity instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
return true; return true;
} }
return instance.isCreativeLevelTwoOp(); return instance.isCreativeLevelTwoOp();

View File

@ -23,7 +23,7 @@ public class MixinLilyPadBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void changeBoundingBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void changeBoundingBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
cir.setReturnValue(viafabricplus_shape_v1_8_x); cir.setReturnValue(viafabricplus_shape_v1_8_x);
} }
} }

View File

@ -19,7 +19,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
@Override @Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return protocolhack_get1_8Shape(state); return protocolhack_get1_8Shape(state);
} }
return super.getOutlineShape(state, world, pos, context); return super.getOutlineShape(state, world, pos, context);
@ -27,7 +27,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
@Override @Override
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return protocolhack_get1_8Shape(state); return protocolhack_get1_8Shape(state);
} }
return super.getCollisionShape(state, world, pos, context); return super.getCollisionShape(state, world, pos, context);

View File

@ -23,13 +23,13 @@ public class MixinPistonHeadBlock extends FacingBlock {
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2))
cir.setReturnValue(viafabricplus_getCoreShape_v1_8_x(state)); cir.setReturnValue(viafabricplus_getCoreShape_v1_8_x(state));
} }
@Override @Override
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
return VoxelShapes.union(viafabricplus_getHeadShape_v1_8_x(state), viafabricplus_getCoreShape_v1_8_x(state)); return VoxelShapes.union(viafabricplus_getHeadShape_v1_8_x(state), viafabricplus_getCoreShape_v1_8_x(state));
return super.getCollisionShape(state, world, pos, context); return super.getCollisionShape(state, world, pos, context);

View File

@ -39,7 +39,7 @@ public class MixinSnowBlock {
@Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(viafabricplus_layers_to_shape_v1_12_2[state.get(LAYERS) - 1]); cir.setReturnValue(viafabricplus_layers_to_shape_v1_12_2[state.get(LAYERS) - 1]);
} }
} }

View File

@ -26,7 +26,7 @@ public class MixinSoulSandBlock extends Block {
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
super.onEntityCollision(state, world, pos, entity); super.onEntityCollision(state, world, pos, entity);
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
final Vec3d velocity = entity.getVelocity(); final Vec3d velocity = entity.getVelocity();
this.viafabricplus_forceValue = true; this.viafabricplus_forceValue = true;
entity.setVelocity(velocity.getX() * this.getVelocityMultiplier(), velocity.getY(), velocity.getZ() * this.getVelocityMultiplier()); entity.setVelocity(velocity.getX() * this.getVelocityMultiplier(), velocity.getY(), velocity.getZ() * this.getVelocityMultiplier());
@ -36,7 +36,7 @@ public class MixinSoulSandBlock extends Block {
@Override @Override
public float getVelocityMultiplier() { public float getVelocityMultiplier() {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4) && !this.viafabricplus_forceValue) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4) && !this.viafabricplus_forceValue) {
return 1.0F; return 1.0F;
} }
return super.getVelocityMultiplier(); return super.getVelocityMultiplier();

View File

@ -16,7 +16,7 @@ public class MixinSugarCaneBlock {
@Redirect(method = "canPlaceAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isIn(Lnet/minecraft/registry/tag/TagKey;)Z")) @Redirect(method = "canPlaceAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isIn(Lnet/minecraft/registry/tag/TagKey;)Z"))
public boolean changePlaceTarget(BlockState instance, TagKey<Block> tagKey) { public boolean changePlaceTarget(BlockState instance, TagKey<Block> tagKey) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) {
return instance.isOf(Blocks.GRASS_BLOCK) || instance.isOf(Blocks.DIRT) || instance.isOf(Blocks.COARSE_DIRT) || instance.isOf(Blocks.PODZOL); return instance.isOf(Blocks.GRASS_BLOCK) || instance.isOf(Blocks.DIRT) || instance.isOf(Blocks.COARSE_DIRT) || instance.isOf(Blocks.PODZOL);
} }
return instance.isIn(tagKey); return instance.isIn(tagKey);

View File

@ -127,28 +127,28 @@ public class MixinWallBlock extends Block {
@Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true) @Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true)
public void injectGetPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable<BlockState> cir) { public void injectGetPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable<BlockState> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue())); cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue()));
} }
} }
@Inject(method = "getStateForNeighborUpdate", at = @At("RETURN"), cancellable = true) @Inject(method = "getStateForNeighborUpdate", at = @At("RETURN"), cancellable = true)
public void injectGetStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos, CallbackInfoReturnable<BlockState> cir) { public void injectGetStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos, CallbackInfoReturnable<BlockState> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue())); cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue()));
} }
} }
@Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true)
public void injectGetCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(viafabricplus_cip_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]); cir.setReturnValue(viafabricplus_cip_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]);
} }
} }
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) { public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(viafabricplus_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]); cir.setReturnValue(viafabricplus_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]);
} }
} }

View File

@ -33,7 +33,7 @@ public abstract class MixinAbstractDonkeyEntity extends AbstractHorseEntity {
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
public void fixInteraction(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) { public void fixInteraction(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
ItemStack lv = player.getStackInHand(hand); ItemStack lv = player.getStackInHand(hand);
if (!this.isBaby()) { if (!this.isBaby()) {
if (this.isTame() && player.shouldCancelInteraction()) { if (this.isTame() && player.shouldCancelInteraction()) {

View File

@ -13,7 +13,7 @@ public class MixinAllayEntity {
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true) @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) { public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
cir.setReturnValue(0.0); cir.setReturnValue(0.0);
} }
} }

View File

@ -13,6 +13,6 @@ public class MixinAnimalEntity {
@Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z")) @Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z"))
public boolean redirectInteractMob(World instance) { public boolean redirectInteractMob(World instance) {
return instance.isClient && ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15); return instance.isClient && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15);
} }
} }

View File

@ -75,11 +75,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
double f = this.getZ() - this.lastZ; double f = this.getZ() - this.lastZ;
double g = this.getYaw() - this.lastYaw; double g = this.getYaw() - this.lastYaw;
double h = this.getPitch() - this.lastPitch; double h = this.getPitch() - this.lastPitch;
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8)) {
++this.ticksSinceLastPositionPacketSent; ++this.ticksSinceLastPositionPacketSent;
} }
double n = MathHelper.square(2.05E-4); double n = MathHelper.square(2.05E-4);
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
n = 9.0E-4D; n = 9.0E-4D;
} }
boolean bl3 = MathHelper.squaredMagnitude(d, e, f) > n || this.ticksSinceLastPositionPacketSent >= 20; boolean bl3 = MathHelper.squaredMagnitude(d, e, f) > n || this.ticksSinceLastPositionPacketSent >= 20;
@ -99,7 +99,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
} else { } else {
IdlePacketExecutor.skipIdlePacket(); IdlePacketExecutor.skipIdlePacket();
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
++this.ticksSinceLastPositionPacketSent; ++this.ticksSinceLastPositionPacketSent;
} }
@ -121,7 +121,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Inject(method = "swingHand", at = @At("HEAD"), cancellable = true) @Inject(method = "swingHand", at = @At("HEAD"), cancellable = true)
public void injectSwingHand(Hand hand, CallbackInfo ci) { public void injectSwingHand(Hand hand, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolhack_areSwingCanceledThisTick) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolhack_areSwingCanceledThisTick) {
ci.cancel(); ci.cancel();
} }
@ -134,7 +134,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/Input;sneaking:Z", ordinal = 0) at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/Input;sneaking:Z", ordinal = 0)
) )
private void injectTickMovement(CallbackInfo ci) { private void injectTickMovement(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
if (this.input.sneaking) { if (this.input.sneaking) {
this.input.movementSideways = (float) ((double) this.input.movementSideways / 0.3D); this.input.movementSideways = (float) ((double) this.input.movementSideways / 0.3D);
this.input.movementForward = (float) ((double) this.input.movementForward / 0.3D); this.input.movementForward = (float) ((double) this.input.movementForward / 0.3D);
@ -146,7 +146,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z")), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0))
public boolean redirectIsSneakingWhileSwimming(ClientPlayerEntity _this) { public boolean redirectIsSneakingWhileSwimming(ClientPlayerEntity _this) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
return false; return false;
} else { } else {
return _this.isSwimming(); return _this.isSwimming();
@ -155,7 +155,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Redirect(method = "isWalking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSubmergedInWater()Z")) @Redirect(method = "isWalking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSubmergedInWater()Z"))
public boolean easierUnderwaterSprinting(ClientPlayerEntity instance) { public boolean easierUnderwaterSprinting(ClientPlayerEntity instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
return false; return false;
} }
return instance.isSubmergedInWater(); return instance.isSubmergedInWater();
@ -163,7 +163,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Redirect(method = "tickMovement()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;hasForwardMovement()Z", ordinal = 0)) @Redirect(method = "tickMovement()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;hasForwardMovement()Z", ordinal = 0))
private boolean disableSprintSneak(Input input) { private boolean disableSprintSneak(Input input) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
return input.movementForward >= 0.8F; return input.movementForward >= 0.8F;
} }
@ -172,7 +172,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z")) @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isTouchingWater()Z"))
private boolean redirectTickMovement(ClientPlayerEntity self) { private boolean redirectTickMovement(ClientPlayerEntity self) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return false; // Disable all water related movement return false; // Disable all water related movement
} }
@ -181,7 +181,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V")) @Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V"))
public void removeSprintingPacket(ClientPlayerEntity instance) { public void removeSprintingPacket(ClientPlayerEntity instance) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) {
sendSprintingPacket(); sendSprintingPacket();
} }
} }

View File

@ -23,7 +23,7 @@ public abstract class MixinCowEntity extends AnimalEntity {
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
public void injectInteractMob(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) { public void injectInteractMob(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) {
cir.setReturnValue(super.interactMob(player, hand)); cir.setReturnValue(super.interactMob(player, hand));
} }
} }

View File

@ -14,7 +14,7 @@ public class MixinCreeperEntity {
@Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/sound/SoundEvents;ITEM_FIRECHARGE_USE:Lnet/minecraft/sound/SoundEvent;")) @Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/sound/SoundEvents;ITEM_FIRECHARGE_USE:Lnet/minecraft/sound/SoundEvent;"))
public SoundEvent fixSound() { public SoundEvent fixSound() {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
return SoundEvents.ITEM_FLINTANDSTEEL_USE; return SoundEvents.ITEM_FLINTANDSTEEL_USE;
} }
return SoundEvents.ITEM_FIRECHARGE_USE; return SoundEvents.ITEM_FIRECHARGE_USE;

View File

@ -42,7 +42,7 @@ public abstract class MixinEntity {
@ModifyConstant(method = "movementInputToVelocity", constant = @Constant(doubleValue = 1E-7)) @ModifyConstant(method = "movementInputToVelocity", constant = @Constant(doubleValue = 1E-7))
private static double injectMovementInputToVelocity(double epsilon) { private static double injectMovementInputToVelocity(double epsilon) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return 1E-4; return 1E-4;
} }
return epsilon; return epsilon;
@ -50,21 +50,21 @@ public abstract class MixinEntity {
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true) @Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
public void injectGetVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) { public void injectGetVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
cir.setReturnValue(new BlockPos(pos.x, getBoundingBox().minY - 1, pos.z)); cir.setReturnValue(new BlockPos(pos.x, getBoundingBox().minY - 1, pos.z));
} }
} }
@Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true) @Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true)
public void onGetRotationVector(float pitch, float yaw, CallbackInfoReturnable<Vec3d> cir) { public void onGetRotationVector(float pitch, float yaw, CallbackInfoReturnable<Vec3d> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(Vec3d.fromPolar(pitch, yaw)); cir.setReturnValue(Vec3d.fromPolar(pitch, yaw));
} }
} }
@Inject(method = "setSwimming", at = @At("HEAD"), cancellable = true) @Inject(method = "setSwimming", at = @At("HEAD"), cancellable = true)
private void onSetSwimming(boolean swimming, CallbackInfo ci) { private void onSetSwimming(boolean swimming, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) {
ci.cancel(); ci.cancel();
} }
} }
@ -72,7 +72,7 @@ public abstract class MixinEntity {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Inject(method = "updateMovementInFluid", at = @At("HEAD"), cancellable = true) @Inject(method = "updateMovementInFluid", at = @At("HEAD"), cancellable = true)
private void modifyFluidMovementBoundingBox(TagKey<Fluid> fluidTag, double d, CallbackInfoReturnable<Boolean> ci) { private void modifyFluidMovementBoundingBox(TagKey<Fluid> fluidTag, double d, CallbackInfoReturnable<Boolean> ci) {
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) {
return; return;
} }
@ -122,19 +122,19 @@ public abstract class MixinEntity {
@Inject(method = "getTargetingMargin", at = @At("HEAD"), cancellable = true) @Inject(method = "getTargetingMargin", at = @At("HEAD"), cancellable = true)
public void expandHitBox(CallbackInfoReturnable<Float> cir) { public void expandHitBox(CallbackInfoReturnable<Float> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
cir.setReturnValue(0.1F); cir.setReturnValue(0.1F);
} }
} }
@Redirect(method = {"setYaw", "setPitch"}, at = @At(value = "INVOKE", target = "Ljava/lang/Float;isFinite(F)Z")) @Redirect(method = {"setYaw", "setPitch"}, at = @At(value = "INVOKE", target = "Ljava/lang/Float;isFinite(F)Z"))
public boolean modifyIsFinite(float f) { public boolean modifyIsFinite(float f) {
return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)); return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2));
} }
@ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7)) @ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7))
public double changeBlockCollisionConstant(double constant) { public double changeBlockCollisionConstant(double constant) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
return 0.001; return 0.001;
} }
return constant; return constant;
@ -143,7 +143,7 @@ public abstract class MixinEntity {
// Not relevant for GamePlay // Not relevant for GamePlay
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onLanding()V")) @Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onLanding()V"))
public void revertOnLanding(Entity instance) { public void revertOnLanding(Entity instance) {
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
instance.onLanding(); instance.onLanding();
} }
} }

View File

@ -25,12 +25,12 @@ public class MixinEntityIndex<T extends EntityLike> {
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z", remap = false)) @Redirect(method = "add", at = @At(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z", remap = false))
private boolean allowDuplicateUuid(Map<UUID, T> instance, Object o) { private boolean allowDuplicateUuid(Map<UUID, T> instance, Object o) {
return instance.containsKey(o) && ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_16_4); return instance.containsKey(o) && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_16_4);
} }
@Inject(method = "size", at = @At("HEAD"), cancellable = true) @Inject(method = "size", at = @At("HEAD"), cancellable = true)
private void returnRealSize(CallbackInfoReturnable<Integer> cir) { private void returnRealSize(CallbackInfoReturnable<Integer> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
cir.setReturnValue(this.idToEntity.size()); cir.setReturnValue(this.idToEntity.size());
} }
} }

View File

@ -14,7 +14,7 @@ public class MixinEntityPredicates {
@SuppressWarnings("target") @SuppressWarnings("target")
@Redirect(method = "method_5915(Lnet/minecraft/entity/Entity;Lnet/minecraft/scoreboard/AbstractTeam;Lnet/minecraft/scoreboard/AbstractTeam$CollisionRule;Lnet/minecraft/entity/Entity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isMainPlayer()Z")) @Redirect(method = "method_5915(Lnet/minecraft/entity/Entity;Lnet/minecraft/scoreboard/AbstractTeam;Lnet/minecraft/scoreboard/AbstractTeam$CollisionRule;Lnet/minecraft/entity/Entity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isMainPlayer()Z"))
private static boolean makeMainPlayerUnpushable(PlayerEntity player) { private static boolean makeMainPlayerUnpushable(PlayerEntity player) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return false; return false;
} }
return player.isMainPlayer(); return player.isMainPlayer();

View File

@ -13,7 +13,7 @@ public class MixinItemEntity {
@Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true) @Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true)
public void injectApplyWaterBuoyancy(CallbackInfo ci) { public void injectApplyWaterBuoyancy(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
ci.cancel(); ci.cancel();
} }
} }

View File

@ -33,7 +33,7 @@ public abstract class MixinLivingEntity extends Entity {
@Inject(method = "getPreferredEquipmentSlot", at = @At("HEAD"), cancellable = true) @Inject(method = "getPreferredEquipmentSlot", at = @At("HEAD"), cancellable = true)
private static void removeShieldSlotPreference(ItemStack stack, CallbackInfoReturnable<EquipmentSlot> cir) { private static void removeShieldSlotPreference(ItemStack stack, CallbackInfoReturnable<EquipmentSlot> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) {
cir.setReturnValue(EquipmentSlot.MAINHAND); cir.setReturnValue(EquipmentSlot.MAINHAND);
} }
} }
@ -43,7 +43,7 @@ public abstract class MixinLivingEntity extends Entity {
@Redirect(method = "applyMovementInput", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;jumping:Z")) @Redirect(method = "applyMovementInput", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;jumping:Z"))
private boolean disableJumpOnLadder(LivingEntity self) { private boolean disableJumpOnLadder(LivingEntity self) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return false; return false;
} }
@ -54,7 +54,7 @@ public abstract class MixinLivingEntity extends Entity {
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;DOLPHINS_GRACE:Lnet/minecraft/entity/effect/StatusEffect;")), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;DOLPHINS_GRACE:Lnet/minecraft/entity/effect/StatusEffect;")),
at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;horizontalCollision:Z", ordinal = 0)) at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;horizontalCollision:Z", ordinal = 0))
private boolean disableClimbing(LivingEntity self) { private boolean disableClimbing(LivingEntity self) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return false; return false;
} }
@ -63,7 +63,7 @@ public abstract class MixinLivingEntity extends Entity {
@ModifyVariable(method = "applyFluidMovingSpeed", ordinal = 0, at = @At("HEAD"), argsOnly = true) @ModifyVariable(method = "applyFluidMovingSpeed", ordinal = 0, at = @At("HEAD"), argsOnly = true)
private boolean modifyMovingDown(boolean movingDown) { private boolean modifyMovingDown(boolean movingDown) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return true; return true;
} }
@ -74,14 +74,14 @@ public abstract class MixinLivingEntity extends Entity {
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;LEVITATION:Lnet/minecraft/entity/effect/StatusEffect;", ordinal = 0)), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;LEVITATION:Lnet/minecraft/entity/effect/StatusEffect;", ordinal = 0)),
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;onLanding()V", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;onLanding()V", ordinal = 0))
private void dontResetLevitationFallDistance(LivingEntity instance) { private void dontResetLevitationFallDistance(LivingEntity instance) {
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) {
instance.onLanding(); instance.onLanding();
} }
} }
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSprinting()Z", ordinal = 0)) @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSprinting()Z", ordinal = 0))
private boolean modifySwimSprintSpeed(LivingEntity self) { private boolean modifySwimSprintSpeed(LivingEntity self) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
return false; return false;
} }
return self.isSprinting(); return self.isSprinting();
@ -89,7 +89,7 @@ public abstract class MixinLivingEntity extends Entity {
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFluidHeight(Lnet/minecraft/registry/tag/TagKey;)D")) @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFluidHeight(Lnet/minecraft/registry/tag/TagKey;)D"))
private double redirectFluidHeight(LivingEntity instance, TagKey<Fluid> tagKey) { private double redirectFluidHeight(LivingEntity instance, TagKey<Fluid> tagKey) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) {
if (instance.getFluidHeight(tagKey) > 0) { if (instance.getFluidHeight(tagKey) > 0) {
return 1; return 1;
} }
@ -99,14 +99,14 @@ public abstract class MixinLivingEntity extends Entity {
@Inject(method = "applyFluidMovingSpeed", at = @At("HEAD"), cancellable = true) @Inject(method = "applyFluidMovingSpeed", at = @At("HEAD"), cancellable = true)
private void modifySwimSprintFallSpeed(double gravity, boolean movingDown, Vec3d velocity, CallbackInfoReturnable<Vec3d> ci) { private void modifySwimSprintFallSpeed(double gravity, boolean movingDown, Vec3d velocity, CallbackInfoReturnable<Vec3d> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && !hasNoGravity()) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && !hasNoGravity()) {
ci.setReturnValue(new Vec3d(velocity.x, velocity.y - 0.02, velocity.z)); ci.setReturnValue(new Vec3d(velocity.x, velocity.y - 0.02, velocity.z));
} }
} }
@ModifyConstant(method = "tickMovement", constant = @Constant(doubleValue = 0.003D)) @ModifyConstant(method = "tickMovement", constant = @Constant(doubleValue = 0.003D))
public double modifyVelocityZero(final double constant) { public double modifyVelocityZero(final double constant) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return 0.005D; return 0.005D;
} }
return constant; return constant;
@ -114,14 +114,14 @@ public abstract class MixinLivingEntity extends Entity {
@Inject(method = "canEnterTrapdoor", at = @At("HEAD"), cancellable = true) @Inject(method = "canEnterTrapdoor", at = @At("HEAD"), cancellable = true)
private void onCanEnterTrapdoor(CallbackInfoReturnable<Boolean> ci) { private void onCanEnterTrapdoor(CallbackInfoReturnable<Boolean> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
ci.setReturnValue(false); ci.setReturnValue(false);
} }
} }
@ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.9F)) @ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.9F))
private float changeEntitySpeed(float constant) { private float changeEntitySpeed(float constant) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
//noinspection ConstantConditions //noinspection ConstantConditions
if ((Entity) this instanceof SkeletonHorseEntity) { if ((Entity) this instanceof SkeletonHorseEntity) {
return this.getBaseMovementSpeedMultiplier(); // 0.96F return this.getBaseMovementSpeedMultiplier(); // 0.96F
@ -133,7 +133,7 @@ public abstract class MixinLivingEntity extends Entity {
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D")) @Redirect(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;cos(D)D"))
public double fixCosTable(double a) { public double fixCosTable(double a) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
return MathHelper.cos((float) a); return MathHelper.cos((float) a);
} }
return Math.cos(a); return Math.cos(a);
@ -143,7 +143,7 @@ public abstract class MixinLivingEntity extends Entity {
public double fixLavaMovement(LivingEntity instance, TagKey<Fluid> tagKey) { public double fixLavaMovement(LivingEntity instance, TagKey<Fluid> tagKey) {
double height = instance.getFluidHeight(tagKey); double height = instance.getFluidHeight(tagKey);
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
height += getSwimHeight() + 4; height += getSwimHeight() + 4;
} }
return height; return height;
@ -151,7 +151,7 @@ public abstract class MixinLivingEntity extends Entity {
@ModifyConstant(method = "isBlocking", constant = @Constant(intValue = 5)) @ModifyConstant(method = "isBlocking", constant = @Constant(intValue = 5))
public int shieldBlockCounter(int constant) { public int shieldBlockCounter(int constant) {
if(ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if(ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return 0; return 0;
} }
return constant; return constant;
@ -159,7 +159,7 @@ public abstract class MixinLivingEntity extends Entity {
@Redirect(method = "tickCramming", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isClient()Z")) @Redirect(method = "tickCramming", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isClient()Z"))
public boolean revertOnlyPlayerCramming(World instance) { public boolean revertOnlyPlayerCramming(World instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
return false; return false;
} }
return instance.isClient(); return instance.isClient();

View File

@ -20,7 +20,7 @@ public class MixinOtherClientPlayerEntity extends AbstractClientPlayerEntity {
@Inject(method = "updatePose", at = @At("HEAD")) @Inject(method = "updatePose", at = @At("HEAD"))
public void injectUpdatePose(CallbackInfo ci) { public void injectUpdatePose(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
super.updatePose(); super.updatePose();
} }
} }

View File

@ -18,7 +18,7 @@ public abstract class MixinPiglinEntity {
@Inject(method = "getActiveEyeHeight", at = @At("HEAD"), cancellable = true) @Inject(method = "getActiveEyeHeight", at = @At("HEAD"), cancellable = true)
public void changeEyeHeight(EntityPose pose, EntityDimensions dimensions, CallbackInfoReturnable<Float> cir) { public void changeEyeHeight(EntityPose pose, EntityDimensions dimensions, CallbackInfoReturnable<Float> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
cir.setReturnValue(this.isBaby() ? 0.93F : 1.74F); cir.setReturnValue(this.isBaby() ? 0.93F : 1.74F);
} }
} }

View File

@ -33,7 +33,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
@Inject(method = "updatePose", at = @At("HEAD"), cancellable = true) @Inject(method = "updatePose", at = @At("HEAD"), cancellable = true)
private void onUpdatePose(CallbackInfo ci) { private void onUpdatePose(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
EntityPose pose; EntityPose pose;
if (isFallFlying()) if (isFallFlying())
@ -57,9 +57,9 @@ public abstract class MixinPlayerEntity extends LivingEntity {
@Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true) @Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true)
private void onGetDimensions(EntityPose pose, CallbackInfoReturnable<EntityDimensions> ci) { private void onGetDimensions(EntityPose pose, CallbackInfoReturnable<EntityDimensions> ci) {
if (pose == EntityPose.CROUCHING) { if (pose == EntityPose.CROUCHING) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
ci.setReturnValue(PlayerEntity.STANDING_DIMENSIONS); ci.setReturnValue(PlayerEntity.STANDING_DIMENSIONS);
} else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
ci.setReturnValue(protocolhack_SNEAKING_DIMENSIONS_1_13_2); ci.setReturnValue(protocolhack_SNEAKING_DIMENSIONS_1_13_2);
} }
} }
@ -67,7 +67,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
@ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f)) @ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f))
private float modifySneakEyeHeight(float prevEyeHeight) { private float modifySneakEyeHeight(float prevEyeHeight) {
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_19_1)) {
return prevEyeHeight; return prevEyeHeight;
} else { } else {
return 1.54f; return 1.54f;
@ -76,7 +76,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
@Inject(method = "getAttackCooldownProgress", at = @At("HEAD"), cancellable = true) @Inject(method = "getAttackCooldownProgress", at = @At("HEAD"), cancellable = true)
private void injectGetAttackCooldownProgress(CallbackInfoReturnable<Float> ci) { private void injectGetAttackCooldownProgress(CallbackInfoReturnable<Float> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
ci.setReturnValue(1f); ci.setReturnValue(1f);
} }
} }

View File

@ -14,7 +14,7 @@ public class MixinSquidEntity {
@Inject(method = "canBeLeashedBy", at = @At("HEAD"), cancellable = true) @Inject(method = "canBeLeashedBy", at = @At("HEAD"), cancellable = true)
public void injectCanBeLeashedBy(PlayerEntity player, CallbackInfoReturnable<Boolean> cir) { public void injectCanBeLeashedBy(PlayerEntity player, CallbackInfoReturnable<Boolean> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
cir.setReturnValue(false); cir.setReturnValue(false);
} }
} }

View File

@ -20,7 +20,7 @@ public class MixinVexEntity extends HostileEntity {
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true) @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) { public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
cir.setReturnValue(0.0); cir.setReturnValue(0.0);
} }
} }

View File

@ -17,7 +17,7 @@ public class MixinWolfEntity {
@Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;getHealth()F")) @Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;getHealth()F"))
public float rewriteHealth(WolfEntity instance) { public float rewriteHealth(WolfEntity instance) {
float health = instance.getHealth(); float health = instance.getHealth();
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get().get(Meta18Storage.class).getHealthDataMap().getOrDefault(instance.getId(), health); return MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get().get(Meta18Storage.class).getHealthDataMap().getOrDefault(instance.getId(), health);
} }
return health; return health;

View File

@ -26,7 +26,7 @@ public class MixinKeyboard {
@Redirect(method = "processF3", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendCommand(Ljava/lang/String;)Z", ordinal = 0)) @Redirect(method = "processF3", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendCommand(Ljava/lang/String;)Z", ordinal = 0))
public boolean replaceSpectatorCommand(ClientPlayNetworkHandler instance, String command) { public boolean replaceSpectatorCommand(ClientPlayNetworkHandler instance, String command) {
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
return false; return false;
} }
return instance.sendCommand(command); return instance.sendCommand(command);

View File

@ -14,9 +14,9 @@ public class MixinKeyboardInput extends Input {
@ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true) @ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true)
private boolean injectTick(boolean slowDown) { private boolean injectTick(boolean slowDown) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return this.sneaking; return this.sneaking;
} else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) { } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return !MinecraftClient.getInstance().player.isSpectator() && (this.sneaking || slowDown); return !MinecraftClient.getInstance().player.isSpectator() && (this.sneaking || slowDown);
} }
return slowDown; return slowDown;

View File

@ -15,7 +15,7 @@ public class MixinAxeItem {
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
public void injectUseOnBlock(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) { public void injectUseOnBlock(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
cir.setReturnValue(ActionResult.PASS); cir.setReturnValue(ActionResult.PASS);
} }
} }

View File

@ -23,7 +23,7 @@ public class MixinBlockItem {
@Inject(method = "canPlace", at = @At("HEAD"), cancellable = true) @Inject(method = "canPlace", at = @At("HEAD"), cancellable = true)
private void injectCanPlace(ItemPlacementContext context, BlockState state, CallbackInfoReturnable<Boolean> ci) { private void injectCanPlace(ItemPlacementContext context, BlockState state, CallbackInfoReturnable<Boolean> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
Block block = state.getBlock(); Block block = state.getBlock();
if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) { if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) {
World world = context.getWorld(); World world = context.getWorld();

View File

@ -18,7 +18,7 @@ public class MixinEnderPearlItem {
@Inject(method = "use", at = @At("HEAD"), cancellable = true) @Inject(method = "use", at = @At("HEAD"), cancellable = true)
private void injectUse(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> ci) { private void injectUse(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) {
ci.setReturnValue(TypedActionResult.pass(user.getStackInHand(hand))); ci.setReturnValue(TypedActionResult.pass(user.getStackInHand(hand)));
} }
} }

View File

@ -13,7 +13,7 @@ public class MixinFireworkRocketItem {
@Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isFallFlying()Z", ordinal = 0)) @Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isFallFlying()Z", ordinal = 0))
private boolean disableFireworkElytraBoost(PlayerEntity player) { private boolean disableFireworkElytraBoost(PlayerEntity player) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) {
return false; return false;
} }

View File

@ -31,7 +31,7 @@ public class MixinHeldItemRenderer {
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"))
private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
//noinspection DataFlowIssue //noinspection DataFlowIssue
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) {
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-102.25f)); matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-102.25f));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(13.365f)); matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(13.365f));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(78.05f)); matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(78.05f));

View File

@ -43,7 +43,7 @@ public abstract class MixinHoeItem extends MiningToolItem {
@Override @Override
public boolean isSuitableFor(BlockState state) { public boolean isSuitableFor(BlockState state) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
return false; return false;
} }
@ -52,10 +52,10 @@ public abstract class MixinHoeItem extends MiningToolItem {
@Override @Override
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
return 1.0F; return 1.0F;
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
return protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F; return protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
} }
return super.getMiningSpeedMultiplier(stack, state); return super.getMiningSpeedMultiplier(stack, state);

View File

@ -23,12 +23,12 @@ public class MixinItemGroups {
@Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z")) @Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z"))
private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) { private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) {
return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getTargetVersion() && viafabricplus_state == GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue(); return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue();
} }
@Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE)) @Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE))
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable<Boolean> cir) { private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable<Boolean> cir) {
viafabricplus_version = ViaLoadingBase.getTargetVersion(); viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion();
viafabricplus_state = GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue(); viafabricplus_state = GeneralSettings.getClassWrapper().removeNotAvailableItemsFromCreativeTab.getValue();
} }
} }

View File

@ -20,9 +20,9 @@ public class MixinItemPlacementContext {
final ItemPlacementContext self = (ItemPlacementContext) (Object) this; final ItemPlacementContext self = (ItemPlacementContext) (Object) this;
final PlayerEntity player = self.getPlayer(); final PlayerEntity player = self.getPlayer();
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && player != null) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && player != null) {
final BlockPos placementPos = self.getBlockPos(); final BlockPos placementPos = self.getBlockPos();
final double blockPosCenterFactor = ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_10) ? 0.5 : 0; final double blockPosCenterFactor = ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_10) ? 0.5 : 0;
if (Math.abs(player.getX() - (placementPos.getX() + blockPosCenterFactor)) < 2 && Math.abs(player.getZ() - (placementPos.getZ() + blockPosCenterFactor)) < 2) { if (Math.abs(player.getX() - (placementPos.getX() + blockPosCenterFactor)) < 2 && Math.abs(player.getZ() - (placementPos.getZ() + blockPosCenterFactor)) < 2) {
final double eyeY = player.getY() + player.getEyeHeight(player.getPose()); final double eyeY = player.getY() + player.getEyeHeight(player.getPose());

View File

@ -28,7 +28,7 @@ public abstract class MixinItemStack {
private void modifyMiningSpeedMultiplier(BlockState state, CallbackInfoReturnable<Float> ci) { private void modifyMiningSpeedMultiplier(BlockState state, CallbackInfoReturnable<Float> ci) {
final Item toolItem = ((ItemStack) (Object) this).getItem(); final Item toolItem = ((ItemStack) (Object) this).getItem();
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && toolItem instanceof HoeItem) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && toolItem instanceof HoeItem) {
ci.setReturnValue(1F); ci.setReturnValue(1F);
} }
} }
@ -37,7 +37,7 @@ public abstract class MixinItemStack {
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/attribute/EntityAttributes;GENERIC_ATTACK_DAMAGE:Lnet/minecraft/entity/attribute/EntityAttribute;", ordinal = 0)), slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/attribute/EntityAttributes;GENERIC_ATTACK_DAMAGE:Lnet/minecraft/entity/attribute/EntityAttribute;", ordinal = 0)),
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getAttributeBaseValue(Lnet/minecraft/entity/attribute/EntityAttribute;)D", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getAttributeBaseValue(Lnet/minecraft/entity/attribute/EntityAttribute;)D", ordinal = 0))
private double redirectGetTooltip(PlayerEntity player, EntityAttribute attribute) { private double redirectGetTooltip(PlayerEntity player, EntityAttribute attribute) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return 0; return 0;
} else { } else {
return player.getAttributeBaseValue(attribute); return player.getAttributeBaseValue(attribute);

View File

@ -17,7 +17,7 @@ public class MixinMiningToolItem {
@Inject(method = "getMiningSpeedMultiplier", at = @At("RETURN"), cancellable = true) @Inject(method = "getMiningSpeedMultiplier", at = @At("RETURN"), cancellable = true)
public void changeHoeEffectiveBlocks(ItemStack stack, BlockState state, CallbackInfoReturnable<Float> cir) { public void changeHoeEffectiveBlocks(ItemStack stack, BlockState state, CallbackInfoReturnable<Float> cir) {
//noinspection ConstantValue //noinspection ConstantValue
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && (Object) this instanceof HoeItem) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && (Object) this instanceof HoeItem) {
cir.setReturnValue(1.0F); cir.setReturnValue(1.0F);
} }
} }

View File

@ -35,7 +35,7 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
@Override @Override
public boolean isSuitableFor(BlockState state) { public boolean isSuitableFor(BlockState state) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
Block block = state.getBlock(); Block block = state.getBlock();
int i = this.getMaterial().getMiningLevel(); int i = this.getMaterial().getMiningLevel();
if (block == Blocks.OBSIDIAN) { if (block == Blocks.OBSIDIAN) {
@ -53,9 +53,9 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
@Override @Override
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F; return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
} else if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { } else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F; return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
} }
return super.getMiningSpeedMultiplier(stack, state); return super.getMiningSpeedMultiplier(stack, state);

View File

@ -17,7 +17,7 @@ public class MixinShovelItem {
at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0), at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0),
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/item/ShovelItem;PATH_STATES:Ljava/util/Map;"))) slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/item/ShovelItem;PATH_STATES:Ljava/util/Map;")))
private Object redirectUseOnBlock(Map<Object, Object> map, Object grassBlock) { private Object redirectUseOnBlock(Map<Object, Object> map, Object grassBlock) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return null; return null;
} else { } else {
return map.get(grassBlock); return map.get(grassBlock);

View File

@ -23,7 +23,7 @@ public class MixinSwordItem extends ToolItem {
@Override @Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) { public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
ItemStack itemStack = user.getStackInHand(hand); ItemStack itemStack = user.getStackInHand(hand);
user.setCurrentHand(hand); user.setCurrentHand(hand);
return TypedActionResult.consume(itemStack); return TypedActionResult.consume(itemStack);
@ -33,7 +33,7 @@ public class MixinSwordItem extends ToolItem {
@Override @Override
public UseAction getUseAction(ItemStack stack) { public UseAction getUseAction(ItemStack stack) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return UseAction.BLOCK; return UseAction.BLOCK;
} }
return super.getUseAction(stack); return super.getUseAction(stack);
@ -41,7 +41,7 @@ public class MixinSwordItem extends ToolItem {
@Override @Override
public int getMaxUseTime(ItemStack stack) { public int getMaxUseTime(ItemStack stack) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
return 72000; return 72000;
} }
return super.getMaxUseTime(stack); return super.getMaxUseTime(stack);

View File

@ -14,7 +14,7 @@ public class MixinPacketByteBuf {
@Inject(method = "readText", at = @At(value = "INVOKE", target = "Lio/netty/handler/codec/DecoderException;<init>(Ljava/lang/String;)V", shift = At.Shift.BEFORE, remap = false), cancellable = true) @Inject(method = "readText", at = @At(value = "INVOKE", target = "Lio/netty/handler/codec/DecoderException;<init>(Ljava/lang/String;)V", shift = At.Shift.BEFORE, remap = false), cancellable = true)
public void injectReadText(CallbackInfoReturnable<Text> cir) { public void injectReadText(CallbackInfoReturnable<Text> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18)) {
cir.setReturnValue(null); cir.setReturnValue(null);
} }
} }

View File

@ -27,7 +27,7 @@ public class MixinUpdatePlayerAbilitiesC2SPacket {
byte b = 0; byte b = 0;
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
if (this.flying) b = (byte) (b | 2); // Minecraft if (this.flying) b = (byte) (b | 2); // Minecraft
if (abilities.invulnerable) b |= 1; if (abilities.invulnerable) b |= 1;

View File

@ -38,14 +38,14 @@ public class MixinConnectScreen_1 {
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getHostName()Ljava/lang/String;", ordinal = 1)) @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getHostName()Ljava/lang/String;", ordinal = 1))
public String replaceAddress(InetSocketAddress instance) { public String replaceAddress(InetSocketAddress instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getAddress(); if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getAddress();
return instance.getHostString(); return instance.getHostString();
} }
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getPort()I")) @Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getPort()I"))
public int replacePort(InetSocketAddress instance) { public int replacePort(InetSocketAddress instance) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getPort(); if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) return field_33737.getPort();
return instance.getPort(); return instance.getPort();
} }
@ -59,11 +59,11 @@ public class MixinConnectScreen_1 {
return; return;
} }
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_19)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_19)) {
return; // This disables the chat session emulation for all versions <= 1.18.2 return; // This disables the chat session emulation for all versions <= 1.18.2
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
try { try {
final PlayerKeyPair playerKeyPair = MinecraftClient.getInstance().getProfileKeys().fetchKeyPair().get().orElse(null); final PlayerKeyPair playerKeyPair = MinecraftClient.getInstance().getProfileKeys().fetchKeyPair().get().orElse(null);
if (playerKeyPair != null) { if (playerKeyPair != null) {
@ -72,7 +72,7 @@ public class MixinConnectScreen_1 {
userConnection.put(new ChatSession1_19_2(userConnection, profileKey, playerKeyPair.privateKey())); userConnection.put(new ChatSession1_19_2(userConnection, profileKey, playerKeyPair.privateKey()));
if (ViaLoadingBase.getTargetVersion() == ProtocolVersion.v1_19) { if (ViaLoadingBase.getClassWrapper().getTargetVersion() == ProtocolVersion.v1_19) {
final byte[] legacyKey = ((IPublicKeyData) (Object) publicKeyData).viafabricplus_get1_19_0Key().array(); final byte[] legacyKey = ((IPublicKeyData) (Object) publicKeyData).viafabricplus_get1_19_0Key().array();
if (legacyKey != null) { if (legacyKey != null) {
userConnection.put(new ChatSession1_19_0(userConnection, profileKey, playerKeyPair.privateKey(), legacyKey)); userConnection.put(new ChatSession1_19_0(userConnection, profileKey, playerKeyPair.privateKey(), legacyKey));

View File

@ -31,14 +31,14 @@ public class MixinDownloadingTerrainScreen extends Screen {
@Inject(method = "tick", at = @At("HEAD"), cancellable = true) @Inject(method = "tick", at = @At("HEAD"), cancellable = true)
public void injectTick(CallbackInfo ci) { public void injectTick(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
protocolhack_tickCounter++; protocolhack_tickCounter++;
if (protocolhack_tickCounter % 20 == 0) { if (protocolhack_tickCounter % 20 == 0) {
MinecraftClient.getInstance().getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0)); MinecraftClient.getInstance().getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0));
} }
} }
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
final boolean isTimeOver = this.closeOnNextTick || System.currentTimeMillis() > this.loadStartTime + 2000L; final boolean isTimeOver = this.closeOnNextTick || System.currentTimeMillis() > this.loadStartTime + 2000L;
if (isTimeOver && this.client != null && this.client.player != null) { if (isTimeOver && this.client != null && this.client.player != null) {

View File

@ -24,10 +24,10 @@ public class MixinGameModeSelectionScreen {
@Inject(method = "<init>", at = @At("RETURN")) @Inject(method = "<init>", at = @At("RETURN"))
public void fixUIWidth(CallbackInfo ci) { public void fixUIWidth(CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
final List<GameModeSelectionScreen.GameModeSelection> gameModeSelections = Arrays.stream(GameModeSelectionScreen.GameModeSelection.values()).toList(); final List<GameModeSelectionScreen.GameModeSelection> gameModeSelections = Arrays.stream(GameModeSelectionScreen.GameModeSelection.values()).toList();
if (ViaLoadingBase.getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE); if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR); if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR);
protocolhack_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new); protocolhack_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
UI_WIDTH = protocolhack_unwrappedGameModes.length * 31 - 5; UI_WIDTH = protocolhack_unwrappedGameModes.length * 31 - 5;
@ -36,7 +36,7 @@ public class MixinGameModeSelectionScreen {
@Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;")) @Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;"))
public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() { public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() {
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
return protocolhack_unwrappedGameModes; return protocolhack_unwrappedGameModes;
} }
return GameModeSelectionScreen.GameModeSelection.values(); return GameModeSelectionScreen.GameModeSelection.values();

View File

@ -24,7 +24,7 @@ public class MixinGameModeSelectionScreen_GameModeSelection {
@Inject(method = "getCommand", at = @At("HEAD"), cancellable = true) @Inject(method = "getCommand", at = @At("HEAD"), cancellable = true)
private void oldCommand(CallbackInfoReturnable<String> cir) { private void oldCommand(CallbackInfoReturnable<String> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_2_4tor1_2_5)) {
cir.setReturnValue( cir.setReturnValue(
"gamemode " + MinecraftClient.getInstance().getSession().getUsername() + ' ' + switch (((Enum<?>)(Object)this).ordinal()) { "gamemode " + MinecraftClient.getInstance().getSession().getUsername() + ' ' + switch (((Enum<?>)(Object)this).ordinal()) {
case 0, 3 -> 1; case 0, 3 -> 1;
@ -37,11 +37,11 @@ public class MixinGameModeSelectionScreen_GameModeSelection {
@Inject(method = "next", at = @At("HEAD"), cancellable = true) @Inject(method = "next", at = @At("HEAD"), cancellable = true)
public void unwrapGameModes(CallbackInfoReturnable<Optional<GameModeSelectionScreen.GameModeSelection>> cir) { public void unwrapGameModes(CallbackInfoReturnable<Optional<GameModeSelectionScreen.GameModeSelection>> cir) {
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
switch ((GameModeSelectionScreen.GameModeSelection)(Object)this) { switch ((GameModeSelectionScreen.GameModeSelection)(Object)this) {
case CREATIVE -> cir.setReturnValue(Optional.of(SURVIVAL)); case CREATIVE -> cir.setReturnValue(Optional.of(SURVIVAL));
case SURVIVAL -> { case SURVIVAL -> {
if (ViaLoadingBase.getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_2_4tor1_2_5)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_2_4tor1_2_5)) {
cir.setReturnValue(Optional.of(CREATIVE)); cir.setReturnValue(Optional.of(CREATIVE));
} else { } else {
cir.setReturnValue(Optional.of(GameModeSelectionScreen.GameModeSelection.ADVENTURE)); cir.setReturnValue(Optional.of(GameModeSelectionScreen.GameModeSelection.ADVENTURE));

View File

@ -19,6 +19,6 @@ public class MixinStructureBlockScreen_1 extends TextFieldWidget {
@Inject(method = "charTyped(CI)Z", at = @At("HEAD"), cancellable = true) @Inject(method = "charTyped(CI)Z", at = @At("HEAD"), cancellable = true)
private void onCharTyped(char chr, int keyCode, CallbackInfoReturnable<Boolean> ci) { private void onCharTyped(char chr, int keyCode, CallbackInfoReturnable<Boolean> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) ci.setReturnValue(super.charTyped(chr, keyCode)); if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) ci.setReturnValue(super.charTyped(chr, keyCode));
} }
} }

View File

@ -12,7 +12,7 @@ public class MixinBossBarHud_1 {
@Redirect(method = "updateProgress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ClientBossBar;setPercent(F)V")) @Redirect(method = "updateProgress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ClientBossBar;setPercent(F)V"))
public void nullSafety(ClientBossBar instance, float percent) { public void nullSafety(ClientBossBar instance, float percent) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
if (instance != null) instance.setPercent(percent); if (instance != null) instance.setPercent(percent);
} }
} }

View File

@ -13,7 +13,7 @@ public class MixinMerchantScreenHandler {
@Inject(method = "switchTo", at = @At("HEAD"), cancellable = true) @Inject(method = "switchTo", at = @At("HEAD"), cancellable = true)
private void injectSwitchTo(int recipeId, CallbackInfo ci) { private void injectSwitchTo(int recipeId, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
ci.cancel(); // no lmao? ci.cancel(); // no lmao?
} }
} }

View File

@ -18,12 +18,12 @@ public class MixinBrewingStandScreenHandler_FuelSlot extends Slot {
@Inject(method = "matches(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), cancellable = true) @Inject(method = "matches(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), cancellable = true)
private static void removeFuelSlot(CallbackInfoReturnable<Boolean> ci) { private static void removeFuelSlot(CallbackInfoReturnable<Boolean> ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
ci.setReturnValue(false); ci.setReturnValue(false);
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8); return ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8);
} }
} }

View File

@ -25,7 +25,7 @@ public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandl
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$2;<init>(Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;III)V")), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$2;<init>(Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;III)V")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;", ordinal = 0))
private Slot redirectAddOffhandSlot(PlayerScreenHandler screenHandler, Slot slot) { private Slot redirectAddOffhandSlot(PlayerScreenHandler screenHandler, Slot slot) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
return null; return null;
return addSlot(slot); return addSlot(slot);
} }
@ -33,7 +33,7 @@ public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandl
@SuppressWarnings("InvalidInjectorMethodSignature") @SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(method = "quickMove", ordinal = 0, at = @At(value = "STORE", ordinal = 0)) @ModifyVariable(method = "quickMove", ordinal = 0, at = @At(value = "STORE", ordinal = 0))
private EquipmentSlot injectTransferSlot(EquipmentSlot slot) { private EquipmentSlot injectTransferSlot(EquipmentSlot slot) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && slot == EquipmentSlot.OFFHAND) if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && slot == EquipmentSlot.OFFHAND)
return EquipmentSlot.MAINHAND; return EquipmentSlot.MAINHAND;
else else
return slot; return slot;

View File

@ -20,7 +20,7 @@ public class MixinScreenHandler implements IScreenHandler {
@Inject(method = "internalOnSlotClick", at = @At("HEAD"), cancellable = true) @Inject(method = "internalOnSlotClick", at = @At("HEAD"), cancellable = true)
private void injectInternalOnSlotClick(int slot, int clickData, SlotActionType actionType, PlayerEntity player, CallbackInfo ci) { private void injectInternalOnSlotClick(int slot, int clickData, SlotActionType actionType, PlayerEntity player, CallbackInfo ci) {
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && actionType == SlotActionType.SWAP && clickData == 40) { if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && actionType == SlotActionType.SWAP && clickData == 40) {
ci.cancel(); ci.cancel();
} }
} }

View File

@ -1,15 +1,15 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialoadingbase; package de.florianmichael.viafabricplus.injection.mixin.fixes.vialoadingbase;
import com.viaversion.viaversion.configuration.AbstractViaConfig; import com.viaversion.viaversion.configuration.AbstractViaConfig;
import de.florianmichael.vialoadingbase.defaults.viaversion.CustomViaConfig; import de.florianmichael.vialoadingbase.defaults.viaversion.VLBViaConfig;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import java.io.File; import java.io.File;
@Mixin(value = CustomViaConfig.class, remap = false) @Mixin(value = VLBViaConfig.class, remap = false)
public abstract class MixinCustomViaConfig extends AbstractViaConfig { public abstract class MixinVLBViaConfig extends AbstractViaConfig {
protected MixinCustomViaConfig(File configFile) { protected MixinVLBViaConfig(File configFile) {
super(configFile); super(configFile);
} }

View File

@ -24,7 +24,7 @@ public abstract class MixinAbstractFenceConnectionHandler {
@Overwrite @Overwrite
public byte getStates(UserConnection user, Position position, int blockState) { public byte getStates(UserConnection user, Position position, int blockState) {
byte states = 0; byte states = 0;
boolean pre1_12 = ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_12); boolean pre1_12 = ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_12);
if (connects(BlockFace.EAST, getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1; if (connects(BlockFace.EAST, getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1;
if (connects(BlockFace.NORTH, getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2; if (connects(BlockFace.NORTH, getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2;
if (connects(BlockFace.SOUTH, getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4; if (connects(BlockFace.SOUTH, getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4;

View File

@ -27,6 +27,6 @@ public abstract class MixinGlassConnectionHandler extends AbstractFenceConnectio
if (states != 0) return states; if (states != 0) return states;
ProtocolInfo protocolInfo = user.getProtocolInfo(); ProtocolInfo protocolInfo = user.getProtocolInfo();
return ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolInfo.getServerProtocolVersion() != -1 ? 0xF : states; return ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolInfo.getServerProtocolVersion() != -1 ? 0xF : states;
} }
} }

View File

@ -83,7 +83,7 @@ public class ProtocolSelectionScreen extends Screen {
@Override @Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final boolean isSelected = ViaLoadingBase.getTargetVersion().getVersion() == protocolVersion.getVersion(); final boolean isSelected = ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion() == protocolVersion.getVersion();
matrices.push(); matrices.push();
matrices.translate(x, y - 1, 0); matrices.translate(x, y - 1, 0);

View File

@ -29,7 +29,7 @@ public class ProtocolSyncBooleanSetting extends BooleanSetting {
@Override @Override
public Boolean getValue() { public Boolean getValue() {
if (GeneralSettings.getClassWrapper().automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ViaLoadingBase.getTargetVersion()); if (GeneralSettings.getClassWrapper().automaticallyChangeValuesBasedOnTheCurrentVersion.getValue()) return this.getProtocolRange().contains(ViaLoadingBase.getClassWrapper().getTargetVersion());
return super.getValue(); return super.getValue();
} }

View File

@ -35,7 +35,7 @@ public class SettingsSave {
try (final FileWriter fw = new FileWriter(CONFIG_FILE)) { try (final FileWriter fw = new FileWriter(CONFIG_FILE)) {
final JsonObject parentNode = new JsonObject(); final JsonObject parentNode = new JsonObject();
parentNode.addProperty("protocol", ViaLoadingBase.getTargetVersion().getVersion()); parentNode.addProperty("protocol", ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion());
for (SettingGroup group : viaFabricPlus.getSettingGroups()) { for (SettingGroup group : viaFabricPlus.getSettingGroups()) {
for (AbstractSetting<?> setting : group.getSettings()) { for (AbstractSetting<?> setting : group.getSettings()) {
setting.write(parentNode); setting.write(parentNode);

View File

@ -98,7 +98,7 @@
"fixes.viaaprilfools.MixinProtocol1_16to20w14infinite", "fixes.viaaprilfools.MixinProtocol1_16to20w14infinite",
"fixes.vialegacy.MixinExtensionProtocolMetadataStorage", "fixes.vialegacy.MixinExtensionProtocolMetadataStorage",
"fixes.vialegacy.MixinProtocol1_8to1_7_6_10", "fixes.vialegacy.MixinProtocol1_8to1_7_6_10",
"fixes.vialoadingbase.MixinCustomViaConfig", "fixes.vialoadingbase.MixinVLBViaConfig",
"fixes.viaversion.MixinCommonBoss", "fixes.viaversion.MixinCommonBoss",
"fixes.viaversion.MixinPacketWrapperImpl", "fixes.viaversion.MixinPacketWrapperImpl",
"fixes.viaversion.MixinProtocolVersion", "fixes.viaversion.MixinProtocolVersion",