mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
updated ViaLoadingBase, remove unused code
This commit is contained in:
parent
0410f4b101
commit
4adda46d75
@ -5,11 +5,11 @@ minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.5
|
||||
loader_version=0.14.14
|
||||
|
||||
mod_version=1.5.4
|
||||
mod_version=1.5.5
|
||||
maven_group=de.florianmichael
|
||||
archives_base_name=viafabricplus
|
||||
|
||||
vialoadingbase_version=8df0605c3d
|
||||
vialoadingbase_version=db24c2279c
|
||||
viaversion_version=4.6.0-1.19.4-pre2-SNAPSHOT
|
||||
viabackwards_version=4.6.0-1.19.4-pre1-SNAPSHOT
|
||||
vialegacy_version=cc56733803
|
||||
|
@ -86,35 +86,6 @@ public class ViaFabricPlus {
|
||||
return MinecraftClient.getInstance().isInSingleplayer();
|
||||
});
|
||||
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 -> {
|
||||
providers.use(MovementTransmitterProvider.class, new ViaFabricPlusMovementTransmitterProvider());
|
||||
providers.use(HandItemProvider.class, new ViaFabricPlusHandItemProvider());
|
||||
|
@ -65,7 +65,7 @@ public class PackFormatsDefinition {
|
||||
}
|
||||
|
||||
public static GameVersion current() {
|
||||
final int targetVersion = ViaLoadingBase.getTargetVersion().getOriginalVersion();
|
||||
final int targetVersion = ViaLoadingBase.getClassWrapper().getTargetVersion().getOriginalVersion();
|
||||
if (!protocolMap.containsKey(targetVersion)) return SharedConstants.getGameVersion();
|
||||
return protocolMap.get(targetVersion);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class ClassicWorldHeightInjection {
|
||||
parentRemapper.handle(wrapper);
|
||||
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")) {
|
||||
changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element"));
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class ClassicWorldHeightInjection {
|
||||
parentRemapper.handle(wrapper);
|
||||
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));
|
||||
}
|
||||
});
|
||||
@ -69,7 +69,7 @@ public class ClassicWorldHeightInjection {
|
||||
parentRemapper.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
wrapper.resetReader();
|
||||
final Chunk chunk = wrapper.read(new Chunk1_17Type(16));
|
||||
wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk);
|
||||
@ -163,7 +163,7 @@ public class ClassicWorldHeightInjection {
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
classicLightHandler.handle(wrapper);
|
||||
} else {
|
||||
parentRemapper.handle(wrapper);
|
||||
|
@ -37,7 +37,7 @@ public class MixinClientConnection implements IClientConnection {
|
||||
|
||||
@Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true)
|
||||
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();
|
||||
this.viafabricplus_decryptionCipher = decryptionCipher;
|
||||
this.viafabricplus_encryptionCipher = encryptionCipher;
|
||||
|
@ -6,8 +6,8 @@ import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.platform.PreNettyConstants;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.netty.CustomViaDecodeHandler;
|
||||
import de.florianmichael.vialoadingbase.netty.CustomViaEncodeHandler;
|
||||
import de.florianmichael.vialoadingbase.netty.VLBViaDecodeHandler;
|
||||
import de.florianmichael.vialoadingbase.netty.VLBViaEncodeHandler;
|
||||
import de.florianmichael.vialoadingbase.netty.NettyConstants;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
@ -39,10 +39,10 @@ public class MixinClientConnection_1 {
|
||||
|
||||
new ProtocolPipelineImpl(user);
|
||||
|
||||
channel.pipeline().addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new CustomViaEncodeHandler(user));
|
||||
channel.pipeline().addBefore("decoder", NettyConstants.HANDLER_DECODER_NAME, new CustomViaDecodeHandler(user));
|
||||
channel.pipeline().addBefore("encoder", NettyConstants.HANDLER_ENCODER_NAME, new VLBViaDecodeHandler(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);
|
||||
|
||||
channel.pipeline().addBefore("prepender", PreNettyConstants.HANDLER_ENCODER_NAME, new PreNettyEncoder(user));
|
||||
|
@ -22,7 +22,7 @@ public class MixinClientLoginNetworkHandler {
|
||||
|
||||
@Inject(method = "joinServerSession", at = @At("HEAD"), cancellable = true)
|
||||
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) {
|
||||
cir.setReturnValue(null);
|
||||
}
|
||||
|
@ -32,24 +32,24 @@ public class MixinDebugHud {
|
||||
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("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);
|
||||
if (entityTracker1_7_10 != null) {
|
||||
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);
|
||||
if (entityTracker1_5_2 != null) {
|
||||
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);
|
||||
if (entityTracker1_2_4_5 != null) {
|
||||
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);
|
||||
if (seedStorage != null) {
|
||||
information.add("World Seed (" + LegacyProtocolVersion.r1_1.getName() + "): " + seedStorage.seed);
|
||||
|
@ -51,14 +51,14 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
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<>();
|
||||
}
|
||||
}
|
||||
|
||||
@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) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -75,14 +75,14 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Inject(method = "onChunkLoadDistance", at = @At("RETURN"))
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onEntitySpawn", at = @At("TAIL"))
|
||||
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) {
|
||||
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"))
|
||||
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;
|
||||
assert player != null;
|
||||
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"))
|
||||
public void moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
|
||||
instance.setReady();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerPositionLook", at = @At("RETURN"))
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
@SuppressWarnings("InvalidInjectorMethodSignature")
|
||||
@ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class))
|
||||
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 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))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
|
||||
@Inject(method = "attackEntity", at = @At("HEAD"))
|
||||
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);
|
||||
((IClientPlayerEntity) player).viafabricplus_cancelSwingOnce();
|
||||
}
|
||||
@ -73,7 +73,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
if (type == SlotActionType.QUICK_CRAFT) return true;
|
||||
|
||||
// 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
|
||||
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"))
|
||||
private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
|
||||
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;
|
||||
|
||||
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"),
|
||||
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) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
clientPlayNetworkHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
@ -139,7 +139,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
|
||||
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
|
||||
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;"))
|
||||
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 interactBlockInternal(player, hand, hitResult);
|
||||
|
@ -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;")),
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -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;")),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;isAccepted()Z", ordinal = 0))
|
||||
private boolean preventGenericInteract(ActionResult instance) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
|
||||
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))
|
||||
public int unwrapOperation(MinecraftClient instance) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return 0;
|
||||
}
|
||||
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))
|
||||
public void updateCooldown(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (this.attackCooldown > 0) {
|
||||
--this.attackCooldown;
|
||||
}
|
||||
@ -91,7 +91,7 @@ public abstract class MixinMinecraftClient {
|
||||
if (getNetworkHandler() != null && DebugSettings.getClassWrapper().sendOpenInventoryPacket.getValue()) {
|
||||
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);
|
||||
clientStatus.write(Type.VAR_INT, 2); // Open Inventory Achievement
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class MixinPlayerEntityRenderer {
|
||||
|
||||
@Inject(method = "getPositionOffset*", at = @At("RETURN"), cancellable = true)
|
||||
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) {
|
||||
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;",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isInSneakingPose()Z"))
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class MixinServerAddress {
|
||||
|
||||
@Inject(method = "parse", at = @At("RETURN"), cancellable = true)
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
@ -37,10 +37,10 @@ public class MixinServerResourcePackProvider {
|
||||
@Inject(method = "getDownloadHeaders", at = @At("TAIL"), cancellable = true)
|
||||
private static void removeHeaders(CallbackInfoReturnable<Map<String, String>> cir) {
|
||||
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");
|
||||
}
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) {
|
||||
modifiableMap.remove("X-Minecraft-Pack-Format");
|
||||
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))
|
||||
public String revertHashAlgorithm(HashCode instance) {
|
||||
try {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
//noinspection deprecation
|
||||
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));
|
||||
}
|
||||
} 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;"))
|
||||
public String disableIgnoreCase(String instance, Locale locale) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -24,25 +24,25 @@ public abstract class MixinAbstractBlock_AbstractBlockState {
|
||||
public void changeHardness(BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
cir.setReturnValue(0F);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class MixinAnvilBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class MixinBambooBlock {
|
||||
|
||||
@Inject(method = "isShapeFullCube", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class MixinBedBlock {
|
||||
|
||||
@Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true)
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -33,7 +33,7 @@ public class MixinBedBlock {
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -17,19 +17,19 @@ public class MixinBlock {
|
||||
private void modifyBlastResistance(CallbackInfoReturnable<Float> ci) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
ci.setReturnValue(0.75F);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class MixinBrewingStandBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public abstract class MixinCauldronBlock extends AbstractCauldronBlock {
|
||||
|
||||
@Override
|
||||
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 super.getOutlineShape(state, world, pos, context);
|
||||
|
@ -35,10 +35,10 @@ public abstract class MixinEndPortalBlock extends BlockWithEntity {
|
||||
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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;"))
|
||||
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 FRAME_WITH_EYE_SHAPE;
|
||||
|
@ -33,7 +33,7 @@ public class MixinFarmlandBlock extends Block {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class MixinFenceBlock {
|
||||
|
||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class MixinFireBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -31,14 +31,14 @@ public class MixinHopperBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getRaycastShape", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class MixinLadderBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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)) {
|
||||
case NORTH -> ci.setReturnValue(viafabricplus_north_shape_v1_8_x);
|
||||
case SOUTH -> ci.setReturnValue(viafabricplus_south_shape_v1_8_x);
|
||||
|
@ -14,7 +14,7 @@ public class MixinLightBlock {
|
||||
// Not relevant for GamePlay
|
||||
@Redirect(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isCreativeLevelTwoOp()Z"))
|
||||
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 instance.isCreativeLevelTwoOp();
|
||||
|
@ -23,7 +23,7 @@ public class MixinLilyPadBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Override
|
||||
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 super.getOutlineShape(state, world, pos, context);
|
||||
@ -27,7 +27,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Override
|
||||
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 super.getCollisionShape(state, world, pos, context);
|
||||
|
@ -23,13 +23,13 @@ public class MixinPistonHeadBlock extends FacingBlock {
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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));
|
||||
}
|
||||
|
||||
@Override
|
||||
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 super.getCollisionShape(state, world, pos, context);
|
||||
|
@ -39,7 +39,7 @@ public class MixinSnowBlock {
|
||||
|
||||
@Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true)
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class MixinSoulSandBlock extends Block {
|
||||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity 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();
|
||||
this.viafabricplus_forceValue = true;
|
||||
entity.setVelocity(velocity.getX() * this.getVelocityMultiplier(), velocity.getY(), velocity.getZ() * this.getVelocityMultiplier());
|
||||
@ -36,7 +36,7 @@ public class MixinSoulSandBlock extends Block {
|
||||
|
||||
@Override
|
||||
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 super.getVelocityMultiplier();
|
||||
|
@ -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"))
|
||||
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.isIn(tagKey);
|
||||
|
@ -127,28 +127,28 @@ public class MixinWallBlock extends Block {
|
||||
|
||||
@Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true)
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@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) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
cir.setReturnValue(viafabricplus_oldWallPlacementLogic(cir.getReturnValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true)
|
||||
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)]);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
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)]);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class MixinAbstractDonkeyEntity extends AbstractHorseEntity {
|
||||
|
||||
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
if (!this.isBaby()) {
|
||||
if (this.isTame() && player.shouldCancelInteraction()) {
|
||||
|
@ -13,7 +13,7 @@ public class MixinAllayEntity {
|
||||
|
||||
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ public class MixinAnimalEntity {
|
||||
|
||||
@Redirect(method = "interactMob", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z"))
|
||||
public boolean redirectInteractMob(World instance) {
|
||||
return instance.isClient && ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15);
|
||||
return instance.isClient && ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15);
|
||||
}
|
||||
}
|
||||
|
@ -75,11 +75,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
double f = this.getZ() - this.lastZ;
|
||||
double g = this.getYaw() - this.lastYaw;
|
||||
double h = this.getPitch() - this.lastPitch;
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8)) {
|
||||
++this.ticksSinceLastPositionPacketSent;
|
||||
}
|
||||
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;
|
||||
}
|
||||
boolean bl3 = MathHelper.squaredMagnitude(d, e, f) > n || this.ticksSinceLastPositionPacketSent >= 20;
|
||||
@ -99,7 +99,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
} else {
|
||||
IdlePacketExecutor.skipIdlePacket();
|
||||
}
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
++this.ticksSinceLastPositionPacketSent;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Inject(method = "swingHand", at = @At("HEAD"), cancellable = true)
|
||||
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();
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/Input;sneaking:Z", ordinal = 0)
|
||||
)
|
||||
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) {
|
||||
this.input.movementSideways = (float) ((double) this.input.movementSideways / 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")),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSwimming()Z", ordinal = 0))
|
||||
public boolean redirectIsSneakingWhileSwimming(ClientPlayerEntity _this) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
|
||||
return false;
|
||||
} else {
|
||||
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"))
|
||||
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 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))
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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"))
|
||||
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
|
||||
}
|
||||
|
||||
@ -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"))
|
||||
public void removeSprintingPacket(ClientPlayerEntity instance) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
sendSprintingPacket();
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public abstract class MixinCowEntity extends AnimalEntity {
|
||||
|
||||
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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;"))
|
||||
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_FIRECHARGE_USE;
|
||||
|
@ -42,7 +42,7 @@ public abstract class MixinEntity {
|
||||
|
||||
@ModifyConstant(method = "movementInputToVelocity", constant = @Constant(doubleValue = 1E-7))
|
||||
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 epsilon;
|
||||
@ -50,21 +50,21 @@ public abstract class MixinEntity {
|
||||
|
||||
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setSwimming", at = @At("HEAD"), cancellable = true)
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ public abstract class MixinEntity {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Inject(method = "updateMovementInFluid", at = @At("HEAD"), cancellable = true)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -122,19 +122,19 @@ public abstract class MixinEntity {
|
||||
|
||||
@Inject(method = "getTargetingMargin", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = {"setYaw", "setPitch"}, at = @At(value = "INVOKE", target = "Ljava/lang/Float;isFinite(F)Z"))
|
||||
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))
|
||||
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 constant;
|
||||
@ -143,7 +143,7 @@ public abstract class MixinEntity {
|
||||
// Not relevant for GamePlay
|
||||
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onLanding()V"))
|
||||
public void revertOnLanding(Entity instance) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
|
||||
instance.onLanding();
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
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)
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class MixinEntityPredicates {
|
||||
@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"))
|
||||
private static boolean makeMainPlayerUnpushable(PlayerEntity player) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return false;
|
||||
}
|
||||
return player.isMainPlayer();
|
||||
|
@ -13,7 +13,7 @@ public class MixinItemEntity {
|
||||
|
||||
@Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true)
|
||||
public void injectApplyWaterBuoyancy(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Inject(method = "getPreferredEquipmentSlot", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -43,7 +43,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Redirect(method = "applyMovementInput", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;jumping:Z"))
|
||||
private boolean disableJumpOnLadder(LivingEntity self) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
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;")),
|
||||
at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;horizontalCollision:Z", ordinal = 0))
|
||||
private boolean disableClimbing(LivingEntity self) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@ModifyVariable(method = "applyFluidMovingSpeed", ordinal = 0, at = @At("HEAD"), argsOnly = true)
|
||||
private boolean modifyMovingDown(boolean movingDown) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
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)),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;onLanding()V", ordinal = 0))
|
||||
private void dontResetLevitationFallDistance(LivingEntity instance) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) {
|
||||
instance.onLanding();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSprinting()Z", ordinal = 0))
|
||||
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 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"))
|
||||
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) {
|
||||
return 1;
|
||||
}
|
||||
@ -99,14 +99,14 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Inject(method = "applyFluidMovingSpeed", at = @At("HEAD"), cancellable = true)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "tickMovement", constant = @Constant(doubleValue = 0.003D))
|
||||
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 constant;
|
||||
@ -114,14 +114,14 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Inject(method = "canEnterTrapdoor", at = @At("HEAD"), cancellable = true)
|
||||
private void onCanEnterTrapdoor(CallbackInfoReturnable<Boolean> ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
ci.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.9F))
|
||||
private float changeEntitySpeed(float constant) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
//noinspection ConstantConditions
|
||||
if ((Entity) this instanceof SkeletonHorseEntity) {
|
||||
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"))
|
||||
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 Math.cos(a);
|
||||
@ -143,7 +143,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
public double fixLavaMovement(LivingEntity instance, TagKey<Fluid> 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;
|
||||
}
|
||||
return height;
|
||||
@ -151,7 +151,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@ModifyConstant(method = "isBlocking", constant = @Constant(intValue = 5))
|
||||
public int shieldBlockCounter(int constant) {
|
||||
if(ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if(ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return 0;
|
||||
}
|
||||
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"))
|
||||
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 instance.isClient();
|
||||
|
@ -20,7 +20,7 @@ public class MixinOtherClientPlayerEntity extends AbstractClientPlayerEntity {
|
||||
|
||||
@Inject(method = "updatePose", at = @At("HEAD"))
|
||||
public void injectUpdatePose(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
super.updatePose();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public abstract class MixinPiglinEntity {
|
||||
|
||||
@Inject(method = "getActiveEyeHeight", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Inject(method = "updatePose", at = @At("HEAD"), cancellable = true)
|
||||
private void onUpdatePose(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
EntityPose pose;
|
||||
|
||||
if (isFallFlying())
|
||||
@ -57,9 +57,9 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
@Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true)
|
||||
private void onGetDimensions(EntityPose pose, CallbackInfoReturnable<EntityDimensions> ci) {
|
||||
if (pose == EntityPose.CROUCHING) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f))
|
||||
private float modifySneakEyeHeight(float prevEyeHeight) {
|
||||
if (ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_19_1)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_19_1)) {
|
||||
return prevEyeHeight;
|
||||
} else {
|
||||
return 1.54f;
|
||||
@ -76,7 +76,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Inject(method = "getAttackCooldownProgress", at = @At("HEAD"), cancellable = true)
|
||||
private void injectGetAttackCooldownProgress(CallbackInfoReturnable<Float> ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
ci.setReturnValue(1f);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class MixinSquidEntity {
|
||||
|
||||
@Inject(method = "canBeLeashedBy", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class MixinVexEntity extends HostileEntity {
|
||||
|
||||
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class MixinWolfEntity {
|
||||
@Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;getHealth()F"))
|
||||
public float rewriteHealth(WolfEntity instance) {
|
||||
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 health;
|
||||
|
@ -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))
|
||||
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 instance.sendCommand(command);
|
||||
|
@ -14,9 +14,9 @@ public class MixinKeyboardInput extends Input {
|
||||
|
||||
@ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true)
|
||||
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;
|
||||
} 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 slowDown;
|
||||
|
@ -15,7 +15,7 @@ public class MixinAxeItem {
|
||||
|
||||
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class MixinBlockItem {
|
||||
|
||||
@Inject(method = "canPlace", at = @At("HEAD"), cancellable = true)
|
||||
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();
|
||||
if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) {
|
||||
World world = context.getWorld();
|
||||
|
@ -18,7 +18,7 @@ public class MixinEnderPearlItem {
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class MixinFireworkRocketItem {
|
||||
|
||||
@Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isFallFlying()Z", ordinal = 0))
|
||||
private boolean disableFireworkElytraBoost(PlayerEntity player) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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"))
|
||||
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
|
||||
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_Y.rotationDegrees(13.365f));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(78.05f));
|
||||
|
@ -43,7 +43,7 @@ public abstract class MixinHoeItem extends MiningToolItem {
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -52,10 +52,10 @@ public abstract class MixinHoeItem extends MiningToolItem {
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
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 super.getMiningSpeedMultiplier(stack, state);
|
||||
|
@ -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"))
|
||||
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))
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ public class MixinItemPlacementContext {
|
||||
final ItemPlacementContext self = (ItemPlacementContext) (Object) this;
|
||||
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 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) {
|
||||
final double eyeY = player.getY() + player.getEyeHeight(player.getPose());
|
||||
|
@ -28,7 +28,7 @@ public abstract class MixinItemStack {
|
||||
private void modifyMiningSpeedMultiplier(BlockState state, CallbackInfoReturnable<Float> ci) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -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)),
|
||||
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) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return 0;
|
||||
} else {
|
||||
return player.getAttributeBaseValue(attribute);
|
||||
|
@ -17,7 +17,7 @@ public class MixinMiningToolItem {
|
||||
@Inject(method = "getMiningSpeedMultiplier", at = @At("RETURN"), cancellable = true)
|
||||
public void changeHoeEffectiveBlocks(ItemStack stack, BlockState state, CallbackInfoReturnable<Float> cir) {
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
|
||||
|
||||
@Override
|
||||
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();
|
||||
int i = this.getMaterial().getMiningLevel();
|
||||
if (block == Blocks.OBSIDIAN) {
|
||||
@ -53,9 +53,9 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
|
||||
|
||||
@Override
|
||||
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;
|
||||
} 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 super.getMiningSpeedMultiplier(stack, state);
|
||||
|
@ -17,7 +17,7 @@ public class MixinShovelItem {
|
||||
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;")))
|
||||
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;
|
||||
} else {
|
||||
return map.get(grassBlock);
|
||||
|
@ -23,7 +23,7 @@ public class MixinSwordItem extends ToolItem {
|
||||
|
||||
@Override
|
||||
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);
|
||||
user.setCurrentHand(hand);
|
||||
return TypedActionResult.consume(itemStack);
|
||||
@ -33,7 +33,7 @@ public class MixinSwordItem extends ToolItem {
|
||||
|
||||
@Override
|
||||
public UseAction getUseAction(ItemStack stack) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return UseAction.BLOCK;
|
||||
}
|
||||
return super.getUseAction(stack);
|
||||
@ -41,7 +41,7 @@ public class MixinSwordItem extends ToolItem {
|
||||
|
||||
@Override
|
||||
public int getMaxUseTime(ItemStack stack) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return 72000;
|
||||
}
|
||||
return super.getMaxUseTime(stack);
|
||||
|
@ -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)
|
||||
public void injectReadText(CallbackInfoReturnable<Text> cir) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18)) {
|
||||
cir.setReturnValue(null);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class MixinUpdatePlayerAbilitiesC2SPacket {
|
||||
|
||||
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 (abilities.invulnerable) b |= 1;
|
||||
|
@ -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))
|
||||
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();
|
||||
}
|
||||
|
||||
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetSocketAddress;getPort()I"))
|
||||
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();
|
||||
}
|
||||
@ -59,11 +59,11 @@ public class MixinConnectScreen_1 {
|
||||
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
|
||||
}
|
||||
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
try {
|
||||
final PlayerKeyPair playerKeyPair = MinecraftClient.getInstance().getProfileKeys().fetchKeyPair().get().orElse(null);
|
||||
if (playerKeyPair != null) {
|
||||
@ -72,7 +72,7 @@ public class MixinConnectScreen_1 {
|
||||
|
||||
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();
|
||||
if (legacyKey != null) {
|
||||
userConnection.put(new ChatSession1_19_0(userConnection, profileKey, playerKeyPair.privateKey(), legacyKey));
|
||||
|
@ -31,14 +31,14 @@ public class MixinDownloadingTerrainScreen extends Screen {
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
public void injectTick(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
||||
protocolhack_tickCounter++;
|
||||
|
||||
if (protocolhack_tickCounter % 20 == 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;
|
||||
|
||||
if (isTimeOver && this.client != null && this.client.player != null) {
|
||||
|
@ -24,10 +24,10 @@ public class MixinGameModeSelectionScreen {
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
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();
|
||||
if (ViaLoadingBase.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(LegacyProtocolVersion.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR);
|
||||
|
||||
protocolhack_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
||||
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;"))
|
||||
public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
|
||||
return protocolhack_unwrappedGameModes;
|
||||
}
|
||||
return GameModeSelectionScreen.GameModeSelection.values();
|
||||
|
@ -24,7 +24,7 @@ public class MixinGameModeSelectionScreen_GameModeSelection {
|
||||
|
||||
@Inject(method = "getCommand", at = @At("HEAD"), cancellable = true)
|
||||
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(
|
||||
"gamemode " + MinecraftClient.getInstance().getSession().getUsername() + ' ' + switch (((Enum<?>)(Object)this).ordinal()) {
|
||||
case 0, 3 -> 1;
|
||||
@ -37,11 +37,11 @@ public class MixinGameModeSelectionScreen_GameModeSelection {
|
||||
|
||||
@Inject(method = "next", at = @At("HEAD"), cancellable = true)
|
||||
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) {
|
||||
case CREATIVE -> cir.setReturnValue(Optional.of(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));
|
||||
} else {
|
||||
cir.setReturnValue(Optional.of(GameModeSelectionScreen.GameModeSelection.ADVENTURE));
|
||||
|
@ -19,6 +19,6 @@ public class MixinStructureBlockScreen_1 extends TextFieldWidget {
|
||||
|
||||
@Inject(method = "charTyped(CI)Z", at = @At("HEAD"), cancellable = true)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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"))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class MixinMerchantScreenHandler {
|
||||
|
||||
@Inject(method = "switchTo", at = @At("HEAD"), cancellable = true)
|
||||
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?
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ public class MixinBrewingStandScreenHandler_FuelSlot extends Slot {
|
||||
|
||||
@Inject(method = "matches(Lnet/minecraft/item/ItemStack;)Z", at = @At("HEAD"), cancellable = true)
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return ViaLoadingBase.getTargetVersion().isNewerThan(ProtocolVersion.v1_8);
|
||||
return ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThan(ProtocolVersion.v1_8);
|
||||
}
|
||||
}
|
||||
|
@ -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")),
|
||||
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) {
|
||||
if (ViaLoadingBase.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
|
||||
return null;
|
||||
return addSlot(slot);
|
||||
}
|
||||
@ -33,7 +33,7 @@ public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandl
|
||||
@SuppressWarnings("InvalidInjectorMethodSignature")
|
||||
@ModifyVariable(method = "quickMove", ordinal = 0, at = @At(value = "STORE", ordinal = 0))
|
||||
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;
|
||||
else
|
||||
return slot;
|
||||
|
@ -20,7 +20,7 @@ public class MixinScreenHandler implements IScreenHandler {
|
||||
|
||||
@Inject(method = "internalOnSlotClick", at = @At("HEAD"), cancellable = true)
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialoadingbase;
|
||||
|
||||
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 java.io.File;
|
||||
|
||||
@Mixin(value = CustomViaConfig.class, remap = false)
|
||||
public abstract class MixinCustomViaConfig extends AbstractViaConfig {
|
||||
@Mixin(value = VLBViaConfig.class, remap = false)
|
||||
public abstract class MixinVLBViaConfig extends AbstractViaConfig {
|
||||
|
||||
protected MixinCustomViaConfig(File configFile) {
|
||||
protected MixinVLBViaConfig(File configFile) {
|
||||
super(configFile);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public abstract class MixinAbstractFenceConnectionHandler {
|
||||
@Overwrite
|
||||
public byte getStates(UserConnection user, Position position, int blockState) {
|
||||
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.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;
|
||||
|
@ -27,6 +27,6 @@ public abstract class MixinGlassConnectionHandler extends AbstractFenceConnectio
|
||||
if (states != 0) return states;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
|
||||
@Override
|
||||
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.translate(x, y - 1, 0);
|
||||
|
@ -29,7 +29,7 @@ public class ProtocolSyncBooleanSetting extends BooleanSetting {
|
||||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class SettingsSave {
|
||||
|
||||
try (final FileWriter fw = new FileWriter(CONFIG_FILE)) {
|
||||
final JsonObject parentNode = new JsonObject();
|
||||
parentNode.addProperty("protocol", ViaLoadingBase.getTargetVersion().getVersion());
|
||||
parentNode.addProperty("protocol", ViaLoadingBase.getClassWrapper().getTargetVersion().getVersion());
|
||||
for (SettingGroup group : viaFabricPlus.getSettingGroups()) {
|
||||
for (AbstractSetting<?> setting : group.getSettings()) {
|
||||
setting.write(parentNode);
|
||||
|
@ -98,7 +98,7 @@
|
||||
"fixes.viaaprilfools.MixinProtocol1_16to20w14infinite",
|
||||
"fixes.vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"fixes.vialegacy.MixinProtocol1_8to1_7_6_10",
|
||||
"fixes.vialoadingbase.MixinCustomViaConfig",
|
||||
"fixes.vialoadingbase.MixinVLBViaConfig",
|
||||
"fixes.viaversion.MixinCommonBoss",
|
||||
"fixes.viaversion.MixinPacketWrapperImpl",
|
||||
"fixes.viaversion.MixinProtocolVersion",
|
||||
|
Loading…
Reference in New Issue
Block a user