Reach: Updates, New mouse events
This commit is contained in:
parent
0bcf09aef4
commit
ea2ab5807c
|
@ -0,0 +1,6 @@
|
|||
package me.rigamortis.seppuku.api.event.mouse;
|
||||
|
||||
import me.rigamortis.seppuku.api.event.EventCancellable;
|
||||
|
||||
public class EventMouseLeftClick extends EventCancellable {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package me.rigamortis.seppuku.api.event.mouse;
|
||||
|
||||
import me.rigamortis.seppuku.api.event.EventCancellable;
|
||||
|
||||
public class EventMouseRightClick extends EventCancellable {
|
||||
}
|
|
@ -164,7 +164,7 @@ public final class XrayCommand extends Command {
|
|||
|
||||
Seppuku.INSTANCE.logcChat(msg);
|
||||
} else {
|
||||
Seppuku.INSTANCE.logChat("You don't have any search ids");
|
||||
Seppuku.INSTANCE.logChat("You don't have any xray ids");
|
||||
}
|
||||
} else if (equals(clearAlias, split[1])) {
|
||||
if (!this.clamp(input, 2, 2)) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import me.rigamortis.seppuku.api.module.Module;
|
|||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import me.rigamortis.seppuku.impl.module.render.BlockHighlightModule;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -29,6 +28,7 @@ public final class ReachModule extends Module {
|
|||
private BlockHighlightModule blockHighlightModule = null;
|
||||
|
||||
private RayTraceResult currentBlockTrace = null;
|
||||
//private RayTraceResult currentEntityTrace = null;
|
||||
|
||||
public ReachModule() {
|
||||
super("Reach", new String[]{"Rch"}, "Extends the player's reach.", "NONE", -1, ModuleType.PLAYER);
|
||||
|
@ -68,6 +68,19 @@ public final class ReachModule extends Module {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (this.entities.getValue()) {
|
||||
Vec3d positionEyes = mc.player.getPositionEyes(event.getPartialTicks());
|
||||
Vec3d look = mc.player.getLook(event.getPartialTicks());
|
||||
Vec3d end = positionEyes.add(look.x * this.distance.getValue(), look.y * this.distance.getValue(), look.z * this.distance.getValue());
|
||||
mc.world.
|
||||
final RayTraceResult result = mc.world.rayTraceBlocks(positionEyes, end, false, true, false);
|
||||
assert result != null;
|
||||
System.out.println(result.entityHit);
|
||||
//this.currentEntityTrace = mc.world.rayTraceBlocks()
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Listener
|
||||
|
@ -87,12 +100,8 @@ public final class ReachModule extends Module {
|
|||
if (mc.gameSettings.keyBindAttack.pressed) {
|
||||
if (!mc.world.isAirBlock(this.currentBlockTrace.getBlockPos())) {
|
||||
if (mc.player.capabilities.isCreativeMode) {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, this.currentBlockTrace.getBlockPos(), this.currentBlockTrace.sideHit));
|
||||
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, this.currentBlockTrace.getBlockPos(), this.currentBlockTrace.sideHit));
|
||||
mc.playerController.onPlayerDestroyBlock(this.currentBlockTrace.getBlockPos());
|
||||
mc.world.setBlockToAir(this.currentBlockTrace.getBlockPos());
|
||||
} else {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, this.currentBlockTrace.getBlockPos(), this.currentBlockTrace.sideHit));
|
||||
mc.playerController.onPlayerDamageBlock(this.currentBlockTrace.getBlockPos(), this.currentBlockTrace.sideHit);
|
||||
}
|
||||
mc.player.swingArm(EnumHand.MAIN_HAND);
|
||||
|
|
|
@ -6,6 +6,8 @@ import me.rigamortis.seppuku.api.event.minecraft.EventDisplayGui;
|
|||
import me.rigamortis.seppuku.api.event.minecraft.EventKeyPress;
|
||||
import me.rigamortis.seppuku.api.event.minecraft.EventRunTick;
|
||||
import me.rigamortis.seppuku.api.event.minecraft.EventUpdateFramebufferSize;
|
||||
import me.rigamortis.seppuku.api.event.mouse.EventMouseLeftClick;
|
||||
import me.rigamortis.seppuku.api.event.mouse.EventMouseRightClick;
|
||||
import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
|
||||
import me.rigamortis.seppuku.api.patch.ClassPatch;
|
||||
import me.rigamortis.seppuku.api.patch.MethodPatch;
|
||||
|
@ -197,4 +199,46 @@ public final class MinecraftPatch extends ClassPatch {
|
|||
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
|
||||
return event.isCanceled();
|
||||
}
|
||||
|
||||
@MethodPatch(
|
||||
mcpName = "clickMouse",
|
||||
notchName = "aA",
|
||||
mcpDesc = "()V",
|
||||
notchDesc = "()V")
|
||||
public void clickMouse(MethodNode methodNode, PatchManager.Environment env) {
|
||||
final InsnList insnList = new InsnList();
|
||||
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "clickMouseHook", "()Z", false));
|
||||
final LabelNode jmp = new LabelNode();
|
||||
insnList.add(new JumpInsnNode(IFEQ, jmp));
|
||||
insnList.add(new InsnNode(RETURN));
|
||||
insnList.add(jmp);
|
||||
methodNode.instructions.insert(insnList);
|
||||
}
|
||||
|
||||
public static boolean clickMouseHook() {
|
||||
final EventMouseLeftClick event = new EventMouseLeftClick();
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
|
||||
return event.isCanceled();
|
||||
}
|
||||
|
||||
@MethodPatch(
|
||||
mcpName = "rightClickMouse",
|
||||
notchName = "aB",
|
||||
mcpDesc = "()V",
|
||||
notchDesc = "()V")
|
||||
public void rightClickMouse(MethodNode methodNode, PatchManager.Environment env) {
|
||||
final InsnList insnList = new InsnList();
|
||||
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "rightClickMouseHook", "()Z", false));
|
||||
final LabelNode jmp = new LabelNode();
|
||||
insnList.add(new JumpInsnNode(IFEQ, jmp));
|
||||
insnList.add(new InsnNode(RETURN));
|
||||
insnList.add(jmp);
|
||||
methodNode.instructions.insert(insnList);
|
||||
}
|
||||
|
||||
public static boolean rightClickMouseHook() {
|
||||
final EventMouseRightClick event = new EventMouseRightClick();
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
|
||||
return event.isCanceled();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue