mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-06 19:18:25 +01:00
Work
This commit is contained in:
parent
90c1832f3e
commit
396f2c80df
@ -87,6 +87,7 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, boolean rejectBad, CallbackInfo ci) {
|
||||
// Compression enabled and elements put into pipeline, move via handlers
|
||||
channel.pipeline().fireUserEventTriggered(CompressionReorderEvent.INSTANCE);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.ui;
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.integration.bedrock;
|
||||
|
||||
import com.viaversion.viafabricplus.injection.access.base.bedrock.IConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.integration;
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.integration.bedrock;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.integration;
|
||||
package com.viaversion.viafabricplus.injection.mixin.base.integration.event;
|
||||
|
||||
import com.viaversion.viafabricplus.api.events.LoadingCycleCallback;
|
||||
import com.viaversion.viafabricplus.base.Events;
|
@ -38,8 +38,12 @@ public abstract class MixinEntityPacketRewriter1_17 {
|
||||
|
||||
@Redirect(method = "registerPackets", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/v1_16_4to1_17/Protocol1_16_4To1_17;registerClientbound(Lcom/viaversion/viaversion/api/protocol/packet/ClientboundPacketType;Lcom/viaversion/viaversion/api/protocol/remapper/PacketHandler;)V"))
|
||||
private void handleClassicWorldHeight(Protocol1_16_4To1_17 instance, ClientboundPacketType packetType, PacketHandler packetHandler) {
|
||||
if (packetType == ClientboundPackets1_16_2.LOGIN) packetHandler = WorldHeightSupport.handleJoinGame(packetHandler);
|
||||
if (packetType == ClientboundPackets1_16_2.RESPAWN) packetHandler = WorldHeightSupport.handleRespawn(packetHandler);
|
||||
if (packetType == ClientboundPackets1_16_2.LOGIN) {
|
||||
packetHandler = WorldHeightSupport.handleJoinGame(packetHandler);
|
||||
}
|
||||
if (packetType == ClientboundPackets1_16_2.RESPAWN) {
|
||||
packetHandler = WorldHeightSupport.handleRespawn(packetHandler);
|
||||
}
|
||||
|
||||
((Protocol) instance).registerClientbound(packetType, packetHandler);
|
||||
}
|
||||
|
@ -38,8 +38,12 @@ public abstract class MixinWorldPacketRewriter1_17 {
|
||||
|
||||
@Redirect(method = "register", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/v1_16_4to1_17/Protocol1_16_4To1_17;registerClientbound(Lcom/viaversion/viaversion/api/protocol/packet/ClientboundPacketType;Lcom/viaversion/viaversion/api/protocol/remapper/PacketHandler;)V"))
|
||||
private static void handleClassicWorldHeight(Protocol1_16_4To1_17 instance, ClientboundPacketType packetType, PacketHandler packetHandler) {
|
||||
if (packetType == ClientboundPackets1_16_2.LEVEL_CHUNK) packetHandler = WorldHeightSupport.handleChunkData(packetHandler);
|
||||
if (packetType == ClientboundPackets1_16_2.LIGHT_UPDATE) packetHandler = WorldHeightSupport.handleUpdateLight(packetHandler);
|
||||
if (packetType == ClientboundPackets1_16_2.LEVEL_CHUNK) {
|
||||
packetHandler = WorldHeightSupport.handleChunkData(packetHandler);
|
||||
}
|
||||
if (packetType == ClientboundPackets1_16_2.LIGHT_UPDATE) {
|
||||
packetHandler = WorldHeightSupport.handleUpdateLight(packetHandler);
|
||||
}
|
||||
|
||||
((Protocol) instance).registerClientbound(packetType, packetHandler);
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 the original authors
|
||||
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
|
||||
* - RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 ViaVersion 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 com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
|
||||
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.AbstractBoatEntity;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.entity.vehicle.VehicleEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(AbstractBoatEntity.class)
|
||||
public abstract class MixinAbstractBoatEntity extends VehicleEntity {
|
||||
|
||||
public MixinAbstractBoatEntity(EntityType<?> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Redirect(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/VehicleEntity;interact(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"))
|
||||
private ActionResult makeNotLeashable(VehicleEntity instance, PlayerEntity player, Hand hand) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
return ActionResult.PASS;
|
||||
} else {
|
||||
return super.interact(player, hand);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 the original authors
|
||||
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
|
||||
* - RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 ViaVersion 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 com.viaversion.viafabricplus.injection.mixin.features.entity.riding_offsets;
|
||||
|
||||
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.vehicle.AbstractBoatEntity;
|
||||
import net.minecraft.entity.vehicle.VehicleEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(AbstractBoatEntity.class)
|
||||
public abstract class MixinAbstractBoatEntity extends VehicleEntity {
|
||||
|
||||
public MixinAbstractBoatEntity(EntityType<?> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Inject(method = "updatePassengerPosition", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void updatePassengerPosition1_8(Entity passenger, Entity.PositionUpdater positionUpdater, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
final Vec3d newPosition = EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(this, passenger).add(this.getPos());
|
||||
positionUpdater.accept(passenger, newPosition.x, newPosition.y + EntityRidingOffsetsPre1_20_2.getHeightOffset(passenger), newPosition.z);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,10 +19,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.entity.v1_8_boat;
|
||||
package com.viaversion.viafabricplus.injection.mixin.features.movement.entity;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2;
|
||||
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -31,14 +30,11 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.AbstractBoatEntity;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.entity.vehicle.VehicleEntity;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@ -88,15 +84,6 @@ public abstract class MixinAbstractBoatEntity extends VehicleEntity {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Redirect(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/VehicleEntity;interact(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"))
|
||||
private ActionResult makeNotLeashable(VehicleEntity instance, PlayerEntity player, Hand hand) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
return ActionResult.PASS;
|
||||
} else {
|
||||
return super.interact(player, hand);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "updateVelocity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSpaceEmpty(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Box;)Z"))
|
||||
private boolean alwaysUpdatePosition(World instance, Entity entity, Box box) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
@ -310,15 +297,6 @@ public abstract class MixinAbstractBoatEntity extends VehicleEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updatePassengerPosition", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void updatePassengerPosition1_8(Entity passenger, PositionUpdater positionUpdater, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
final Vec3d newPosition = EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(this, passenger).add(this.getPos());
|
||||
positionUpdater.accept(passenger, newPosition.x, newPosition.y + EntityRidingOffsetsPre1_20_2.getHeightOffset(passenger), newPosition.z);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPassengerLookAround", at = @At("HEAD"), cancellable = true)
|
||||
private void onPassengerLookAround1_8(Entity passenger, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
@ -18,15 +18,15 @@
|
||||
"base.connection.MixinMultiplayerServerListPinger",
|
||||
"base.integration.MixinClientConnection",
|
||||
"base.integration.MixinDebugHud",
|
||||
"base.integration.MixinMinecraftClient",
|
||||
"base.integration.MixinMultiplayerServerListPinger",
|
||||
"base.integration.MixinMultiplayerServerListPinger_1",
|
||||
"base.integration.MixinServerInfo",
|
||||
"base.integration.MixinUserConnectionImpl",
|
||||
"base.integration.bedrock.MixinConfirmScreen",
|
||||
"base.integration.bedrock.MixinConnectScreen_1",
|
||||
"base.integration.bedrock.MixinMultiplayerServerListPinger",
|
||||
"base.integration.event.MixinMinecraftClient",
|
||||
"base.integration.sync_tasks.MixinClientCommonNetworkHandler",
|
||||
"base.ui.MixinAddServerScreen",
|
||||
"base.ui.MixinConfirmScreen",
|
||||
"base.ui.MixinConnectScreen_1",
|
||||
"base.ui.MixinDirectConnectScreen",
|
||||
"base.ui.MixinDownloadingTerrainScreen",
|
||||
@ -107,7 +107,7 @@
|
||||
"features.entity.metadata_handling.MixinEntityTracker1_9",
|
||||
"features.entity.pose.MixinOtherClientPlayerEntity",
|
||||
"features.entity.riding_offsets.MixinCamelEntity",
|
||||
"features.entity.v1_8_boat.MixinAbstractBoatEntity",
|
||||
"features.movement.entity.MixinAbstractBoatEntity",
|
||||
"features.entity.v1_8_boat.MixinEntityModels",
|
||||
"features.entity.v1_8_boat.MixinEntityRenderDispatcher",
|
||||
"features.execute_inputs_sync.MixinKeyboard",
|
||||
@ -167,6 +167,11 @@
|
||||
"features.movement.block.MixinHoneyBlock",
|
||||
"features.movement.block.MixinSoulSandBlock",
|
||||
"features.movement.elytra.MixinFireworkRocketItem",
|
||||
"features.movement.entity.MixinClientPlayerEntity",
|
||||
"features.movement.entity.MixinEntity",
|
||||
"features.movement.entity.MixinLivingEntity",
|
||||
"features.movement.entity.MixinPlayerEntity",
|
||||
"features.movement.entity.MixinPlayerEntityRenderer",
|
||||
"features.movement.entity.MixinSkeletonHorseEntity",
|
||||
"features.movement.item.MixinEnderEyeItem",
|
||||
"features.movement.levitation_value.MixinStatusEffectInstance",
|
||||
@ -200,6 +205,7 @@
|
||||
"features.networking.srv_resolving.MixinRedirectResolver",
|
||||
"features.networking.srv_resolving.MixinServerAddress",
|
||||
"features.networking.warn_feature_updates.MixinClientConfigurationNetworkHandler",
|
||||
"features.open_inventory_packet.MixinMinecraftClient",
|
||||
"features.player_abilities.MixinUpdatePlayerAbilitiesC2SPacket",
|
||||
"features.recipe_emulation.MixinCraftingScreenHandler",
|
||||
"features.recipe_emulation.MixinEntityPacketRewriter1_12",
|
||||
@ -217,18 +223,16 @@
|
||||
"features.world.item_picking.MixinMinecraftClient",
|
||||
"features.world.remove_server_view_distance.MixinGameOptions",
|
||||
"integration.viabedrock.MixinJoinPackets",
|
||||
"integration.vialegacy.MixinViaLegacyConfig",
|
||||
"features.open_inventory_packet.MixinMinecraftClient",
|
||||
"features.movement.entity.MixinClientPlayerEntity",
|
||||
"features.movement.entity.MixinEntity",
|
||||
"features.movement.entity.MixinLivingEntity",
|
||||
"features.movement.entity.MixinPlayerEntity",
|
||||
"features.movement.entity.MixinPlayerEntityRenderer"
|
||||
"integration.vialegacy.MixinViaLegacyConfig"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
},
|
||||
"mixins": [
|
||||
"features.entity.interactions.MixinAbstractBoatEntity",
|
||||
"features.entity.riding_offsets.MixinAbstractBoatEntity"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user