Skip to content

Commit

Permalink
24w26a
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Sep 4, 2024
1 parent 00e48df commit 72b298e
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 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=24w35a
minecraft_version=24w36a
loader_version=0.15.11
jsr305_version=3.0.2
fabric_version=0.102.0+1.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ChunkMap.DistanceManager;
import net.minecraft.server.level.ChunkResult;
import net.minecraft.server.level.ChunkTaskPriorityQueueSorter;
//import net.minecraft.server.level.ChunkTaskPriorityQueueSorter;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ThreadedLevelLightEngine;
import net.minecraft.server.level.TicketType;
Expand Down Expand Up @@ -76,9 +76,9 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
@Final
private ThreadedLevelLightEngine lightEngine;

@Shadow
@Final
private ChunkTaskPriorityQueueSorter queueSorter;
//@Shadow
//@Final
//private ChunkTaskPriorityQueueSorter queueSorter;

@Shadow
@Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ElytraItem;
//import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -26,7 +26,7 @@ private void allowDeploys(CallbackInfoReturnable<Boolean> cir)
if (CarpetSettings.antiCheatDisabled && (Object)this instanceof ServerPlayer sp && sp.getServer().isDedicatedServer())
{
ItemStack itemStack_1 = getItemBySlot(EquipmentSlot.CHEST);
if (itemStack_1.getItem() == Items.ELYTRA && ElytraItem.isFlyEnabled(itemStack_1)) {
if (itemStack_1.getItem() == Items.ELYTRA && !itemStack_1.nextDamageWillBreak()) {
startFallFlying();
cir.setReturnValue(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import carpet.fakes.EntityInterface;
import net.minecraft.network.protocol.game.ServerboundChatCommandPacket;
import net.minecraft.world.entity.player.Input;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down Expand Up @@ -57,12 +58,14 @@ private void checkMoves(ServerboundPlayerInputPacket p, CallbackInfo ci)
{
// todo this may not ride on the right thread moment, so needs to be checked

if (!((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null
player.setShiftKeyDown(p.isShiftKeyDown());
Input input = p.input();

if (PLAYER_RIDES.isNeeded() && (p.getXxa() != 0.0F || p.getZza() != 0.0F || p.isJumping() || p.isShiftKeyDown()))
if (player.getVehicle() != null && !((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null
player.setShiftKeyDown(p.input().shift());

if (PLAYER_RIDES.isNeeded() && (input.jump() || input.shift() || input.forward() || input.backward() || input.left() || input.right()))
{
PLAYER_RIDES.onMountControls(player, p.getXxa(), p.getZza(), p.isJumping(), p.isShiftKeyDown());
PLAYER_RIDES.onMountControls(player, input.left() == input.right() ? 0 : (input.left() ? -1 : 1 ), input.forward() == input.backward() ? 0 : (input.forward() ? 1 : -1), input.jump(), input.shift());
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/carpet/patches/EntityPlayerMPFake.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import carpet.utils.Messenger;

import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

@SuppressWarnings("EntityConstructor")
Expand Down Expand Up @@ -77,7 +78,7 @@ public static boolean createFake(String username, MinecraftServer server, Vec3 p
EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false);
instance.fixStartingPosition = () -> instance.moveTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation(), false));
instance.teleportTo(worldIn, pos.x, pos.y, pos.z, (float) yaw, (float) pitch, true);
instance.teleportTo(worldIn, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true);
instance.setHealth(20.0F);
instance.unsetRemoved();
instance.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(0.6F);
Expand Down Expand Up @@ -151,7 +152,7 @@ public void kill(Component reason)
if (reason.getContents() instanceof TranslatableContents text && text.getKey().equals("multiplayer.disconnect.duplicate_login")) {
this.connection.onDisconnect(new DisconnectionDetails(reason));
} else {
this.server.tell(new TickTask(this.server.getTickCount(), () -> {
this.server.schedule(new TickTask(this.server.getTickCount(), () -> {
this.connection.onDisconnect(new DisconnectionDetails(reason));
}));
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/carpet/patches/NetHandlerPlayServerFake.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import net.minecraft.world.entity.RelativeMovement;
import net.minecraft.world.entity.PositionMoveRotation;
import net.minecraft.world.entity.Relative;
import java.util.Set;

public class NetHandlerPlayServerFake extends ServerGamePacketListenerImpl
Expand All @@ -33,9 +34,9 @@ public void disconnect(Component message)
}

@Override
public void teleport(double d, double e, double f, float g, float h, Set<RelativeMovement> set)
public void teleport(PositionMoveRotation positionMoveRotation, Set<Relative> set)
{
super.teleport(d, e, f, g, h, set);
super.teleport(positionMoveRotation, set);
if (player.serverLevel().getPlayerByUUID(player.getUUID()) != null) {
resetPosition();
player.serverLevel().getChunkSource().move(player);
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/carpet/script/value/EntityValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.RelativeMovement;
import net.minecraft.world.entity.PositionMoveRotation;
import net.minecraft.world.entity.Relative;
import net.minecraft.world.entity.ai.Brain;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeMap;
Expand Down Expand Up @@ -899,10 +900,11 @@ private static void updatePosition(Entity e, double x, double y, double z, float
if (e instanceof ServerPlayer sp)
{
// this forces position but doesn't angles for some reason. Need both in the API in the future.
EnumSet<RelativeMovement> set = EnumSet.noneOf(RelativeMovement.class);
set.add(RelativeMovement.X_ROT);
set.add(RelativeMovement.Y_ROT);
sp.connection.teleport(x, y, z, yaw, pitch, set);
EnumSet<Relative> set = EnumSet.noneOf(Relative.class);
set.add(Relative.X_ROT);
set.add(Relative.Y_ROT);

sp.connection.teleport(new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, yaw, pitch), set);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/carpet/utils/CommandHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void notifyPlayersCommandsChanged(MinecraftServer server)
{
return;
}
server.tell(new TickTask(server.getTickCount(), () ->
server.schedule(new TickTask(server.getTickCount(), () ->
{
try {
for (ServerPlayer player : server.getPlayerList().getPlayers()) {
Expand Down

0 comments on commit 72b298e

Please sign in to comment.