mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-23 21:51:26 +01:00
Fixed sneaking finally
Fixed Wall block culling
This commit is contained in:
parent
f49b5a6db6
commit
ddb1578ccf
@ -39,6 +39,8 @@ 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.Map;
|
||||
|
||||
@Mixin(WallBlock.class)
|
||||
public class MixinWallBlock extends Block {
|
||||
|
||||
@ -101,6 +103,10 @@ public class MixinWallBlock extends Block {
|
||||
@Shadow
|
||||
@Final
|
||||
public static EnumProperty<WallShape> SOUTH_SHAPE;
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<BlockState, VoxelShape> shapeMap;
|
||||
|
||||
public MixinWallBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
@ -163,6 +169,11 @@ public class MixinWallBlock extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
return this.shapeMap.get(state); // Always use the real outline shape for culling
|
||||
}
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
|
@ -105,6 +105,15 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f))
|
||||
private float modifySneakEyeHeight(float prevEyeHeight) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThan(ProtocolVersion.v1_13_2)) {
|
||||
return prevEyeHeight;
|
||||
} else {
|
||||
return 1.54f;
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
public boolean viafabricplus_isSprinting;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user