started with 1.20 port

This commit is contained in:
FlorianMichael 2023-04-27 01:05:41 +02:00
parent 7520103bae
commit ba330ec1a2
14 changed files with 1183 additions and 46 deletions

View File

@ -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=23w17a
yarn_mappings=1.19.4+build.1 yarn_mappings=23w17a+build.2
loader_version=0.14.19 loader_version=0.14.19
fabric_api_version=0.76.0+1.19.4 fabric_api_version=0.79.1+1.20
# viafabricplus # viafabricplus
mod_version=2.6.7 mod_version=2.6.7
@ -34,5 +34,5 @@ mcstructs_text_version=2.2.4
reflect_version=1.1.0 reflect_version=1.1.0
# other libs # other libs
mod_menu_version=6.1.0-rc.4 mod_menu_version=7.0.0-beta.1
netty_codec_http_version=4.1.90.Final netty_codec_http_version=4.1.90.Final

View File

@ -20,14 +20,13 @@ package de.florianmichael.viafabricplus.definition.c0_30;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.Window; import net.minecraft.client.util.Window;
import net.minecraft.client.util.math.MatrixStack;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storage.ClassicProgressStorage; import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.storage.ClassicProgressStorage;
public class ClassicProgressRenderer extends DrawableHelper { public class ClassicProgressRenderer {
public static void renderProgress(final MatrixStack matrices) { public static void renderProgress(final DrawContext context) {
if (MinecraftClient.getInstance().getNetworkHandler() == null) return; if (MinecraftClient.getInstance().getNetworkHandler() == null) return;
final UserConnection connection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get(); final UserConnection connection = MinecraftClient.getInstance().getNetworkHandler().getConnection().channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get();
if (connection == null) return; if (connection == null) return;
@ -35,8 +34,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( context.drawCenteredTextWithShadow(
matrices,
MinecraftClient.getInstance().textRenderer, MinecraftClient.getInstance().textRenderer,
"[ViaFabricPlus] " + classicProgressStorage.status, "[ViaFabricPlus] " + classicProgressStorage.status,
window.getScaledWidth() / 2, window.getScaledWidth() / 2,

View File

@ -0,0 +1,95 @@
/*
* 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.definition.v1_19_4;
import net.minecraft.block.MapColor;
import net.minecraft.block.piston.PistonBehavior;
public enum Material1_19_4 {
AIR(MapColor.CLEAR, PistonBehavior.NORMAL, false, false, false, false, true, false),
STRUCTURE_VOID(MapColor.CLEAR, PistonBehavior.NORMAL, false, false, false, false, true, false),
PORTAL(MapColor.CLEAR, PistonBehavior.BLOCK, false, false, false, false, false, false),
CARPET(MapColor.WHITE_GRAY, PistonBehavior.NORMAL, false, true, false, false, false, false),
PLANT(MapColor.DARK_GREEN, PistonBehavior.DESTROY, false, false, false, false, false, false),
UNDERWATER_PLANT(MapColor.WATER_BLUE, PistonBehavior.DESTROY, false, false, false, false, false, false),
REPLACEABLE_PLANT(MapColor.DARK_GREEN, PistonBehavior.DESTROY, false, true, false, false, true, false),
NETHER_SHOOTS(MapColor.DARK_GREEN, PistonBehavior.DESTROY, false, false, false, false, true, false),
REPLACEABLE_UNDERWATER_PLANT(MapColor.WATER_BLUE, PistonBehavior.DESTROY, false, false, false, false, true, false),
WATER(MapColor.WATER_BLUE, PistonBehavior.DESTROY, false, false, true, false, true, false),
BUBBLE_COLUMN(MapColor.WATER_BLUE, PistonBehavior.DESTROY, false, false, true, false, true, false),
LAVA(MapColor.BRIGHT_RED, PistonBehavior.DESTROY, false, false, true, false, true, false),
SNOW_LAYER(MapColor.WHITE, PistonBehavior.DESTROY, false, false, false, false, true, false),
FIRE(MapColor.CLEAR, PistonBehavior.DESTROY, false, false, false, false, true, false),
DECORATION(MapColor.CLEAR, PistonBehavior.DESTROY, false, false, false, false, false, false),
COBWEB(MapColor.WHITE_GRAY, PistonBehavior.DESTROY, false, false, false, false, false, true),
SCULK(MapColor.BLACK, PistonBehavior.NORMAL, true, false, false, true, false, true),
REDSTONE_LAMP(MapColor.CLEAR, PistonBehavior.NORMAL, true, false, false, true, false, true),
ORGANIC_PRODUCT(MapColor.LIGHT_BLUE_GRAY, PistonBehavior.NORMAL, true, false, false, true, false, true),
SOIL(MapColor.DIRT_BROWN, PistonBehavior.NORMAL, true, false, false, true, false, true),
SOLID_ORGANIC(MapColor.PALE_GREEN, PistonBehavior.NORMAL, true, false, false, true, false, true),
DENSE_ICE(MapColor.PALE_PURPLE, PistonBehavior.NORMAL, true, false, false, true, false, true),
AGGREGATE(MapColor.PALE_YELLOW, PistonBehavior.NORMAL, true, false, false, true, false, true),
SPONGE(MapColor.YELLOW, PistonBehavior.NORMAL, true, false, false, true, false, true),
SHULKER_BOX(MapColor.PURPLE, PistonBehavior.NORMAL, true, false, false, true, false, true),
WOOD(MapColor.OAK_TAN, PistonBehavior.NORMAL, true, true, false, true, false, true),
NETHER_WOOD(MapColor.OAK_TAN, PistonBehavior.NORMAL, true, false, false, true, false, true),
BAMBOO_SAPLING(MapColor.OAK_TAN, PistonBehavior.DESTROY, false, true, false, true, false, true),
BAMBOO(MapColor.OAK_TAN, PistonBehavior.DESTROY, true, true, false, true, false, true),
WOOL(MapColor.WHITE_GRAY, PistonBehavior.NORMAL, true, true, false, true, false, true),
TNT(MapColor.BRIGHT_RED, PistonBehavior.NORMAL, true, true, false, false, false, true),
LEAVES(MapColor.DARK_GREEN, PistonBehavior.DESTROY, true, true, false, false, false, true),
GLASS(MapColor.CLEAR, PistonBehavior.NORMAL, true, false, false, false, false, true),
ICE(MapColor.PALE_PURPLE, PistonBehavior.NORMAL, true, false, false, false, false, true),
CACTUS(MapColor.DARK_GREEN, PistonBehavior.DESTROY, true, false, false, false, false, true),
STONE(MapColor.STONE_GRAY, PistonBehavior.NORMAL, true, false, false, true, false, true),
METAL(MapColor.IRON_GRAY, PistonBehavior.NORMAL, true, false, false, true, false, true),
SNOW_BLOCK(MapColor.WHITE, PistonBehavior.NORMAL, true, false, false, true, false, true),
REPAIR_STATION(MapColor.IRON_GRAY, PistonBehavior.BLOCK, true, false, false, true, false, true),
BARRIER(MapColor.CLEAR, PistonBehavior.BLOCK, true, false, false, true, false, true),
PISTON(MapColor.STONE_GRAY, PistonBehavior.BLOCK, true, false, false, true, false, true),
MOSS_BLOCK(MapColor.DARK_GREEN, PistonBehavior.DESTROY, true, false, false, true, false, true),
GOURD(MapColor.DARK_GREEN, PistonBehavior.DESTROY, true, false, false, true, false, true),
EGG(MapColor.DARK_GREEN, PistonBehavior.DESTROY, true, false, false, true, false, true),
CAKE(MapColor.CLEAR, PistonBehavior.DESTROY, true, false, false, true, false, true),
AMETHYST(MapColor.PURPLE, PistonBehavior.NORMAL, true, false, false, true, false, true),
POWDER_SNOW(MapColor.WHITE, PistonBehavior.NORMAL, false, false, false, true, false, false),
FROGSPAWN(MapColor.WATER_BLUE, PistonBehavior.DESTROY, false, false, false, false, false, false),
FROGLIGHT(MapColor.CLEAR, PistonBehavior.NORMAL, true, false, false, true, false, true),
DECORATED_POT(MapColor.TERRACOTTA_RED, PistonBehavior.DESTROY, true, false, false, true, false, true);
public final MapColor color;
public final PistonBehavior pistonBehavior;
public final boolean blocksMovement;
public final boolean burnable;
public final boolean liquid;
public final boolean blocksLight;
public final boolean replaceable;
public final boolean solid;
Material1_19_4(MapColor color, PistonBehavior pistonBehavior, boolean blocksMovement, boolean burnable, boolean liquid, boolean blocksLight, boolean replaceable, boolean solid) {
this.color = color;
this.pistonBehavior = pistonBehavior;
this.blocksMovement = blocksMovement;
this.burnable = burnable;
this.liquid = liquid;
this.blocksLight = blocksLight;
this.replaceable = replaceable;
this.solid = solid;
}
}

View File

@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer; import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer;
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings; import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ConnectScreen; import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -30,9 +31,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinConnectScreen { public class MixinConnectScreen {
@Inject(method = "render", at = @At("RETURN")) @Inject(method = "render", at = @At("RETURN"))
public void renderClassicProgress(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { public void renderClassicProgress(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (!GeneralSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) return; if (!GeneralSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) return;
ClassicProgressRenderer.renderProgress(matrices); ClassicProgressRenderer.renderProgress(context);
} }
} }

View File

@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base;
import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer; import de.florianmichael.viafabricplus.definition.c0_30.ClassicProgressRenderer;
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings; import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.DownloadingTerrainScreen; import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -30,9 +31,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinDownloadingTerrainScreen { public class MixinDownloadingTerrainScreen {
@Inject(method = "render", at = @At("RETURN")) @Inject(method = "render", at = @At("RETURN"))
public void renderClassicProgress(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { public void renderClassicProgress(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (!GeneralSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) return; if (!GeneralSettings.INSTANCE.showClassicLoadingProgressInConnectScreen.getValue()) return;
ClassicProgressRenderer.renderProgress(matrices); ClassicProgressRenderer.renderProgress(context);
} }
} }

View File

@ -31,6 +31,7 @@ public class MixinProfileKeysImpl {
@Inject(method = "decodeKeyPairResponse", at = @At("RETURN")) @Inject(method = "decodeKeyPairResponse", at = @At("RETURN"))
private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) { private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) {
((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(keyPairResponse.getLegacyPublicKeySignature()); // ((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(keyPairResponse.getLegacyPublicKeySignature());
// TODO | Track Key
} }
} }

View File

@ -55,7 +55,7 @@ public abstract class MixinAbstractDonkeyEntity extends AbstractHorseEntity {
if (!this.isBaby()) { if (!this.isBaby()) {
if (this.isTame() && player.shouldCancelInteraction()) { if (this.isTame() && player.shouldCancelInteraction()) {
this.openInventory(player); this.openInventory(player);
cir.setReturnValue(ActionResult.success(this.world.isClient)); cir.setReturnValue(ActionResult.success(this.getWorld().isClient));
} }
if (this.hasPassengers()) { if (this.hasPassengers()) {
cir.setReturnValue(super.interactMob(player, hand)); cir.setReturnValue(super.interactMob(player, hand));
@ -67,7 +67,7 @@ public abstract class MixinAbstractDonkeyEntity extends AbstractHorseEntity {
} }
if (!this.isTame()) { if (!this.isTame()) {
this.playAngrySound(); this.playAngrySound();
cir.setReturnValue(ActionResult.success(this.world.isClient)); cir.setReturnValue(ActionResult.success(this.getWorld().isClient));
} }
if (!this.hasChest() && lv.isOf(Blocks.CHEST.asItem())) { if (!this.hasChest() && lv.isOf(Blocks.CHEST.asItem())) {
this.setHasChest(true); this.setHasChest(true);
@ -76,18 +76,18 @@ public abstract class MixinAbstractDonkeyEntity extends AbstractHorseEntity {
lv.decrement(1); lv.decrement(1);
} }
this.onChestedStatusChanged(); this.onChestedStatusChanged();
cir.setReturnValue(ActionResult.success(this.world.isClient)); cir.setReturnValue(ActionResult.success(this.getWorld().isClient));
} }
if (!this.isBaby() && !this.isSaddled() && lv.isOf(Items.SADDLE)) { if (!this.isBaby() && !this.isSaddled() && lv.isOf(Items.SADDLE)) {
this.openInventory(player); this.openInventory(player);
cir.setReturnValue(ActionResult.success(this.world.isClient)); cir.setReturnValue(ActionResult.success(this.getWorld().isClient));
} }
} }
if (this.isBaby()) { if (this.isBaby()) {
cir.setReturnValue(super.interactMob(player, hand)); cir.setReturnValue(super.interactMob(player, hand));
} }
this.putPlayerOnBack(player); this.putPlayerOnBack(player);
cir.setReturnValue(ActionResult.success(this.world.isClient)); cir.setReturnValue(ActionResult.success(this.getWorld().isClient));
} }
} }
} }

View File

@ -105,16 +105,16 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
bl4 = g != 0.0 || h != 0.0; bl4 = g != 0.0 || h != 0.0;
if (this.hasVehicle()) { if (this.hasVehicle()) {
Vec3d vec3d = this.getVelocity(); Vec3d vec3d = this.getVelocity();
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(vec3d.x, -999.0, vec3d.z, this.getYaw(), this.getPitch(), this.onGround)); this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(vec3d.x, -999.0, vec3d.z, this.getYaw(), this.getPitch(), this.isOnGround()));
bl3 = false; bl3 = false;
} else if (bl3 && bl4) { } else if (bl3 && bl4) {
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(this.getX(), this.getY(), this.getZ(), this.getYaw(), this.getPitch(), this.onGround)); this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(this.getX(), this.getY(), this.getZ(), this.getYaw(), this.getPitch(), this.isOnGround()));
} else if (bl3) { } else if (bl3) {
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(this.getX(), this.getY(), this.getZ(), this.onGround)); this.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(this.getX(), this.getY(), this.getZ(), this.isOnGround()));
} else if (bl4) { } else if (bl4) {
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(this.getYaw(), this.getPitch(), this.onGround)); this.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(this.getYaw(), this.getPitch(), this.isOnGround()));
} else if (this.lastOnGround != this.onGround || DebugSettings.INSTANCE.sendIdlePacket.getValue()) { } else if (this.lastOnGround != this.isOnGround() || DebugSettings.INSTANCE.sendIdlePacket.getValue()) {
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(this.onGround)); this.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(this.isOnGround()));
} else { } else {
SkipIdlePacketCallback.EVENT.invoker().onSkipIdlePacket(); SkipIdlePacketCallback.EVENT.invoker().onSkipIdlePacket();
} }
@ -132,7 +132,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
this.lastYaw = this.getYaw(); this.lastYaw = this.getYaw();
this.lastPitch = this.getPitch(); this.lastPitch = this.getPitch();
} }
this.lastOnGround = this.onGround; this.lastOnGround = this.isOnGround();
this.autoJumpEnabled = this.client.options.getAutoJump().getValue(); this.autoJumpEnabled = this.client.options.getAutoJump().getValue();
} }
return false; return false;

View File

@ -19,11 +19,12 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.mappings.MaterialMappings;
import de.florianmichael.viafabricplus.definition.v1_19_4.Material1_19_4;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.MiningToolItem; import net.minecraft.item.MiningToolItem;
import net.minecraft.item.PickaxeItem; import net.minecraft.item.PickaxeItem;
@ -41,7 +42,7 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
private final static Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1165 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.NETHER_GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.PISTON, Blocks.STICKY_PISTON, Blocks.PISTON_HEAD); private final static Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1165 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.NETHER_GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.PISTON, Blocks.STICKY_PISTON, Blocks.PISTON_HEAD);
@Unique @Unique
private final static Set<Material> viafabricplus_EFFECTIVE_MATERIALS = ImmutableSet.of(Material.METAL, Material.REPAIR_STATION, Material.STONE); private final static Set<Material1_19_4> viafabricplus_EFFECTIVE_MATERIALS = ImmutableSet.of(Material1_19_4.METAL, Material1_19_4.REPAIR_STATION, Material1_19_4.STONE);
@Unique @Unique
private final static Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1152 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX); private final static Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1152 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX);
@ -59,7 +60,7 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
return i == 3; return i == 3;
} else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE && block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK && block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE && block != Blocks.REDSTONE_ORE) { } else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE && block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK && block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE && block != Blocks.REDSTONE_ORE) {
if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE && block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) { if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE && block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) {
return viafabricplus_EFFECTIVE_MATERIALS.contains(state.getMaterial()); return viafabricplus_EFFECTIVE_MATERIALS.contains(MaterialMappings.fromBlock(state.getBlock()));
} else } else
return i >= 1; return i >= 1;
} else } else
@ -70,10 +71,12 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
@Override @Override
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
final Material1_19_4 material = MaterialMappings.fromBlock(state.getBlock());
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
return viafabricplus_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || viafabricplus_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F; return viafabricplus_EFFECTIVE_MATERIALS.contains(material) || viafabricplus_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
} else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) { } else if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
return viafabricplus_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || viafabricplus_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F; return viafabricplus_EFFECTIVE_MATERIALS.contains(material) || viafabricplus_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
} }
return super.getMiningSpeedMultiplier(stack, state); return super.getMiningSpeedMultiplier(stack, state);
} }

View File

@ -180,7 +180,7 @@ public class MixinProtocol1_19_3To1_19_1 extends AbstractProtocol<ClientboundPac
final long timestamp = wrapper.get(Type.LONG, 0); final long timestamp = wrapper.get(Type.LONG, 0);
final long salt = wrapper.get(Type.LONG, 1); final long salt = wrapper.get(Type.LONG, 1);
final byte[] signature = chatSession1192.sign(sender, new MessageMetadataModel(message, +timestamp, salt), messagesStorage.lastSignatures()); final byte[] signature = chatSession1192.sign(sender, new MessageMetadataModel(message, timestamp, salt), messagesStorage.lastSignatures());
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature); wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature);
wrapper.write(Type.BOOLEAN, false); // Signed Preview - not implemented yet, but I could do it wrapper.write(Type.BOOLEAN, false); // Signed Preview - not implemented yet, but I could do it

View File

@ -79,10 +79,10 @@ public class ItemReleaseVersionMappings {
register(Items.EYE_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.NETHERITE_UPGRADE_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.PINK_PETALS, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.PINK_PETALS, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.POTTERY_SHARD_ARCHER, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.ARCHER_POTTERY_SHERD, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.POTTERY_SHARD_ARMS_UP, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.ARMS_UP_POTTERY_SHERD, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.POTTERY_SHARD_PRIZE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.PRIZE_POTTERY_SHERD, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.POTTERY_SHARD_SKULL, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.SKULL_POTTERY_SHERD, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.RIB_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.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));
register(Items.SNIFFER_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_4)); register(Items.SNIFFER_SPAWN_EGG, ProtocolRange.andNewer(ProtocolVersion.v1_19_4));

File diff suppressed because it is too large Load Diff

View File

@ -17,20 +17,22 @@
*/ */
package de.florianmichael.viafabricplus.screen.base; package de.florianmichael.viafabricplus.screen.base;
import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget; import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
public abstract class MappedSlotEntry extends AlwaysSelectedEntryListWidget.Entry<MappedSlotEntry> { public abstract class MappedSlotEntry extends AlwaysSelectedEntryListWidget.Entry<MappedSlotEntry> {
public abstract void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta); public abstract void mappedRenderer(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta);
@Override @Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
final MatrixStack matrices = context.getMatrices();
matrices.push(); matrices.push();
matrices.translate(x, y, 0); matrices.translate(x, y, 0);
DrawableHelper.fill(matrices, 0, 0, entryWidth - 4 /* int i = this.left + (this.width - entryWidth) / 2; int j = this.left + (this.width + entryWidth) / 2; */, entryHeight, Integer.MIN_VALUE); context.fill(0, 0, entryWidth - 4 /* int i = this.left + (this.width - entryWidth) / 2; int j = this.left + (this.width + entryWidth) / 2; */, entryHeight, Integer.MIN_VALUE);
mappedRenderer(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta); mappedRenderer(context, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
matrices.pop(); matrices.pop();
} }
} }

View File

@ -22,8 +22,7 @@ import de.florianmichael.viafabricplus.settings.type_impl.ButtonSetting;
import de.florianmichael.viafabricplus.util.ScreenUtil; import de.florianmichael.viafabricplus.util.ScreenUtil;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
public class ButtonSettingRenderer extends MappedSlotEntry { public class ButtonSettingRenderer extends MappedSlotEntry {
@ -46,9 +45,9 @@ public class ButtonSettingRenderer extends MappedSlotEntry {
} }
@Override @Override
public void mappedRenderer(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { public void mappedRenderer(DrawContext context, 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); context.drawCenteredTextWithShadow(textRenderer, this.value.displayValue(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
} }
} }