Adds ReachModule, Updates bugs
This commit is contained in:
parent
3901469a17
commit
ab94bcbb85
|
@ -164,6 +164,7 @@ public final class ModuleManager {
|
|||
add(new AutoEatModule());
|
||||
add(new NoFriendHurtModule());
|
||||
add(new DonkeyAlertModule());
|
||||
add(new ReachModule());
|
||||
|
||||
// p2w experience
|
||||
if (Seppuku.INSTANCE.getCapeManager().hasCape())
|
||||
|
|
|
@ -31,7 +31,10 @@ public final class VisualRangeModule extends Module {
|
|||
|
||||
@Listener
|
||||
public void onEntityAdded(EventAddEntity event) {
|
||||
if (Minecraft.getMinecraft().world != null && !Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
|
||||
if (Minecraft.getMinecraft().world == null || Minecraft.getMinecraft().player == null)
|
||||
return;
|
||||
|
||||
if (!Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
|
||||
final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(event.getEntity());
|
||||
final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has entered your visual range.";
|
||||
|
||||
|
@ -51,7 +54,10 @@ public final class VisualRangeModule extends Module {
|
|||
|
||||
@Listener
|
||||
public void onEntityRemove(EventRemoveEntity event) {
|
||||
if (Minecraft.getMinecraft().world != null && !Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
|
||||
if (Minecraft.getMinecraft().world == null || Minecraft.getMinecraft().player == null)
|
||||
return;
|
||||
|
||||
if (!Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
|
||||
if (this.prevPlayer != event.getEntity().getEntityId()) {
|
||||
this.prevPlayer = event.getEntity().getEntityId();
|
||||
final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(event.getEntity());
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
package me.rigamortis.seppuku.impl.module.player;
|
||||
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate;
|
||||
import me.rigamortis.seppuku.api.event.render.EventRender3D;
|
||||
import me.rigamortis.seppuku.api.event.world.EventLoadWorld;
|
||||
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;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
/**
|
||||
* @author noil
|
||||
*/
|
||||
public final class ReachModule extends Module {
|
||||
|
||||
public final Value<Float> distance = new Value<Float>("Distance", new String[]{"Dist", "D"}, "The distance (in blocks) to reach.", 5.0f, 0.0f, 10.0f, 0.5f);
|
||||
public final Value<Boolean> highlight = new Value<Boolean>("Highlight", new String[]{"Hover", "H"}, "Enables rendering the BlockHighlight for the extended reach.", true);
|
||||
public final Value<Boolean> blocks = new Value<Boolean>("Blocks", new String[]{"Block", "B"}, "Enables reaching for breaking & building blocks.", true);
|
||||
public final Value<Boolean> entities = new Value<Boolean>("Entities", new String[]{"Entity", "Entitie", "E"}, "Enables reaching for attacking and interacting with entities.", false);
|
||||
|
||||
private BlockHighlightModule blockHighlightModule = null;
|
||||
|
||||
private RayTraceResult currentBlockTrace = null;
|
||||
|
||||
public ReachModule() {
|
||||
super("Reach", new String[]{"Rch"}, "Extends the player's reach.", "NONE", -1, ModuleType.PLAYER);
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onLoadWorld(EventLoadWorld event) {
|
||||
if (event.getWorld() == null)
|
||||
return;
|
||||
|
||||
this.blockHighlightModule = (BlockHighlightModule) Seppuku.INSTANCE.getModuleManager().find(BlockHighlightModule.class);
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onRender3D(EventRender3D event) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (mc.player == null)
|
||||
return;
|
||||
|
||||
if (mc.objectMouseOver == null)
|
||||
return;
|
||||
|
||||
if (!mc.objectMouseOver.typeOfHit.equals(RayTraceResult.Type.MISS)) {
|
||||
this.currentBlockTrace = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.blocks.getValue()) {
|
||||
this.currentBlockTrace = mc.player.rayTrace(this.distance.getValue(), event.getPartialTicks());
|
||||
|
||||
if (!this.highlight.getValue())
|
||||
return;
|
||||
|
||||
if (this.blockHighlightModule != null && this.currentBlockTrace != null) {
|
||||
if (this.blockHighlightModule.isEnabled()) {
|
||||
this.blockHighlightModule.drawHighlight(this.currentBlockTrace, mc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onUpdate(EventPlayerUpdate event) {
|
||||
if (event.getStage() != EventStageable.EventStage.PRE)
|
||||
return;
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.player == null || mc.world == null)
|
||||
return;
|
||||
|
||||
if (this.blocks.getValue()) {
|
||||
if (this.currentBlockTrace == null)
|
||||
return;
|
||||
|
||||
if (this.currentBlockTrace.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
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);
|
||||
}
|
||||
} else if (mc.gameSettings.keyBindUseItem.pressed && mc.player.ticksExisted % 3 == 0) {
|
||||
final EnumActionResult actionResult = mc.playerController.processRightClickBlock(mc.player, mc.world, this.currentBlockTrace.getBlockPos(), this.currentBlockTrace.sideHit, new Vec3d(0d, 0d, 0d), EnumHand.MAIN_HAND);
|
||||
if (actionResult.equals(EnumActionResult.SUCCESS)) {
|
||||
mc.player.swingArm(EnumHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (this.entities.getValue()) {
|
||||
if (entityTraceResult == null) {
|
||||
if (mc.gameSettings.keyBindAttack.pressed) {
|
||||
System.out.println("ATTACJ");
|
||||
mc.playerController.attackEntity(mc.player, entityTraceResult.entityHit);
|
||||
} else if (mc.gameSettings.keyBindUseItem.pressed) {
|
||||
mc.playerController.interactWithEntity(mc.player, entityTraceResult.entityHit, EnumHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ public final class BlockHighlightModule extends Module {
|
|||
public final Value<Color> color = new Value<Color>("Color", new String[]{"Col", "c"}, "Edit the block highlight color.", new Color(255, 255, 255));
|
||||
public final Value<Integer> alpha = new Value<Integer>("Alpha", new String[]{"Alp", "Opacity", "a", "o"}, "Alpha value for the highlight visual.", 127, 0, 255, 1);
|
||||
public final Value<Float> width = new Value<Float>("Width", new String[]{"W", "size", "s"}, "Width value of the highlight visual.", 1.5f, 0.0f, 5.0f, 0.1f);
|
||||
public final Value<Boolean> breaking = new Value<Boolean>("Breaking", new String[]{"Break", "block", "brk"}, "Sizes the highlight visual based on the block breaking damage.", true);
|
||||
public final Value<Boolean> breaking = new Value<Boolean>("Breaking", new String[]{"Break", "block", "brk"}, "Sizes the highlight visual based on the block breaking damage.", false);
|
||||
|
||||
public enum Mode {
|
||||
BOX, OUTLINE, CROSS
|
||||
|
@ -42,15 +42,23 @@ public final class BlockHighlightModule extends Module {
|
|||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final RayTraceResult ray = mc.objectMouseOver;
|
||||
if (ray.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
this.drawHighlight(ray, mc);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawHighlight(final RayTraceResult ray, final Minecraft mc) {
|
||||
final BlockPos blockpos = ray.getBlockPos();
|
||||
final IBlockState iblockstate = mc.world.getBlockState(blockpos);
|
||||
if (iblockstate.getMaterial() != Material.AIR && mc.world.getWorldBorder().contains(blockpos)) {
|
||||
float currentDamage;
|
||||
float currentDamage = 0.0f;
|
||||
|
||||
if (mc.player.isSwingInProgress) {
|
||||
if (this.breaking.getValue()) {
|
||||
currentDamage = mc.playerController.curBlockDamageMP;
|
||||
currentDamage = Math.abs(mc.playerController.curBlockDamageMP);
|
||||
} else {
|
||||
currentDamage = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
RenderUtil.begin3D();
|
||||
final Vec3d interp = MathUtil.interpolateEntity(mc.player, mc.getRenderPartialTicks());
|
||||
|
@ -74,4 +82,3 @@ public final class BlockHighlightModule extends Module {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,33 +60,27 @@ public final class ChamsModule extends Module {
|
|||
Minecraft.getMinecraft().getRenderManager().setRenderShadow(false);
|
||||
Minecraft.getMinecraft().getRenderManager().setRenderOutlines(false);
|
||||
|
||||
switch (this.mode.getValue()) {
|
||||
case NORMAL:
|
||||
GlStateManager.pushMatrix();
|
||||
switch (this.mode.getValue().name().toLowerCase()) {
|
||||
case "normal":
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
|
||||
glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.0f, -1100000.0f);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
case TEXTURE:
|
||||
GlStateManager.pushMatrix();
|
||||
case "texture":
|
||||
glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.0f, -1100000.0f);
|
||||
glDisable(GL11.GL_TEXTURE_2D);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
case FLAT:
|
||||
GlStateManager.pushMatrix();
|
||||
case "flat":
|
||||
glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.0f, -1100000.0f);
|
||||
glDisable(GL11.GL_TEXTURE_2D);
|
||||
glDisable(GL11.GL_LIGHTING);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
case WIREFRAME:
|
||||
GlStateManager.pushMatrix();
|
||||
case "wireframe":
|
||||
glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||
glEnable(GL11.GL_POLYGON_OFFSET_LINE);
|
||||
glPolygonOffset(1.0f, -1100000.0f);
|
||||
|
@ -96,47 +90,41 @@ public final class ChamsModule extends Module {
|
|||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
glLineWidth(1);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
if (event.getStage() == EventStageable.EventStage.POST) {
|
||||
|
||||
Minecraft.getMinecraft().getRenderManager().setRenderShadow(shadow);
|
||||
|
||||
switch (this.mode.getValue()) {
|
||||
case NORMAL:
|
||||
GlStateManager.pushMatrix();
|
||||
switch (this.mode.getValue().name().toLowerCase()) {
|
||||
case "normal":
|
||||
glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.0f, 1100000.0f);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
case TEXTURE:
|
||||
GlStateManager.pushMatrix();
|
||||
case "texture":
|
||||
glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.0f, 1100000.0f);
|
||||
glEnable(GL11.GL_TEXTURE_2D);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
case FLAT:
|
||||
GlStateManager.pushMatrix();
|
||||
case "flat":
|
||||
glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(1.0f, 1100000.0f);
|
||||
glEnable(GL11.GL_TEXTURE_2D);
|
||||
glEnable(GL11.GL_LIGHTING);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
case WIREFRAME:
|
||||
GlStateManager.pushMatrix();
|
||||
case "wireframe":
|
||||
glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||
glDisable(GL11.GL_POLYGON_OFFSET_LINE);
|
||||
glPolygonOffset(1.0f, 1100000.0f);
|
||||
glEnable(GL11.GL_TEXTURE_2D);
|
||||
glEnable(GL11.GL_LIGHTING);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
GlStateManager.popMatrix();
|
||||
break;
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue