mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-15 10:45:35 +01:00
backported latest version to 1.19.3
This commit is contained in:
parent
1ac8d9fb18
commit
4c56bcf4e4
246
README.md
246
README.md
@ -1,245 +1 @@
|
|||||||
<div align="center">
|
This is a backport of the actual mod to Minecraft version 1.19.4, this backport no longer gets updates and is not supported, for more information please switch to the main branch
|
||||||
<img src="https://raw.githubusercontent.com/FlorianMichael/ViaFabricPlus/main/src/main/resources/assets/viafabricplus/icon.png" width="150">
|
|
||||||
<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://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>
|
|
||||||
|
|
||||||
#### Clientside ViaVersion, ViaLegacy, ViaBedrock and ViaAprilFools implementation with clientside fixes for Fabric
|
|
||||||
This project has nothing to do with the original ViaFabric and is therefore also not compact
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Why?
|
|
||||||
ViaFabricPlus is supposed to be an alternative to [multiconnect](https://github.com/Earthcomputer/multiconnect) that offers more compactness and more clientside improvements,
|
|
||||||
as ViaFabricPlus implements all Via platforms (ViaVersion, ViaBackwards, ViaLegacy, ViaAprilFools, ViaBedrock) and adds tons of clientside fixes and QoL improvements like old rendering for all platforms.
|
|
||||||
|
|
||||||
## Issues and Contributions
|
|
||||||
If you encounter any issues, please report them on the
|
|
||||||
[issue tracker](https://github.com/FlorianMichael/ViaFabricPlus/issues).
|
|
||||||
Contributions in the form of pull requests are always welcome, please just stick to my code style and make sure your code is easy to update and compatible with other mods.
|
|
||||||
|
|
||||||
## Translations
|
|
||||||
Translations for other languages are always welcome, in ~/resources/assets/viafabricplus/lang you can find all translations,
|
|
||||||
if you know a language well, feel free to make a PR and add translations for that language <br>
|
|
||||||
|
|
||||||
**Currently supported languages**:
|
|
||||||
- English
|
|
||||||
|
|
||||||
## Compatibility
|
|
||||||
ViaFabricPlus is structured to interfere with mods as little as possible.
|
|
||||||
It should work fine with most if not all mods and modpacks.
|
|
||||||
|
|
||||||
### Known incompatibilities:
|
|
||||||
- ***[ViaFabric](https://github.com/ViaVersion/ViaFabric)***
|
|
||||||
- ***[multiconnect](https://github.com/Earthcomputer/multiconnect)***
|
|
||||||
- ***[Krypton](https://github.com/astei/krypton)***
|
|
||||||
- ***[Raknetify](https://github.com/RelativityMC/raknetify/tree/master)***
|
|
||||||
|
|
||||||
## Basic Features
|
|
||||||
- [x] ViaVersion implementation
|
|
||||||
- [x] ViaBackwards implementation
|
|
||||||
- [x] ViaLegacy implementation
|
|
||||||
- [x] ViaAprilFools implementation
|
|
||||||
- [x] ViaBedrock implementation
|
|
||||||
- [x] BetaCraft implementation for MP Pass
|
|
||||||
|
|
||||||
## Clientside related Fixes
|
|
||||||
- [x] Bounding boxes for all versions
|
|
||||||
- [x] Entity interaction and movement related packet fixes
|
|
||||||
- [x] Sync and async mouse/keyboard handling in <= 1.12.2
|
|
||||||
- [x] Mining speeds and item attributes
|
|
||||||
- [x] Filter item creative tabs for only available items
|
|
||||||
- [x] Combat system in <= 1.8
|
|
||||||
- [x] Tons of modifications to ViaVersion to make it more legit (Metadata fixes, broken packets, edge-cases)
|
|
||||||
- [x] Visual and screen related changes (newer Command Block features, GameMode selection, ...)
|
|
||||||
- [x] ViaAprilFools and ViaLegacy extensions to make it more legit
|
|
||||||
- [x] Chat signatures (secure login) for all versions (1.19.0, 1.19.1, 1.19.2)
|
|
||||||
- [x] Address parsing for all minecraft versions
|
|
||||||
- [x] PackFormats and HTTP Header for all resource pack versions
|
|
||||||
- [x] Raytrace related fixes in <= 1.8
|
|
||||||
- [x] Implementing HUD changes for <= b1.7.3
|
|
||||||
- [x] Chat lengths of all versions
|
|
||||||
- [x] Implementing non-sequenced block placement in <= 1.18.2
|
|
||||||
- [x] Animation related fixes (1.7 Sneaking, c0.30 walking animation, ...)
|
|
||||||
- [x] Fixed clientside packet handling (1.16.5 transactions, 1.19.0 tablist, ...)
|
|
||||||
|
|
||||||
## TODO
|
|
||||||
- [ ] ClassiCube implementation for MP Pass
|
|
||||||
- [ ] BetaCraft server list screen
|
|
||||||
- [ ] More extensions for Classic Protocol Extensions protocol
|
|
||||||
- [ ] Window click interactions in <= 1.16.5
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
| Dependency | Download |
|
|
||||||
|------------------------|------------------------------------------------------------|
|
|
||||||
| Fabric API | https://github.com/fabricMC/fabric |
|
|
||||||
| ViaVersion | https://github.com/ViaVersion/ViaVersion |
|
|
||||||
| ViaBackwards | https://github.com/ViaVersion/ViaBackwards |
|
|
||||||
| Snake YAML | https://mvnrepository.com/artifact/org.yaml/snakeyaml/1.33 |
|
|
||||||
| ViaLegacy | https://github.com/RaphiMC/ViaLegacy |
|
|
||||||
| ViaAprilFools | https://github.com/RaphiMC/ViaAprilFools |
|
|
||||||
| ViaBedrock | https://github.com/RaphiMC/ViaBedrock |
|
|
||||||
| MC-Structs | https://github.com/Lenni0451/MCStructs |
|
|
||||||
| Reflect | https://github.com/Lenni0451/Reflect |
|
|
||||||
| ViaLoadingBase | https://github.com/FlorianMichael/ViaLoadingBase |
|
|
||||||
| Netty-transport-RakNet | https://github.com/CloudburstMC/Network/tree/develop |
|
|
||||||
|
|
||||||
## Setting up a Workspace
|
|
||||||
ViaFabricPlus uses Gradle, to make sure that it is installed properly you can check [Gradle's website](https://gradle.org/install/).
|
|
||||||
1. Clone the repository using `git clone https://github.com/FlorianMichael/ViaFabricPlus`.
|
|
||||||
2. CD into the local repository.
|
|
||||||
3. Run `./gradlew genSources`.
|
|
||||||
4. Open the folder as a Gradle project in your preferred IDE.
|
|
||||||
5. Run the mod.
|
|
||||||
|
|
||||||
## Settings and GUI
|
|
||||||
In the multiplayer screen you will find the ViaFabricPlus button in the upper left corner by default, it is the main button, <br>
|
|
||||||
click on it, and you will see the Protocol selection, there you can choose the Minecraft version you want to connect to, <br>
|
|
||||||
in the upper left corner you can go to the Settings.
|
|
||||||
|
|
||||||
![](/.github/images/multiplayer.png)
|
|
||||||
![](/.github/images/protocol.png)
|
|
||||||
|
|
||||||
### Settings are optional settings that can turn fixes on and off, originally they were used for debugging<br>
|
|
||||||
![](/.github/images/settings.png)
|
|
||||||
|
|
||||||
## Bedrock edition
|
|
||||||
Keep in mind that the Java -> Bedrock support is still in beta phase, and therefore many things are not implemented <br>
|
|
||||||
yet and there is no guarantee that everything will work as it should.
|
|
||||||
|
|
||||||
![](/.github/images/bedrock.png)
|
|
||||||
|
|
||||||
To log in to a Bedrock account you can press the button **"Click to set account for Bedrock edition"** in the settings, <br>
|
|
||||||
then you can log in via device login, the account logged in there will be stored in **~/ViaFabricPlus/bedrock.account**.
|
|
||||||
|
|
||||||
## Classic stuff
|
|
||||||
### Custom protocol extensions
|
|
||||||
ViaFabricPlus implements new Classic Extensions into the CPE protocol of ViaLegacy which are rather client side. <br>
|
|
||||||
- **WeatherType** extension (version **1**)
|
|
||||||
|
|
||||||
### Protocol commands
|
|
||||||
To better control the Classic Protocol, there are a few clientside commands, the command prefix is **/v**: <br>
|
|
||||||
- **/vhelp** - Displays all commands, available from: **c0.28-c0.30**
|
|
||||||
- **/vsettime <Time (Long)>** - Changes the Clientside World Time, available from: **c0.28-c0.30**
|
|
||||||
- **/vlistextensions** - Displays all classic protocol extensions, available in: **c0.30 CPE**
|
|
||||||
|
|
||||||
## Addons
|
|
||||||
There is no real addon base, to create addons you can simply use the event system, which uses Fabric's Event-API.
|
|
||||||
```java
|
|
||||||
public class ViaFabricPlusExampleAddon implements ClientModInitializer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient() {
|
|
||||||
ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
|
|
||||||
System.out.println("Version changed to " + protocolVersion.getName());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
#### ViaFabricPlus has 7 events at the moment:
|
|
||||||
| Callback class name | Description |
|
|
||||||
|--------------------------------------|--------------------------------------------------------------------------------------------|
|
|
||||||
| ChangeProtocolVersionCallback | Called when the user changes the target version in the screen |
|
|
||||||
| FinishMinecraftLoadCallback | Called when Minecraft is finished with loading all its components |
|
|
||||||
| FinishViaLoadingBaseStartupCallback | Called when ViaLoadingBase and Via* 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) |
|
|
||||||
| SkipIdlePacketCallback | Called as soon as the idle packet is skipped in the <= 1.8 |
|
|
||||||
|
|
||||||
### General API
|
|
||||||
#### Get the release version of an 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
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
// https://github.com/FlorianMichael/ViaLoadingBase
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Creating own settings for the settings screen:
|
|
||||||
```java
|
|
||||||
public class ExampleSettingGroup extends SettingGroup {
|
|
||||||
public final static ExampleSettingGroup INSTANCE = new ExampleSettingGroup();
|
|
||||||
|
|
||||||
public final BooleanSetting test = new BooleanSetting("Test", false);
|
|
||||||
|
|
||||||
public ExampleSettingGroup() {
|
|
||||||
super("Example");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
and then you register the setting group in your onLoad method:
|
|
||||||
```java
|
|
||||||
PreLoadCallback.EVENT.register(() -> {
|
|
||||||
ViaFabricPlus.INSTANCE.getSettingsSystem().addGroup(ExampleSettingGroup.INSTANCE);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Implementing classic protocol commands:
|
|
||||||
```java
|
|
||||||
public class ExampleCommand implements ICommand {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String name() {
|
|
||||||
return "example";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String description() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(String[] args) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
and then you register the command in your onLoad method:
|
|
||||||
```java
|
|
||||||
PreLoadCallback.EVENT.register(() -> {
|
|
||||||
ClassicProtocolCommands.commands.add(new ExampleCommand());
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Implementing custom classic protocol extensions:
|
|
||||||
```java
|
|
||||||
public class ExampleExtensionSupport implements ClientModInitializer {
|
|
||||||
|
|
||||||
public static ClientboundPacketsc0_30cpe EXT_CLICK_DISTANCE;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient() {
|
|
||||||
PreLoadCallback.EVENT.register(() -> {
|
|
||||||
CustomClassicProtocolExtensions.allowExtension(ClassicProtocolExtension.CLICK_DISTANCE); // Register extension as supported
|
|
||||||
|
|
||||||
EXT_CLICK_DISTANCE = CustomClassicProtocolExtensions.createNewPacket(ClassicProtocolExtension.CLICK_DISTANCE, 0x12, (user, buf) -> buf.readShort());
|
|
||||||
});
|
|
||||||
|
|
||||||
FinishViaLoadingBaseStartupCallback.EVENT.register(() -> {
|
|
||||||
Via.getManager().getProtocolManager().getProtocol(Protocolc0_30toc0_30cpe.class).registerClientbound(EXT_CLICK_DISTANCE, null, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
protected void register() {
|
|
||||||
handler(wrapper -> {
|
|
||||||
wrapper.cancel();
|
|
||||||
final short distance = wrapper.read(Type.SHORT);
|
|
||||||
// Do your stuff...
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Alternatives
|
|
||||||
- [ClientViaVersion](https://github.com/Gerrygames/ClientViaVersion): Discontinued 5zig plugin.
|
|
||||||
- [multiconnect](https://www.curseforge.com/minecraft/mc-mods/multiconnect): Fabric mod for connecting to older
|
|
||||||
versions: down to 1.11 (stable) and 1.8 (experimental).
|
|
||||||
- [ViaFabric](https://www.curseforge.com/minecraft/mc-mods/viafabric): Client-side and server-side ViaVersion implementation for Fabric
|
|
||||||
|
|
||||||
## ⚠️ WARNING ⚠️
|
|
||||||
**I cannot guarantee that this mod is allowed on every (or even any) server. This mod may cause problems with anti cheat
|
|
||||||
plugins. USE AT OWN RISK**
|
|
@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx8G
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# minecraft and fabric
|
# minecraft and fabric
|
||||||
minecraft_version=1.19.4
|
minecraft_version=1.19.3
|
||||||
yarn_mappings=1.19.4+build.1
|
yarn_mappings=1.19.3+build.5
|
||||||
loader_version=0.14.17
|
loader_version=0.14.14
|
||||||
fabric_api_version=0.76.0+1.19.4
|
fabric_api_version=0.74.0+1.19.3
|
||||||
|
|
||||||
# viafabricplus
|
# viafabricplus
|
||||||
mod_version=2.2.0
|
mod_version=2.2.0
|
||||||
@ -33,4 +33,4 @@ mcstructs_text_version=2.2.0
|
|||||||
reflect_version=1.1.0
|
reflect_version=1.1.0
|
||||||
|
|
||||||
# other mods
|
# other mods
|
||||||
mod_menu_version=6.1.0-rc.1
|
mod_menu_version=5.0.2
|
||||||
|
@ -60,49 +60,6 @@ public class ItemReleaseVersionDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
register(Items.CHERRY_PLANKS, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_SAPLING, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.SUSPICIOUS_SAND, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_LOG, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.STRIPPED_CHERRY_LOG, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.STRIPPED_CHERRY_WOOD, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_WOOD, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_LEAVES, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.TORCHFLOWER, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.PINK_PETALS, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_SLAB, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.DECORATED_POT, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_FENCE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_STAIRS, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_BUTTON, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_PRESSURE_PLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_DOOR, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_TRAPDOOR, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_FENCE_GATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_BOAT, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_CHEST_BOAT, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_SIGN, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.CHERRY_HANGING_SIGN, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.SNIFFER_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.TORCHFLOWER_SEEDS, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.BRUSH, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.POTTERY_SHARD_ARCHER, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.POTTERY_SHARD_PRIZE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.POTTERY_SHARD_ARMS_UP, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.POTTERY_SHARD_SKULL, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
register(Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
|
|
||||||
|
|
||||||
register(Items.IRON_GOLEM_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_3));
|
register(Items.IRON_GOLEM_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_3));
|
||||||
register(Items.SNOW_GOLEM_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_3));
|
register(Items.SNOW_GOLEM_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_3));
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package de.florianmichael.viafabricplus.definition;
|
package de.florianmichael.viafabricplus.definition;
|
||||||
|
|
||||||
|
import com.mojang.bridge.game.PackType;
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||||
import net.minecraft.GameVersion;
|
import net.minecraft.GameVersion;
|
||||||
import net.minecraft.SaveVersion;
|
import net.minecraft.SaveVersion;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.resource.ResourceType;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -32,7 +32,6 @@ public class PackFormatsDefinition {
|
|||||||
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
registerVersion(ProtocolVersion.v1_19_4, 13, "1.19.4");
|
|
||||||
registerVersion(ProtocolVersion.v1_19_3, 12, "1.19.3");
|
registerVersion(ProtocolVersion.v1_19_3, 12, "1.19.3");
|
||||||
registerVersion(ProtocolVersion.v1_19_1, 9, "1.19.2");
|
registerVersion(ProtocolVersion.v1_19_1, 9, "1.19.2");
|
||||||
registerVersion(ProtocolVersion.v1_19, 9, "1.19");
|
registerVersion(ProtocolVersion.v1_19, 9, "1.19");
|
||||||
@ -79,7 +78,7 @@ public class PackFormatsDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final GameVersion gameVersion = protocolMap.get(nativeVersion);
|
final GameVersion gameVersion = protocolMap.get(nativeVersion);
|
||||||
if (!gameVersion.getName().equals(SharedConstants.getGameVersion().getName()) || !gameVersion.getId().equals(SharedConstants.getGameVersion().getId()) || gameVersion.getResourceVersion(ResourceType.CLIENT_RESOURCES) != SharedConstants.getGameVersion().getResourceVersion(ResourceType.CLIENT_RESOURCES)) {
|
if (!gameVersion.getName().equals(SharedConstants.getGameVersion().getName()) || !gameVersion.getId().equals(SharedConstants.getGameVersion().getId()) || gameVersion.getPackVersion(PackType.RESOURCE) != SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)) {
|
||||||
throw new RuntimeException("The current version has no pack format registered");
|
throw new RuntimeException("The current version has no pack format registered");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,8 +116,8 @@ public class PackFormatsDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getResourceVersion(ResourceType type) {
|
public int getPackVersion(PackType packType) {
|
||||||
if (type == ResourceType.CLIENT_RESOURCES) {
|
if (packType == PackType.RESOURCE) {
|
||||||
return packFormat;
|
return packFormat;
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -162,7 +162,7 @@ public class ClassicItemSelectionScreen extends Screen {
|
|||||||
final int renderY = halfHeight - boxHeight / 2;
|
final int renderY = halfHeight - boxHeight / 2;
|
||||||
|
|
||||||
fill(matrices, renderX, renderY, renderX + boxWidth, renderY + boxHeight, Integer.MIN_VALUE);
|
fill(matrices, renderX, renderY, renderX + boxWidth, renderY + boxHeight, Integer.MIN_VALUE);
|
||||||
drawCenteredTextWithShadow(matrices, textRenderer, "Select block", renderX + boxWidth / 2, renderY + SIDE_OFFSET, -1);
|
drawCenteredText(matrices, textRenderer, "Select block", renderX + boxWidth / 2, renderY + SIDE_OFFSET, -1);
|
||||||
selectedItem = null;
|
selectedItem = null;
|
||||||
|
|
||||||
int y = SIDE_OFFSET + SIDE_OFFSET;
|
int y = SIDE_OFFSET + SIDE_OFFSET;
|
||||||
@ -175,7 +175,7 @@ public class ClassicItemSelectionScreen extends Screen {
|
|||||||
fill(matrices, renderX + x, renderY + y, renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC, renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC, Integer.MAX_VALUE);
|
fill(matrices, renderX + x, renderY + y, renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC, renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC, Integer.MAX_VALUE);
|
||||||
selectedItem = item.getDefaultStack();
|
selectedItem = item.getDefaultStack();
|
||||||
}
|
}
|
||||||
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(matrices, item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
|
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
|
||||||
x += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
x += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
||||||
}
|
}
|
||||||
y += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
y += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
||||||
|
@ -35,7 +35,7 @@ public class ClassicProgressRenderer extends DrawableHelper {
|
|||||||
if (classicProgressStorage == null) return;
|
if (classicProgressStorage == null) return;
|
||||||
|
|
||||||
final Window window = MinecraftClient.getInstance().getWindow();
|
final Window window = MinecraftClient.getInstance().getWindow();
|
||||||
drawCenteredTextWithShadow(
|
drawCenteredText(
|
||||||
matrices,
|
matrices,
|
||||||
MinecraftClient.getInstance().textRenderer,
|
MinecraftClient.getInstance().textRenderer,
|
||||||
"[ViaFabricPlus] " + classicProgressStorage.status,
|
"[ViaFabricPlus] " + classicProgressStorage.status,
|
||||||
|
@ -30,9 +30,9 @@ import io.netty.channel.epoll.EpollDatagramChannel;
|
|||||||
import io.netty.channel.epoll.EpollSocketChannel;
|
import io.netty.channel.epoll.EpollSocketChannel;
|
||||||
import io.netty.channel.socket.nio.NioDatagramChannel;
|
import io.netty.channel.socket.nio.NioDatagramChannel;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.encryption.PacketDecryptor;
|
import net.minecraft.network.encryption.PacketDecryptor;
|
||||||
import net.minecraft.network.encryption.PacketEncryptor;
|
import net.minecraft.network.encryption.PacketEncryptor;
|
||||||
import net.minecraft.network.packet.Packet;
|
|
||||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||||
import net.raphimc.viabedrock.netty.AesGcmEncryption;
|
import net.raphimc.viabedrock.netty.AesGcmEncryption;
|
||||||
import net.raphimc.viabedrock.netty.SnappyCompression;
|
import net.raphimc.viabedrock.netty.SnappyCompression;
|
||||||
|
@ -27,7 +27,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(Main.class)
|
@Mixin(Main.class)
|
||||||
public class MixinMain {
|
public class MixinMain {
|
||||||
|
|
||||||
@Inject(method = "main", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/crash/CrashReport;initCrashReport()V"))
|
@Inject(method = "main([Ljava/lang/String;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/crash/CrashReport;initCrashReport()V"))
|
||||||
private static void preLoad(CallbackInfo ci) {
|
private static void preLoad(CallbackInfo ci) {
|
||||||
ViaFabricPlus.INSTANCE.init();
|
ViaFabricPlus.INSTANCE.init();
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public abstract class MixinOptionsScreen extends Screen {
|
|||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/ClickableWidget;)Lnet/minecraft/client/gui/widget/ClickableWidget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
public void addValuesButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
public void addValuesButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
||||||
if (BridgeSettings.INSTANCE.showSuperSecretSettings.getValue() && MinecraftClient.getInstance().player != null) {
|
if (BridgeSettings.INSTANCE.showSuperSecretSettings.getValue() && MinecraftClient.getInstance().player != null) {
|
||||||
this.addDrawableChild(ButtonWidget.builder(Text.literal("Super Secret Settings..."), button -> MinecraftClient.getInstance().gameRenderer.cycleSuperSecretSetting()).dimensions(this.width / 2 + 5, this.height / 6 + 18, 150, 20).build());
|
this.addDrawableChild(ButtonWidget.builder(Text.literal("Super Secret Settings..."), button -> MinecraftClient.getInstance().gameRenderer.cycleSuperSecretSetting()).dimensions(this.width / 2 + 5, this.height / 6 + 18, 150, 20).build());
|
||||||
|
@ -74,7 +74,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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)
|
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||||
private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) {
|
private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) {
|
||||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,7 +35,7 @@ import net.minecraft.client.network.ClientPlayerInteractionManager;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.network.packet.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket;
|
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket;
|
||||||
import net.minecraft.screen.slot.SlotActionType;
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
@ -97,7 +97,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
|||||||
return type == SlotActionType.PICKUP && slot == -999;
|
return type == SlotActionType.PICKUP && slot == -999;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V"))
|
@Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V"))
|
||||||
private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
|
private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
|
||||||
try {
|
try {
|
||||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
||||||
@ -133,7 +133,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
|||||||
instance.sendPacket(packet);
|
instance.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0),
|
@Redirect(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0),
|
||||||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"),
|
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"),
|
||||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0)))
|
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0)))
|
||||||
private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet<?> packet) {
|
private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet<?> packet) {
|
||||||
@ -142,7 +142,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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))
|
@Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0, shift = At.Shift.BEFORE))
|
||||||
public void injectInteractItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
public void injectInteractItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||||
ViaFabricPlusHandItemProvider.lastUsedItem = player.getStackInHand(hand).copy();
|
ViaFabricPlusHandItemProvider.lastUsedItem = player.getStackInHand(hand).copy();
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public abstract class MixinEntity {
|
|||||||
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
|
||||||
public void injectGetVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) {
|
public void injectGetVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) {
|
||||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||||
cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - 1, pos.z));
|
cir.setReturnValue(new BlockPos(pos.x, getBoundingBox().minY - 1, pos.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class MixinHeldItemRenderer {
|
|||||||
|
|
||||||
@Inject(method = "renderFirstPersonItem",
|
@Inject(method = "renderFirstPersonItem",
|
||||||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/util/UseAction;")),
|
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/util/UseAction;")),
|
||||||
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"))
|
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"))
|
||||||
private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
||||||
//noinspection DataFlowIssue
|
//noinspection DataFlowIssue
|
||||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) {
|
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,42 +20,32 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
|||||||
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
|
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
|
||||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||||
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
|
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
|
||||||
import net.minecraft.item.ItemGroup;
|
|
||||||
import net.minecraft.item.ItemGroups;
|
import net.minecraft.item.ItemGroups;
|
||||||
import net.minecraft.registry.RegistryWrapper;
|
|
||||||
import net.minecraft.resource.featuretoggle.FeatureSet;
|
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(ItemGroups.class)
|
@Mixin(ItemGroups.class)
|
||||||
public abstract class MixinItemGroups {
|
public class MixinItemGroups {
|
||||||
|
|
||||||
@Shadow @Nullable private static ItemGroup.@Nullable DisplayContext displayContext;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
protected static void updateEntries(ItemGroup.DisplayContext displayContext) {
|
|
||||||
}
|
|
||||||
@Unique
|
@Unique
|
||||||
private static ComparableProtocolVersion viafabricplus_version;
|
private static ComparableProtocolVersion viafabricplus_version;
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
private static boolean viafabricplus_state;
|
private static boolean viafabricplus_state;
|
||||||
|
|
||||||
@Inject(method = "updateDisplayContext", at = @At("HEAD"), cancellable = true)
|
@Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z"))
|
||||||
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, RegistryWrapper.WrapperLookup lookup, CallbackInfoReturnable<Boolean> cir) {
|
private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) {
|
||||||
if (viafabricplus_version != ViaLoadingBase.getClassWrapper().getTargetVersion() || viafabricplus_state != GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue()) {
|
return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE))
|
||||||
|
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable<Boolean> cir) {
|
||||||
viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion();
|
viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion();
|
||||||
viafabricplus_state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
viafabricplus_state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||||
|
|
||||||
displayContext = new ItemGroup.DisplayContext(enabledFeatures, operatorEnabled, lookup);
|
|
||||||
updateEntries(displayContext);
|
|
||||||
|
|
||||||
cir.setReturnValue(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class MixinConnectScreen_1 {
|
|||||||
return instance.getPort();
|
return instance.getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1, shift = At.Shift.BEFORE))
|
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/Packet;)V", ordinal = 1, shift = At.Shift.BEFORE))
|
||||||
public void setupConnectionSessions(CallbackInfo ci) {
|
public void setupConnectionSessions(CallbackInfo ci) {
|
||||||
final ClientConnection connection = field_2416.connection;
|
final ClientConnection connection = field_2416.connection;
|
||||||
if (connection == null || connection.channel == null) return;
|
if (connection == null || connection.channel == null) return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -39,7 +39,7 @@ public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "<init>",
|
@Redirect(method = "<init>",
|
||||||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$2;<init>(Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;IIILnet/minecraft/entity/player/PlayerEntity;)V")),
|
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler$2;<init>(Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;III)V")),
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;", ordinal = 0))
|
at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/PlayerScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;", ordinal = 0))
|
||||||
private Slot redirectAddOffhandSlot(PlayerScreenHandler screenHandler, Slot slot) {
|
private Slot redirectAddOffhandSlot(PlayerScreenHandler screenHandler, Slot slot) {
|
||||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
|
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8))
|
||||||
|
@ -76,9 +76,9 @@ public class ProtocolSelectionScreen extends Screen {
|
|||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.scale(2F, 2F, 2F);
|
matrices.scale(2F, 2F, 2F);
|
||||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
drawCenteredText(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
drawCenteredText(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -122,7 +122,7 @@ public class ProtocolSelectionScreen extends Screen {
|
|||||||
matrices.translate(x, y - 1, 0);
|
matrices.translate(x, y - 1, 0);
|
||||||
|
|
||||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||||
drawCenteredTextWithShadow(matrices, textRenderer, this.protocolVersion.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isSelected ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
drawCenteredText(matrices, textRenderer, this.protocolVersion.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isSelected ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,9 @@ public class SettingsScreen extends Screen {
|
|||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.scale(2F, 2F, 2F);
|
matrices.scale(2F, 2F, 2F);
|
||||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
drawCenteredText(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
drawCenteredText(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,6 +49,6 @@ public class ButtonSettingRenderer extends AbstractSettingRenderer {
|
|||||||
public void renderSetting(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
public void renderSetting(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||||
|
|
||||||
DrawableHelper.drawCenteredTextWithShadow(matrices, textRenderer, this.value.displayValue(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
DrawableHelper.drawCenteredText(matrices, textRenderer, this.value.displayValue(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user