mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-15 10:45:35 +01:00
Merge remote-tracking branch 'origin/main' into 1.20-recode
# Conflicts: # README.md # gradle.properties # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinItemRenderer.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinAnvilBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBedBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinBrewingStandBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinCauldronBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinChestBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinEndPortalFrameBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFarmlandBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFenceBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinFireBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinHopperBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLadderBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinLilyPadBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPaneBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinPistonHeadBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinSnowBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/block/MixinWallBlock.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItemStack.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinPickaxeItem.java # src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinProtocolVersion.java # src/main/java/de/florianmichael/viafabricplus/mappings/ItemReleaseVersionMappings.java # src/main/java/de/florianmichael/viafabricplus/mappings/PackFormatsMappings.java # src/main/java/de/florianmichael/viafabricplus/screen/impl/ClassicItemSelectionScreen.java # src/main/java/de/florianmichael/viafabricplus/screen/impl/base/ForceVersionScreen.java # src/main/java/de/florianmichael/viafabricplus/screen/impl/base/ProtocolSelectionScreen.java # src/main/java/de/florianmichael/viafabricplus/screen/impl/thirdparty/classicube/ClassiCubeLoginScreen.java # src/main/java/de/florianmichael/viafabricplus/screen/impl/thirdparty/classicube/ClassiCubeMFAScreen.java # src/main/resources/fabric.mod.json
This commit is contained in:
commit
c6f03fe6bb
11
.github/DEVELOPER_API.md
vendored
11
.github/DEVELOPER_API.md
vendored
@ -5,27 +5,26 @@ public class ViaFabricPlusExampleAddon implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
|
||||
System.out.println("Version changed to " + protocolVersion.getName());
|
||||
ChangeProtocolVersionCallback.EVENT.register(versionEnum -> {
|
||||
System.out.println("Version changed to " + versionEnum.getName());
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
#### ViaFabricPlus has 7 events at the moment:
|
||||
#### ViaFabricPlus has 6 events at the moment:
|
||||
| Callback class name | Description |
|
||||
|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ChangeProtocolVersionCallback | Called when the user changes the target version in the screen, or if you connect to a server for which a specific version has been selected, you disconnect, the event for the actual version is also called. |
|
||||
| FinishMinecraftLoadCallback | Called when Minecraft is finished with loading all its components |
|
||||
| FinishViaLoadingBaseStartupCallback | Called when ViaLoadingBase and Via* is loaded and ready to use |
|
||||
| FinishViaVersionStartupCallback | Called when ViaVersion is loaded and ready to use |
|
||||
| InitializeSettingsCallback | Called after the default setting groups are loaded and before the setting config is loaded |
|
||||
| LoadClassicProtocolExtensionCallback | Called when the classic server sends the protocol extensions (only in **c0.30 CPE**) |
|
||||
| PreLoadCallback | Called before everything (Pre-pre load) |
|
||||
| ViaLoadingBaseBuilderCallback | Called when Via* is initialized |
|
||||
|
||||
### General API
|
||||
#### Get the release version of a material:
|
||||
```java
|
||||
final ProtocolRange range = ItemReleaseVersionDefinition.INSTANCE.getItemMap().get(Items.WRITABLE_BOOK); // If an item does not appear in the item map, it has always existed
|
||||
final VersionRange range = ItemReleaseVersionDefinition.INSTANCE.getItemMap().get(Items.WRITABLE_BOOK); // If an item does not appear in the item map, it has always existed
|
||||
|
||||
// The Range class then contains all versions in which the item occurs.
|
||||
// You can find out how the Range class works in the ViaLoadingBase README.
|
||||
|
@ -3,7 +3,7 @@
|
||||
<h1>ViaFabricPlus</h1>
|
||||
<a href="https://fabricmc.net"><img src="https://img.shields.io/badge/Mod%20Loader-Fabric-lightyellow?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE4LTEyLTE2VDE2OjU0OjE3LTA4OjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOS0wNy0yOFQyMToxNzo0OC0wNzowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOS0wNy0yOFQyMToxNzo0OC0wNzowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MGVkYjFjMmMtZmY4Yy1lNDQxLTkzMWYtNDk1ZDRmMTRjNzYwIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6MGVkYjFjMmMtZmY4Yy1lNDQxLTkzMWYtNDk1ZDRmMTRjNzYwIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHN0RXZ0OndoZW49IjIwMTgtMTItMTZUMTY6NTQ6MTctMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4/HiGMAAAAtUlEQVRYw+XXrQqAMBQF4D2P2eBL+QIG8RnEJFaNBjEum+0+zMQLtwwv+wV3ZzhhMDgfJ0wUSinxZUQWgKos1JP/AbD4OneIDyQPwCFniA+EJ4CaXm4TxAXCC0BNHgLhAdAnx9hC8PwGSRtAFVMQjF7cNTWED8B1cgwW20yfJgAvrssAsZ1cB3g/xckAxr6FmCDU5N6f488BrpCQ4rQBJkiMYh4ACmLzwOQF0CExinkCsvw7vgGikl+OotaKRwAAAABJRU5ErkJggg=="></a>
|
||||
<img src="https://img.shields.io/badge/Enviroment-Client-purple">
|
||||
<a href="https://discord.gg/BwWhCHUKDf"><img src="https://img.shields.io/discord/1033745845809586356?color=0098DB&label=Discord&logo=discord&logoColor=0098DB"></a> <br />
|
||||
<a href="https://discord.gg/viaversion"><img src="https://img.shields.io/discord/316206679014244363?color=0098DB&label=Discord&logo=discord&logoColor=0098DB"></a> <br />
|
||||
<a href="https://modrinth.com/mod/viafabricplus"><img src="https://img.shields.io/badge/dynamic/json?color=158000&label=downloads&prefix=+%20&query=downloads&url=https://api.modrinth.com/v2/project/rIC2XJV4&logo=modrinth"></a>
|
||||
<a href="https://curseforge.com/minecraft/mc-mods/viafabricplus"><img src="https://cf.way2muchnoise.eu/full_830604_downloads.svg"></a>
|
||||
<a href="https://github.com/FlorianMichael/ViaFabricPlus/actions/workflows/build.yml"><img src="https://github.com/FlorianMichael/ViaFabricPlus/actions/workflows/build.yml/badge.svg?branch=main"></a>
|
||||
@ -14,16 +14,18 @@
|
||||
# Why another protocol translator?
|
||||
ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomputer/multiconnect), and it also promises more compactness and stability. ViaFabricPlus can do everything multiconnect could do, but supports more Minecraft versions (listed below) and has more protocol changes implemented.
|
||||
### Supported Server versions
|
||||
- Release (1.0.0 - 1.20 [1.20-pre5])
|
||||
- Release (1.0.0 - 1.20 [1.20-pre7])
|
||||
- Beta (b1.0 - b1.8.1)
|
||||
- Alpha (a1.0.15 - a1.2.6)
|
||||
- Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension))
|
||||
- Snapshots (3D Shareware, 20w14infinite, Combat Test 8C)
|
||||
- Bedrock (1.19.80)
|
||||
|
||||
### If you want to talk with me, feel free to join my [Discord](https://discord.gg/BwWhCHUKDf)
|
||||
|
||||
# For users
|
||||
### Detailed instructions for use are available here [here](.github/USAGE.md)
|
||||
### If you encounter any issues, please report them on the [issue tracker](https://github.com/FlorianMichael/ViaFabricPlus/issues).
|
||||
### If you encounter any issues, please report them on the [issue tracker](https://github.com/FlorianMichael/ViaFabricPlus/issues) or on the ViaVersion [Discord](https://discord.gg/viaversion)
|
||||
|
||||
## Known incompatibilities
|
||||
- ***[ViaFabric](https://github.com/ViaVersion/ViaFabric)***
|
||||
|
@ -53,8 +53,8 @@ dependencies {
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
||||
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
|
||||
|
||||
library "com.github.FlorianMichael:ViaLoadingBase:${project.vialoadingbase_version}"
|
||||
library "com.github.FlorianMichael:Classic4J:${project.classic4j_version}"
|
||||
library "net.raphimc:ViaLoader:${project.vialoader_version}"
|
||||
|
||||
library "com.viaversion:viaversion:${project.viaversion_version}"
|
||||
library ("com.viaversion:viabackwards-common:${project.viabackwards_version}") {
|
||||
|
@ -14,20 +14,20 @@ maven_group=de.florianmichael
|
||||
archives_base_name=viafabricplus
|
||||
|
||||
# base lib
|
||||
vialoadingbase_version=1f4e409d86
|
||||
raknet_transport_version=1.0.0.CR1-SNAPSHOT
|
||||
classic4j_version=1.2.0
|
||||
|
||||
# viaversion (and required) libs
|
||||
viaversion_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||
viaversion_version=4.7.0-1.20-pre7-SNAPSHOT
|
||||
viabackwards_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||
snake_yml_version=2.0
|
||||
|
||||
# raphimc libs
|
||||
vialegacy_version=2.2.16
|
||||
vialegacy_version=2.2.17-SNAPSHOT
|
||||
viaaprilfools_version=2.0.7-SNAPSHOT
|
||||
viabedrock_version=0.0.1-SNAPSHOT
|
||||
minecraftauth_version=2.1.2
|
||||
minecraftauth_version=2.1.4-SNAPSHOT
|
||||
vialoader_version=2.2.5-SNAPSHOT
|
||||
|
||||
# lenni0451 libs
|
||||
mcstructs_text_version=2.2.5
|
||||
|
@ -24,13 +24,13 @@ import de.florianmichael.viafabricplus.definition.v1_12_2.FontCacheFix;
|
||||
import de.florianmichael.viafabricplus.mappings.ItemReleaseVersionMappings;
|
||||
import de.florianmichael.viafabricplus.mappings.PackFormatsMappings;
|
||||
import de.florianmichael.viafabricplus.definition.bedrock.BedrockAccountHandler;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.ClassicItemSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.screen.impl.ClassicItemSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.protocol.CustomClassicProtocolExtensions;
|
||||
import de.florianmichael.viafabricplus.definition.v1_8.ArmorPointCalculation;
|
||||
import de.florianmichael.viafabricplus.base.event.FinishMinecraftLoadCallback;
|
||||
import de.florianmichael.viafabricplus.base.event.PreLoadCallback;
|
||||
import de.florianmichael.viafabricplus.ui.information.InformationSystem;
|
||||
import de.florianmichael.viafabricplus.information.InformationSystem;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.base.settings.SettingsSystem;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
@ -17,9 +17,9 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.base.event;
|
||||
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
public interface ChangeProtocolVersionCallback {
|
||||
|
||||
@ -29,5 +29,5 @@ public interface ChangeProtocolVersionCallback {
|
||||
}
|
||||
});
|
||||
|
||||
void onChangeProtocolVersion(final ComparableProtocolVersion protocolVersion);
|
||||
void onChangeProtocolVersion(final VersionEnum protocolVersion);
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ package de.florianmichael.viafabricplus.base.event;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
||||
public interface FinishViaLoadingBaseStartupCallback {
|
||||
public interface FinishViaVersionStartupCallback {
|
||||
|
||||
Event<FinishViaLoadingBaseStartupCallback> EVENT = EventFactory.createArrayBacked(FinishViaLoadingBaseStartupCallback.class, listeners -> () -> {
|
||||
for (FinishViaLoadingBaseStartupCallback listener : listeners) {
|
||||
listener.onFinishViaLoadingBaseStartup();
|
||||
Event<FinishViaVersionStartupCallback> EVENT = EventFactory.createArrayBacked(FinishViaVersionStartupCallback.class, listeners -> () -> {
|
||||
for (FinishViaVersionStartupCallback listener : listeners) {
|
||||
listener.onFinishViaVersionStartup();
|
||||
}
|
||||
});
|
||||
|
||||
void onFinishViaLoadingBaseStartup();
|
||||
void onFinishViaVersionStartup();
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.base.event;
|
||||
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
||||
public interface ViaLoadingBaseBuilderCallback {
|
||||
|
||||
Event<ViaLoadingBaseBuilderCallback> EVENT = EventFactory.createArrayBacked(ViaLoadingBaseBuilderCallback.class, listeners -> builder -> {
|
||||
for (ViaLoadingBaseBuilderCallback listener : listeners) {
|
||||
listener.onBuildViaLoadingBase(builder);
|
||||
}
|
||||
});
|
||||
|
||||
void onBuildViaLoadingBase(final ViaLoadingBase.ViaLoadingBaseBuilder builder);
|
||||
}
|
@ -23,8 +23,8 @@ import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.*;
|
||||
import de.florianmichael.viafabricplus.base.FileSaver;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -54,7 +54,7 @@ public class SettingsSystem extends FileSaver {
|
||||
|
||||
@Override
|
||||
public void write(JsonObject object) {
|
||||
object.addProperty("protocol", ViaLoadingBase.getInstance().getTargetVersion().getVersion());
|
||||
object.addProperty("protocol", ProtocolHack.getTargetVersion().getVersion());
|
||||
for (SettingGroup group : groups) {
|
||||
for (AbstractSetting<?> setting : group.getSettings()) {
|
||||
setting.write(object);
|
||||
@ -65,9 +65,9 @@ public class SettingsSystem extends FileSaver {
|
||||
@Override
|
||||
public void read(JsonObject object) {
|
||||
if (object.has("protocol")) {
|
||||
final ComparableProtocolVersion protocolVersion = ViaLoadingBase.fromProtocolId(object.get("protocol").getAsInt());
|
||||
final VersionEnum protocolVersion = VersionEnum.fromProtocolId(object.get("protocol").getAsInt());
|
||||
|
||||
if (protocolVersion != null) ViaLoadingBase.getInstance().reload(protocolVersion);
|
||||
if (protocolVersion != null) ProtocolHack.setTargetVersion(protocolVersion);
|
||||
}
|
||||
for (SettingGroup group : groups) {
|
||||
for (AbstractSetting<?> setting : group.getSettings()) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.base.settings.base;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ui.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.base.settings.groups;
|
||||
|
||||
import de.florianmichael.viafabricplus.definition.bedrock.BedrockAccountHandler;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.base.ProtocolSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.settings.SettingsScreen;
|
||||
import de.florianmichael.viafabricplus.screen.impl.base.ProtocolSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.screen.impl.settings.SettingsScreen;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.base.settings.type_impl.BooleanSetting;
|
||||
import de.florianmichael.viafabricplus.base.settings.type_impl.ButtonSetting;
|
||||
|
@ -17,40 +17,43 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.base.settings.groups;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.base.settings.type_impl.ProtocolSyncBooleanSetting;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.minecraft.text.Text;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class DebugSettings extends SettingGroup {
|
||||
public final static DebugSettings INSTANCE = new DebugSettings();
|
||||
|
||||
// 1.19 -> 1.18.2
|
||||
public final ProtocolSyncBooleanSetting disableSequencing = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.sequence"), ProtocolRange.andOlder(ProtocolVersion.v1_18_2));
|
||||
public final ProtocolSyncBooleanSetting disableSequencing = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.sequence"), VersionRange.andOlder(VersionEnum.r1_18_2));
|
||||
|
||||
// 1.14 -> 1.13.2
|
||||
public final ProtocolSyncBooleanSetting smoothOutMerchantScreens = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.merchant"), ProtocolRange.andOlder(ProtocolVersion.v1_13_2));
|
||||
public final ProtocolSyncBooleanSetting smoothOutMerchantScreens = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.merchant"), VersionRange.andOlder(VersionEnum.r1_13_2));
|
||||
|
||||
// 1.13 -> 1.12.2
|
||||
public final ProtocolSyncBooleanSetting executeInputsInSync = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.postfix"), ProtocolRange.andOlder(ProtocolVersion.v1_12_2));
|
||||
public final ProtocolSyncBooleanSetting sneakInstant = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.sneakinstant"), new ProtocolRange(ProtocolVersion.v1_12_2, ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting executeInputsInSync = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.postfix"), VersionRange.andOlder(VersionEnum.r1_12_2));
|
||||
public final ProtocolSyncBooleanSetting sneakInstant = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.sneakinstant"), new VersionRange(VersionEnum.r1_12_2, VersionEnum.r1_8));
|
||||
|
||||
// 1.12 -> 1.11.1-1.11.2
|
||||
public final ProtocolSyncBooleanSetting sendOpenInventoryPacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.inventory"), ProtocolRange.andOlder(ProtocolVersion.v1_11_1));
|
||||
public final ProtocolSyncBooleanSetting sendOpenInventoryPacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.inventory"), VersionRange.andOlder(VersionEnum.r1_11_1to1_11_2));
|
||||
|
||||
// 1.9 -> 1.8.x
|
||||
public final ProtocolSyncBooleanSetting removeCooldowns = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.cooldown"), ProtocolRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting sendIdlePacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.idle"), new ProtocolRange(ProtocolVersion.v1_8, LegacyProtocolVersion.r1_3_1tor1_3_2));
|
||||
public final ProtocolSyncBooleanSetting replaceAttributeModifiers = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.attribute"), ProtocolRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting removeCooldowns = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.cooldown"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
public final ProtocolSyncBooleanSetting sendIdlePacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.idle"), new VersionRange(VersionEnum.r1_8, VersionEnum.r1_3_1tor1_3_2));
|
||||
public final ProtocolSyncBooleanSetting replaceAttributeModifiers = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.attribute"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
|
||||
// 1.8.x -> 1.7.6
|
||||
public final ProtocolSyncBooleanSetting replaceSneaking = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.replacesneak"), ProtocolRange.andOlder(ProtocolVersion.v1_7_6));
|
||||
public final ProtocolSyncBooleanSetting longSneaking = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.longsneak"), ProtocolRange.andOlder(ProtocolVersion.v1_7_6));
|
||||
public final ProtocolSyncBooleanSetting replaceSneaking = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.replacesneak"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
public final ProtocolSyncBooleanSetting longSneaking = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.longsneak"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
|
||||
// r1_5tor1_5_1 -> r1_4_6tor1_4_7
|
||||
public final ProtocolSyncBooleanSetting legacyMiningSpeeds = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.legacypseeds"), ProtocolRange.andOlder(LegacyProtocolVersion.r1_4_6tor1_4_7));
|
||||
public final ProtocolSyncBooleanSetting legacyMiningSpeeds = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.legacypseeds"), VersionRange.andOlder(VersionEnum.r1_4_6tor1_4_7));
|
||||
|
||||
public DebugSettings() {
|
||||
super("Debug");
|
||||
|
@ -17,42 +17,44 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.base.settings.groups;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.base.settings.type_impl.ProtocolSyncBooleanSetting;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.minecraft.text.Text;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class VisualSettings extends SettingGroup {
|
||||
public final static VisualSettings INSTANCE = new VisualSettings();
|
||||
|
||||
// 1.19.2 -> 1.19
|
||||
public final ProtocolSyncBooleanSetting disableSecureChatWarning = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.secure"), ProtocolRange.andOlder(ProtocolVersion.v1_19));
|
||||
public final ProtocolSyncBooleanSetting disableSecureChatWarning = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.secure"), VersionRange.andOlder(VersionEnum.r1_19));
|
||||
|
||||
// 1.19 -> 1.18.2
|
||||
public final ProtocolSyncBooleanSetting hideSignatureIndicator = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.indicator"), ProtocolRange.andOlder(ProtocolVersion.v1_18_2));
|
||||
public final ProtocolSyncBooleanSetting hideSignatureIndicator = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.indicator"), VersionRange.andOlder(VersionEnum.r1_18_2));
|
||||
|
||||
// 1.16 -> 1.15.2
|
||||
public final ProtocolSyncBooleanSetting removeNewerFeaturesFromJigsawScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.jigsaw"), ProtocolRange.andOlder(ProtocolVersion.v1_15_2));
|
||||
public final ProtocolSyncBooleanSetting removeNewerFeaturesFromJigsawScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.jigsaw"), VersionRange.andOlder(VersionEnum.r1_15_2));
|
||||
|
||||
// 1.13 -> 1.12.2
|
||||
public final ProtocolSyncBooleanSetting replacePetrifiedOakSlab = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.stoneslab"), new ProtocolRange(ProtocolVersion.v1_12_2, LegacyProtocolVersion.r1_3_1tor1_3_2));
|
||||
public final ProtocolSyncBooleanSetting replacePetrifiedOakSlab = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.stoneslab"), new VersionRange(VersionEnum.r1_12_2, VersionEnum.r1_3_1tor1_3_2));
|
||||
|
||||
// 1.9 -> 1.8.x
|
||||
public final ProtocolSyncBooleanSetting emulateArmorHud = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.armor"), ProtocolRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting removeNewerFeaturesFromCommandBlockScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.command"), ProtocolRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting emulateArmorHud = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.armor"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
public final ProtocolSyncBooleanSetting removeNewerFeaturesFromCommandBlockScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.command"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
|
||||
// r1_0_0tor1_0_1 -> b1_8tob1_8_1
|
||||
public final ProtocolSyncBooleanSetting replaceHurtSoundWithOOFSound = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.oof"), ProtocolRange.andOlder(LegacyProtocolVersion.b1_8tob1_8_1));
|
||||
public final ProtocolSyncBooleanSetting replaceHurtSoundWithOOFSound = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.oof"), VersionRange.andOlder(VersionEnum.b1_8tob1_8_1));
|
||||
|
||||
// b1_8tob1_8_1 -> b1_7tob1_7_3
|
||||
public final ProtocolSyncBooleanSetting removeNewerHudElements = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.betahud"), ProtocolRange.andOlder(LegacyProtocolVersion.b1_7tob1_7_3));
|
||||
public final ProtocolSyncBooleanSetting removeNewerHudElements = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.betahud"), VersionRange.andOlder(VersionEnum.b1_7tob1_7_3));
|
||||
|
||||
// a1_0_15 -> c0_28toc0_30
|
||||
public final ProtocolSyncBooleanSetting replaceCreativeInventory = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.classic"), ProtocolRange.andOlder(LegacyProtocolVersion.c0_28toc0_30));
|
||||
public final ProtocolSyncBooleanSetting oldWalkingAnimation = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.walkanimation"), ProtocolRange.andOlder(LegacyProtocolVersion.c0_28toc0_30));
|
||||
public final ProtocolSyncBooleanSetting fixSodiumChunkRendering = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.sodium"), ProtocolRange.andOlder(LegacyProtocolVersion.c0_28toc0_30));
|
||||
public final ProtocolSyncBooleanSetting replaceCreativeInventory = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.classic"), VersionRange.andOlder(VersionEnum.c0_28toc0_30));
|
||||
public final ProtocolSyncBooleanSetting oldWalkingAnimation = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.walkanimation"), VersionRange.andOlder(VersionEnum.c0_28toc0_30));
|
||||
public final ProtocolSyncBooleanSetting fixSodiumChunkRendering = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.sodium"), VersionRange.andOlder(VersionEnum.c0_28toc0_30));
|
||||
|
||||
public VisualSettings() {
|
||||
super("Visual");
|
||||
|
@ -18,8 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.base.settings.type_impl;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ui.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.settings.settingrenderer.BooleanSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.screen.impl.settings.settingrenderer.BooleanSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import net.minecraft.text.MutableText;
|
||||
|
@ -18,8 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.base.settings.type_impl;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ui.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.settings.settingrenderer.ButtonSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.screen.impl.settings.settingrenderer.ButtonSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import net.minecraft.text.MutableText;
|
||||
|
@ -18,8 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.base.settings.type_impl;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ui.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.settings.settingrenderer.ModeSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.screen.impl.settings.settingrenderer.ModeSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.AbstractSetting;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import net.minecraft.text.MutableText;
|
||||
|
@ -18,18 +18,18 @@
|
||||
package de.florianmichael.viafabricplus.base.settings.type_impl;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ui.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.settings.settingrenderer.ProtocolSyncBooleanSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.screen.MappedSlotEntry;
|
||||
import de.florianmichael.viafabricplus.screen.impl.settings.settingrenderer.ProtocolSyncBooleanSettingRenderer;
|
||||
import de.florianmichael.viafabricplus.base.settings.base.SettingGroup;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class ProtocolSyncBooleanSetting extends BooleanSetting {
|
||||
private final ProtocolRange protocolRange;
|
||||
private final VersionRange protocolRange;
|
||||
|
||||
public ProtocolSyncBooleanSetting(SettingGroup parent, MutableText name, ProtocolRange protocolRange) {
|
||||
public ProtocolSyncBooleanSetting(SettingGroup parent, MutableText name, VersionRange protocolRange) {
|
||||
super(parent, name, true);
|
||||
|
||||
this.protocolRange = protocolRange;
|
||||
@ -59,7 +59,7 @@ public class ProtocolSyncBooleanSetting extends BooleanSetting {
|
||||
return super.getValue();
|
||||
}
|
||||
|
||||
public ProtocolRange getProtocolRange() {
|
||||
public VersionRange getProtocolRange() {
|
||||
return protocolRange;
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,12 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.definition;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.base.event.LoadClassicProtocolExtensionCallback;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.data.ClassicProtocolExtension;
|
||||
|
||||
@ -34,10 +36,10 @@ public class ChatLengthCalculation {
|
||||
|
||||
ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
|
||||
INSTANCE.maxLength = 256;
|
||||
if (protocolVersion.isOlderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
if (protocolVersion.isOlderThanOrEqualTo(VersionEnum.r1_10)) {
|
||||
INSTANCE.maxLength = 100;
|
||||
|
||||
if (protocolVersion.isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (protocolVersion.isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
INSTANCE.maxLength = 64 - MinecraftClient.getInstance().getSession().getUsername().length() - 2;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.command.ClassicViaSubCommand;
|
||||
import de.florianmichael.viafabricplus.injection.access.IExtensionProtocolMetadataStorage;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage;
|
||||
|
||||
public class ListExtensionsCommand extends ClassicViaSubCommand {
|
||||
@ -33,14 +33,14 @@ public class ListExtensionsCommand extends ClassicViaSubCommand {
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Shows all classic extensions (only for " + LegacyProtocolVersion.c0_30cpe.getName() + ")";
|
||||
return "Shows all classic extensions (only for " + VersionEnum.c0_30cpe.getName() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(ViaCommandSender sender, String[] args) {
|
||||
final UserConnection connection = getUser();
|
||||
if (!connection.has(ExtensionProtocolMetadataStorage.class)) {
|
||||
sendMessage(sender, Formatting.RED + "Only for " + LegacyProtocolVersion.c0_30cpe.getName());
|
||||
sendMessage(sender, Formatting.RED + "Only for " + VersionEnum.c0_30cpe.getName());
|
||||
return true;
|
||||
}
|
||||
((IExtensionProtocolMetadataStorage) connection.get(ExtensionProtocolMetadataStorage.class)).getServerExtensions().forEach((extension, version) -> {
|
||||
|
@ -21,6 +21,7 @@ import com.viaversion.viaversion.api.command.ViaCommandSender;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.command.ClassicViaSubCommand;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocola1_0_17_1_0_17_4toa1_0_16_2.storage.TimeLockStorage;
|
||||
|
||||
@ -32,7 +33,7 @@ public class SetTimeCommand extends ClassicViaSubCommand {
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Changes the time (Only for <= " + LegacyProtocolVersion.a1_0_16toa1_0_16_2.getName() + ")";
|
||||
return "Changes the time (Only for <= " + VersionEnum.a1_0_16toa1_0_16_2.getName() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,7 +45,7 @@ public class SetTimeCommand extends ClassicViaSubCommand {
|
||||
public boolean execute(ViaCommandSender sender, String[] args) {
|
||||
final UserConnection connection = getUser();
|
||||
if (!connection.has(TimeLockStorage.class)) {
|
||||
sendMessage(sender, Formatting.RED + "Only for <= " + LegacyProtocolVersion.a1_0_16toa1_0_16_2.getName());
|
||||
sendMessage(sender, Formatting.RED + "Only for <= " + VersionEnum.a1_0_16toa1_0_16_2.getName());
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
|
@ -30,6 +30,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.model.ClassicLevel;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicWorldHeightProvider;
|
||||
@ -46,7 +47,7 @@ public class ClassicWorldHeightInjection {
|
||||
parentHandler.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.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"));
|
||||
}
|
||||
@ -60,7 +61,7 @@ public class ClassicWorldHeightInjection {
|
||||
parentHandler.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0));
|
||||
}
|
||||
};
|
||||
@ -71,7 +72,7 @@ public class ClassicWorldHeightInjection {
|
||||
parentHandler.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
wrapper.resetReader();
|
||||
final Chunk chunk = wrapper.read(new Chunk1_17Type(16));
|
||||
wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk);
|
||||
@ -161,7 +162,7 @@ public class ClassicWorldHeightInjection {
|
||||
};
|
||||
|
||||
return wrapper -> {
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(LegacyProtocolVersion.c0_28toc0_30)) {
|
||||
if (ProtocolHack.getTargetVersion(wrapper.user().getChannel()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
classicLightHandler.handle(wrapper);
|
||||
} else {
|
||||
parentHandler.handle(wrapper);
|
||||
|
@ -18,7 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.definition.c0_30.protocol;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.ClassicItemSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.screen.impl.ClassicItemSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.base.event.LoadClassicProtocolExtensionCallback;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
@ -18,18 +18,18 @@
|
||||
package de.florianmichael.viafabricplus.definition.v1_12_2;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.injection.access.IFontStorage;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.Glyph;
|
||||
import net.minecraft.client.font.GlyphRenderer;
|
||||
import net.minecraft.client.font.RenderableGlyph;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@ -37,7 +37,7 @@ import java.util.function.Supplier;
|
||||
public class FontCacheFix {
|
||||
public final static boolean DASH_LOADER = FabricLoader.getInstance().isModLoaded("dashloader");
|
||||
|
||||
private static ComparableProtocolVersion protocolVersion;
|
||||
private static VersionEnum protocolVersion;
|
||||
|
||||
public static void init() {
|
||||
if (DASH_LOADER) return;
|
||||
@ -50,9 +50,9 @@ public class FontCacheFix {
|
||||
}
|
||||
|
||||
public static boolean shouldReplaceFontRenderer() {
|
||||
if (ViaLoadingBase.getInstance() == null || DASH_LOADER || protocolVersion == null) return false;
|
||||
if (DASH_LOADER || protocolVersion == null) return false;
|
||||
|
||||
return ExperimentalSettings.INSTANCE.fixFontCache.getValue() && protocolVersion.isOlderThanOrEqualTo(ProtocolVersion.v1_12_2);
|
||||
return ExperimentalSettings.INSTANCE.fixFontCache.getValue() && protocolVersion.isOlderThanOrEqualTo(VersionEnum.r1_12_2);
|
||||
}
|
||||
|
||||
public enum BuiltinEmptyGlyph1_12_2 implements Glyph {
|
||||
|
@ -17,22 +17,19 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.definition.v1_14_4;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.network.AllowedAddressResolver;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class LegacyServerAddress {
|
||||
private final static ProtocolRange SRV_RANGE = new ProtocolRange(ProtocolVersion.v1_16_4, LegacyProtocolVersion.r1_3_1tor1_3_2);
|
||||
private final static VersionRange SRV_RANGE = new VersionRange(VersionEnum.r1_16_4tor1_16_5, VersionEnum.r1_3_1tor1_3_2);
|
||||
|
||||
public static ServerAddress parse(ComparableProtocolVersion version, String address) {
|
||||
if (version == null) version = ViaLoadingBase.getInstance().getTargetVersion();
|
||||
public static ServerAddress parse(VersionEnum version, String address) {
|
||||
if (version == null) version = ProtocolHack.getTargetVersion();
|
||||
final ServerAddress mc = ServerAddress.parse(address);
|
||||
if (SRV_RANGE.contains(version) || version.isEqualTo(BedrockProtocolVersion.bedrockLatest)) {
|
||||
if (SRV_RANGE.contains(version) || version == VersionEnum.bedrockLatest) {
|
||||
if (!mc.equals(ServerAddress.INVALID)) {
|
||||
return AllowedAddressResolver.DEFAULT.redirectResolver.lookupRedirect(mc).orElse(mc);
|
||||
}
|
||||
|
@ -15,18 +15,18 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information;
|
||||
package de.florianmichael.viafabricplus.information;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractInformationGroup {
|
||||
private final ProtocolRange protocolRange;
|
||||
private final VersionRange versionRange;
|
||||
|
||||
public AbstractInformationGroup(final ProtocolRange protocolRange) {
|
||||
this.protocolRange = protocolRange;
|
||||
public AbstractInformationGroup(final VersionRange versionRange) {
|
||||
this.versionRange = versionRange;
|
||||
}
|
||||
|
||||
public abstract void applyInformation(final UserConnection userConnection, final List<String> output);
|
||||
@ -48,7 +48,7 @@ public abstract class AbstractInformationGroup {
|
||||
return format(((double) value / 1024.0 / 1024.0 / 1024.0 / 1024.0)) + " Tb";
|
||||
}
|
||||
|
||||
public ProtocolRange getProtocolRange() {
|
||||
return protocolRange;
|
||||
public VersionRange getVersionRange() {
|
||||
return versionRange;
|
||||
}
|
||||
}
|
@ -15,9 +15,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information;
|
||||
package de.florianmichael.viafabricplus.information;
|
||||
|
||||
import de.florianmichael.viafabricplus.ui.information.impl.*;
|
||||
import de.florianmichael.viafabricplus.information.impl.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
@ -15,24 +15,24 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.definition.bedrock.storage.JoinGameStorage;
|
||||
import de.florianmichael.viafabricplus.definition.bedrock.ModelFormats;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.viabedrock.ViaFabricPlusBlobCacheProvider;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.lenni0451.reflect.stream.RStream;
|
||||
import net.lenni0451.reflect.stream.field.FieldStream;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.viabedrock.api.chunk.BedrockChunk;
|
||||
import net.raphimc.viabedrock.api.model.entity.Entity;
|
||||
import net.raphimc.viabedrock.protocol.providers.BlobCacheProvider;
|
||||
import net.raphimc.viabedrock.protocol.storage.BlobCache;
|
||||
import net.raphimc.viabedrock.protocol.storage.ChunkTracker;
|
||||
import net.raphimc.viabedrock.protocol.storage.GameSessionStorage;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -42,7 +42,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class BedrockInformation extends AbstractInformationGroup {
|
||||
|
||||
public BedrockInformation() {
|
||||
super(ProtocolRange.singleton(BedrockProtocolVersion.bedrockLatest));
|
||||
super(VersionRange.singleton(VersionEnum.bedrockLatest));
|
||||
}
|
||||
|
||||
@Override
|
@ -15,20 +15,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class C0_30CPEInformation extends AbstractInformationGroup {
|
||||
|
||||
public C0_30CPEInformation() {
|
||||
super(ProtocolRange.singleton(LegacyProtocolVersion.c0_30cpe));
|
||||
super(VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
}
|
||||
|
||||
@Override
|
@ -15,12 +15,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -33,7 +32,7 @@ public class GeneralInformation extends AbstractInformationGroup {
|
||||
@Override
|
||||
public void applyInformation(UserConnection userConnection, List<String> output) {
|
||||
output.add("Pipeline count: " + userConnection.getProtocolInfo().getPipeline().pipes().size());
|
||||
output.add("Selected version (in the GUI): " + ViaLoadingBase.getInstance().getTargetVersion().getName() + " (" + ViaLoadingBase.getInstance().getTargetVersion().getVersion() + ")");
|
||||
output.add("Selected version (in the GUI): " + ProtocolHack.targetVersion.getName() + " (" + ProtocolHack.targetVersion.getVersion() + ")");
|
||||
output.add("Connected version: " + ProtocolHack.getTargetVersion().getName() + " (" + ProtocolHack.getTargetVersion().getVersion() + ")");
|
||||
}
|
||||
}
|
@ -15,20 +15,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.SeedStorage;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class V1_1Information extends AbstractInformationGroup {
|
||||
|
||||
public V1_1Information() {
|
||||
super(ProtocolRange.andOlder(LegacyProtocolVersion.r1_1));
|
||||
super(VersionRange.andOlder(VersionEnum.r1_1));
|
||||
}
|
||||
|
||||
@Override
|
@ -15,20 +15,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.EntityTracker;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class V1_2_4_5Information extends AbstractInformationGroup {
|
||||
|
||||
public V1_2_4_5Information() {
|
||||
super(ProtocolRange.andOlder(LegacyProtocolVersion.r1_2_4tor1_2_5));
|
||||
super(VersionRange.andOlder(VersionEnum.r1_2_4tor1_2_5));
|
||||
}
|
||||
|
||||
@Override
|
@ -15,20 +15,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class V1_5_2Information extends AbstractInformationGroup {
|
||||
|
||||
public V1_5_2Information() {
|
||||
super(ProtocolRange.andOlder(LegacyProtocolVersion.r1_5_2));
|
||||
super(VersionRange.andOlder(VersionEnum.r1_5_2));
|
||||
}
|
||||
|
||||
@Override
|
@ -15,20 +15,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.ui.information.impl;
|
||||
package de.florianmichael.viafabricplus.information.impl;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.vialoadingbase.model.ProtocolRange;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.EntityTracker;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class V1_7_10Information extends AbstractInformationGroup {
|
||||
|
||||
public V1_7_10Information() {
|
||||
super(ProtocolRange.andOlder(ProtocolVersion.v1_7_6));
|
||||
super(VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
}
|
||||
|
||||
@Override
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
public interface IServerInfo {
|
||||
|
||||
ComparableProtocolVersion viafabricplus_forcedVersion();
|
||||
void viafabricplus_forceVersion(ComparableProtocolVersion version);
|
||||
VersionEnum viafabricplus_forcedVersion();
|
||||
void viafabricplus_forceVersion(VersionEnum version);
|
||||
}
|
||||
|
@ -18,13 +18,13 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.base.ForceVersionScreen;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.screen.impl.base.ForceVersionScreen;
|
||||
import net.minecraft.client.gui.screen.AddServerScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.text.Text;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -43,7 +43,7 @@ public class MixinAddServerScreen extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
public void injectButton(CallbackInfo ci) {
|
||||
final ComparableProtocolVersion forcedVersion = ((IServerInfo) server).viafabricplus_forcedVersion();
|
||||
final VersionEnum forcedVersion = ((IServerInfo) server).viafabricplus_forcedVersion();
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.literal(forcedVersion == null ? "Set version for this server" : forcedVersion.getName()), button ->
|
||||
client.setScreen(new ForceVersionScreen(this, version -> ((IServerInfo) server).viafabricplus_forceVersion(version)))).
|
||||
position(width - (forcedVersion == null ? 150 : 98) - 5, 5).size(forcedVersion == null ? 150 : 98, 20).build());
|
||||
|
@ -21,10 +21,8 @@ import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.base.event.DisconnectConnectionCallback;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLBPipeline;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLLegacyPipeline;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.viabedrock.RakNetClientConnection;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.netty.event.CompressionReorderEvent;
|
||||
import io.netty.channel.*;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.encryption.PacketDecryptor;
|
||||
@ -32,9 +30,10 @@ import net.minecraft.network.encryption.PacketEncryptor;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Lazy;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.viabedrock.netty.*;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialoader.netty.VLLegacyPipeline;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.netty.CompressionReorderEvent;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -70,12 +69,12 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, boolean rejectBad, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new CompressionReorderEvent());
|
||||
channel.pipeline().fireUserEventTriggered(CompressionReorderEvent.INSTANCE);
|
||||
}
|
||||
|
||||
@Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true)
|
||||
private void storeEncryptionCiphers(Cipher decryptionCipher, Cipher encryptionCipher, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion(channel).isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
|
||||
if (ProtocolHack.getTargetVersion(channel).isOlderThanOrEqualTo(VersionEnum.r1_6_4)) {
|
||||
ci.cancel();
|
||||
this.viafabricplus_decryptionCipher = decryptionCipher;
|
||||
this.viafabricplus_setupPreNettyEncryption(encryptionCipher);
|
||||
@ -86,7 +85,8 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
private static void captureAddress(InetSocketAddress address, boolean useEpoll, CallbackInfoReturnable<ClientConnection> cir, final ClientConnection clientConnection, Class class_, Lazy lazy) {
|
||||
((IClientConnection) clientConnection).viafabricplus_captureAddress(address);
|
||||
|
||||
if (ProtocolHack.getForcedVersions().containsKey(address) ? (ProtocolHack.getForcedVersions().get(address).getVersion() == BedrockProtocolVersion.bedrockLatest.getVersion()) : ProtocolHack.getTargetVersion().isEqualTo(BedrockProtocolVersion.bedrockLatest)) {
|
||||
if (ProtocolHack.getForcedVersions().containsKey(address) ? (ProtocolHack.getForcedVersions().get(address).getVersion() == VersionEnum.bedrockLatest.getVersion()) :
|
||||
ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
RakNetClientConnection.connectRakNet(clientConnection, address, lazy, class_);
|
||||
cir.setReturnValue(clientConnection);
|
||||
}
|
||||
@ -104,20 +104,20 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
|
||||
@Inject(method = "disconnect", at = @At("RETURN"))
|
||||
public void resetStorages(Text disconnectReason, CallbackInfo ci) {
|
||||
ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(ViaLoadingBase.getInstance().getTargetVersion());
|
||||
ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(ProtocolHack.getTargetVersion());
|
||||
DisconnectConnectionCallback.EVENT.invoker().onDisconnect();
|
||||
}
|
||||
|
||||
@Unique
|
||||
public void viafabricplus_setupPreNettyEncryption(final Cipher encryptionCipher) {
|
||||
this.encrypted = true;
|
||||
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_LEGACY_PRE_NETTY_LENGTH_REMOVER_HANDLER_NAME, "encrypt", new PacketEncryptor(encryptionCipher));
|
||||
this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, "encrypt", new PacketEncryptor(encryptionCipher));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viafabricplus_setupPreNettyDecryption() {
|
||||
this.encrypted = true;
|
||||
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_LEGACY_PRE_NETTY_LENGTH_PREPENDER_HANDLER_NAME, "decrypt", new PacketDecryptor(this.viafabricplus_decryptionCipher));
|
||||
this.channel.pipeline().addBefore(VLLegacyPipeline.VIALEGACY_PRE_NETTY_LENGTH_PREPENDER_NAME, "decrypt", new PacketDecryptor(this.viafabricplus_decryptionCipher));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,7 +135,7 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
if (this.viafabricplus_compressionEnabled) throw new IllegalStateException("Compression is already enabled");
|
||||
this.viafabricplus_compressionEnabled = true;
|
||||
|
||||
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_BEDROCK_BATCH_LENGTH_HANDLER_NAME, ViaFabricPlusVLBPipeline.VIA_BEDROCK_COMPRESSION_HANDLER_NAME, new ZLibCompression());
|
||||
this.channel.pipeline().addBefore("splitter", ViaFabricPlusVLLegacyPipeline.VIABEDROCK_COMPRESSION_HANDLER_NAME, new ZLibCompression());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -143,7 +143,7 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
if (this.viafabricplus_compressionEnabled) throw new IllegalStateException("Compression is already enabled");
|
||||
this.viafabricplus_compressionEnabled = true;
|
||||
|
||||
this.channel.pipeline().addBefore(ViaFabricPlusVLBPipeline.VIA_BEDROCK_BATCH_LENGTH_HANDLER_NAME, ViaFabricPlusVLBPipeline.VIA_BEDROCK_COMPRESSION_HANDLER_NAME, new SnappyCompression());
|
||||
this.channel.pipeline().addBefore("splitter", ViaFabricPlusVLLegacyPipeline.VIABEDROCK_COMPRESSION_HANDLER_NAME, new SnappyCompression());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -151,6 +151,6 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
if (this.encrypted) throw new IllegalStateException("Encryption is already enabled");
|
||||
this.encrypted = true;
|
||||
|
||||
this.channel.pipeline().addAfter(ViaFabricPlusVLBPipeline.VIA_BEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, ViaFabricPlusVLBPipeline.VIA_BEDROCK_ENCRYPTION_HANDLER_NAME, new AesEncryption(secretKey));
|
||||
this.channel.pipeline().addAfter(ViaFabricPlusVLLegacyPipeline.VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, ViaFabricPlusVLLegacyPipeline.VIABEDROCK_ENCRYPTION_HANDLER_NAME, new AesEncryption(secretKey));
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.network.ClientLoginNetworkHandler;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.text.Text;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ProtocolMetadataStorage;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -39,7 +40,7 @@ public class MixinClientLoginNetworkHandler {
|
||||
|
||||
@Inject(method = "joinServerSession", at = @At("HEAD"), cancellable = true)
|
||||
public void dontVerifySessionIfCracked(String serverId, CallbackInfoReturnable<Text> cir) {
|
||||
if (ProtocolHack.getTargetVersion(connection.channel).isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
|
||||
if (ProtocolHack.getTargetVersion(connection.channel).isOlderThanOrEqualTo(VersionEnum.r1_6_4)) {
|
||||
if (!connection.channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get().get(ProtocolMetadataStorage.class).authenticate) {
|
||||
cir.setReturnValue(null);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -43,7 +43,7 @@ public class MixinConnectScreen_1 {
|
||||
final InetSocketAddress address = instance.get();
|
||||
if (field_40415 == null) return address;
|
||||
|
||||
final ComparableProtocolVersion forcedVersion = ((IServerInfo) field_40415).viafabricplus_forcedVersion();
|
||||
final VersionEnum forcedVersion = ((IServerInfo) field_40415).viafabricplus_forcedVersion();
|
||||
if (forcedVersion != null) {
|
||||
ProtocolHack.getForcedVersions().put(address, forcedVersion);
|
||||
ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(forcedVersion);
|
||||
|
@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.ui.information.AbstractInformationGroup;
|
||||
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -48,7 +48,7 @@ public class MixinDebugHud {
|
||||
information.add(Formatting.GOLD + "[ViaFabricPlus] " + Formatting.WHITE);
|
||||
|
||||
for (AbstractInformationGroup group : ViaFabricPlus.INSTANCE.getInformationSystem().getGroups()) {
|
||||
if (group.getProtocolRange() != null && !group.getProtocolRange().contains(ProtocolHack.getTargetVersion())) continue;
|
||||
if (group.getVersionRange() != null && !group.getVersionRange().contains(ProtocolHack.getTargetVersion())) continue;
|
||||
|
||||
final List<String> groupInformation = new ArrayList<>();
|
||||
try {
|
||||
@ -56,7 +56,7 @@ public class MixinDebugHud {
|
||||
} catch (Exception ignored) {}
|
||||
if (groupInformation.isEmpty()) continue;
|
||||
|
||||
information.add(group.getProtocolRange() == null ? "General" : group.getProtocolRange().toString());
|
||||
information.add(group.getVersionRange() == null ? "General" : group.getVersionRange().toString());
|
||||
information.addAll(groupInformation);
|
||||
information.add("");
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.definition.v1_14_4.LegacyServerAddress;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.base.ProtocolSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.screen.impl.base.ProtocolSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.GeneralSettings;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
|
@ -20,11 +20,10 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.viabedrock.RakNetClientConnection;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.minecraft.client.network.MultiplayerServerListPinger;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -39,12 +38,12 @@ public class MixinMultiplayerServerListPinger {
|
||||
|
||||
@Inject(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;Z)Lnet/minecraft/network/ClientConnection;"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void trackSessions(ServerInfo entry, Runnable saver, CallbackInfo ci, ServerAddress serverAddress, Optional optional, InetSocketAddress inetSocketAddress) {
|
||||
final ComparableProtocolVersion version = ((IServerInfo) entry).viafabricplus_forcedVersion();
|
||||
final VersionEnum version = ((IServerInfo) entry).viafabricplus_forcedVersion();
|
||||
|
||||
if (version != null) {
|
||||
ProtocolHack.getForcedVersions().put(inetSocketAddress, version);
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion(inetSocketAddress).isEqualTo(BedrockProtocolVersion.bedrockLatest)) {
|
||||
if (ProtocolHack.getTargetVersion(inetSocketAddress) == VersionEnum.bedrockLatest) {
|
||||
RakNetClientConnection.getRakNetPingSessions().add(inetSocketAddress);
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,9 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.model.ComparableProtocolVersion;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@ -37,15 +36,15 @@ public class MixinServerInfo implements IServerInfo {
|
||||
@Shadow public String name;
|
||||
|
||||
@Unique
|
||||
private ComparableProtocolVersion viafabricplus_forcedVersion = null;
|
||||
private VersionEnum viafabricplus_forcedVersion = null;
|
||||
|
||||
@Override
|
||||
public ComparableProtocolVersion viafabricplus_forcedVersion() {
|
||||
public VersionEnum viafabricplus_forcedVersion() {
|
||||
return viafabricplus_forcedVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viafabricplus_forceVersion(ComparableProtocolVersion version) {
|
||||
public void viafabricplus_forceVersion(VersionEnum version) {
|
||||
viafabricplus_forcedVersion = version;
|
||||
}
|
||||
|
||||
@ -60,7 +59,7 @@ public class MixinServerInfo implements IServerInfo {
|
||||
private static void loadForcedVersion(NbtCompound root, CallbackInfoReturnable<ServerInfo> cir, ServerInfo serverInfo) {
|
||||
if (root.contains("viafabricplus_forcedversion")) {
|
||||
try {
|
||||
((IServerInfo) serverInfo).viafabricplus_forceVersion(ViaLoadingBase.fromProtocolId(root.getInt("viafabricplus_forcedversion")));
|
||||
((IServerInfo) serverInfo).viafabricplus_forceVersion(VersionEnum.fromProtocolId(root.getInt("viafabricplus_forcedversion")));
|
||||
} catch (Exception ignored) {
|
||||
// Version doesn't exist anymore
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.ui.screen.impl.thirdparty.classicube.ClassiCubeLoginScreen;
|
||||
import de.florianmichael.viafabricplus.screen.impl.thirdparty.classicube.ClassiCubeLoginScreen;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
@ -74,14 +75,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
this.listedPlayerListEntries = new LinkedHashSet<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/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 (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_17)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,14 +99,14 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Inject(method = "onChunkLoadDistance", at = @At("RETURN"))
|
||||
public void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_17_1)) {
|
||||
this.onSimulationDistance(new SimulationDistanceS2CPacket(packet.getDistance()));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = { "onGameJoin", "onPlayerRespawn" }, at = @At("TAIL"))
|
||||
private void injectOnOnGameJoinOrRespawn(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
ClientPlayerEntity player = MinecraftClient.getInstance().player;
|
||||
assert player != null;
|
||||
onEntityStatus(new EntityStatusS2CPacket(player, (byte) 28));
|
||||
@ -114,12 +115,12 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@WrapWithCondition(method = "onPlayerSpawnPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;setReady()V"))
|
||||
public boolean moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19);
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19);
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerPositionLook", at = @At("RETURN"))
|
||||
public void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2) && MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) {
|
||||
MinecraftClient.getInstance().setScreen(null);
|
||||
}
|
||||
}
|
||||
@ -127,7 +128,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
@SuppressWarnings("InvalidInjectorMethodSignature")
|
||||
@ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class))
|
||||
public Class<?> dontChangePlayerYaw(Object entity, Class<?> constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2)) {
|
||||
return Integer.class;
|
||||
}
|
||||
return constant;
|
||||
@ -135,12 +136,12 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
|
||||
public boolean removeWarning(Logger instance, String s, Object o) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3);
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19_3);
|
||||
}
|
||||
|
||||
@Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V"))
|
||||
public void forceSendKeepAlive(ClientPlayNetworkHandler instance, Packet<ServerPlayPacketListener> packet, BooleanSupplier sendCondition, Duration expirationTime) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
sendPacket(packet);
|
||||
return;
|
||||
}
|
||||
@ -154,7 +155,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Inject(method = "onSetTradeOffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
public void checkLoginPacket(SetTradeOffersS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion(connection.channel).isOlderThanOrEqualTo(ProtocolVersion.v1_13_2) && this.client.player == null) {
|
||||
if (ProtocolHack.getTargetVersion(connection.channel).isOlderThanOrEqualTo(VersionEnum.r1_13_2) && this.client.player == null) {
|
||||
ViaFabricPlus.LOGGER.error("Server tried to send Play packet in Login process, dropping \"SetTradeOffers\"");
|
||||
ci.cancel();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
|
||||
@ -76,7 +77,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
|
||||
@Inject(method = "attackEntity", at = @At("HEAD"))
|
||||
private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && player instanceof IClientPlayerEntity) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && player instanceof IClientPlayerEntity) {
|
||||
player.swingHand(Hand.MAIN_HAND);
|
||||
((IClientPlayerEntity) player).viafabricplus_cancelSwingOnce();
|
||||
}
|
||||
@ -96,7 +97,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 && ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) return true;
|
||||
if (type == SlotActionType.QUICK_MOVE && ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_11_1to1_11_2)) return true;
|
||||
|
||||
// pickup with slot -999 (outside window) to throw items always uses empty stack for verification
|
||||
return type == SlotActionType.PICKUP && slot == -999;
|
||||
@ -104,7 +105,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
|
||||
@WrapWithCondition(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V"))
|
||||
private boolean modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
||||
ItemStack slotItemBeforeModification;
|
||||
|
||||
if (this.viafabricplus_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot()))
|
||||
@ -120,7 +121,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
final byte button = (byte) clickSlot.getButton();
|
||||
final short lastActionId = ((IScreenHandler) client.player.currentScreenHandler).viafabricplus_getAndIncrementLastActionId();
|
||||
final int actionType = clickSlot.getActionType().ordinal();
|
||||
final Item item = ItemTranslator.minecraftToViaVersion(viaConnection, slotItemBeforeModification, ProtocolVersion.v1_16.getVersion());
|
||||
final Item item = ItemTranslator.minecraftToViaVersion(viaConnection, slotItemBeforeModification, VersionEnum.r1_16.getVersion());
|
||||
|
||||
viaConnection.getChannel().eventLoop().submit(() -> {
|
||||
final PacketWrapper clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, viaConnection);
|
||||
@ -149,7 +150,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 boolean redirectInteractItem(ClientPlayNetworkHandler instance, Packet<?> packet) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17);
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_17);
|
||||
}
|
||||
|
||||
@Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0, shift = At.Shift.BEFORE))
|
||||
@ -167,7 +168,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
this.viafabricplus_actionResult = this.interactBlockInternal(player, hand, hitResult);
|
||||
|
||||
if (this.viafabricplus_actionResult == ActionResult.FAIL) {
|
||||
@ -178,7 +179,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
return this.viafabricplus_actionResult;
|
||||
}
|
||||
return interactBlockInternal(player, hand, hitResult);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
@ -47,4 +48,11 @@ public class MixinItemRenderer {
|
||||
cir.setReturnValue(this.models.getModelManager().getMissingModel());
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "renderGuiItemOverlay(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I"))
|
||||
public int recolor(TextRenderer instance, String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_10) && text.startsWith("-")) color = -43213;
|
||||
return instance.draw(text, x, y, color, shadow, matrix, vertexConsumers, layerType, backgroundColor, light);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPac
|
||||
import de.florianmichael.viafabricplus.injection.access.IMinecraftClient;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
@ -61,14 +62,14 @@ public abstract class MixinMinecraftClient implements IMinecraftClient {
|
||||
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))
|
||||
public boolean removeEquipProgressReset(HeldItemRenderer instance, Hand hand) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_8) || !(player.getStackInHand(hand).getItem() instanceof SwordItem);
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_8) || !(player.getStackInHand(hand).getItem() instanceof SwordItem);
|
||||
}
|
||||
|
||||
@Redirect(method = "doItemUse",
|
||||
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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -77,7 +78,7 @@ public abstract class MixinMinecraftClient implements IMinecraftClient {
|
||||
|
||||
@Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1))
|
||||
public int unwrapOperation(MinecraftClient instance) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return 0;
|
||||
}
|
||||
return attackCooldown;
|
||||
@ -85,7 +86,7 @@ public abstract class MixinMinecraftClient implements IMinecraftClient {
|
||||
|
||||
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V", shift = At.Shift.BEFORE))
|
||||
public void updateCooldown(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
if (this.attackCooldown > 0) {
|
||||
--this.attackCooldown;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
@ -34,7 +35,7 @@ public class MixinPlayerEntityRenderer {
|
||||
|
||||
@Inject(method = "getPositionOffset*", at = @At("RETURN"), cancellable = true)
|
||||
private void injectGetPositionOffset(AbstractClientPlayerEntity player, float delta, CallbackInfoReturnable<Vec3d> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
if (player.getSleepingDirection() != null) {
|
||||
ci.setReturnValue(ci.getReturnValue().subtract(player.getSleepingDirection().getOffsetX() * 0.4, 0, player.getSleepingDirection().getOffsetZ() * 0.4));
|
||||
}
|
||||
@ -44,6 +45,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 (ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_11_1)) && player.isInSneakingPose();
|
||||
return (ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_11_1to1_11_2)) && player.isInSneakingPose();
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.Files;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.mappings.PackFormatsMappings;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
@ -54,10 +55,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 (ProtocolHack.getTargetVersion().isOlderThan(ProtocolVersion.v1_14)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_14)) {
|
||||
modifiableMap.remove("X-Minecraft-Version-ID");
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(ProtocolVersion.v1_13)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_13)) {
|
||||
modifiableMap.remove("X-Minecraft-Pack-Format");
|
||||
modifiableMap.remove("User-Agent");
|
||||
}
|
||||
@ -73,10 +74,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
//noinspection deprecation
|
||||
return Hashing.sha1().hashBytes(Files.toByteArray(viafabricplus_trackedFile)).toString();
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThan(ProtocolVersion.v1_18)) {
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_18tor1_18_1)) {
|
||||
return DigestUtils.sha1Hex(new FileInputStream(viafabricplus_trackedFile));
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
@ -86,7 +87,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return instance;
|
||||
}
|
||||
return instance.toLowerCase(locale);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
@ -41,25 +42,25 @@ public abstract class MixinAbstractBlock_AbstractBlockState {
|
||||
public void changeHardness(BlockView world, BlockPos pos, CallbackInfoReturnable<Float> cir) {
|
||||
final BlockState state = this.asBlockState();
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
if (state.getBlock() instanceof InfestedBlock) {
|
||||
cir.setReturnValue(0.75F);
|
||||
}
|
||||
}
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
|
||||
if (state.getBlock() == Blocks.PISTON || state.getBlock() == Blocks.STICKY_PISTON || state.getBlock() == Blocks.PISTON_HEAD) {
|
||||
cir.setReturnValue(0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
if (state.getBlock() instanceof InfestedBlock) {
|
||||
cir.setReturnValue(0F);
|
||||
}
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.AnvilBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@ -52,7 +52,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.BambooBlock;
|
||||
@ -33,7 +34,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_17)) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.block.BedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@ -44,14 +43,14 @@ public class MixinBedBlock {
|
||||
|
||||
@Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true)
|
||||
public void injectBounceEntity(Entity entity, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_11_1to1_11_2)) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
cir.setReturnValue(viafabricplus_bed_shape_v1_13_2);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -34,19 +35,19 @@ public class MixinBlock {
|
||||
private void modifyBlastResistance(CallbackInfoReturnable<Float> ci) {
|
||||
final Block block = ((Block) (Object) this);
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
|
||||
if (block == Blocks.PISTON || block == Blocks.STICKY_PISTON || block == Blocks.PISTON_HEAD) {
|
||||
ci.setReturnValue(0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
if (block instanceof InfestedBlock) {
|
||||
ci.setReturnValue(0.75F);
|
||||
}
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BrewingStandBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
@ -45,7 +45,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_base_shape_v1_12_2);
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,11 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.cauldron.CauldronBehavior;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.function.BooleanBiFunction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -49,7 +49,7 @@ public abstract class MixinCauldronBlock extends AbstractCauldronBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
return viafabricplus_cauldron_shape_v1_12_2;
|
||||
}
|
||||
return super.getOutlineShape(state, world, pos, context);
|
||||
|
@ -21,11 +21,11 @@ import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@ -40,7 +40,7 @@ public abstract class MixinChestBlock extends AbstractChestBlock<ChestBlockEntit
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_4_2)) {
|
||||
return VoxelShapes.fullCube();
|
||||
}
|
||||
return super.getCollisionShape(state, world, pos, context);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.*;
|
||||
@ -47,10 +48,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) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
cir.setReturnValue(viafabricplus_shape_v1_8_x);
|
||||
}
|
||||
else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
cir.setReturnValue(viafabricplus_shape_v1_16_5);
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,11 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.EndPortalFrameBlock;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -45,7 +45,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
return VoxelShapes.union(FRAME_SHAPE, viafabricplus_eye_shape_v1_12_2);
|
||||
}
|
||||
return FRAME_WITH_EYE_SHAPE;
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FarmlandBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
@ -51,7 +51,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_9_3tor1_9_4)) {
|
||||
cir.setReturnValue(viafabricplus_shape_v1_9_4);
|
||||
}
|
||||
}
|
||||
|
@ -17,15 +17,16 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@ -42,7 +43,7 @@ public class MixinFenceBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||
private void injectOnUse(CallbackInfoReturnable<ActionResult> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_10)) {
|
||||
ci.setReturnValue(ActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
@ -52,7 +53,7 @@ public class MixinFenceBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.b1_8tob1_8_1)) {
|
||||
return viafabricplus_fence_shape_b1_8_1;
|
||||
}
|
||||
return super.getCollisionShape(state, world, pos, context);
|
||||
@ -60,7 +61,7 @@ public class MixinFenceBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.b1_8tob1_8_1)) {
|
||||
return VoxelShapes.fullCube();
|
||||
}
|
||||
return super.getOutlineShape(state, world, pos, context);
|
||||
|
@ -17,9 +17,9 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FireBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
@ -37,9 +37,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.getInstance().getTargetVersion() == null) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
|
||||
cir.setReturnValue(VoxelShapes.empty());
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -39,7 +40,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_10) && content != Blocks.AIR) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_10) && content != Blocks.AIR) {
|
||||
ci.setReturnValue(ActionResult.CONSUME);
|
||||
}
|
||||
}
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.HopperBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.function.BooleanBiFunction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@ -49,14 +49,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_inside_shape_v1_12_2);
|
||||
}
|
||||
}
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.LadderBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
@ -50,7 +50,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.LightBlock;
|
||||
@ -31,7 +32,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
return true;
|
||||
}
|
||||
return instance.isCreativeLevelTwoOp();
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.LilyPadBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
@ -41,7 +41,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
cir.setReturnValue(viafabricplus_shape_v1_8_x);
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
@ -37,7 +37,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return viafabricplus_get1_8Shape(state);
|
||||
}
|
||||
return super.getOutlineShape(state, world, pos, context);
|
||||
@ -45,7 +45,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return viafabricplus_get1_8Shape(state);
|
||||
}
|
||||
return super.getCollisionShape(state, world, pos, context);
|
||||
|
@ -17,9 +17,9 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@ -41,18 +41,14 @@ 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.getInstance().getTargetVersion() == null) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_getCoreShape_v1_8_x(state));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (ViaLoadingBase.getInstance().getTargetVersion() == null) return super.getCollisionShape(state, world, pos, context);
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return VoxelShapes.union(viafabricplus_getHeadShape_v1_8_x(state), viafabricplus_getCoreShape_v1_8_x(state));
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,13 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.SnowBlock;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@ -57,7 +57,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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_layers_to_shape_v1_12_2[state.get(LAYERS) - 1]);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -43,7 +44,7 @@ public class MixinSoulSandBlock extends Block {
|
||||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
|
||||
super.onEntityCollision(state, world, pos, entity);
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) {
|
||||
final Vec3d velocity = entity.getVelocity();
|
||||
this.viafabricplus_forceValue = true;
|
||||
entity.setVelocity(velocity.getX() * this.getVelocityMultiplier(), velocity.getY(), velocity.getZ() * this.getVelocityMultiplier());
|
||||
@ -53,7 +54,7 @@ public class MixinSoulSandBlock extends Block {
|
||||
|
||||
@Override
|
||||
public float getVelocityMultiplier() {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4) && !this.viafabricplus_forceValue) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4) && !this.viafabricplus_forceValue) {
|
||||
return 1.0F;
|
||||
}
|
||||
return super.getVelocityMultiplier();
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -33,7 +34,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_17)) {
|
||||
return instance.isOf(Blocks.GRASS_BLOCK) || instance.isOf(Blocks.DIRT) || instance.isOf(Blocks.COARSE_DIRT) || instance.isOf(Blocks.PODZOL);
|
||||
}
|
||||
return instance.isIn(tagKey);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -24,7 +25,6 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.WallBlock;
|
||||
import net.minecraft.block.enums.WallShape;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -151,21 +151,21 @@ public class MixinWallBlock extends Block {
|
||||
|
||||
@Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true)
|
||||
public void injectGetPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable<BlockState> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_cip_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]);
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ public class MixinWallBlock 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 (MinecraftClient.getInstance() != null && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_shape_by_index_v1_12_2[viafabricplus_getShapeIndex_v1_12_2(state)]);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Blocks;
|
||||
@ -50,7 +51,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
ItemStack lv = player.getStackInHand(hand);
|
||||
if (!this.isBaby()) {
|
||||
if (this.isTame() && player.shouldCancelInteraction()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.passive.AllayEntity;
|
||||
@ -30,7 +31,7 @@ public class MixinAllayEntity {
|
||||
|
||||
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(0.0);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
@ -30,6 +31,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 && ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_15);
|
||||
return instance.isClient && ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_15);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
|
||||
import de.florianmichael.viafabricplus.definition.v1_8.ArmorPointCalculation;
|
||||
@ -69,7 +70,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;square(D)D"))
|
||||
public double changeMagnitude(double n) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2)) {
|
||||
n = 9.0E-4D;
|
||||
}
|
||||
return MathHelper.square(n);
|
||||
@ -78,7 +79,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;ticksSinceLastPositionPacketSent:I", ordinal = 0))
|
||||
public int revertLastPositionPacketSentIncrementor(ClientPlayerEntity instance) {
|
||||
// Mixin calls the redirector and sets the original field to the return value of the redirector + 1, therefore the -1 results, so we truncate the + 1 again and the field does not change
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return ticksSinceLastPositionPacketSent - 1;
|
||||
}
|
||||
return ticksSinceLastPositionPacketSent;
|
||||
@ -86,7 +87,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z"))
|
||||
public void incrementLastPositionPacketSentCounter(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
++this.ticksSinceLastPositionPacketSent;
|
||||
}
|
||||
}
|
||||
@ -101,7 +102,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Inject(method = "swingHand", at = @At("HEAD"), cancellable = true)
|
||||
public void injectSwingHand(Hand hand, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && viafabricplus_areSwingCanceledThisTick) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && viafabricplus_areSwingCanceledThisTick) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@ -114,7 +115,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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);
|
||||
@ -126,7 +127,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_1)) {
|
||||
return false;
|
||||
} else {
|
||||
return _this.isSwimming();
|
||||
@ -135,7 +136,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_1)) {
|
||||
return false;
|
||||
}
|
||||
return instance.isSubmergedInWater();
|
||||
@ -143,7 +144,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_1)) {
|
||||
return input.movementForward >= 0.8F;
|
||||
}
|
||||
|
||||
@ -152,7 +153,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
return false; // Disable all water related movement
|
||||
}
|
||||
|
||||
@ -161,14 +162,14 @@ 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 (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
sendSprintingPacket();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "autoJump", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;inverseSqrt(F)F"))
|
||||
public float useFastInverse(float x) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
final float var1 = 0.5F * x;
|
||||
int var2 = Float.floatToIntBits(x);
|
||||
var2 = 1597463007 - (var2 >> 1);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.EntityType;
|
||||
@ -40,7 +41,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2) && player.getAbilities().creativeMode) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2) && player.getAbilities().creativeMode) {
|
||||
cir.setReturnValue(super.interactMob(player, hand));
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.mob.CreeperEntity;
|
||||
@ -31,7 +32,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
return SoundEvents.ITEM_FLINTANDSTEEL_USE;
|
||||
}
|
||||
return SoundEvents.ITEM_FIRECHARGE_USE;
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
|
||||
@ -62,7 +63,7 @@ public abstract class MixinEntity {
|
||||
|
||||
@ModifyConstant(method = "movementInputToVelocity", constant = @Constant(doubleValue = 1E-7))
|
||||
private static double injectMovementInputToVelocity(double epsilon) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return 1E-4;
|
||||
}
|
||||
return epsilon;
|
||||
@ -70,9 +71,9 @@ public abstract class MixinEntity {
|
||||
|
||||
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - 0.5000001, pos.z));
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) {
|
||||
cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - 1, pos.z));
|
||||
}
|
||||
}
|
||||
@ -80,14 +81,14 @@ public abstract class MixinEntity {
|
||||
|
||||
@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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(Vec3d.fromPolar(pitch, yaw));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setSwimming", at = @At("HEAD"), cancellable = true)
|
||||
private void onSetSwimming(boolean swimming, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && swimming) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2) && swimming) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@ -95,7 +96,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 (ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_12_2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -145,19 +146,19 @@ public abstract class MixinEntity {
|
||||
|
||||
@Inject(method = "getTargetingMargin", at = @At("HEAD"), cancellable = true)
|
||||
public void expandHitBox(CallbackInfoReturnable<Float> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2));
|
||||
return Float.isFinite(f) || ((Object) this instanceof ClientPlayerEntity && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2));
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "checkBlockCollision", constant = @Constant(doubleValue = 1.0E-7))
|
||||
public double changeBlockCollisionConstant(double constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
return 0.001;
|
||||
}
|
||||
return constant;
|
||||
@ -166,14 +167,14 @@ 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 (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_19)) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19)) {
|
||||
instance.onLanding();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getPosWithYOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeLogic(float offset, CallbackInfoReturnable<BlockPos> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
final BlockPos blockPos = new BlockPos(MathHelper.floor(this.pos.x), MathHelper.floor(this.pos.y - (double)offset), MathHelper.floor(this.pos.z));
|
||||
|
||||
if (this.world.getBlockState(blockPos).isAir()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
@ -42,12 +43,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) && ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_16_4);
|
||||
return instance.containsKey(o) && ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_16_4tor1_16_5);
|
||||
}
|
||||
|
||||
@Inject(method = "size", at = @At("HEAD"), cancellable = true)
|
||||
private void returnRealSize(CallbackInfoReturnable<Integer> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
cir.setReturnValue(this.idToEntity.size());
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -31,7 +32,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return false;
|
||||
}
|
||||
return player.isMainPlayer();
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
@ -30,7 +31,7 @@ public class MixinItemEntity {
|
||||
|
||||
@Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true)
|
||||
public void injectApplyWaterBuoyancy(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.ExperimentalSettings;
|
||||
@ -52,7 +53,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_9_3) && stack.isOf(Items.SHIELD)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_9_3tor1_9_4) && stack.isOf(Items.SHIELD)) {
|
||||
cir.setReturnValue(EquipmentSlot.MAINHAND);
|
||||
}
|
||||
}
|
||||
@ -62,7 +63,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -73,7 +74,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@ModifyVariable(method = "applyFluidMovingSpeed", ordinal = 0, at = @At("HEAD"), argsOnly = true)
|
||||
private boolean modifyMovingDown(boolean movingDown) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -93,12 +94,12 @@ 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 boolean dontResetLevitationFallDistance(LivingEntity instance) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_12_2);
|
||||
return ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_12_2);
|
||||
}
|
||||
|
||||
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSprinting()Z", ordinal = 0))
|
||||
private boolean modifySwimSprintSpeed(LivingEntity self) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
return false;
|
||||
}
|
||||
return self.isSprinting();
|
||||
@ -106,7 +107,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 (ExperimentalSettings.INSTANCE.waterMovementEdgeDetection.getValue() && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && tagKey == FluidTags.WATER) {
|
||||
if (ExperimentalSettings.INSTANCE.waterMovementEdgeDetection.getValue() && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2) && tagKey == FluidTags.WATER) {
|
||||
if (instance.getFluidHeight(tagKey) > 0) {
|
||||
return 1;
|
||||
}
|
||||
@ -116,14 +117,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2) && !hasNoGravity()) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return 0.005D;
|
||||
}
|
||||
return constant;
|
||||
@ -131,14 +132,14 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@Inject(method = "canEnterTrapdoor", at = @At("HEAD"), cancellable = true)
|
||||
private void onCanEnterTrapdoor(CallbackInfoReturnable<Boolean> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
ci.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.9F))
|
||||
private float changeEntitySpeed(float constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
//noinspection ConstantConditions
|
||||
if ((Entity) this instanceof SkeletonHorseEntity) {
|
||||
return this.getBaseMovementSpeedMultiplier(); // 0.96F
|
||||
@ -150,7 +151,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_18_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2)) {
|
||||
return MathHelper.cos((float) a);
|
||||
}
|
||||
return Math.cos(a);
|
||||
@ -160,7 +161,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
public double fixLavaMovement(LivingEntity instance, TagKey<Fluid> tagKey) {
|
||||
double height = instance.getFluidHeight(tagKey);
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
|
||||
height += getSwimHeight() + 4;
|
||||
}
|
||||
return height;
|
||||
@ -168,7 +169,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
|
||||
@ModifyConstant(method = "isBlocking", constant = @Constant(intValue = 5))
|
||||
public int shieldBlockCounter(int constant) {
|
||||
if(ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if(ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return 0;
|
||||
}
|
||||
return constant;
|
||||
@ -176,7 +177,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
return false;
|
||||
}
|
||||
return instance.isClient();
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
@ -37,7 +38,7 @@ public class MixinOtherClientPlayerEntity extends AbstractClientPlayerEntity {
|
||||
|
||||
@Inject(method = "updatePose", at = @At("HEAD"))
|
||||
public void injectUpdatePose(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
super.updatePose();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
@ -35,7 +36,7 @@ public abstract class MixinPiglinEntity {
|
||||
|
||||
@Inject(method = "getActiveEyeHeight", at = @At("HEAD"), cancellable = true)
|
||||
public void changeEyeHeight(EntityPose pose, EntityDimensions dimensions, CallbackInfoReturnable<Float> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(this.isBaby() ? 0.93F : 1.74F);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
@ -59,7 +60,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Inject(method = "updatePose", at = @At("HEAD"), cancellable = true)
|
||||
private void onUpdatePose(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
EntityPose pose;
|
||||
|
||||
if (isFallFlying())
|
||||
@ -83,9 +84,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
ci.setReturnValue(PlayerEntity.STANDING_DIMENSIONS);
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2) || ProtocolHack.getTargetVersion().isEqualTo(BedrockProtocolVersion.bedrockLatest)) {
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2) || ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
ci.setReturnValue(viafabricplus_sneaking_dimensions_v1_13_2);
|
||||
}
|
||||
}
|
||||
@ -93,7 +94,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Inject(method = "getAttackCooldownProgress", at = @At("HEAD"), cancellable = true)
|
||||
private void injectGetAttackCooldownProgress(CallbackInfoReturnable<Float> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
ci.setReturnValue(1f);
|
||||
}
|
||||
}
|
||||
@ -107,7 +108,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f))
|
||||
private float modifySneakEyeHeight(float prevEyeHeight) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThan(VersionEnum.r1_13_2)) {
|
||||
return prevEyeHeight;
|
||||
} else {
|
||||
return 1.54f;
|
||||
@ -124,7 +125,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Redirect(method = "getOffGroundSpeed", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSprinting()Z"))
|
||||
public boolean useOldField(PlayerEntity instance) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
return viafabricplus_isSprinting;
|
||||
}
|
||||
return instance.isSprinting();
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.passive.SquidEntity;
|
||||
@ -31,7 +32,7 @@ public class MixinSquidEntity {
|
||||
|
||||
@Inject(method = "canBeLeashedBy", at = @At("HEAD"), cancellable = true)
|
||||
public void injectCanBeLeashedBy(PlayerEntity player, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.EntityType;
|
||||
@ -37,7 +38,7 @@ public class MixinVexEntity extends HostileEntity {
|
||||
|
||||
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(0.0);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.definition.v1_14_4.Meta18Storage;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
@ -35,7 +36,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) {
|
||||
final UserConnection userConnection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get();
|
||||
if (!userConnection.has(Meta18Storage.class)) userConnection.put(new Meta18Storage(userConnection));
|
||||
return userConnection.get(Meta18Storage.class).getHealthDataMap().getOrDefault(instance.getId(), health);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.input;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IMinecraftClient;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.DebugSettings;
|
||||
@ -43,7 +44,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 (ProtocolHack.getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_8)) {
|
||||
return false;
|
||||
}
|
||||
return instance.sendCommand(command);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.input;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -31,9 +32,9 @@ public class MixinKeyboardInput extends Input {
|
||||
|
||||
@ModifyVariable(method = "tick", at = @At(value = "LOAD", ordinal = 0), argsOnly = true)
|
||||
private boolean injectTick(boolean slowDown) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return this.sneaking;
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) {
|
||||
return !MinecraftClient.getInstance().player.isSpectator() && (this.sneaking || slowDown);
|
||||
}
|
||||
return slowDown;
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
@ -43,7 +44,7 @@ public class MixinArmorItem extends Item {
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
public void implementLegacyAction(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
ItemStack itemStack = user.getStackInHand(hand);
|
||||
EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(itemStack);
|
||||
ItemStack itemStack2 = user.getEquippedStack(equipmentSlot);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.item.AxeItem;
|
||||
@ -32,7 +33,7 @@ public class MixinAxeItem {
|
||||
|
||||
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
|
||||
public void injectUseOnBlock(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(ActionResult.PASS);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -45,7 +46,7 @@ public class MixinBlockItem {
|
||||
|
||||
@Inject(method = "canPlace", at = @At("HEAD"), cancellable = true)
|
||||
private void injectCanPlace(ItemPlacementContext context, BlockState state, CallbackInfoReturnable<Boolean> ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
Block block = state.getBlock();
|
||||
if (block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) {
|
||||
World world = context.getWorld();
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
@ -43,7 +44,7 @@ public class MixinElytraItem extends Item {
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
public void implementLegacyAction(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
ItemStack itemStack = user.getStackInHand(hand);
|
||||
EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(itemStack);
|
||||
ItemStack itemStack2 = user.getEquippedStack(equipmentSlot);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -35,7 +36,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8) && user.getAbilities().creativeMode) {
|
||||
ci.setReturnValue(TypedActionResult.pass(user.getStackInHand(hand)));
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -30,7 +31,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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_11)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_11)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -53,7 +54,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/ModelTransformationMode;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 (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_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));
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
@ -60,7 +61,7 @@ public abstract class MixinHoeItem extends MiningToolItem {
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -69,10 +70,10 @@ public abstract class MixinHoeItem extends MiningToolItem {
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
|
||||
return 1.0F;
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_16_4tor1_16_5)) {
|
||||
return viafabricplus_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
}
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user