Skip to content

Commit

Permalink
Pests ESP:
Browse files Browse the repository at this point in the history
 = Tweaks

Pests Destroyer on the track:
 = Adjustments

Logs:
 - Removed some of the unneeded logs
  • Loading branch information
May2Beez committed Mar 17, 2024
1 parent 441f75b commit f2bface
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
mcVersion=1.8.9
modid=farmhelperv2
modName=FarmHelper
version=2.5.0-pre6
version=2.5.0-pre7
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ public void onMessage(String message) {
}
}
receivedBanwaveInfo = true;
System.out.println("Banwave info received: " + bans + " global staff bans in the last " + minutes + " minutes, " + bansByMod + " bans by this mod");
break;
}
case "playerGotBanned": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,13 @@ public void onRender(RenderWorldLastEvent event) {
if (this.pests.stream().anyMatch(pest -> displayName.contains(pest.getSecond()))) {
if (killedEntities.contains(entity)) return false;
Entity realEntity = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityBat || e instanceof EntitySilverfish);
if (realEntity != null && (killedEntities.contains(realEntity) || realEntity.isDead))
Entity nameEntity = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityArmorStand && e != entity);
if (realEntity != null && (killedEntities.contains(realEntity) || realEntity.isDead)) {
return false;
}
if (nameEntity != null && (killedEntities.contains(nameEntity))) {
return false;
}
return killedEntities.stream().noneMatch(ke -> ke.getDistanceToEntity(entity) < 1.5);
}
}
Expand Down Expand Up @@ -1132,17 +1137,27 @@ public void onEntityDeath(LivingDeathEvent event) {
}
if (entity instanceof EntityArmorStand) {
Entity realEntity = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityBat || e instanceof EntitySilverfish);
Entity nameEntity = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityArmorStand && e != entity);
if (realEntity != null) {
LogUtils.sendDebug("[Pests Destroyer] Found real entity: " + realEntity.getName() + "(" + realEntity.getEntityId() + ")" + " at: " + realEntity.getPosition());
killedEntities.add(realEntity);
}
if (nameEntity != null) {
LogUtils.sendDebug("[Pests Destroyer] Found name entity: " + nameEntity.getName() + "(" + nameEntity.getEntityId() + ")" + " at: " + nameEntity.getPosition());
killedEntities.add(nameEntity);
}
}
if (entity instanceof EntityBat || entity instanceof EntitySilverfish) {
Entity armorStand = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityArmorStand);
Entity armorStand = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityArmorStand && e.getName().contains("Armor Stand"));
Entity nameEntity = PlayerUtils.getEntityCuttingOtherEntity(entity, (e) -> e instanceof EntityArmorStand && e != armorStand);
if (armorStand != null) {
LogUtils.sendDebug("[Pests Destroyer] Found armor stand: " + armorStand.getName() + "(" + armorStand.getEntityId() + ")" + " at: " + armorStand.getPosition());
killedEntities.add(armorStand);
}
if (nameEntity != null) {
LogUtils.sendDebug("[Pests Destroyer] Found name entity: " + nameEntity.getName() + "(" + nameEntity.getEntityId() + ")" + " at: " + nameEntity.getPosition());
killedEntities.add(nameEntity);
}
}
RotationHandler.getInstance().reset();
FlyPathFinderExecutor.getInstance().stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,18 @@ public void onTickShouldEnable(TickEvent.PlayerTickEvent event) {
if (!isToggled()) return;

if (getPest(true).isPresent()) {
start();
delayStart.schedule(500);
if (delayStart.isScheduled() && delayStart.passed()) {
start();
return;
}
if (delayStart.isScheduled() && !delayStart.passed()) return;
if (!delayStart.isScheduled()) {
delayStart.reset();
delayStart.schedule(1_500);
LogUtils.sendDebug("[" + getName() + "] Found pest, waiting for him to stay in range!");
}
} else {
delayStart.reset();
}
}

Expand All @@ -118,7 +128,9 @@ public void onTickExecution(TickEvent.PlayerTickEvent event) {
stop();
return;
}
if (delayStart.isScheduled() && !delayStart.passed()) return;

ItemStack currentItem = mc.thePlayer.getHeldItem();
PestsDestroyer.getInstance().getVacuum(currentItem);

Optional<Entity> entity = getPest(false);
if (entity.isPresent()) {
Expand Down Expand Up @@ -152,7 +164,7 @@ private Optional<Entity> getPest(boolean start) {
float yaw = (float) Math.toDegrees(Math.atan2(zDiff, xDiff)) - 90F;
return dist <= vacuumRange - 2 && yaw < FarmHelperConfig.pestsDestroyerOnTheTrackFOV / 2f;
}
return dist <= vacuumRange - 2;
return dist <= vacuumRange + 1.5;
}).min((e1, e2) -> {
double d1 = e1.getDistanceToEntity(mc.thePlayer);
double d2 = e2.getDistanceToEntity(mc.thePlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ public void onReceivedChat(ClientChatReceivedEvent event) {
Optional<String> optional = rngToCountList.stream().filter(message::contains).findFirst();
if (optional.isPresent()) {
String name = optional.get();
LogUtils.sendDebug("RNG DROP. Adding " + name + " to rng drops");
addRngDrop(name);
return;
}
Expand All @@ -425,7 +424,6 @@ public void onReceivedChat(ClientChatReceivedEvent event) {
if (matcher.group(2).contains("Block") || matcher.group(2).contains("Polished")) {
amountDropped *= 160;
}
LogUtils.sendDebug("RNG DROP. Adding " + amountDropped + " " + itemDropped + " to drops");
addDroppedItem(itemDropped, amountDropped);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public void easeTo(RotationConfiguration configuration) {
targetRotation.setYaw(startRotation.getYaw() + neededChange.getYaw());
targetRotation.setPitch(startRotation.getPitch() + neededChange.getPitch());

LogUtils.sendDebug("[Rotation] Needed change: " + neededChange.getYaw() + " " + neededChange.getPitch());

float absYaw = Math.max(Math.abs(neededChange.getYaw()), 1);
float absPitch = Math.max(Math.abs(neededChange.getPitch()), 1);
float pythagoras = pythagoras(absYaw, absPitch);
Expand Down Expand Up @@ -110,8 +108,6 @@ public void easeBackFromServerRotation() {
targetRotation.setYaw(startRotation.getYaw() + neededChange.getYaw());
targetRotation.setPitch(startRotation.getPitch() + neededChange.getPitch());

LogUtils.sendDebug("[Rotation] Needed change: " + neededChange.getYaw() + " " + neededChange.getPitch());

float time = configuration.time();
endTime = System.currentTimeMillis() + Math.max((long) time, 50);
configuration.callback(Optional.of(this::reset));
Expand Down Expand Up @@ -208,7 +204,6 @@ public boolean shouldRotate(Rotation to, float difference) {
}

public void reset() {
LogUtils.sendDebug("[Rotation] Resetting");
rotating = false;
configuration = null;
startTime = 0;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/jelly/farmhelperv2/util/PlayerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public static void getTool() {
LogUtils.sendError("No tool found!");
return;
}
LogUtils.sendDebug("Tool id: " + id + " current item: " + mc.thePlayer.inventory.currentItem);
if (id == mc.thePlayer.inventory.currentItem) return;
mc.thePlayer.inventory.currentItem = id;
}
Expand Down

0 comments on commit f2bface

Please sign in to comment.