removed spawn chunks size rule. Hack for network stuff - may stay. 24w03a

This commit is contained in:
gnembon committed 2024-01-18 23:11:56 +01:00
1 parent 4aec8114c9
commit d524df5a0b
25 files changed
+116 -194

No files matched your search

@@ -1,38 +1,43 @@
package carpet.mixins;
import carpet.CarpetSettings;
import com.mojang.authlib.GameProfile;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = ServerPlayer.class)
public abstract class ServerPlayerGameMode_antiCheatMixin extends Player
@Mixin(value = Player.class)
public abstract class ServerPlayerGameMode_antiCheatMixin extends LivingEntity
{
public ServerPlayerGameMode_antiCheatMixin(final Level level, final BlockPos blockPos, final float f, final GameProfile gameProfile)
@Shadow public abstract double entityInteractionRange();
@Shadow public abstract double blockInteractionRange();
protected ServerPlayerGameMode_antiCheatMixin(final EntityType<? extends LivingEntity> entityType, final Level level)
{
super(level, blockPos, f, gameProfile);
super(entityType, level);
}
@Inject(method = "canInteractWithBlock", at = @At("HEAD"), cancellable = true)
private void canInteractLongRangeBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir)
private void canInteractLongRangeBlock(BlockPos pos, double d, CallbackInfoReturnable<Boolean> cir)
{
double maxRange = blockInteractionRange() + 1.0;
double maxRange = blockInteractionRange() + d;
maxRange = maxRange * maxRange;
if (CarpetSettings.antiCheatDisabled && maxRange < 1024 && getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) < 1024) cir.setReturnValue(true);
}
@Inject(method = "canInteractWithEntity", at = @At("HEAD"), cancellable = true)
private void canInteractLongRangeEntity(AABB aabb, CallbackInfoReturnable<Boolean> cir)
@Inject(method = "canInteractWithEntity(Lnet/minecraft/world/phys/AABB;D)Z", at = @At("HEAD"), cancellable = true)
private void canInteractLongRangeEntity(AABB aabb, double d, CallbackInfoReturnable<Boolean> cir)
{
double maxRange = entityInteractionRange() + 1.0;
double maxRange = entityInteractionRange() + d;
maxRange = maxRange * maxRange;
if (CarpetSettings.antiCheatDisabled && maxRange < 1024 && aabb.distanceToSqr(getEyePosition()) < 1024) cir.setReturnValue(true);
}