mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-08 19:38:57 +01:00
Updated Via* (1.20-rc1) and implemented new lines in Bedrock
This commit is contained in:
parent
515e81360e
commit
70a5566d34
3
.github/DEVELOPER_API.md
vendored
3
.github/DEVELOPER_API.md
vendored
@ -27,8 +27,7 @@ public class ViaFabricPlusExampleAddon implements ClientModInitializer {
|
||||
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.
|
||||
// https://github.com/FlorianMichael/ViaLoadingBase
|
||||
// https://github.com/ViaVersion/ViaLoader
|
||||
```
|
||||
|
||||
#### Creating own settings for the settings screen:
|
||||
|
10
README.md
10
README.md
@ -14,7 +14,7 @@
|
||||
# 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-pre7])
|
||||
- Release (1.0.0 - 1.20 [1.20-rc1])
|
||||
- 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))
|
||||
@ -75,12 +75,12 @@ For compiling only! **You do not need to install these!**
|
||||
| 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 |
|
||||
| ViaLegacy | https://github.com/ViaVersion/ViaLegacy |
|
||||
| ViaAprilFools | https://github.com/ViaVersion/ViaAprilFools |
|
||||
| ViaBedrock | https://github.com/ViaVersion/ViaBedrock |
|
||||
| MC-Structs | https://github.com/Lenni0451/MCStructs |
|
||||
| Reflect | https://github.com/Lenni0451/Reflect |
|
||||
| ViaLoadingBase | https://github.com/FlorianMichael/ViaLoadingBase |
|
||||
| ViaLoader | https://github.com/ViaVersion/ViaLoader |
|
||||
| Netty-transport-RakNet | https://github.com/CloudburstMC/Network/tree/develop |
|
||||
| Classic4J | https://github.com/FlorianMichael/Classic4J |
|
||||
</details>
|
||||
|
@ -18,7 +18,7 @@ raknet_transport_version=1.0.0.CR1-SNAPSHOT
|
||||
classic4j_version=1.2.0
|
||||
|
||||
# viaversion (and required) libs
|
||||
viaversion_version=4.7.0-1.20-pre7-SNAPSHOT
|
||||
viaversion_version=4.7.0-1.20-rc1-SNAPSHOT
|
||||
viabackwards_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||
snake_yml_version=2.0
|
||||
|
||||
@ -31,7 +31,7 @@ vialoader_version=2.2.5-SNAPSHOT
|
||||
|
||||
# lenni0451 libs
|
||||
mcstructs_text_version=2.2.5
|
||||
reflect_version=1.1.0
|
||||
reflect_version=1.2.0
|
||||
|
||||
# other libs
|
||||
mod_menu_version=6.1.0-rc.4
|
||||
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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.injection.mixin.fixes.minecraft;
|
||||
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.text.OrderedText;
|
||||
import net.minecraft.text.StringVisitable;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(TextRenderer.class)
|
||||
public abstract class MixinTextRenderer {
|
||||
|
||||
@Shadow public abstract List<OrderedText> wrapLines(StringVisitable text, int width);
|
||||
|
||||
@Shadow public abstract int draw(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light);
|
||||
|
||||
@Shadow public abstract String mirror(String text);
|
||||
|
||||
@Shadow @Final public int fontHeight;
|
||||
|
||||
@Shadow protected abstract int drawInternal(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light);
|
||||
|
||||
@Shadow public abstract int getWidth(OrderedText text);
|
||||
|
||||
@Inject(method = "draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNewLines_String(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean rightToLeft, CallbackInfoReturnable<Integer> cir) {
|
||||
if (ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
final List<OrderedText> lines = wrapLines(StringVisitable.plain(rightToLeft ? this.mirror(text) : text), Integer.MAX_VALUE);
|
||||
if (lines.size() > 1) {
|
||||
int offsetX = 0;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
offsetX = this.drawInternal(lines.get(i), x, y - (lines.size() * (fontHeight + 2)) + (i * (fontHeight + 2)), color, shadow, new Matrix4f(matrix), vertexConsumers, layerType, backgroundColor, light);
|
||||
}
|
||||
cir.setReturnValue(offsetX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "draw(Lnet/minecraft/text/Text;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNewLines_Text(Text text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, CallbackInfoReturnable<Integer> cir) {
|
||||
if (ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
final List<OrderedText> lines = wrapLines(text, Integer.MAX_VALUE);
|
||||
if (lines.size() > 1) {
|
||||
int offsetX = 0;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
offsetX = this.draw(lines.get(i), x, y - (lines.size() * (fontHeight + 2)) + (i * (fontHeight + 2)), color, shadow, new Matrix4f(matrix), vertexConsumers, layerType, backgroundColor, light);
|
||||
}
|
||||
cir.setReturnValue(offsetX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getWidth(Lnet/minecraft/text/StringVisitable;)I", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNewLines_getWidth(StringVisitable text, CallbackInfoReturnable<Integer> cir) {
|
||||
if (MinecraftClient.getInstance().world != null && ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
int i = 0;
|
||||
for (OrderedText wrapLine : this.wrapLines(text, Integer.MAX_VALUE)) {
|
||||
if (getWidth(wrapLine) >= i) i = getWidth(wrapLine);
|
||||
}
|
||||
cir.setReturnValue(MathHelper.ceil(i));
|
||||
}
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ public abstract class MixinProtocolVersion {
|
||||
viafabricplus_remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null));
|
||||
viafabricplus_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null));
|
||||
viafabricplus_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null));
|
||||
viafabricplus_remaps.put("1.20", new Pair<>("1.20-pre7", null));
|
||||
viafabricplus_remaps.put("1.20", new Pair<>("1.20-rc1", null));
|
||||
}
|
||||
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))
|
||||
|
@ -34,6 +34,7 @@
|
||||
"fixes.minecraft.MixinProfileKeysImpl",
|
||||
"fixes.minecraft.MixinServerResourcePackProvider",
|
||||
"fixes.minecraft.MixinStringHelper",
|
||||
"fixes.minecraft.MixinTextRenderer",
|
||||
"fixes.minecraft.block.MixinAbstractBlock",
|
||||
"fixes.minecraft.block.MixinAbstractBlock_AbstractBlockState",
|
||||
"fixes.minecraft.block.MixinAnvilBlock",
|
||||
@ -146,6 +147,7 @@
|
||||
"fixes.viaversion.protocol1_18_2to1_18.MixinProtocol1_18_2To1_18",
|
||||
"fixes.viaversion.protocol1_19_1to1_19.MixinProtocol1_19_1To1_19",
|
||||
"fixes.viaversion.protocol1_19_3to1_19_1.MixinProtocol1_19_3To1_19_1",
|
||||
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinChunk1_8Type",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinCommandBlockProvider",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityPackets_6_1",
|
||||
@ -155,8 +157,7 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"jsonwebtoken.MixinClasses",
|
||||
"jsonwebtoken.MixinDefaultCompressionCodecResolver",
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder",
|
||||
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9"
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user