Skip to content

Commit

Permalink
Wow
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Jun 7, 2024
1 parent 46d968b commit 0caa832
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;

import java.util.Collection;
import java.util.UUID;

import static mcjty.theoneprobe.api.TextStyleClass.INFO;
import static mcjty.theoneprobe.api.TextStyleClass.LABEL;

Expand All @@ -39,30 +45,68 @@ public void addProbeEntityInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlaye
float aiMoveSpeed = entityLivingBase.getAIMoveSpeed();
int revengeTimer = entityLivingBase.getRevengeTimer();
boolean isOnFire = entityLivingBase.isBurning();
double posX = entityLivingBase.posX;
double posY = entityLivingBase.posY;
double posZ = entityLivingBase.posZ;
double motionX = entityLivingBase.motionX;
double motionY = entityLivingBase.motionY;
double motionZ = entityLivingBase.motionZ;
float health = entityLivingBase.getHealth();
float maxHealth = entityLivingBase.getMaxHealth();
Collection<PotionEffect> activeEffects = entityLivingBase.getActivePotionEffects();
UUID uuid = entityLivingBase.getUniqueID();
String entityName = entityLivingBase.getCustomNameTag();

vertical
.text(LABEL + "Step Height: " + INFO + stepHeight)
.text(LABEL + "Total armor: " + INFO + totalArmorValue)
.text(LABEL + "Total Armor: " + INFO + totalArmorValue)
.text(LABEL + "Age: " + INFO + age)
.text(LABEL + "Absorption: " + INFO + absorptionAmount)
.text(LABEL + "AI Move Speed: " + INFO + aiMoveSpeed)
.text(LABEL + "Revenge Timer: " + INFO + revengeTimer)
.text(LABEL + "On Fire: " + INFO + isOnFire);
.text(LABEL + "On Fire: " + INFO + isOnFire)
.text(LABEL + "Position: " + INFO + String.format("X: %.2f, Y: %.2f, Z: %.2f", posX, posY, posZ))
.text(LABEL + "Motion: " + INFO + String.format("X: %.2f, Y: %.2f, Z: %.2f", motionX, motionY, motionZ))
.text(LABEL + "Health: " + INFO + health + " / " + maxHealth);

if (ConfigSetup.showDebugUUID) {
vertical.text(LABEL + "UUID: " + INFO + uuid);
}
if (entityLivingBase.hasCustomName()) {
vertical.text(LABEL + "Custom Name: " + INFO + entityName);
}
if (!activeEffects.isEmpty()) {
vertical.text(LABEL + "Active Effects: ");
for (PotionEffect effect : activeEffects) {
vertical.text(INFO + effect.getEffectName() + " (" + effect.getAmplifier() + ") - " + effect.getDuration() + " ticks");
}
}
}
if (entity instanceof EntityAgeable) {

if (entity instanceof EntityAgeable) {
EntityAgeable entityAgeable = (EntityAgeable) entity;
int growingAge = entityAgeable.getGrowingAge();
vertical
.text(LABEL + "Growing Age: " + INFO + growingAge);
}
if (entity instanceof EntityWaterMob) {

if (entity instanceof EntityWaterMob) {
EntityWaterMob entityWaterMob = (EntityWaterMob) entity;
boolean canBreatheUnderwater = entityWaterMob.canBreatheUnderwater();
vertical
.text(LABEL + "Can Breath Underwater: " + INFO + canBreatheUnderwater)
.text(LABEL + "Can Breathe Underwater: " + INFO + canBreatheUnderwater)
.text(LABEL + "In Water: " + INFO + entityWaterMob.isInWater());
}

if (entity instanceof EntityPlayer) {
EntityPlayer entityPlayer = (EntityPlayer) entity;
int foodLevel = entityPlayer.getFoodStats().getFoodLevel();
float saturationLevel = entityPlayer.getFoodStats().getSaturationLevel();
vertical
.text(LABEL + "Food Level: " + INFO + foodLevel)
.text(LABEL + "Saturation Level: " + INFO + saturationLevel);
}
}
}
}

2 changes: 2 additions & 0 deletions src/main/java/mcjty/theoneprobe/config/ConfigSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class ConfigSetup {

public static float probeDistance = 6;
public static boolean showLiquids = false;
public static boolean showDebugUUID = false;
public static boolean isVisible = true;
public static boolean compactEqualStacks = true;
public static boolean holdKeyToMakeVisible = false;
Expand Down Expand Up @@ -129,6 +130,7 @@ public static IProbeConfig getRealConfig() {
}

public static void init(Configuration cfg) {
showDebugUUID = cfg.getBoolean("showDebugUUID", CATEGORY_THEONEPROBE, showDebugUUID,"Show a entities UUID in the debug probe menu");
loggingThrowableTimeout = cfg.getInt("loggingThrowableTimeout", CATEGORY_THEONEPROBE, loggingThrowableTimeout, 1, 10000000, "How much time (in ms) to wait before reporting an exception again");
needsProbe = cfg.getInt("needsProbe", CATEGORY_THEONEPROBE, needsProbe, 0, 3, "Is the probe needed to show the tooltip? 0 = no, 1 = yes, 2 = yes and clients cannot override, 3 = probe needed for extended info only");
extendedInMain = cfg.getBoolean("extendedInMain", CATEGORY_THEONEPROBE, extendedInMain, "If true the probe will automatically show extended information if it is in your main hand (so not required to sneak)");
Expand Down

0 comments on commit 0caa832

Please sign in to comment.