Skip to content

Commit

Permalink
25w06a
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Feb 5, 2025
1 parent 85803ce commit 7c73a93
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 44 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check https://fabricmc.net/develop/
minecraft_version=25w05a
minecraft_version=25w06a
loader_version=0.16.10
jsr305_version=3.0.2
fabric_version=0.110.5+1.21.4
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/carpet/helpers/EntityPlayerActionPack.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ public void drop(int selectedSlot, boolean dropAll)
else // one slot
{
if (selectedSlot == -1)
selectedSlot = inv.selected;
selectedSlot = inv.getSelectedSlot();
dropItemFromSlot(selectedSlot, dropAll);
}
}

public void setSlot(int slot)
{
player.getInventory().selected = slot-1;
player.getInventory().setSelectedSlot(slot-1);
player.connection.send(new ClientboundSetHeldSlotPacket(slot-1));
}

Expand Down
15 changes: 12 additions & 3 deletions src/main/java/carpet/mixins/Player_antiCheatDisabledMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,39 @@

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;
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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/carpet/mixins/ServerChunkCacheMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"
))
Expand All @@ -54,7 +54,7 @@ private int setupTracking(DistanceManager chunkTicketManager)
}


@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private void onUpdatedSelectedSLot(ServerboundSetCarriedItemPacket packet, Callb
{
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());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ protected ServerLevel_scarpetMixin(WritableLevelData writableLevelData, Resource
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)
{
Expand Down
Loading

0 comments on commit 7c73a93

Please sign in to comment.