Upload files to "src/openonyx/features/combat"

This commit is contained in:
winterflyt committed 2026-11-30 05:48:27 +02:00
1 parent b86b04326a
commit 2bdf1a80d8
5 files changed
+1748

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
package openonyx.features.combat;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.scoreboard.ScorePlayerTeam;
import openonyx.configuration.internal.TickEvent;
import openonyx.configuration.internal.WorldChangeEvent;
import openonyx.core.OnyxClient;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.BooleanSetting;
public class AntiBot extends Module {
public BooleanSetting hideVisuals;
private volatile Set<String> strings;
public BooleanSetting tabCheck = new BooleanSetting("Tab check", false).describe("Also flags any player whose name is absent from the tab list");
public static boolean L(EntityPlayer entityPlayer) {
EntityPlayer entityPlayer1 = entityPlayer;
AntiBot antiBot;
if ((antiBot = L()) == null || !antiBot.isEnabled()) {
return false;
} else if (mc.isSingleplayer()) {
return false;
} else if (antiBot.tabCheck.isEnabled() && !antiBot.strings.contains(entityPlayer1.getName())) {
return true;
} else if (entityPlayer1 instanceof EntityPlayerSP) {
return false;
} else {
NetHandlerPlayClient netHandlerPlayClient;
if ((netHandlerPlayClient = mc.getNetHandler()) == null) {
return false;
} else {
NetworkPlayerInfo networkPlayerInfo;
if ((networkPlayerInfo = netHandlerPlayClient.getPlayerInfo(entityPlayer1.getName())) == null) {
return true;
} else if (entityPlayer1.getName().startsWith("§k")) {
return entityPlayer1.isInvisible();
} else if (networkPlayerInfo.getResponseTime() < 1) {
return true;
} else {
ScorePlayerTeam scorePlayerTeam;
if ((scorePlayerTeam = networkPlayerInfo.getPlayerTeam()) == null) {
return false;
} else {
return !scorePlayerTeam.getRegisteredName().isEmpty() ? false : scorePlayerTeam.getColorPrefix().equals("§c");
}
}
}
}
}
public static boolean L(Entity entity) {
Entity entity1 = entity;
AntiBot antiBot;
return (antiBot = L()) == null || !antiBot.isEnabled() || !antiBot.hideVisuals.isEnabled()
? false
: entity1 instanceof EntityPlayer && L((EntityPlayer)entity1);
}
public AntiBot() {
super("AntiBot", "Stops the combat modules from targeting bots", ModuleCategory.COMBAT);
this.hideVisuals = new BooleanSetting("Hide visuals", true)
.describe(
"Also keep the render modules off flagged bots - no ESP, glow, chams, boxes, skeleton or name tag on a player the combat modules already ignore"
);
this.strings = new HashSet<>();
}
private static AntiBot L() {
return OnyxClient.moduleManager == null ? null : OnyxClient.moduleManager.antiBot;
}
@EventHandler
public void onTick(TickEvent tickEvent) {
AntiBot antiBot1 = this;
if (mc.thePlayer != null && mc.getNetHandler() != null) {
HashSet hashSet = new HashSet();
Iterator iterator;
Iterator iterator1 = iterator = mc.getNetHandler().getPlayerInfoMap().iterator();
while (iterator1.hasNext()) {
NetworkPlayerInfo networkPlayerInfo;
if ((networkPlayerInfo = (NetworkPlayerInfo)iterator.next()).getGameProfile().getId().equals(mc.thePlayer.getUniqueID())) {
iterator1 = iterator;
} else {
hashSet.add(networkPlayerInfo.getGameProfile().getName());
iterator1 = iterator;
}
}
antiBot1.strings = hashSet;
}
}
@EventHandler
public void onWorldChange(WorldChangeEvent worldChangeEvent) {
this.strings = new HashSet<>();
}
@Override
protected void onDisable() {
this.strings = new HashSet<>();
}
}
@@ -0,0 +1,14 @@
package openonyx.features.combat;
public enum AutoBlockMode {
WATCHDOG,
OFF;
private static AutoBlockMode[] L() {
AutoBlockMode[] autoBlockModes = new AutoBlockMode[2];
boolean bl = true;
autoBlockModes[0] = OFF;
autoBlockModes[1] = WATCHDOG;
return autoBlockModes;
}
}
@@ -0,0 +1,16 @@
package openonyx.features.combat;
public enum AutoBlockTrigger {
TOGGLE,
ALWAYS,
HOLD;
private static AutoBlockTrigger[] L() {
AutoBlockTrigger[] autoBlockTriggers = new AutoBlockTrigger[3];
boolean bl = true;
autoBlockTriggers[0] = ALWAYS;
autoBlockTriggers[1] = HOLD;
autoBlockTriggers[2] = TOGGLE;
return autoBlockTriggers;
}
}
@@ -0,0 +1,392 @@
package openonyx.features.combat;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBed;
import net.minecraft.block.BlockBed.EnumPartType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import openonyx.configuration.internal.TickEvent;
import openonyx.configuration.internal.WorldChangeEvent;
import openonyx.core.OnyxClient;
import openonyx.events.GeometryUtils;
import openonyx.events.Rotation;
import openonyx.events.RotationFixMode;
import openonyx.events.RotationManager;
import openonyx.events.RotationMath;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.EnumSetting;
import openonyx.history.internal.NumberSetting;
import openonyx.interaction.BlockUtils;
import openonyx.interaction.SwingMode;
import openonyx.utilities.Timer;
public class BedBreaker extends Module {
private boolean a;
public BooleanSetting prioritizeKillAura;
public NumberSetting range = new NumberSetting("Range", 4.5, 1.0, 6.0, 0.05).withSuffix("m");
public BooleanSetting ignoreOwnBed;
private BlockPos blockPos;
private int j;
private BlockPos blockPos2;
public BooleanSetting keepRotation;
private BlockPos blockPos3;
public EnumSetting<RotationFixMode> moveFix = new EnumSetting<>("Move fix", RotationFixMode.SILENT)
.describe("Keeps movement consistent with the rotation the server sees");
private static final long d = 10L;
public EnumSetting<SwingMode> swing = new EnumSetting<>("Swing", SwingMode.DO_NOT_HIDE).describe("How the mining swing is shown");
private static final long f = 400L;
private final Timer timer;
private final Timer timer2;
private EnumFacing L(BlockPos blockPos, Rotation rotation) {
Vec3 vec3 = GeometryUtils.L();
Vec3 vec31 = GeometryUtils.L(rotation.yaw(), rotation.pitch());
double dx = this.range.getFloat() + 1.0;
Vec3 vec32 = vec3.addVector(vec31.xCoord * dx, vec31.yCoord * dx, vec31.zCoord * dx);
MovingObjectPosition movingObjectPosition;
return (movingObjectPosition = mc.theWorld.rayTraceBlocks(vec3, vec32, false, false, false)) != null
&& movingObjectPosition.typeOfHit == MovingObjectType.BLOCK
&& blockPosx.equals(movingObjectPosition.getBlockPos())
&& movingObjectPosition.sideHit != null
? movingObjectPosition.sideHit
: this.L(blockPosx);
}
private BlockPos L(BlockPos blockPos) {
BedBreaker bedBreaker1 = this;
Vec3 vec3 = GeometryUtils.L();
boolean bl1 = false;
BlockPos blockPos1 = null;
double dx = -1.0;
double e = Double.MAX_VALUE;
boolean bl = false;
BlockPos[] blockPos2x;
int i = (blockPos2x = bedBreaker1.L(blockPosx)).length;
int jx;
for (int n = jx = 0; n < i; n = ++jx) {
BlockPos blockPos3x = blockPos2x[jx];
EnumFacing[] enumFacings1 = new EnumFacing[5];
boolean bl2 = true;
enumFacings1[0] = EnumFacing.UP;
enumFacings1[1] = EnumFacing.NORTH;
enumFacings1[2] = EnumFacing.EAST;
enumFacings1[3] = EnumFacing.SOUTH;
enumFacings1[4] = EnumFacing.WEST;
EnumFacing[] enumFacings = enumFacings1;
int k = enumFacings1.length;
int l;
for (int m = l = 0; m < k; m = ++l) {
EnumFacing enumFacing = enumFacings[l];
BlockPos blockPos4 = blockPos3x.offset(enumFacing);
Block block = mc.theWorld.getBlockState(blockPos4).getBlock();
if (bedBreaker1.L(blockPos4, block)) {
bl1 = true;
} else {
double fx;
if (!(block instanceof BlockBed) && bedBreaker1.L(blockPos4) && !((fx = bedBreaker1.L(blockPos4, block)) <= 0.0)) {
if (blockPos4.equals(bedBreaker1.blockPos3)) {
bl = true;
}
double g = vec3.squareDistanceTo(GeometryUtils.L(vec3, bedBreaker1.L(blockPos4)));
if (fx > dx || fx == dx && g < e) {
dx = fx;
e = g;
blockPos1 = blockPos4;
}
}
}
}
}
if (bl1) {
return blockPosx;
} else {
return bl ? bedBreaker1.blockPos3 : blockPos1;
}
}
private float L(ItemStack itemStack, Block block) {
if (itemStack == null) {
return 1.0F;
}
float fx = !itemStack.canHarvestBlock(block) && itemStack.getItem() instanceof ItemPickaxe ? 1.0F : itemStack.getStrVsBlock(block);
int i;
if (itemStack.getItem() instanceof ItemTool && fx > 1.0F && (i = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, itemStack)) > 0) {
fx += i * i + 1;
}
return fx;
}
@EventHandler
public void onTick(TickEvent tickEvent) {
BedBreaker bedBreaker1 = this;
if (mc.thePlayer != null && mc.theWorld != null) {
if (bedBreaker1.prioritizeKillAura.isEnabled() && OnyxClient.moduleManager.killAura.isEnabled()) {
if (OnyxClient.moduleManager.killAura.getPreviousTarget() != null) {
bedBreaker1.timer2.reset();
}
if (!bedBreaker1.timer2.hasReached(400L)) {
bedBreaker1.h();
return;
}
}
BlockPos blockPos1;
if ((blockPos1 = bedBreaker1.L()) == null) {
bedBreaker1.h();
} else {
BlockPos blockPosx;
if ((blockPosx = bedBreaker1.L(blockPos1)) == null) {
bedBreaker1.h();
} else {
bedBreaker1.blockPos = blockPos1;
Rotation rotation = RotationMath.L(bedBreaker1.L(blockPosx), RotationManager.L());
bedBreaker1.L(blockPosx, rotation);
EnumFacing enumFacing = bedBreaker1.L(blockPosx, rotation);
bedBreaker1.L(blockPosx);
mc.playerController.onPlayerDamageBlock(blockPosx, enumFacing);
bedBreaker1.swing.getValue().L();
bedBreaker1.blockPos2 = blockPosx;
bedBreaker1.blockPos3 = blockPosx;
}
}
}
}
private void L(BlockPos blockPos) {
BedBreaker bedBreaker1 = this;
Block block = mc.theWorld.getBlockState(blockPosx).getBlock();
int i = mc.thePlayer.inventory.currentItem;
int jx = mc.thePlayer.inventory.currentItem;
float fx = bedBreaker1.L(mc.thePlayer.inventory.getStackInSlot(i), block);
for (int l = k = 0; l < 9; l = ++k) {
float g;
if ((g = bedBreaker1.L(mc.thePlayer.inventory.getStackInSlot(k), block)) > fx) {
fx = g;
jx = k;
}
}
if (jx != i) {
if (bedBreaker1.j == -1) {
bedBreaker1.j = i;
}
mc.thePlayer.inventory.currentItem = jx;
}
}
private double L(BlockPos blockPos, Block block) {
float fx;
if ((fx = block.getBlockHardness(mc.theWorld, blockPosx)) < 0.0F) {
return -1.0;
} else {
return fx == 0.0F ? Double.MAX_VALUE : this.L(block) / fx;
}
}
private void L(BlockPos blockPos, Rotation rotation) {
if (this.keepRotation.isEnabled()) {
RotationManager.setRotation(rotation, this.moveFix.getValue());
} else if (!blockPosx.equals(this.blockPos2)) {
RotationManager.setRotation(rotation, this.moveFix.getValue());
this.timer.reset();
this.a = true;
} else {
if (this.a && this.timer.hasReached(10L)) {
RotationManager.d();
this.a = false;
}
}
}
public BedBreaker() {
super("BedBreaker", "Breaks nearby beds with the best tool", ModuleCategory.COMBAT);
this.keepRotation = new BooleanSetting("Keep rotation", false).describe("Holds the aim on the block the whole time instead of a brief flick per block");
this.ignoreOwnBed = new BooleanSetting("Ignore own bed", true).describe("Skips your team's bed, found from the BedWars start message and base teleport");
this.prioritizeKillAura = new BooleanSetting("Prioritize KillAura", false)
.describe("Pauses bed breaking while KillAura has a target so attacks take priority");
this.j = -1;
this.timer = new Timer();
this.timer2 = new Timer();
}
@Override
protected void onDisable() {
this.h();
}
private BlockPos[] L(BlockPos blockPos) {
IBlockState iBlockState;
if (!((iBlockState = mc.theWorld.getBlockState(blockPosx)).getBlock() instanceof BlockBed)) {
BlockPos[] blockPos2x = new BlockPos[1];
boolean bl = true;
blockPos2x[0] = blockPosx;
return blockPos2x;
} else {
EnumPartType enumPartType = iBlockState.getValue(BlockBed.PART);
EnumFacing enumFacing = iBlockState.getValue(BlockBed.FACING);
BlockPos blockPos1 = blockPosx.offset(enumPartType == EnumPartType.HEAD ? enumFacing.getOpposite() : enumFacing);
BlockPos[] blockPos3x = new BlockPos[2];
boolean bl1 = true;
blockPos3x[0] = blockPosx;
blockPos3x[1] = blockPos1;
return blockPos3x;
}
}
public BlockPos getBlockPos3() {
return this.blockPos3;
}
private float L(Block block) {
BedBreaker bedBreaker1 = this;
float fx = 1.0F;
int i;
for (int jx = i = 0; jx < 9; jx = i) {
ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
i++;
fx = Math.max(fx, bedBreaker1.L(itemStack, block));
}
return fx;
}
private void h() {
if (this.blockPos3 != null) {
mc.playerController.resetBlockRemoving();
this.blockPos3 = null;
}
if (this.j != -1) {
if (mc.thePlayer != null) {
mc.thePlayer.inventory.currentItem = this.j;
if (mc.playerController != null) {
mc.playerController.syncCurrentPlayItem();
}
}
this.j = -1;
}
this.blockPos2 = null;
this.blockPos = null;
this.a = false;
RotationManager.d();
}
private EnumFacing L(BlockPos blockPos) {
Vec3 vec3 = GeometryUtils.L();
EnumFacing enumFacing = EnumFacing.UP;
double dx = Double.MAX_VALUE;
EnumFacing[] enumFacings;
int i = (enumFacings = EnumFacing.values()).length;
int jx;
for (int k = jx = 0; k < i; k = ++jx) {
EnumFacing enumFacing1 = enumFacings[jx];
if (BlockUtils.d(blockPosx.offset(enumFacing1))) {
Vec3 vec31 = new Vec3(
blockPosx.getX() + 0.5 + enumFacing1.getFrontOffsetX() * 0.5,
blockPosx.getY() + 0.5 + enumFacing1.getFrontOffsetY() * 0.5,
blockPosx.getZ() + 0.5 + enumFacing1.getFrontOffsetZ() * 0.5
);
double e;
if ((e = vec3.squareDistanceTo(vec31)) < dx) {
dx = e;
enumFacing = enumFacing1;
}
}
}
return enumFacing;
}
private boolean L(BlockPos blockPos) {
double dx = this.range.getFloat();
Vec3 vec3 = GeometryUtils.L();
return vec3.squareDistanceTo(GeometryUtils.L(vec3, this.L(blockPosx))) <= dx * dx;
}
@EventHandler
public void onWorldChange(WorldChangeEvent worldChangeEvent) {
this.h();
}
private AxisAlignedBB L(BlockPos blockPos) {
return BlockUtils.L(blockPosx).offset(blockPosx.getX(), blockPosx.getY(), blockPosx.getZ());
}
public BlockPos getBlockPos() {
return this.blockPos;
}
private boolean L(BlockPos blockPos, Block block) {
return BlockUtils.d(blockPosx) || block.getMaterial().isReplaceable();
}
private BlockPos L() {
BedBreaker bedBreaker1 = this;
double dx;
double g = dx = bedBreaker1.range.getFloat();
double e = g * g;
Vec3 vec3 = GeometryUtils.L();
if (bedBreaker1.blockPos != null
&& mc.theWorld.getBlockState(bedBreaker1.blockPos).getBlock() instanceof BlockBed
&& (!bedBreaker1.ignoreOwnBed.isEnabled() || !BedTracker.INSTANCE.L(bedBreaker1.blockPos))
&& vec3.squareDistanceTo(GeometryUtils.L(vec3, bedBreaker1.L(bedBreaker1.blockPos))) <= e) {
return bedBreaker1.blockPos;
}
BlockPos blockPosx = new BlockPos(mc.thePlayer);
int l = (int)Math.ceil(dx);
BlockPos blockPos1 = null;
dx = Double.MAX_VALUE;
int i;
int jx;
for (int o = i = -l; o <= l; o = ++i) {
int k;
for (int m = jx = -l; m <= l; m = ++jx) {
for (int n = k = -l; n <= l; n = ++k) {
BlockPos blockPos2x = blockPosx.add(i, jx, k);
double fx;
if (mc.theWorld.getBlockState(blockPos2x).getBlock() instanceof BlockBed
&& (!bedBreaker1.ignoreOwnBed.isEnabled() || !BedTracker.INSTANCE.L(blockPos2x))
&& !((fx = vec3.squareDistanceTo(GeometryUtils.L(vec3, bedBreaker1.L(blockPos2x)))) > e)
&& fx < dx) {
dx = fx;
blockPos1 = blockPos2x;
}
}
}
}
return blockPos1;
}
private Vec3 L(BlockPos blockPos) {
return GeometryUtils.L(GeometryUtils.L(), this.L(blockPosx));
}
}
File diff suppressed because it is too large. Load diff