mirror of
https://github.com/seppukudevelopment/seppuku
synced 2025-01-29 02:12:47 +00:00
Added NoEntityTrace, Updated NoCrystal & CrystalAura, New Lagger mode, bug fixes
This commit is contained in:
parent
eea0e940da
commit
ac72a7e943
@ -28,6 +28,14 @@ compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = false
|
||||
outputDir = compileJava.destinationDir
|
||||
testOutputDir = compileTestJava.destinationDir
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.5.2768"
|
||||
runDir = "run"
|
||||
|
@ -36,8 +36,6 @@ public class Camera {
|
||||
private final int WIDTH_RESOLUTION = 800;
|
||||
private final int HEIGHT_RESOLUTION = 600;
|
||||
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public Camera() {
|
||||
this.pos = new Vec3d(0, 0, 0);
|
||||
this.yaw = 0;
|
||||
@ -74,6 +72,8 @@ public class Camera {
|
||||
}
|
||||
|
||||
public void updateFbo() {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (!this.firstUpdate) {
|
||||
mc.renderGlobal.loadRenderers();
|
||||
this.firstUpdate = true;
|
||||
|
@ -0,0 +1,9 @@
|
||||
package me.rigamortis.seppuku.api.event.entity;
|
||||
|
||||
import me.rigamortis.seppuku.api.event.EventCancellable;
|
||||
|
||||
/**
|
||||
* @author noil
|
||||
*/
|
||||
public class EventGetMouseOver extends EventCancellable {
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package me.rigamortis.seppuku.api.event.module;
|
||||
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
|
||||
/**
|
||||
* Author Seth
|
||||
* 6/10/2019 @ 2:36 PM.
|
||||
|
@ -1,15 +0,0 @@
|
||||
package me.rigamortis.seppuku.api.event.module;
|
||||
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
|
||||
public final class EventModulePostLoaded {
|
||||
private final Module module;
|
||||
|
||||
public EventModulePostLoaded(final Module module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public Module getModule() {
|
||||
return module;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package me.rigamortis.seppuku.api.task.block;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.play.client.CPacketEntityAction;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
/**
|
||||
* @author Daniel E
|
||||
*/
|
||||
public final class BlockPlacementRequest {
|
||||
private final BlockPos structurePosition;
|
||||
private final EnumFacing placeDirection;
|
||||
|
||||
public BlockPlacementRequest(final BlockPos structurePosition,
|
||||
final EnumFacing placeDirection) {
|
||||
this.structurePosition = structurePosition;
|
||||
this.placeDirection = placeDirection;
|
||||
}
|
||||
|
||||
public BlockPos getStructurePosition() {
|
||||
return structurePosition;
|
||||
}
|
||||
|
||||
public EnumFacing getPlaceDirection() {
|
||||
return placeDirection;
|
||||
}
|
||||
|
||||
public void handlePlaceRequest(final Minecraft minecraft) {
|
||||
final BlockPos structurePosition = this.getStructurePosition();
|
||||
final IBlockState structureBlockState = minecraft.world.getBlockState(structurePosition);
|
||||
final boolean blockActivated = structureBlockState.getBlock().onBlockActivated(minecraft.world,
|
||||
structurePosition, structureBlockState, minecraft.player, EnumHand.MAIN_HAND,
|
||||
EnumFacing.UP, 0.0f, 0.0f, 0.0f);
|
||||
if (blockActivated)
|
||||
minecraft.player.connection.sendPacket(new CPacketEntityAction(minecraft.player,
|
||||
CPacketEntityAction.Action.START_SNEAKING));
|
||||
|
||||
if (minecraft.playerController.processRightClickBlock(minecraft.player, minecraft.world,
|
||||
structurePosition, this.getPlaceDirection(),
|
||||
Vec3d.ZERO, EnumHand.MAIN_HAND) != EnumActionResult.FAIL)
|
||||
minecraft.player.swingArm(EnumHand.MAIN_HAND);
|
||||
|
||||
if (blockActivated)
|
||||
minecraft.player.connection.sendPacket(new CPacketEntityAction(minecraft.player,
|
||||
CPacketEntityAction.Action.STOP_SNEAKING));
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package me.rigamortis.seppuku.api.task.hand;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* @author Daniel E
|
||||
*/
|
||||
public final class HandSwapContext {
|
||||
private final int oldSlot;
|
||||
private final int newSlot;
|
||||
|
||||
public HandSwapContext(final int oldSlot, final int newSlot) {
|
||||
this.oldSlot = oldSlot;
|
||||
this.newSlot = newSlot;
|
||||
}
|
||||
|
||||
public int getOldSlot() {
|
||||
return oldSlot;
|
||||
}
|
||||
|
||||
public int getNewSlot() {
|
||||
return newSlot;
|
||||
}
|
||||
|
||||
public void handleHandSwap(final boolean restore,
|
||||
final Minecraft minecraft) {
|
||||
minecraft.player.inventory.currentItem =
|
||||
restore ? this.getOldSlot() : this.getNewSlot();
|
||||
minecraft.playerController.updateController();
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package me.rigamortis.seppuku.impl.management;
|
||||
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.module.EventModuleLoad;
|
||||
import me.rigamortis.seppuku.api.event.module.EventModulePostLoaded;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.util.ReflectionUtil;
|
||||
import me.rigamortis.seppuku.api.util.StringUtil;
|
||||
@ -157,6 +156,7 @@ public final class ModuleManager {
|
||||
add(new BridgeModule());
|
||||
add(new AutoFarmModule());
|
||||
add(new NoEffectsModule());
|
||||
add(new NoEntityTraceModule());
|
||||
|
||||
// p2w experience
|
||||
if (Seppuku.INSTANCE.getCapeManager().hasCape())
|
||||
@ -164,9 +164,6 @@ public final class ModuleManager {
|
||||
|
||||
this.loadExternalModules();
|
||||
|
||||
for (final Module module : moduleList)
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(new EventModulePostLoaded(module));
|
||||
|
||||
Collections.sort(moduleList, Comparator.comparing(Module::getDisplayName));
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
public final class CrystalAuraModule extends Module {
|
||||
|
||||
public final Value<Float> range = new Value("Range", new String[]{"Dist"}, "The minimum range to attack crystals.", 4.5f, 0.0f, 5.0f, 0.1f);
|
||||
public final Value<Float> delay = new Value("Attack_Delay", new String[]{"AttackDelay", "AttackDel", "Del"}, "The delay to attack in milliseconds.", 50.0f, 0.0f, 1000.0f, 1.0f);
|
||||
public final Value<Float> attackDelay = new Value("Attack_Delay", new String[]{"AttackDelay", "AttackDel", "Del"}, "The delay to attack in milliseconds.", 50.0f, 0.0f, 1000.0f, 1.0f);
|
||||
public final Value<Boolean> place = new Value("Place", new String[]{"AutoPlace"}, "Automatically place crystals.", true);
|
||||
public final Value<Float> placeDelay = new Value("Place_Delay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay to place crystals.", 50.0f, 0.0f, 1000.0f, 1.0f);
|
||||
public final Value<Float> minDamage = new Value("Min_Damage", new String[]{"MinDamage", "Min", "MinDmg"}, "The minimum explosion damage calculated to place down a crystal.", 1.0f, 0.0f, 20.0f, 0.5f);
|
||||
@ -51,10 +51,10 @@ public final class CrystalAuraModule extends Module {
|
||||
public final Value<Boolean> render = new Value("Render", new String[]{"R"}, "Draws information about recently placed crystals from your player.", true);
|
||||
public final Value<Boolean> renderDamage = new Value("Render_Damage", new String[]{"RD", "RenderDamage", "ShowDamage"}, "Draws calculated explosion damage on recently placed crystals from your player.", true);
|
||||
|
||||
private Timer attackTimer = new Timer();
|
||||
private Timer placeTimer = new Timer();
|
||||
private final Timer attackTimer = new Timer();
|
||||
private final Timer placeTimer = new Timer();
|
||||
|
||||
private List<PlaceLocation> placeLocations = new CopyOnWriteArrayList<>();
|
||||
private final List<PlaceLocation> placeLocations = new CopyOnWriteArrayList<>();
|
||||
|
||||
public CrystalAuraModule() {
|
||||
super("CrystalAura", new String[]{"AutoCrystal", "Crystal"}, "Automatically places crystals near enemies and detonates them", "NONE", -1, ModuleType.COMBAT);
|
||||
@ -85,7 +85,7 @@ public final class CrystalAuraModule extends Module {
|
||||
|
||||
if (canPlaceCrystal(blockPos)) {
|
||||
for (Entity entity : mc.world.loadedEntityList) {
|
||||
if (entity != null && entity instanceof EntityPlayer) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
final EntityPlayer player = (EntityPlayer) entity;
|
||||
if (player != mc.player && !player.getName().equals(mc.player.getName()) && player.getHealth() > 0 && Seppuku.INSTANCE.getFriendManager().isFriend(player) == null) {
|
||||
final double distToBlock = entity.getDistance(blockPos.getX() + 0.5f, blockPos.getY() + 1, blockPos.getZ() + 0.5f);
|
||||
@ -103,7 +103,7 @@ public final class CrystalAuraModule extends Module {
|
||||
|
||||
float localDamage = calculateExplosionDamage(mc.player, 6.0f, blockPos.getX() + 0.5f, blockPos.getY() + 1.0f, blockPos.getZ() + 0.5f) / 2.0f;
|
||||
|
||||
if (!canTakeDamage()) {
|
||||
if (this.isLocalImmune()) {
|
||||
localDamage = -1;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public final class CrystalAuraModule extends Module {
|
||||
}
|
||||
|
||||
for (Entity entity : mc.world.loadedEntityList) {
|
||||
if (entity != null && entity instanceof EntityEnderCrystal) {
|
||||
if (entity instanceof EntityEnderCrystal) {
|
||||
if (mc.player.getDistance(entity) <= this.range.getValue()) {
|
||||
for (Entity ent : mc.world.loadedEntityList) {
|
||||
if (ent != null && ent != mc.player && (ent.getDistance(entity) <= 14.0f) && ent != entity && ent instanceof EntityPlayer) {
|
||||
@ -137,14 +137,14 @@ public final class CrystalAuraModule extends Module {
|
||||
float currentDamage = calculateExplosionDamage(player, 6.0f, (float) entity.posX, (float) entity.posY, (float) entity.posZ) / 2.0f;
|
||||
float localDamage = calculateExplosionDamage(mc.player, 6.0f, (float) entity.posX, (float) entity.posY, (float) entity.posZ) / 2.0f;
|
||||
|
||||
if (!canTakeDamage()) {
|
||||
if (this.isLocalImmune()) {
|
||||
localDamage = -1;
|
||||
}
|
||||
|
||||
if (localDamage <= currentDamage && currentDamage >= this.minDamage.getValue()) {
|
||||
final float[] angle = MathUtil.calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), entity.getPositionVector());
|
||||
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(angle[0], angle[1]);
|
||||
if (this.attackTimer.passed(this.delay.getValue())) {
|
||||
if (this.attackTimer.passed(this.attackDelay.getValue())) {
|
||||
mc.player.swingArm(EnumHand.MAIN_HAND);
|
||||
mc.playerController.attackEntity(mc.player, entity);
|
||||
this.attackTimer.reset();
|
||||
@ -215,24 +215,20 @@ public final class CrystalAuraModule extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canTakeDamage() {
|
||||
private boolean isLocalImmune() {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (mc.player.capabilities.isCreativeMode) {
|
||||
return false;
|
||||
}
|
||||
if (mc.player.capabilities.isCreativeMode)
|
||||
return true;
|
||||
|
||||
final GodModeModule mod = (GodModeModule) Seppuku.INSTANCE.getModuleManager().find(GodModeModule.class);
|
||||
if (mod != null && mod.isEnabled())
|
||||
return true;
|
||||
|
||||
if (mod != null && mod.isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
if (this.ignore.getValue())
|
||||
return true;
|
||||
|
||||
if (this.ignore.getValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canPlaceCrystal(BlockPos pos) {
|
||||
@ -246,9 +242,7 @@ public final class CrystalAuraModule extends Module {
|
||||
|
||||
if (floor == Blocks.AIR && ceil == Blocks.AIR) {
|
||||
if (mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos.add(0, 1, 0))).isEmpty()) {
|
||||
if (mc.player.getDistance(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f) <= this.range.getValue()) {
|
||||
return true;
|
||||
}
|
||||
return mc.player.getDistance(pos.getX(), pos.getY(), pos.getZ()) <= this.range.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,11 +276,11 @@ public final class CrystalAuraModule extends Module {
|
||||
return damage;
|
||||
}
|
||||
|
||||
private final class PlaceLocation extends Vec3i {
|
||||
private static final class PlaceLocation extends Vec3i {
|
||||
|
||||
private int alpha = 0xAA;
|
||||
private boolean placed = false;
|
||||
private float damage;
|
||||
private final float damage;
|
||||
|
||||
private PlaceLocation(int xIn, int yIn, int zIn, float damage) {
|
||||
super(xIn, yIn, zIn);
|
||||
|
@ -1,20 +1,27 @@
|
||||
package me.rigamortis.seppuku.impl.module.combat;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.player.EventUpdateWalkingPlayer;
|
||||
import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.task.hand.HandSwapContext;
|
||||
import me.rigamortis.seppuku.api.util.MathUtil;
|
||||
import me.rigamortis.seppuku.api.util.Timer;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import me.rigamortis.seppuku.impl.module.player.FreeCamModule;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockObsidian;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.CPacketAnimation;
|
||||
import net.minecraft.network.play.client.CPacketEntityAction;
|
||||
import net.minecraft.network.play.client.CPacketPlayer;
|
||||
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@ -23,6 +30,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Seth
|
||||
* @since 5/15/2019 @ 9:20 AM.
|
||||
@ -31,15 +40,17 @@ public final class NoCrystalModule extends Module {
|
||||
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public final Value<Boolean> visible = new Value("Visible", new String[]{"Visible", "v"}, "When disabled, you will not see swing animations or sounds.", true);
|
||||
public final Value<Boolean> rotate = new Value("Rotate", new String[]{"rotation", "r", "rotate"}, "Rotate to place blocks", true);
|
||||
public final Value<Boolean> disable = new Value<Boolean>("Disable", new String[]{"dis"}, "Automatically disable after obsidian is placed.", false);
|
||||
public final Value<Boolean> visible = new Value<Boolean>("Visible", new String[]{"Visible", "v"}, "When disabled, you will not see swing animations or sounds.", true);
|
||||
public final Value<Boolean> rotate = new Value<Boolean>("Rotate", new String[]{"rotation", "r", "rotate"}, "Rotate to place blocks.", true);
|
||||
public final Value<Boolean> center = new Value<Boolean>("Center", new String[]{"centered", "c", "cen"}, "Centers the player on their current block when beginning to place.", true);
|
||||
public final Value<Boolean> extended = new Value<Boolean>("Extended", new String[]{"extend", "e", "big"}, "Enlarges the size of the fortress.", true);
|
||||
public final Value<Boolean> disable = new Value<Boolean>("Disable", new String[]{"dis", "autodisable", "autodis", "d"}, "Automatically disable after obsidian is placed.", false);
|
||||
public final Value<Boolean> sneak = new Value<Boolean>("PlaceOnSneak", new String[]{"sneak", "s", "pos", "sneakPlace"}, "When true, NoCrystal will only place while the player is sneaking.", false);
|
||||
public final Value<Float> placeDelay = new Value("Delay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay between obsidian blocks being placed.", 100.0f, 0.0f, 1000.0f, 1.0f);
|
||||
public final Value<Float> placeDelay = new Value<Float>("Delay", new String[]{"PlaceDelay", "PlaceDel"}, "The delay between obsidian blocks being placed.", 100.0f, 0.0f, 1000.0f, 1.0f);
|
||||
|
||||
private final Timer placeTimer = new Timer();
|
||||
|
||||
private Timer placeTimer = new Timer();
|
||||
private int placeIndex = 0;
|
||||
private FreeCamModule freeCamModule = null;
|
||||
|
||||
public NoCrystalModule() {
|
||||
super("NoCrystal", new String[]{"AntiCrystal", "FeetPlace", "Surround"}, "Automatically places obsidian around you to avoid crystal damage", "NONE", -1, ModuleType.COMBAT);
|
||||
@ -47,98 +58,151 @@ public final class NoCrystalModule extends Module {
|
||||
|
||||
@Listener
|
||||
public void onWalkingUpdate(EventUpdateWalkingPlayer event) {
|
||||
final boolean instant = placeDelay.getValue() == 0.0f;
|
||||
if (instant || this.placeTimer.passed(this.placeDelay.getValue())) {
|
||||
if (event.getStage() == EventStageable.EventStage.PRE) {
|
||||
if (!event.getStage().equals(EventStageable.EventStage.PRE))
|
||||
return;
|
||||
|
||||
final FreeCamModule freeCam = (FreeCamModule) Seppuku.INSTANCE.getModuleManager().find(FreeCamModule.class);
|
||||
if (freeCam != null && freeCam.isEnabled()) return;
|
||||
if (!mc.player.isSneaking() && this.sneak.getValue())
|
||||
return;
|
||||
|
||||
final Vec3d pos = MathUtil.interpolateEntity(mc.player, mc.getRenderPartialTicks());
|
||||
final float playerSpeed = (float) MathUtil.getDistance(pos, mc.player.posX, mc.player.posY, mc.player.posZ);
|
||||
if (freeCamModule != null && freeCamModule.isEnabled())
|
||||
return;
|
||||
|
||||
final BlockPos interpPos = new BlockPos(pos.x, pos.y, pos.z);
|
||||
final Vec3d pos = MathUtil.interpolateEntity(mc.player, mc.getRenderPartialTicks());
|
||||
final float playerSpeed = (float) MathUtil.getDistance(pos, mc.player.posX, mc.player.posY, mc.player.posZ);
|
||||
|
||||
final BlockPos north = interpPos.north();
|
||||
final BlockPos south = interpPos.south();
|
||||
final BlockPos east = interpPos.east();
|
||||
final BlockPos west = interpPos.west();
|
||||
if (!mc.player.onGround || playerSpeed > 0.005f)
|
||||
return;
|
||||
|
||||
final BlockPos[] surroundBlocks = {north.down(), south.down(), east.down(), west.down(),
|
||||
north, south, east, west};
|
||||
final BlockPos interpolatedPos = new BlockPos(pos.x, pos.y, pos.z);
|
||||
final BlockPos north = interpolatedPos.north();
|
||||
final BlockPos south = interpolatedPos.south();
|
||||
final BlockPos east = interpolatedPos.east();
|
||||
final BlockPos west = interpolatedPos.west();
|
||||
|
||||
int lastSlot = 0;
|
||||
final int slot = findStackHotbar(Blocks.OBSIDIAN);
|
||||
if (slot != -1) {
|
||||
// 0.005f: Absolute minimum velocity to register as standing still.
|
||||
// Don't ask me why, I'm just a comment.
|
||||
if ((mc.player.onGround && playerSpeed <= 0.005f) && (this.sneak.getValue() || (!mc.gameSettings.keyBindSneak.isKeyDown()))) {
|
||||
lastSlot = mc.player.inventory.currentItem;
|
||||
mc.player.inventory.currentItem = slot;
|
||||
mc.playerController.updateController();
|
||||
BlockPos[] surroundBlocks;
|
||||
if (this.extended.getValue()) {
|
||||
// ..x..
|
||||
// .xxx. x = to place block
|
||||
// xx@xx . = to ignore
|
||||
// .xxx. @ = player
|
||||
// ..x..
|
||||
surroundBlocks = new BlockPos[]{north.down(), south.down(), east.down(), west.down(),
|
||||
north, south, east, west, north.east(), north.west(), south.east(), south.west(),
|
||||
north.north(), south.south(), east.east(), west.west()};
|
||||
} else {
|
||||
// ..x.. x = to place block
|
||||
// .x@x. . = to ignore
|
||||
// ..x.. @ = player
|
||||
surroundBlocks = new BlockPos[]{north.down(), south.down(), east.down(), west.down(),
|
||||
north, south, east, west};
|
||||
}
|
||||
|
||||
place(surroundBlocks[placeIndex]);
|
||||
final List<BlockPos> blocksToPlace = Lists.newArrayListWithCapacity(8);
|
||||
|
||||
if (!instant) this.placeTimer.reset();
|
||||
if (placeIndex >= surroundBlocks.length - 1) {
|
||||
placeIndex = 0;
|
||||
if (this.disable.getValue()) this.toggle();
|
||||
} else placeIndex++;
|
||||
}
|
||||
if (!slotEqualsBlock(lastSlot, Blocks.OBSIDIAN)) mc.player.inventory.currentItem = lastSlot;
|
||||
mc.playerController.updateController();
|
||||
// find missing blocks (starting from under the player first and going upwards)
|
||||
for (int i = 0; i < surroundBlocks.length; i++) {
|
||||
BlockPos blockPos = surroundBlocks[i];
|
||||
if (!this.valid(blockPos))
|
||||
continue;
|
||||
|
||||
blocksToPlace.add(blockPos);
|
||||
}
|
||||
|
||||
if (!blocksToPlace.isEmpty()) { // we have blocks to place
|
||||
final HandSwapContext handSwapContext = new HandSwapContext(
|
||||
mc.player.inventory.currentItem, this.findObsidianInHotbar(mc.player));
|
||||
if (handSwapContext.getNewSlot() == -1)
|
||||
return;
|
||||
|
||||
// swap to obby
|
||||
handSwapContext.handleHandSwap(false, mc);
|
||||
|
||||
// 0.005f: Absolute minimum velocity to register as standing still.
|
||||
// Don't ask me why, I'm just a comment.
|
||||
for (BlockPos blockPos : blocksToPlace) {
|
||||
if (this.center.getValue()) {
|
||||
final double[] newPos = {Math.floor(mc.player.posX) + 0.5d, mc.player.posY, Math.floor(mc.player.posZ) + 0.5d};
|
||||
final CPacketPlayer.Position middleOfPos = new CPacketPlayer.Position(newPos[0], newPos[1], newPos[2], mc.player.onGround);
|
||||
mc.player.connection.sendPacket(middleOfPos);
|
||||
mc.player.setPosition(newPos[0], newPos[1], newPos[2]);
|
||||
}
|
||||
|
||||
if (this.placeDelay.getValue() <= 0.0f) {
|
||||
this.place(blockPos);
|
||||
} else if (placeTimer.passed(this.placeDelay.getValue())) {
|
||||
this.place(blockPos);
|
||||
this.placeTimer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
// swap back to original
|
||||
handSwapContext.handleHandSwap(true, mc);
|
||||
}
|
||||
|
||||
if (this.disable.getValue()) {
|
||||
if (blocksToPlace.size() == 0) // no more blocks
|
||||
this.toggle(); // auto disable
|
||||
}
|
||||
}
|
||||
|
||||
private boolean slotEqualsBlock(int slot, Block type) {
|
||||
if (mc.player.inventory.getStackInSlot(slot).getItem() instanceof ItemBlock) {
|
||||
final ItemBlock block = (ItemBlock) mc.player.inventory.getStackInSlot(slot).getItem();
|
||||
return block.getBlock() == type;
|
||||
@Listener
|
||||
public void onLoadWorld(EventLoadWorld event) {
|
||||
if (event.getWorld() != null) {
|
||||
freeCamModule = (FreeCamModule) Seppuku.INSTANCE.getModuleManager().find(FreeCamModule.class);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isItemStackObsidian(final ItemStack itemStack) {
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
return ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockObsidian;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int findStackHotbar(Block type) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (slotEqualsBlock(i, type)) return i;
|
||||
}
|
||||
private int findObsidianInHotbar(final EntityPlayerSP player) {
|
||||
for (int index = 0; InventoryPlayer.isHotbar(index); index++)
|
||||
if (this.isItemStackObsidian(player.inventory.getStackInSlot(index)))
|
||||
return index;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private boolean valid(BlockPos pos) {
|
||||
// There are no entities to block placement,
|
||||
if (!mc.world.checkNoEntityCollision(new AxisAlignedBB(pos))) return false;
|
||||
if (!mc.world.checkNoEntityCollision(new AxisAlignedBB(pos)))
|
||||
return false;
|
||||
// Check if the block is replaceable
|
||||
return mc.world.getBlockState(pos).getBlock().isReplaceable(mc.world, pos);
|
||||
}
|
||||
|
||||
private void place(BlockPos pos) {
|
||||
final Block block = mc.world.getBlockState(pos).getBlock();
|
||||
final EnumFacing direction = calcSide(pos);
|
||||
final boolean activated = block.onBlockActivated(mc.world, pos, mc.world.getBlockState(pos), mc.player, EnumHand.MAIN_HAND, direction, 0, 0, 0);
|
||||
|
||||
if (!valid(pos)) return;
|
||||
final EnumFacing direction = this.calcSide(pos);
|
||||
if (direction == null)
|
||||
return;
|
||||
|
||||
final boolean activated = block.onBlockActivated(mc.world, pos, mc.world.getBlockState(pos), mc.player, EnumHand.MAIN_HAND, direction, 0, 0, 0);
|
||||
|
||||
if (activated)
|
||||
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING));
|
||||
if (direction != null) {
|
||||
final EnumFacing otherSide = direction.getOpposite();
|
||||
final BlockPos sideOffset = pos.offset(direction);
|
||||
|
||||
if (rotate.getValue()) {
|
||||
final float[] angle = MathUtil.calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), new Vec3d(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f));
|
||||
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(angle[0], angle[1]);
|
||||
}
|
||||
if (!visible.getValue()) {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(sideOffset, otherSide, EnumHand.MAIN_HAND, 0.5F, 0.5F, 0.5F));
|
||||
mc.player.connection.sendPacket(new CPacketAnimation(EnumHand.MAIN_HAND));
|
||||
} else {
|
||||
mc.playerController.processRightClickBlock(mc.player, mc.world, sideOffset, otherSide, new Vec3d(0.5F, 0.5F, 0.5F), EnumHand.MAIN_HAND);
|
||||
mc.player.swingArm(EnumHand.MAIN_HAND);
|
||||
}
|
||||
final EnumFacing otherSide = direction.getOpposite();
|
||||
final BlockPos sideOffset = pos.offset(direction);
|
||||
|
||||
if (rotate.getValue()) {
|
||||
final float[] angle = MathUtil.calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), new Vec3d(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f));
|
||||
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(angle[0], angle[1]);
|
||||
}
|
||||
|
||||
if (!visible.getValue()) {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(sideOffset, otherSide, EnumHand.MAIN_HAND, 0.5F, 0.5F, 0.5F));
|
||||
mc.player.connection.sendPacket(new CPacketAnimation(EnumHand.MAIN_HAND));
|
||||
} else {
|
||||
mc.playerController.processRightClickBlock(mc.player, mc.world, sideOffset, otherSide, new Vec3d(0.5F, 0.5F, 0.5F), EnumHand.MAIN_HAND);
|
||||
mc.player.swingArm(EnumHand.MAIN_HAND);
|
||||
}
|
||||
|
||||
if (activated)
|
||||
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING));
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package me.rigamortis.seppuku.impl.module.combat;
|
||||
|
||||
import me.rigamortis.seppuku.api.event.entity.EventGetMouseOver;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
/**
|
||||
* @author noil
|
||||
*/
|
||||
public final class NoEntityTraceModule extends Module {
|
||||
|
||||
public NoEntityTraceModule() {
|
||||
super("NoEntityTrace", new String[]{"NoMiningTrace", "EntityTrace", "MiningTrace", "NoBB"}, "Mine through entities by overriding the moused over entity-list.", "NONE", -1, ModuleType.COMBAT);
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onGetMouseOver(EventGetMouseOver event) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
@ -2,26 +2,24 @@ package me.rigamortis.seppuku.impl.module.combat;
|
||||
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.module.EventModulePostLoaded;
|
||||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.event.player.EventUpdateWalkingPlayer;
|
||||
import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.task.block.BlockPlacementRequest;
|
||||
import me.rigamortis.seppuku.api.task.hand.HandSwapContext;
|
||||
import me.rigamortis.seppuku.impl.module.player.FreeCamModule;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockAir;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.BlockObsidian;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.CPacketEntityAction;
|
||||
import net.minecraft.network.play.server.SPacketBlockChange;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@ -46,7 +44,7 @@ public final class ObsidianReplaceModule extends Module {
|
||||
{0, 0, -1},
|
||||
};
|
||||
|
||||
private final Queue<PlacementRequest> placementRequests = new ConcurrentLinkedQueue<>();
|
||||
private final Queue<BlockPlacementRequest> placementRequests = new ConcurrentLinkedQueue<>();
|
||||
private FreeCamModule freeCamModule = null;
|
||||
|
||||
public ObsidianReplaceModule() {
|
||||
@ -73,19 +71,21 @@ public final class ObsidianReplaceModule extends Module {
|
||||
final Minecraft minecraft = Minecraft.getMinecraft();
|
||||
final EntityPlayerSP player = minecraft.player;
|
||||
final HandSwapContext handSwapContext = new HandSwapContext(
|
||||
player.inventory.currentItem, findObsidianInHotbar(player));
|
||||
player.inventory.currentItem, this.findObsidianInHotbar(player));
|
||||
if (handSwapContext.getNewSlot() == -1)
|
||||
return;
|
||||
|
||||
handleHandSwap(handSwapContext, false, minecraft);
|
||||
handSwapContext.handleHandSwap(false, minecraft);
|
||||
|
||||
final PlacementRequest placementRequest = placementRequests.poll();
|
||||
final double playerToBlockDistance = calculateVecDistance(
|
||||
player.getPositionEyes(1.0f), placementRequest.getStructurePosition());
|
||||
if (playerToBlockDistance <= getReachDistance(minecraft))
|
||||
handlePlaceRequest(minecraft, placementRequest);
|
||||
final BlockPlacementRequest placementRequest = placementRequests.poll();
|
||||
if (placementRequest != null) {
|
||||
final double playerToBlockDistance = calculateVecDistance(
|
||||
player.getPositionEyes(1.0f), placementRequest.getStructurePosition());
|
||||
if (playerToBlockDistance <= getReachDistance(minecraft))
|
||||
placementRequest.handlePlaceRequest(minecraft);
|
||||
}
|
||||
|
||||
handleHandSwap(handSwapContext, true, minecraft);
|
||||
handSwapContext.handleHandSwap(true, minecraft);
|
||||
}
|
||||
|
||||
@Listener
|
||||
@ -110,11 +110,9 @@ public final class ObsidianReplaceModule extends Module {
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onModulePostLoaded(final EventModulePostLoaded event) {
|
||||
if (event.getModule() instanceof FreeCamModule) {
|
||||
freeCamModule = (FreeCamModule) event.getModule();
|
||||
if (!Seppuku.INSTANCE.getEventManager().removeEventListener(this))
|
||||
throw new RuntimeException();
|
||||
public void onLoadWorld(EventLoadWorld event) {
|
||||
if (event.getWorld() != null) {
|
||||
freeCamModule = (FreeCamModule) Seppuku.INSTANCE.getModuleManager().find(FreeCamModule.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +131,7 @@ public final class ObsidianReplaceModule extends Module {
|
||||
continue;
|
||||
|
||||
final EnumFacing blockPlacementFace = calculateFaceForPlacement(relativePosition, position);
|
||||
if (blockPlacementFace != null && placementRequests.offer(new PlacementRequest(
|
||||
if (blockPlacementFace != null && placementRequests.offer(new BlockPlacementRequest(
|
||||
relativePosition, blockPlacementFace)))
|
||||
return;
|
||||
}
|
||||
@ -186,26 +184,6 @@ public final class ObsidianReplaceModule extends Module {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void handlePlaceRequest(final Minecraft minecraft, final PlacementRequest placementRequest) {
|
||||
final BlockPos structurePosition = placementRequest.getStructurePosition();
|
||||
final IBlockState structureBlockState = minecraft.world.getBlockState(structurePosition);
|
||||
final boolean blockActivated = structureBlockState.getBlock().onBlockActivated(minecraft.world,
|
||||
structurePosition, structureBlockState, minecraft.player, EnumHand.MAIN_HAND,
|
||||
EnumFacing.UP, 0.0f, 0.0f, 0.0f);
|
||||
if (blockActivated)
|
||||
minecraft.player.connection.sendPacket(new CPacketEntityAction(minecraft.player,
|
||||
CPacketEntityAction.Action.START_SNEAKING));
|
||||
|
||||
if (minecraft.playerController.processRightClickBlock(minecraft.player, minecraft.world,
|
||||
structurePosition, placementRequest.getPlaceDirection(),
|
||||
Vec3d.ZERO, EnumHand.MAIN_HAND) != EnumActionResult.FAIL)
|
||||
minecraft.player.swingArm(EnumHand.MAIN_HAND);
|
||||
|
||||
if (blockActivated)
|
||||
minecraft.player.connection.sendPacket(new CPacketEntityAction(minecraft.player,
|
||||
CPacketEntityAction.Action.STOP_SNEAKING));
|
||||
}
|
||||
|
||||
private boolean isItemStackObsidian(final ItemStack itemStack) {
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
return ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockObsidian;
|
||||
@ -215,7 +193,7 @@ public final class ObsidianReplaceModule extends Module {
|
||||
|
||||
private int findObsidianInHotbar(final EntityPlayerSP player) {
|
||||
for (int index = 0; InventoryPlayer.isHotbar(index); index++)
|
||||
if (isItemStackObsidian(player.inventory.getStackInSlot(index)))
|
||||
if (this.isItemStackObsidian(player.inventory.getStackInSlot(index)))
|
||||
return index;
|
||||
|
||||
return -1;
|
||||
@ -233,48 +211,4 @@ public final class ObsidianReplaceModule extends Module {
|
||||
final double diffZ = blockPosition.getZ() - vec.z;
|
||||
return MathHelper.sqrt(diffX * diffX + diffY * diffY + diffZ * diffZ);
|
||||
}
|
||||
|
||||
private void handleHandSwap(final HandSwapContext context, final boolean restore,
|
||||
final Minecraft minecraft) {
|
||||
minecraft.player.inventory.currentItem =
|
||||
restore ? context.getOldSlot() : context.getNewSlot();
|
||||
minecraft.playerController.updateController();
|
||||
}
|
||||
|
||||
private static final class HandSwapContext {
|
||||
private final int oldSlot;
|
||||
private final int newSlot;
|
||||
|
||||
HandSwapContext(final int oldSlot, final int newSlot) {
|
||||
this.oldSlot = oldSlot;
|
||||
this.newSlot = newSlot;
|
||||
}
|
||||
|
||||
int getOldSlot() {
|
||||
return oldSlot;
|
||||
}
|
||||
|
||||
int getNewSlot() {
|
||||
return newSlot;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class PlacementRequest {
|
||||
private final BlockPos structurePosition;
|
||||
private final EnumFacing placeDirection;
|
||||
|
||||
PlacementRequest(final BlockPos structurePosition,
|
||||
final EnumFacing placeDirection) {
|
||||
this.structurePosition = structurePosition;
|
||||
this.placeDirection = placeDirection;
|
||||
}
|
||||
|
||||
BlockPos getStructurePosition() {
|
||||
return structurePosition;
|
||||
}
|
||||
|
||||
EnumFacing getPlaceDirection() {
|
||||
return placeDirection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,23 @@
|
||||
package me.rigamortis.seppuku.impl.module.misc;
|
||||
|
||||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.minecraft.EventDisplayGui;
|
||||
import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.network.play.client.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntitySign;
|
||||
import net.minecraft.tileentity.*;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
@ -28,12 +32,12 @@ public final class LaggerModule extends Module {
|
||||
public final Value<Mode> mode = new Value<Mode>("Mode", new String[]{"Mode", "M"}, "Change between various lagger modes, each utilizing a different exploit to cause lag.", Mode.BOXER);
|
||||
|
||||
private enum Mode {
|
||||
BOXER, SWAP, MOVEMENT, SIGN, NBT
|
||||
BOXER, SWAP, MOVEMENT, SIGN, NBT, CONTAINER
|
||||
}
|
||||
|
||||
public final Value<Integer> packets = new Value<Integer>("Packets", new String[]{"pckts", "packet"}, "Amount of packets to send each tick while running the chosen lag mode.", 500, 0, 5000, 1);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
private Container lastContainer = null;
|
||||
|
||||
public LaggerModule() {
|
||||
super("Lagger", new String[]{"Lag"}, "Spams unoptimized packets", "NONE", -1, ModuleType.MISC);
|
||||
@ -47,6 +51,10 @@ public final class LaggerModule extends Module {
|
||||
@Listener
|
||||
public void onUpdate(EventPlayerUpdate event) {
|
||||
if (event.getStage() == EventStageable.EventStage.PRE) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.player == null || mc.world == null)
|
||||
return;
|
||||
|
||||
switch (this.mode.getValue()) {
|
||||
case BOXER:
|
||||
for (int i = 0; i <= this.packets.getValue(); i++) {
|
||||
@ -99,8 +107,30 @@ public final class LaggerModule extends Module {
|
||||
//mc.player.connection.sendPacket(new CPacketClickWindow(0, 0, 0, ClickType.PICKUP, itemStack, (short)0));
|
||||
}
|
||||
break;
|
||||
case CONTAINER:
|
||||
for (TileEntity tileEntity : mc.world.loadedTileEntityList) {
|
||||
if (tileEntity instanceof TileEntityChest || tileEntity instanceof TileEntityShulkerBox || tileEntity instanceof TileEntityEnderChest) {
|
||||
if (mc.player.openContainer != this.lastContainer) {
|
||||
mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(tileEntity.getPos(), EnumFacing.DOWN, EnumHand.MAIN_HAND, 0, 0, 0));
|
||||
mc.player.connection.sendPacket(new CPacketCloseWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onDisplayGui(EventDisplayGui event) {
|
||||
if (event.getScreen() != null) {
|
||||
if (this.mode.getValue().equals(Mode.CONTAINER)) {
|
||||
if (!(event.getScreen() instanceof GuiInventory) && event.getScreen() instanceof GuiContainer) {
|
||||
GuiContainer guiContainer = (GuiContainer) event.getScreen();
|
||||
this.lastContainer = guiContainer.inventorySlots;
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
public class MiddleClickPearlModule extends Module {
|
||||
private boolean clicked;
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public MiddleClickPearlModule() {
|
||||
super("MiddleClickPearl", new String[]{"mcp", "autopearl"}, "Throws a pearl if you middle-click pointing in mid-air", "NONE", -1, ModuleType.MISC);
|
||||
@ -23,12 +22,16 @@ public class MiddleClickPearlModule extends Module {
|
||||
@Listener
|
||||
public void onUpdate(EventPlayerUpdate event) {
|
||||
if (event.getStage() == EventStageable.EventStage.PRE) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.player == null || mc.world == null)
|
||||
return;
|
||||
|
||||
if (mc.currentScreen == null) {
|
||||
if (Mouse.isButtonDown(2)) {
|
||||
if (!this.clicked) {
|
||||
final RayTraceResult result = mc.objectMouseOver;
|
||||
if (result != null && result.typeOfHit == RayTraceResult.Type.MISS) {
|
||||
final int pearlSlot = findPearlInHotbar();
|
||||
final int pearlSlot = findPearlInHotbar(mc);
|
||||
if (pearlSlot != -1) {
|
||||
final int oldSlot = mc.player.inventory.currentItem;
|
||||
mc.player.inventory.currentItem = pearlSlot;
|
||||
@ -49,7 +52,7 @@ public class MiddleClickPearlModule extends Module {
|
||||
return itemStack.getItem() instanceof ItemEnderPearl;
|
||||
}
|
||||
|
||||
private int findPearlInHotbar() {
|
||||
private int findPearlInHotbar(final Minecraft mc) {
|
||||
for (int index = 0; InventoryPlayer.isHotbar(index); index++) {
|
||||
if (isItemStackPearl(mc.player.inventory.getStackInSlot(index))) return index;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.rigamortis.seppuku.impl.patch;
|
||||
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.entity.EventGetMouseOver;
|
||||
import me.rigamortis.seppuku.api.event.player.EventFovModifier;
|
||||
import me.rigamortis.seppuku.api.event.render.EventHurtCamEffect;
|
||||
import me.rigamortis.seppuku.api.event.render.EventOrientCamera;
|
||||
@ -12,10 +13,14 @@ import me.rigamortis.seppuku.api.util.ASMUtil;
|
||||
import me.rigamortis.seppuku.impl.management.PatchManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.*;
|
||||
import team.stiff.pomelo.EventManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
/**
|
||||
@ -204,4 +209,30 @@ public final class EntityRendererPatch extends ClassPatch {
|
||||
methodNode.instructions.insert(insnList);
|
||||
}
|
||||
|
||||
@MethodPatch(
|
||||
mcpName = "getMouseOver",
|
||||
notchName = "a",
|
||||
mcpDesc = "(F)V")
|
||||
public void getMouseOver(MethodNode methodNode, PatchManager.Environment env) {
|
||||
final AbstractInsnNode target = ASMUtil.findMethodInsn(methodNode, INVOKEVIRTUAL, env == PatchManager.Environment.IDE ? "net/minecraft/client/multiplayer/WorldClient" : "bsb", env == PatchManager.Environment.IDE ? "getEntitiesInAABBexcluding" : "a", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/AxisAlignedBB;Lcom/google/common/base/Predicate;)Ljava/util/List;" : "(Lvg;Lbhb;Lcom/google/common/base/Predicate;)Ljava/util/List;");
|
||||
|
||||
if (target != null) {
|
||||
final InsnList insnList = new InsnList();
|
||||
insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "getMouseOverHook", "()Z", false));
|
||||
final LabelNode jmp = new LabelNode();
|
||||
insnList.add(new JumpInsnNode(IFEQ, jmp));
|
||||
insnList.add(new TypeInsnNode(NEW, Type.getInternalName(ArrayList.class)));
|
||||
insnList.add(new InsnNode(DUP));
|
||||
insnList.add(new MethodInsnNode(INVOKESPECIAL, Type.getInternalName(ArrayList.class), "<init>", "()V", false));
|
||||
insnList.add(new VarInsnNode(ASTORE, 14));
|
||||
insnList.add(jmp);
|
||||
methodNode.instructions.insert(target.getNext(), insnList);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getMouseOverHook() {
|
||||
final EventGetMouseOver event = new EventGetMouseOver();
|
||||
Seppuku.INSTANCE.getEventManager().dispatchEvent(event);
|
||||
return event.isCanceled();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user