This commit is contained in:
Brady 2023-08-18 14:14:34 -05:00
parent bfc813a802
commit fc474cfb49
No known key found for this signature in database
GPG Key ID: 73A788379A197567
4 changed files with 6 additions and 65 deletions

View File

@ -183,7 +183,7 @@ public class MixinClientPlayNetHandler {
List<Pair<BlockPos, BlockState>> changes = new ArrayList<>();
packetIn.runUpdates((mutPos, state) -> {
changes.add(new Pair<>(mutPos.immutable(), state)); // bradyfix is this right
changes.add(new Pair<>(mutPos.immutable(), state));
});
if (changes.isEmpty()) {
return;
@ -192,28 +192,6 @@ public class MixinClientPlayNetHandler {
new ChunkPos(changes.get(0).first()),
changes
));
ChunkPos[] chunkPos = new ChunkPos[1];
packetIn.runUpdates((pos, state) -> {
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(state.getBlock())) {
chunkPos[0] = new ChunkPos(pos);
}
});
if (chunkPos[0] == null) {
return;
}
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
LocalPlayer player = ibaritone.getPlayerContext().player();
if (player != null && player.connection == (ClientPacketListener) (Object) this) {
ibaritone.getGameEventHandler().onChunkEvent(
new ChunkEvent(
EventState.POST,
ChunkEvent.Type.POPULATE_FULL,
chunkPos[0].x,
chunkPos[0].z
)
);
}
}
}
@Inject(

View File

@ -121,5 +121,5 @@ public class MixinClientPlayerEntity {
return false;
}
return ElytraItem.isFlyEnabled(stack);
} // bradyfix is this right?
}
}

View File

@ -51,7 +51,7 @@ public abstract class MixinLivingEntity extends Entity {
@Unique
private RotationMoveEvent elytraRotationEvent;
public MixinLivingEntity(EntityType<?> entityTypeIn, Level worldIn) {
private MixinLivingEntity(EntityType<?> entityTypeIn, Level worldIn) {
super(entityTypeIn, worldIn);
}
@ -111,33 +111,6 @@ public abstract class MixinLivingEntity extends Entity {
this.elytraRotationEvent = null;
}
}
// bradyfix in 1.12.2 this is a redirect of moveRelative as called from travel, but it looks like in 1.19.4 we're doing it in MixinEntity as injecting into moveRelative itself, is that right?
/*@Redirect(
method = "travel",
at = @At(
value = "INVOKE",
target = "net/minecraft/entity/EntityLivingBase.moveRelative(FFFF)V"
)
)
private void onMoveRelative(EntityLivingBase self, float strafe, float up, float forward, float friction) {
Optional<IBaritone> baritone = this.getBaritone();
if (!baritone.isPresent()) {
// If a shadow is used here it breaks on Forge
this.moveRelative(strafe, up, forward, friction);
return;
}
RotationMoveEvent event = new RotationMoveEvent(RotationMoveEvent.Type.MOTION_UPDATE, this.rotationYaw, this.rotationPitch);
baritone.get().getGameEventHandler().onPlayerRotationMove(event);
this.rotationYaw = event.getYaw();
this.rotationPitch = event.getPitch();
this.moveRelative(strafe, up, forward, friction);
this.rotationYaw = event.getOriginal().getYaw();
this.rotationPitch = event.getOriginal().getPitch();
}*/
@Unique
private Optional<IBaritone> getBaritone() {

View File

@ -34,6 +34,7 @@ import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.function.BiFunction;
@ -61,21 +62,12 @@ public class MixinMinecraft {
BaritoneAPI.getProvider().getPrimaryBaritone();
}
@Inject(
method = "tick",
at = @At(
//<<<<<<< HEAD
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;",
ordinal = 4,
shift = At.Shift.BY,
by = -3
/*=======
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "net/minecraft/client/Minecraft.currentScreen:Lnet/minecraft/client/gui/GuiScreen;",
target = "net/minecraft/client/Minecraft.screen:Lnet/minecraft/client/gui/screens/Screen;",
ordinal = 0,
shift = At.Shift.BEFORE
),
@ -83,10 +75,8 @@ public class MixinMinecraft {
from = @At(
value = "FIELD",
opcode = Opcodes.PUTFIELD,
target = "net/minecraft/client/Minecraft.leftClickCounter:I"
target = "net/minecraft/client/Minecraft.missTime:I"
)
>>>>>>> master*/
// bradyfix ^
)
)
private void runTick(CallbackInfo ci) {