Skip to content

Commit

Permalink
resolve compiler errors (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Mar 8, 2023
1 parent b083ef3 commit 16c3a05
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/main/java/dev/dfonline/codeclient/CodeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public void onInitialize() {
dispatcher.register(literal("fixcc").executes(context -> {
currentAction = new None();
worldPlot = null;
location = null;
SocketHandler.setConnection(null);
PlotLocation.set(0,0,0);
ActionDump.clear();
return 0;
}));
Expand Down
28 changes: 15 additions & 13 deletions src/main/java/dev/dfonline/codeclient/action/impl/GetPlotSize.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package dev.dfonline.codeclient.action.impl;

import dev.dfonline.codeclient.CodeClient;
import dev.dfonline.codeclient.PlotLocation;
import dev.dfonline.codeclient.Utility;
import dev.dfonline.codeclient.WorldPlot;
import dev.dfonline.codeclient.action.Action;
import dev.dfonline.codeclient.location.Dev;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
Expand Down Expand Up @@ -56,19 +56,21 @@ public void onTick() {

@Override
public boolean onReceivePacket(Packet<?> packet) {
if(step == Step.TP && packet instanceof PlayerPositionLookS2CPacket position) {
step = Step.DONE;
double size = position.getZ() - PlotLocation.getZ();
if(size > 49) {
CodeClient.worldPlot = WorldPlot.Size.BASIC;
if(CodeClient.location instanceof Dev plot) {
if(step == Step.TP && packet instanceof PlayerPositionLookS2CPacket position) {
step = Step.DONE;
double size = position.getZ() - plot.getZ();
if(size > 49) {
CodeClient.worldPlot = WorldPlot.Size.BASIC;
}
if(size > 99) {
CodeClient.worldPlot = WorldPlot.Size.LARGE;
}
if(size > 299) {
CodeClient.worldPlot = WorldPlot.Size.MASSIVE;
}
callback();
}
if(size > 99) {
CodeClient.worldPlot = WorldPlot.Size.LARGE;
}
if(size > 299) {
CodeClient.worldPlot = WorldPlot.Size.MASSIVE;
}
callback();
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.google.gson.JsonParser;
import dev.dfonline.codeclient.CodeClient;
import dev.dfonline.codeclient.location.Dev;
import dev.dfonline.codeclient.PlotLocation;
import dev.dfonline.codeclient.mixin.ClientPlayerInteractionManagerAccessor;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
Expand Down Expand Up @@ -122,7 +121,8 @@ public static boolean onClickSlot(Slot slot, int button, SlotActionType actionTy
}

public static boolean onBlockInteract(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult) {
if(PlotLocation.isInCodeSpace(hitResult.getPos())) {
if(CodeClient.location instanceof Dev plot)
if(plot.isInCodeSpace(hitResult.getPos().getX(), hitResult.getPos().getZ())) {
CodeClient.MC.player.swingHand(Hand.MAIN_HAND);
// CodeClient.MC.getSoundManager().play(new PositionedSoundInstance(new SoundEvent(new Identifier("minecraft:block.stone.place")), SoundCategory.BLOCKS, 2, 0.8F, Random.create(), pos));
if(hitResult.getSide() == Direction.UP) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import static dev.dfonline.codeclient.CodeClient.MC;

@Mixin(ClientPlayerEntity.class)
public class MClientPlayerEntity {
@Shadow @Final public ClientPlayNetworkHandler networkHandler;
Expand All @@ -27,20 +29,20 @@ public class MClientPlayerEntity {
private void tick(CallbackInfo ci) {
CodeClient.onTick();
CodeClient.currentAction.onTick();
if(NoClip.ignoresWalls()) CodeClient.MC.player.noClip = true;
if(NoClip.ignoresWalls()) MC.player.noClip = true;
// ChestPeeker.tick();
}

@Inject(method = "sendMovementPackets", at = @At("HEAD"), cancellable = true)
private void sendMovementPackets(CallbackInfo ci) {
if(CodeClient.location instanceof Dev) {
if (CodeClient.currentAction instanceof MoveToSpawn mts) if (mts.moveModifier()) ci.cancel();
ClientPlayerEntity player = MC.player;
if (NoClip.ignoresWalls()) {
ci.cancel();
Vec3d pos = NoClip.handleSeverPosition();
ClientPlayerEntity player = CodeClient.MC.player;
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(pos.x, pos.y, pos.z, player.getYaw(), player.getPitch(), false));

}
boolean sneaking = player.isSneaking();
if (sneaking != this.lastSneaking) {
ClientCommandC2SPacket.Mode mode = sneaking ? ClientCommandC2SPacket.Mode.PRESS_SHIFT_KEY : ClientCommandC2SPacket.Mode.RELEASE_SHIFT_KEY;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.dfonline.codeclient.mixin;

import dev.dfonline.codeclient.PlotLocation;
import dev.dfonline.codeclient.CodeClient;
import dev.dfonline.codeclient.dev.InteractionManager;
import dev.dfonline.codeclient.location.Dev;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.player.PlayerEntity;
Expand All @@ -26,7 +27,7 @@ public void onAttackBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {

@Inject(method = "interactBlock", at = @At("HEAD") , cancellable = true)
private void onBlockInteract(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
if(PlotLocation.isInCodeSpace(hitResult.getBlockPos()) && InteractionManager.onBlockInteract(player, hand, hitResult)) cir.setReturnValue(ActionResult.FAIL);
if(CodeClient.location instanceof Dev plot && plot.isInCodeSpace(hitResult.getBlockPos().getX(), hitResult.getPos().getZ()) && InteractionManager.onBlockInteract(player, hand, hitResult)) cir.setReturnValue(ActionResult.FAIL);
}

@Inject(method = "clickSlot", at = @At("HEAD"), cancellable = true)
Expand Down

0 comments on commit 16c3a05

Please sign in to comment.