25w06a
This commit is contained in:
1 parent
85803cecbb
commit
7c73a9344c
9 files changed
+62
-44
No files matched your search
@@ -2,11 +2,15 @@ package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
//import net.minecraft.world.item.ElytraItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -14,18 +18,23 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Player.class)
|
||||
public abstract class Player_antiCheatDisabledMixin
|
||||
public abstract class Player_antiCheatDisabledMixin extends LivingEntity
|
||||
{
|
||||
@Shadow public abstract ItemStack getItemBySlot(EquipmentSlot equipmentSlot_1);
|
||||
protected Player_antiCheatDisabledMixin(final EntityType<? extends LivingEntity> entityType, final Level level)
|
||||
{
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
@Shadow public abstract void startFallFlying();
|
||||
|
||||
@Shadow public abstract Inventory getInventory();
|
||||
|
||||
@Inject(method = "tryToStartFallFlying", at = @At("HEAD"), cancellable = true)
|
||||
private void allowDeploys(CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.antiCheatDisabled && (Object)this instanceof ServerPlayer sp && sp.getServer().isDedicatedServer())
|
||||
{
|
||||
ItemStack itemStack_1 = getItemBySlot(EquipmentSlot.CHEST);
|
||||
ItemStack itemStack_1 = equipment.get(EquipmentSlot.CHEST);
|
||||
if (itemStack_1.getItem() == Items.ELYTRA && !itemStack_1.nextDamageWillBreak()) {
|
||||
startFallFlying();
|
||||
cir.setReturnValue(true);
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class ServerChunkCacheMixin
|
||||
|
||||
@Shadow @Final private DistanceManager distanceManager;
|
||||
|
||||
@Redirect(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At(
|
||||
@Redirect(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/DistanceManager;getNaturalSpawnChunkCount()I"
|
||||
))
|
||||
@@ -54,7 +54,7 @@ public abstract class ServerChunkCacheMixin
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN"))
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("RETURN"))
|
||||
private void onFinishSpawnWorldCycle(CallbackInfo ci)
|
||||
{
|
||||
LevelData levelData = this.level.getLevelData(); // levelProperies class
|
||||
|
||||
@@ -19,13 +19,13 @@ public abstract class ServerChunkCache_profilerMixin
|
||||
|
||||
CarpetProfiler.ProfilerToken currentSection;
|
||||
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("HEAD"))
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("HEAD"))
|
||||
private void startSpawningSection(CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(level, "Spawning", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN"))
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;J)V", at = @At("RETURN"))
|
||||
private void stopSpawningSection(CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
|
||||
@@ -269,7 +269,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
|
||||
{
|
||||
if (PLAYER_SWITCHES_SLOT.isNeeded() && player.getServer() != null && player.getServer().isSameThread())
|
||||
{
|
||||
PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.getInventory().selected, packet.getSlot());
|
||||
PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.getInventory().getSelectedSlot(), packet.getSlot());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
|
||||
super(writableLevelData, resourceKey, registryAccess, holder, bl, bl2, l, i);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunk", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(
|
||||
@Inject(method = "tickThunder", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/ServerLevel;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z",
|
||||
shift = At.Shift.BEFORE,
|
||||
ordinal = 1
|
||||
))
|
||||
private void onNaturalLightinig(LevelChunk chunk, int randomTickSpeed, CallbackInfo ci,
|
||||
private void onNaturalLightinig(LevelChunk chunk, CallbackInfo ci,
|
||||
//ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, boolean bl2)
|
||||
ChunkPos chunkPos, boolean bl, int i, int j, ProfilerFiller profiler, BlockPos blockPos, DifficultyInstance localDifficulty, boolean bl2, LightningBolt lightningEntity)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user