Fixed 1.7 interactions

This commit is contained in:
FlorianMichael 2023-03-30 01:10:49 +02:00
parent 50db6ec48b
commit 6a070fda9f
4 changed files with 7 additions and 46 deletions

View File

@ -68,7 +68,7 @@ public abstract class MixinMinecraftClient {
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;isAccepted()Z", ordinal = 0)) at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult;isAccepted()Z", ordinal = 0))
private boolean preventGenericInteract(ActionResult instance) { private boolean preventGenericInteract(ActionResult instance) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
return true; return false;
} }
return instance.isAccepted(); return instance.isAccepted();

View File

@ -43,11 +43,10 @@ public abstract class MixinMetadataRewriter1_15To1_14_4 extends EntityRewriter<C
@Inject(method = "handleMetadata", at = @At(value = "INVOKE", target = "Ljava/util/List;remove(Ljava/lang/Object;)Z", shift = At.Shift.BEFORE), remap = false) @Inject(method = "handleMetadata", at = @At(value = "INVOKE", target = "Ljava/util/List;remove(Ljava/lang/Object;)Z", shift = At.Shift.BEFORE), remap = false)
public void trackHealth(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection, CallbackInfo ci) { public void trackHealth(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection, CallbackInfo ci) {
final Meta18Storage meta18Storage = protocol.get(Meta18Storage.class); if (protocol.get(Meta18Storage.class) == null) {
if (meta18Storage == null) { protocol.put(new Meta18Storage(connection));
Via.getPlatform().getLogger().severe("Metadata 18 storage is missing!"); Via.getPlatform().getLogger().severe("Metadata 18 storage is missing!");
return;
} }
meta18Storage.getHealthDataMap().put(entityId, (Float) metadata.getValue()); protocol.get(Meta18Storage.class).getHealthDataMap().put(entityId, (Float) metadata.getValue());
} }
} }

View File

@ -1,35 +0,0 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_15to1_14_4;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
import de.florianmichael.viafabricplus.definition.v1_14_4.Meta18Storage;
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(value = Protocol1_15To1_14_4.class, remap = false)
public class MixinProtocol1_15To1_14_4 {
@Inject(method = "init", at = @At("HEAD"))
public void addMeta18Storage(UserConnection connection, CallbackInfo ci) {
connection.put(new Meta18Storage(connection));
}
}

View File

@ -132,7 +132,6 @@
"fixes.viaversion.protocol1_13to1_12_2.MixinWorldPackets1_13", "fixes.viaversion.protocol1_13to1_12_2.MixinWorldPackets1_13",
"fixes.viaversion.protocol1_14to1_13_2.MixinInventoryPackets_2", "fixes.viaversion.protocol1_14to1_13_2.MixinInventoryPackets_2",
"fixes.viaversion.protocol1_15to1_14_4.MixinMetadataRewriter1_15To1_14_4", "fixes.viaversion.protocol1_15to1_14_4.MixinMetadataRewriter1_15To1_14_4",
"fixes.viaversion.protocol1_15to1_14_4.MixinProtocol1_15To1_14_4",
"fixes.viaversion.protocol1_16_2to1_16_1.MixinWorldPackets_2", "fixes.viaversion.protocol1_16_2to1_16_1.MixinWorldPackets_2",
"fixes.viaversion.protocol1_16to1_15_2.MixinProtocol1_16To1_15_2", "fixes.viaversion.protocol1_16to1_15_2.MixinProtocol1_16To1_15_2",
"fixes.viaversion.protocol1_17to1_16_4.MixinEntityPackets1_17", "fixes.viaversion.protocol1_17to1_16_4.MixinEntityPackets1_17",
@ -150,12 +149,10 @@
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread", "fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
"jsonwebtoken.MixinClasses", "jsonwebtoken.MixinClasses",
"jsonwebtoken.MixinDefaultCompressionCodecResolver", "jsonwebtoken.MixinDefaultCompressionCodecResolver",
"jsonwebtoken.MixinDefaultJwtParserBuilder" "jsonwebtoken.MixinDefaultJwtParserBuilder",
"base.MixinSharedConstants"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1
}, }
"mixins": [
"base.MixinSharedConstants"
]
} }