Implemented brush item reach changes

This commit is contained in:
RaphiMC 2023-12-13 18:08:15 +01:00
parent 24368bb5eb
commit 2ae5122d83
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD
* Copyright (C) 2023 RK_01/RaphiMC 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.item;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BrushItem;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(BrushItem.class)
public abstract class MixinBrushItem {
@Redirect(method = "getHitResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getReachDistance(Z)F"))
private float modifyReachDistance(boolean creative) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_20_2)) {
return 5F;
}
return PlayerEntity.getReachDistance(creative);
}
}

View File

@ -113,6 +113,7 @@
"fixes.minecraft.item.MixinAxeItem",
"fixes.minecraft.item.MixinBlockItem",
"fixes.minecraft.item.MixinBowItem",
"fixes.minecraft.item.MixinBrushItem",
"fixes.minecraft.item.MixinDrawContext",
"fixes.minecraft.item.MixinEnderPearlItem",
"fixes.minecraft.item.MixinEquipment",