use of net.minecraft.entity.mob.Monster in project MCDungeonsWeapons by chronosacaria.
the class ProspectorEnchantmentMixin method onProspectorEnchantmentKill.
@Inject(at = @At("HEAD"), method = "onDeath", cancellable = true)
private void onProspectorEnchantmentKill(DamageSource source, CallbackInfo ci) {
if (!(source.getAttacker() instanceof PlayerEntity))
return;
LivingEntity user = (LivingEntity) source.getAttacker();
LivingEntity target = (LivingEntity) (Object) this;
ItemStack mainHandStack = null;
if (user != null) {
mainHandStack = user.getMainHandStack();
}
if (McdwEnchantsConfig.getValue("prospector")) {
if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.PROSPECTOR, mainHandStack) >= 1)) {
int level = EnchantmentHelper.getLevel(EnchantsRegistry.PROSPECTOR, mainHandStack);
float prospectorChance = 0.05F * level;
float prospectorRand = user.getRandom().nextFloat();
if (prospectorRand <= prospectorChance) {
if (target instanceof Monster) {
ItemEntity emeraldDrop = new ItemEntity(target.world, target.getX(), target.getY(), target.getZ(), new ItemStack(Items.EMERALD, 1));
user.world.spawnEntity(emeraldDrop);
}
}
}
}
}
use of net.minecraft.entity.mob.Monster in project KiwiClient by TangyKiwi.
the class Nametags method onWorldRender.
@Subscribe
@AllowConcurrentEvents
public void onWorldRender(WorldRenderEvent.Post event) {
for (Entity entity : mc.world.getEntities()) {
Vec3d rPos = entity.getPos().subtract(RenderUtils.getInterpolationOffset(entity)).add(0, entity.getHeight(), 0);
double d = entity.squaredDistanceTo(mc.cameraEntity);
if (!(d > 4096.0D)) {
float scale = 1f;
if (Math.sqrt(d) > 10)
scale *= Math.sqrt(d) / 10;
if (entity instanceof ItemEntity && getSetting(3).asToggle().state) {
ItemEntity itemEntity = (ItemEntity) entity;
String name = itemEntity.getName().getString();
String customName = itemEntity.getStack().getName().getString();
String amount = "[x" + itemEntity.getStack().getCount() + "]";
if (!customName.equals(name)) {
double up = 0.7 + 0.9 * (Math.sqrt(d / 4096));
RenderUtils.drawWorldText(name + " " + getEmptyString(amount), rPos.x, rPos.y + up, rPos.z, scale, 0xFFAA00, true);
RenderUtils.drawWorldText(getEmptyString(name) + " " + amount, rPos.x, rPos.y + up, rPos.z, scale, 0xFFFF55, true);
RenderUtils.drawWorldText(customName, rPos.x, rPos.y + 0.5, rPos.z, scale, 0xFFAA00, true);
} else {
// RenderUtils.drawWorldText("\u00a76" + name + " " + "\u00a7e" + amount, rPos.x, rPos.y + 0.5, rPos.z, scale, -1, true);
RenderUtils.drawWorldText(name + " " + getEmptyString(amount), rPos.x, rPos.y + 0.5, rPos.z, scale, 0xFFAA00, true);
RenderUtils.drawWorldText(getEmptyString(name) + " " + amount, rPos.x, rPos.y + 0.5, rPos.z, scale, 0xFFFF55, true);
}
} else if (entity instanceof LivingEntity) {
if (entity == mc.player || entity.hasPassenger(mc.player) || mc.player.hasPassenger(entity)) {
continue;
}
if ((EntityUtils.isAnimal(entity) && getSetting(1).asToggle().state) || (entity instanceof Monster && getSetting(2).asToggle().state) || (entity instanceof PlayerEntity && getSetting(0).asToggle().state) || (entity instanceof ItemEntity && getSetting(3).asToggle().state)) {
LivingEntity livingEntity = (LivingEntity) entity;
String name = livingEntity.getName().getString();
String health = String.format("%.1f", livingEntity.getHealth());
RenderUtils.drawWorldText(name + " " + getEmptyString(health), rPos.x, rPos.y + 0.5, rPos.z, scale, 0xFFFFFF, true);
RenderUtils.drawWorldText(getEmptyString(name) + " " + health, rPos.x, rPos.y + 0.5, rPos.z, scale, getHealthColor(livingEntity), true);
int armorAmount = 0;
for (ItemStack i : livingEntity.getArmorItems()) {
if (!i.isEmpty()) {
armorAmount++;
}
}
double c = -3 + 0.5 * (4 - armorAmount);
double lscale = scale * 0.4;
double up = 0.7 + 0.9 * (Math.sqrt(d / 4096));
int height = 0;
height = Math.min(height, drawItem(rPos.x, rPos.y + up, rPos.z, 0.5 * (armorAmount + 1), 0, lscale, livingEntity.getEquippedStack(EquipmentSlot.MAINHAND)));
height = Math.min(height, drawItem(rPos.x, rPos.y + up, rPos.z, -0.5 * (armorAmount + 1), 0, lscale, livingEntity.getEquippedStack(EquipmentSlot.OFFHAND)));
for (ItemStack i : livingEntity.getArmorItems()) {
height = Math.min(height, drawItem(rPos.x, rPos.y + up, rPos.z, c + 1.5, 0, lscale, i));
if (!i.isEmpty()) {
c++;
}
}
}
}
}
}
}
use of net.minecraft.entity.mob.Monster in project BleachHack by BleachDrinker420.
the class Nametags method onWorldRender.
@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
for (Entity entity : mc.world.getEntities()) {
if (entity == mc.player || entity.hasPassenger(mc.player) || mc.player.hasPassenger(entity)) {
continue;
}
Vec3d rPos = entity.getPos().subtract(Renderer.getInterpolationOffset(entity)).add(0, entity.getHeight() + 0.25, 0);
if (entity instanceof PlayerEntity && getSetting(1).asToggle().getState()) {
double scale = Math.max(getSetting(1).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getPlayerLines((PlayerEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
if (getSetting(1).asToggle().getChild(1).asToggle().getState()) {
drawItems(rPos.x, rPos.y + (lines.size() + 1) * 0.25 * scale, rPos.z, scale, getMainEquipment(entity));
}
} else if (EntityUtils.isAnimal(entity) && getSetting(2).asToggle().getState()) {
double scale = Math.max(getSetting(2).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getAnimalLines((LivingEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
if (getSetting(2).asToggle().getChild(1).asToggle().getState() && entity instanceof FoxEntity) {
drawItems(rPos.x, rPos.y + (lines.size() + 1) * 0.25 * scale, rPos.z, scale, List.of(((FoxEntity) entity).getMainHandStack()));
}
} else if (entity instanceof Monster && getSetting(3).asToggle().getState()) {
double scale = Math.max(getSetting(3).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getMobLines((LivingEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
if (getSetting(3).asToggle().getChild(1).asToggle().getState()) {
drawItems(rPos.x, rPos.y + (lines.size() + 1) * 0.25 * scale, rPos.z, scale, getMainEquipment(entity));
}
} else if (entity instanceof ItemEntity && getSetting(4).asToggle().getState()) {
double scale = Math.max(getSetting(4).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getItemLines((ItemEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
} else if (entity instanceof ArmorStandEntity && getSetting(5).asToggle().getState()) {
double scale = Math.max(getSetting(5).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
drawItems(rPos.x, rPos.y + 0.25 * scale, rPos.z, scale, getMainEquipment(entity));
}
}
}
Aggregations