Начинающий
- Статус
- Оффлайн
- Регистрация
- 1 Окт 2025
- Сообщения
- 21
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Перестал делать читикс, ушел в больше в плагины (интереснее). Вот вам недо Hud как у Nursultan, не вижу его смысла вообще сливать, но кому то может пригодится, много паст сидит на дефолтном Zenith худе (делается все это 3 минуты).
Инвентарь можете сделать как у Nursultan, но мне больше такой вариант понравился...
Правый угол
Середина
левый угол
Все остальное надеюсь сами найдете, пофиксите...
Watermark:
public class Watermark extends AbstractDraggable {
private int fpsCount = 0;
public Watermark() {
super("Watermark", 10, 10, 92, 12, true);
}
@Override
public void tick() {
fpsCount = (int) MathUtil.interpolate(fpsCount, mc.getCurrentFps());
}
@Override
public void drawDraggable(DrawContext e) {
MatrixStack matrix = e.getMatrices();
FontRenderer fontDef = Fonts.getSize(16, Fonts.Type.DEFAULT);
FontRenderer fontIcons = Fonts.getSize(16, Fonts.Type.ICONS);
float x = getX();
float y = getY();
float height = 12;
String fps = " " + mc.getCurrentFps();
String role = " " + Profile.getRole();
LocalTime localTime = LocalTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
String time = " " + localTime.format(formatter);
String coordsText = " " + (int) mc.player.getX() + " " + (int) mc.player.getY() + " " + (int) mc.player.getZ();
float otstup = 2f;
float fpsWidth = fontDef.getStringWidth(fps);
float roleWidth = fontDef.getStringWidth(role);
float timeWidth = fontDef.getStringWidth(time);
float coordsTextWidth = fontDef.getStringWidth(coordsText);
float iconWidth = fontIcons.getStringWidth("U");
float fpsIconWidth = fontIcons.getStringWidth("X");
float roleIconWidth = fontIcons.getStringWidth("W");
float timeIconWidth = fontIcons.getStringWidth("V");
float coordsIconWidth = fontIcons.getStringWidth("S");
blur.render(ShapeProperties.create(matrix, x - 2, y, iconWidth + 4, height).round(3).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "U", x, y + 5, ColorUtil.getClientColor());
float currentX = x + iconWidth + 4 + otstup;
blur.render(ShapeProperties.create(matrix, currentX - 2, y, fpsWidth + fpsIconWidth + 4, height).round(3).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "X", currentX + 1, y + 5, -1);
fontDef.drawString(matrix, fps, currentX + fpsIconWidth, y + 4, -1);
currentX += fpsWidth + fpsIconWidth + 4 + otstup;
blur.render(ShapeProperties.create(matrix, currentX - 2, y, roleWidth + roleIconWidth + 4, height).round(3).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "W", currentX + 1, y + 5, -1);
fontDef.drawString(matrix, role, currentX + roleIconWidth, y + 4, -1);
currentX += roleWidth + roleIconWidth + 4 + otstup;
blur.render(ShapeProperties.create(matrix, currentX - 2, y, timeWidth + timeIconWidth + 4, height).round(3).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "V", currentX + 1, y + 5, -1);
fontDef.drawString(matrix, time, currentX + timeIconWidth, y + 4, -1);
currentX += timeWidth + timeIconWidth + 4 + otstup;
blur.render(ShapeProperties.create(matrix, currentX - 2, y, coordsTextWidth + coordsIconWidth + 4, height).round(3).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "S", currentX + 1, y + 5, -1);
fontDef.drawString(matrix, coordsText, currentX + coordsIconWidth, y + 4, -1);
setWidth((int) (currentX + timeWidth + timeIconWidth + 4 - x));
}
}
HotKeys:
public class HotKeys extends AbstractDraggable {
private List<Module> keysList = new ArrayList<>();
public HotKeys() {
super("Hot Keys", 300, 10, 80, 23,true);
}
@Override
public boolean visible() {
return !keysList.isEmpty() || PlayerIntersectionUtil.isChat(mc.currentScreen);
}
@Override
public void tick() {
keysList = Main.getInstance().getModuleProvider().getModules().stream().filter(module -> module.getAnimation().getOutput().floatValue() != 0 && module.getKey() != -1).toList();
}
@Override
public void drawDraggable(DrawContext e) {
MatrixStack matrix = e.getMatrices();
float centerX = getX() + getWidth() / 2F;
FontRenderer font = Fonts.getSize(14, Fonts.Type.DEFAULT);
FontRenderer fontIcons = Fonts.getSize(16, Fonts.Type.ICONS);
FontRenderer fontModule = Fonts.getSize(13, Fonts.Type.DEFAULT);
blur.render(ShapeProperties.create(matrix, getX(), getY(), getWidth(), 13.5F)
.round(4).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "C", getX() + 3.5F, getY() + 6, ColorUtil.getText());
font.drawString(matrix, getName(), (int) (centerX - font.getStringWidth(getName()) / 2), getY() + 5.5f, ColorUtil.getText());
int offset = 23 - 6;
int maxWidth = 80;
for (Module module : keysList) {
String bind = Formatting.GRAY + "| " + Formatting.RESET + StringUtil.getBindName(module.getKey()) + "";
float centerY = getY() + offset;
float animation = module.getAnimation().getOutput().floatValue();
float width = fontModule.getStringWidth(module.getName() + bind) + 15;
MathUtil.scale(matrix,centerX,centerY,1,animation,() -> {
blur.render(ShapeProperties.create(matrix, getX(), centerY - 2, getWidth(), 10).round(4).color(ColorUtil.getInterfaceColor()).build());
fontModule.drawString(matrix, module.getName(), getX() + 3.5f, centerY + 1.5f, ColorUtil.getText());
fontModule.drawString(matrix, bind, getX() + getWidth() - 3.5f - fontModule.getStringWidth(bind), centerY + 1.5f, ColorUtil.getText());
});
offset += (int) (animation * 11);
maxWidth = (int) Math.max(width, maxWidth);
}
setWidth(maxWidth);
setHeight(offset);
}
}
Potions:
public class Potions extends AbstractDraggable {
private final List<Potion> list = new ArrayList<>();
public Potions() {
super("Potions", 210, 10, 80, 23,true);
}
@Override
public boolean visible() {
return !list.isEmpty() || PlayerIntersectionUtil.isChat(mc.currentScreen);
}
@Override
public void tick() {
list.removeIf(p -> p.anim.isFinished(Direction.BACKWARDS));
list.forEach(p -> p.effect.update(mc.player,null));
}
@Override
public void packet(PacketEvent e) {
switch (e.getPacket()) {
case EntityStatusEffectS2CPacket effect -> {
if (!PlayerIntersectionUtil.nullCheck() && effect.getEntityId() == Objects.requireNonNull(mc.player).getId()) {
RegistryEntry<StatusEffect> effectId = effect.getEffectId();
list.stream().filter(p -> p.effect.getEffectType().getIdAsString().equals(effectId.getIdAsString())).forEach(s -> s.anim.setDirection(Direction.BACKWARDS));
list.add(new Potion(new StatusEffectInstance(effectId, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.shouldShowParticles(), effect.shouldShowIcon()), new DecelerateAnimation().setMs(150).setValue(1.0F)));
}
}
case RemoveEntityStatusEffectS2CPacket effect -> list.stream().filter(s -> s.effect.getEffectType().getIdAsString().equals(effect.effect().getIdAsString())).forEach(s -> s.anim.setDirection(Direction.BACKWARDS));
case PlayerRespawnS2CPacket p -> list.clear();
case GameJoinS2CPacket p -> list.clear();
default -> {}
}
}
@Override
public void drawDraggable(DrawContext context) {
MatrixStack matrix = context.getMatrices();
FontRenderer font = Fonts.getSize(14, Fonts.Type.DEFAULT);
FontRenderer fontIcons = Fonts.getSize(16, Fonts.Type.ICONS);
FontRenderer fontPotion = Fonts.getSize(13, Fonts.Type.DEFAULT);
blur.render(ShapeProperties.create(matrix, getX(), getY(), getWidth(), 13.5F)
.round(4).color(ColorUtil.getInterfaceColor()).build());
float centerX = getX() + getWidth() / 2.0F;
int offset = 23 - 6, maxWidth = 80;
fontIcons.drawString(matrix, "E", getX() + 3.5F, getY() + 6, ColorUtil.getText());
font.drawString(matrix, getName(),(int) (centerX - font.getStringWidth(getName()) / 2.0F), getY() + 5.5f, ColorUtil.getText());
for (Potion potion : list) {
StatusEffectInstance effect = potion.effect;
float animation = potion.anim.getOutput().floatValue();
float centerY = getY() + offset;
int amplifier = effect.getAmplifier();
String name = effect.getEffectType().value().getName().getString();
String duration = Formatting.GRAY + "| " + Formatting.RESET + getDuration(effect);
String lvl = amplifier > 0 ? Formatting.RED + " " + (amplifier + 1) + Formatting.RESET : "";
MathUtil.scale(matrix, centerX, centerY, 1, animation, () -> {
float animRed = effect.getDuration() != -1 && effect.getDuration() <= 120 ? MathUtil.blinking(1000, 8) : 1;
blur.render(ShapeProperties.create(matrix, getX(), centerY - 2, getWidth(), 10).round(4).color(ColorUtil.getInterfaceColor()).build());
Render2DUtil.drawSprite(matrix, mc.getStatusEffectSpriteManager().getSprite(effect.getEffectType()), getX() + 2.5f, centerY - 1.5f, 8, 8);
fontPotion.drawString(matrix, name + lvl, getX() + 11.5f, centerY + 1, ColorUtil.getText());
fontPotion.drawString(matrix, duration, getX() + getWidth() - 5 - fontPotion.getStringWidth(duration), centerY + 1, ColorUtil.multRed(ColorUtil.getText(), animRed));
});
int width = (int) fontPotion.getStringWidth(name + lvl + duration) + 30;
maxWidth = Math.max(width, maxWidth);
offset += (int) (11 * animation);
}
setWidth(maxWidth);
setHeight(offset);
}
private String getDuration(StatusEffectInstance pe) {
int var1 = pe.getDuration();
int mins = var1 / 1200;
return pe.isInfinite() || mins > 60 ? "**:**": mins + ":" + String.format("%02d", (var1 % 1200) / 20);
}
private record Potion(StatusEffectInstance effect, Animation anim) {}
}
TargetHud:
public class TargetHud extends AbstractDraggable {
private final Animation animation = new DecelerateAnimation().setMs(200).setValue(1);
private final StopWatch stopWatch = new StopWatch();
private LivingEntity lastTarget;
private Item lastItem = Items.AIR;
private float health;
public TargetHud() {
super("Target Hud", 10, 40, 100, 36,true);
}
@Override
public boolean visible() {
return scaleAnimation.isDirection(Direction.FORWARDS);
}
@Override
public void tick() {
LivingEntity auraTarget = Aura.getInstance().getTarget();
LivingEntity triggerBotTarget = TriggerBot.getInstance().getTarget();
if (auraTarget != null) {
lastTarget = auraTarget;
startAnimation();
} else if (triggerBotTarget != null) {
lastTarget = triggerBotTarget;
startAnimation();
stopWatch.reset();
} else if (PlayerIntersectionUtil.isChat(mc.currentScreen)) {
lastTarget = mc.player;
startAnimation();
} else if (stopWatch.finished(500)) stopAnimation();
}
@Override
public void drawDraggable(DrawContext context) {
if (lastTarget != null) {
MatrixStack matrix = context.getMatrices();
// drawUsingItem(context, matrix);
// drawArmor(context, matrix);
drawMain(context, matrix);
drawFace(context);
}
}
private void drawMain(DrawContext context, MatrixStack matrix) {
FontRenderer font = Fonts.getSize(16, Fonts.Type.DEFAULT);
float hp = PlayerIntersectionUtil.getHealth(lastTarget);
float widthHp = 61;
String stringHp = PlayerIntersectionUtil.getHealthString(hp);
health = MathHelper.clamp(MathUtil.interpolateSmooth(1, health, Math.round(hp / lastTarget.getMaxHealth() * widthHp)), 2, widthHp);
blur.render(ShapeProperties.create(matrix, getX(), getY(), getWidth(), getHeight()).round(8).color(ColorUtil.getInterfaceColor()).build());
if (font.getStringWidth(lastTarget.getName().getString()) > 60) {
ScissorManager scissorManager = Main.getInstance().getScissorManager();
scissorManager.push(matrix.peek().getPositionMatrix(), getX(), getY(), getWidth() - 1, getHeight());
font.drawGradientString(matrix, lastTarget.getName().getString(), getX() + 35, getY() + 6, ColorUtil.getText(), ColorUtil.getText(0.6F));
scissorManager.pop();
} else font.drawString(matrix, lastTarget.getName().getString(), getX() + 35, getY() + 6, ColorUtil.getText());
rectangle.render(ShapeProperties.create(matrix, getX() + 34, getY() + 22F, widthHp, 8F)
.round(4).color(ColorUtil.replAlpha(ColorUtil.getInterfaceColor(), 100)).build());
rectangle.render(ShapeProperties.create(matrix, getX() + 34, getY() + 22F, health, 8F)
.round(4).color(ColorUtil.multDark(ColorUtil.getRenderColor(), 0.5F), ColorUtil.multDark(ColorUtil.getRenderColor(), 0.5F), ColorUtil.getRenderColor(), ColorUtil.getRenderColor() ).build());
float width = Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(stringHp);
Fonts.getSize(12, Fonts.Type.DEFAULT).drawString(matrix, "HP: " + stringHp, getX() + 35.5f, getY() + 15.5F, ColorUtil.getText());
}
private void drawArmor(DrawContext context, MatrixStack matrix) {
List<ItemStack> items = StreamSupport.stream(lastTarget.getEquippedItems().spliterator(), false).filter(s -> !s.isEmpty()).toList();
if (!items.isEmpty()) {
float x = getX() + getWidth() / 2F - items.size() * 5.5F;
float y = getY() - 13;
float itemX = -10.5F;
matrix.push();
matrix.translate(x, y, -200);
blur.render(ShapeProperties.create(matrix, 0, 0, items.size() * 11, 11).round(2.5F).softness(1)
.thickness(2).outlineColor(ColorUtil.getOutline()).color(ColorUtil.getRect(0.7F)).build());
for (ItemStack stack : items) {
Render2DUtil.defaultDrawStack(context, stack, itemX += 11, 0.5F, false, true, 0.5F);
}
matrix.pop();
}
}
private void drawUsingItem(DrawContext context, MatrixStack matrix) {
animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
lastItem = lastTarget.getActiveItem().getItem();
}
if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
int size = 24;
float anim = animation.getOutput().floatValue();
float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemUtil.maxUseTick(lastItem) * 360;
float x = getX() - (size + 5) * anim;
float y = getY() + 6;
ScissorManager scissorManager = Main.getInstance().getScissorManager();
scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
MathUtil.setAlpha(anim, () -> {
blur.render(ShapeProperties.create(matrix, x, y, size, size).round(12).softness(1)
.thickness(2).outlineColor(ColorUtil.getOutline()).color(ColorUtil.getRect(0.7F)).build());
arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.4F).thickness(0.2f).end(progress)
.color(ColorUtil.fade(0), ColorUtil.fade(200), ColorUtil.fade(0), ColorUtil.fade(200)).build());
Render2DUtil.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3, y + 3, false, false, 1);
});
scissorManager.pop();
}
}
private void drawFace(DrawContext context) {
EntityRenderer<? super LivingEntity, ?> baseRenderer = mc.getEntityRenderDispatcher().getRenderer(lastTarget);
if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
return;
}
@SuppressWarnings("unchecked")
LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer = (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;
LivingEntityRenderState state = renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));
Identifier textureLocation = renderer.getTexture(state);
AbstractTexture abstractTexture = mc.getTextureManager().getTexture(textureLocation);
/* MinecraftTextureHelper minecraftTextureHelper = MinecraftTextureHelper.INSTANCE;
RenderPhase.Texture texture = minecraftTextureHelper.getOrCreateTexture(abstractTexture);
MinecraftTextureHelper.UV uv = minecraftTextureHelper.getFaceUV(currentTarget.getClass()); */
Render2DUtil.drawTexture(context, textureLocation, getX() + 3, getY() + 4F, 28, 6, 8, 8, 64, ColorUtil.getRect(1), ColorUtil.multRed(-1, 1 + lastTarget.hurtTime / 4F));
}
}
cooldowns:
public class CoolDowns extends AbstractDraggable {
public static CoolDowns getInstance() {
return Instance.getDraggable(CoolDowns.class);
}
public final List<CoolDown> list = new ArrayList<>();
public CoolDowns() {
super("Cool Downs", 120, 10, 80, 23,true);
}
@Override
public boolean visible() {
return !list.isEmpty() || PlayerIntersectionUtil.isChat(mc.currentScreen);
}
@Override
public void tick() {
list.removeIf(c -> c.anim.isFinished(Direction.BACKWARDS));
list.stream().filter(c -> !Objects.requireNonNull(mc.player).getItemCooldownManager().isCoolingDown(c.item.getDefaultStack())).forEach(coolDown -> coolDown.anim.setDirection(Direction.BACKWARDS));
}
@Override
public void packet(PacketEvent e) {
if (PlayerIntersectionUtil.nullCheck()) return;
switch (e.getPacket()) {
case CooldownUpdateS2CPacket c -> {
Item item = Registries.ITEM.get(c.cooldownGroup());
list.stream().filter(coolDown -> coolDown.item.equals(item)).forEach(coolDown -> coolDown.anim.setDirection(Direction.BACKWARDS));
if (c.cooldown() != 0) {
list.add(new CoolDown(item, new StopWatch().setMs(-c.cooldown() * 50L), new DecelerateAnimation().setMs(150).setValue(1.0F)));
}
}
case PlayerRespawnS2CPacket p -> list.clear();
default -> {}
}
}
@Override
public void drawDraggable(DrawContext context) {
MatrixStack matrix = context.getMatrices();
FontRenderer font = Fonts.getSize(14, Fonts.Type.DEFAULT);
FontRenderer fontCoolDown = Fonts.getSize(13, Fonts.Type.DEFAULT);
FontRenderer fontIcons = Fonts.getSize(16, Fonts.Type.ICONS);
blur.render(ShapeProperties.create(matrix, getX(), getY(), getWidth(), 13.5F )
.round(4).color(ColorUtil.getInterfaceColor()).build());
float centerX = getX() + getWidth() / 2.0F;
font.drawString(matrix, getName(), (int) (centerX - font.getStringWidth(getName()) / 2.0F), getY() + 5.5f, ColorUtil.getText());
fontIcons.drawString(matrix, "T", getX() + 3.5F, getY() + 5.5F, ColorUtil.getText());
int offset = 23 - 6;
int maxWidth = 80;
for (CoolDown coolDown : list) {
float animation = coolDown.anim.getOutput().floatValue();
float centerY = getY() + offset;
int time = -coolDown.time.elapsedTime() / 1000;
String name = coolDown.item.getDefaultStack().getName().getString();
String duration = Formatting.GRAY + "| " + Formatting.RESET + StringUtil.getDuration(time);
MathUtil.scale(matrix, centerX, centerY, 1, animation, () -> {
float green = time <= 5 ? MathUtil.blinking(1000, 8) : 1;
blur.render(ShapeProperties.create(matrix, getX(), centerY - 2, getWidth(), 10).round(4).color(ColorUtil.getInterfaceColor()).build());
Render2DUtil.defaultDrawStack(context, coolDown.item.getDefaultStack(), getX() + 1F, centerY - 2.5F, false, false, 0.5F);
fontCoolDown.drawString(matrix, name, getX() + 11.5F, centerY + 1, ColorUtil.getText());
fontCoolDown.drawString(matrix, duration, getX() + getWidth() - 5 - fontCoolDown.getStringWidth(duration), centerY + 1, ColorUtil.multGreen(ColorUtil.getText(), green));
});
int width = (int) fontCoolDown.getStringWidth(name + duration) + 30;
maxWidth = Math.max(width, maxWidth);
offset += (int) (11 * animation);
}
setWidth(maxWidth);
setHeight(offset);
}
public record CoolDown(Item item, StopWatch time, Animation anim) {}
}
Inventory:
public class Inventory extends AbstractDraggable {
List<ItemStack> stacks = new ArrayList<>();
public Inventory() {
super("Inventory", 390, 10, 123, 60,true);
}
@Override
public boolean visible() {
return !stacks.stream().filter(stack -> !stack.isEmpty()).toList().isEmpty() || PlayerIntersectionUtil.isChat(mc.currentScreen);
}
@Override
public void tick() {
stacks = IntStream.range(9, 36).mapToObj(i -> mc.player.inventory.getStack(i)).toList();
}
@Override
public void drawDraggable(DrawContext context) {
MatrixStack matrix = context.getMatrices();
blur.render(ShapeProperties.create(matrix, getX(), getY(), getWidth(), 13.5F)
.round(4).color(ColorUtil.getInterfaceColor()).build());
Fonts.getSize(14, Fonts.Type.DEFAULT).drawCenteredString(matrix, getName(), getX() + getWidth() / 2F, getY() + 5.5f, ColorUtil.getText());
Fonts.getSize(16, Fonts.Type.ICONS).drawString(matrix, "R" , getX() + 3.5F, getY() + 5.5F, ColorUtil.getText());
int offsetY = 20 - 5;
int offsetX = 4;
for (ItemStack stack : stacks) {
Render2DUtil.defaultDrawStack(context, stack, getX() + offsetX, getY() + offsetY, true, true, 0.5F);
offsetX += 13;
if (offsetX > getWidth() - 13) {
offsetY += 13;
offsetX = 4;
}
}
}
}
нотифки:
public class Notifications extends AbstractDraggable {
public static Notifications getInstance() {
return Instance.getDraggable(Notifications.class);
}
private final List<Notification> list = new ArrayList<>();
private final List<Stack> stacks = new ArrayList<>();
public Notifications() {
super("Notifications", 0, 50, 100, 15,true);
}
@Override
public void tick() {
list.forEach(notif -> {
if (System.currentTimeMillis() > notif.removeTime || (notif.text.getString().contains("t.me/scamware_su") && !PlayerIntersectionUtil.isChat(mc.currentScreen)))
notif.anim.setDirection(Direction.BACKWARDS);
});
list.removeIf(notif -> notif.anim.isFinished(Direction.BACKWARDS));
while (!stacks.isEmpty()) {
addTextIfNotEmpty(TypePickUp.INVENTORY, "Подняты предметы: ");
addTextIfNotEmpty(TypePickUp.SHULKER_INVENTORY, "Сложены предметы в шалкер: ");
addTextIfNotEmpty(TypePickUp.SHULKER, "Поднят шалкер с: ");
}
}
@Override
public void packet(PacketEvent e) {
if (!PlayerIntersectionUtil.nullCheck()) switch (e.getPacket()) {
case ItemPickupAnimationS2CPacket item when Hud.getInstance().notificationSettings.isSelected("Item Pick Up") && item.getCollectorEntityId()
== Objects.requireNonNull(mc.player).getId() && Objects.requireNonNull(mc.world).getEntityById(item.getEntityId()) instanceof ItemEntity entity -> {
ItemStack itemStack = entity.getStack();
ContainerComponent component = itemStack.get(DataComponentTypes.CONTAINER);
if (component == null) {
Text itemText = itemStack.getName();
if (itemText.getContent().toString().equals("empty")) {
MutableText text = Text.empty().append(itemText);
if (itemStack.getCount() > 1) text.append(Formatting.RESET + " [" + Formatting.RED + itemStack.getCount() + Formatting.GRAY + "x" + Formatting.RESET + "]");
stacks.add(new Stack(TypePickUp.INVENTORY, text));
}
} else component.stream().filter(s -> s.getName().getContent().toString().equals("empty")).forEach(stack -> {
MutableText text = Text.empty().append(stack.getName());
if (stack.getCount() > 1) text.append(Formatting.RESET + " [" + Formatting.RED + stack.getCount() + Formatting.GRAY + "x" + Formatting.RESET + "]");
stacks.add(new Stack(TypePickUp.SHULKER, text));
});
}
case ScreenHandlerSlotUpdateS2CPacket slot when Hud.getInstance().notificationSettings.isSelected("Item Pick Up") -> {
int slotId = slot.getSlot();
ContainerComponent updatedContainer = slot.getStack().get(DataComponentTypes.CONTAINER);
if (updatedContainer != null && slotId < Objects.requireNonNull(mc.player).currentScreenHandler.slots.size() && slot.getSyncId() == 0) {
ContainerComponent currentContainer = mc.player.currentScreenHandler.getSlot(slotId).getStack().get(DataComponentTypes.CONTAINER);
if (currentContainer != null) updatedContainer.stream().filter(stack -> currentContainer.stream().noneMatch(s -> Objects.equals(s.getComponents(), stack.getComponents()) && s.toString().equals(stack.toString()))).forEach(stack -> {
MutableText text = Text.empty().append(stack.getName());
stacks.add(new Stack(TypePickUp.SHULKER_INVENTORY, text));
});
}
}
default -> {}
}
}
@Override
public void setScreen(SetScreenEvent e) {
if (e.getScreen() instanceof ChatScreen) {
addList("t.me/scamware_su",99999999);
}
}
@Override
public void drawDraggable(DrawContext context) {
MatrixStack matrix = context.getMatrices();
FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
FontRenderer fontIcons = Fonts.getSize(16, Fonts.Type.ICONS);
int screenWidth = mc.getWindow().getScaledWidth();
float elementCenterX = getX() + getWidth() / 2;
float alignmentOffset;
boolean isRight = elementCenterX > screenWidth * 2f / 3f;
boolean isLeft = elementCenterX < screenWidth / 3f;
if (isLeft) {
alignmentOffset = 8f;
} else if (isRight) {
alignmentOffset = getWidth() - 8f;
} else {
alignmentOffset = getWidth() / 2f;
}
float offsetX = 5;
if (isRight) {
float totalHeight = 0;
for (Notification notification : list) {
float anim = notification.anim.getOutput().floatValue();
totalHeight += (getHeight() + 3) * anim;
}
float offsetY = totalHeight;
for (Notification notification : list) {
float anim = notification.anim.getOutput().floatValue();
float width = font.getStringWidth(notification.text) + offsetX * 2;
float startY = getY() + getHeight() - offsetY; // Начинаем снизу
float startX = getX() + alignmentOffset - width;
MathUtil.setAlpha(anim, () -> {
blur.render(ShapeProperties.create(matrix, startX, startY, width, getHeight()).round(4)
.color(ColorUtil.getInterfaceColor()).build());
font.drawText(matrix, notification.text, (int) (startX + offsetX), startY + 6.5F);
blur.render(ShapeProperties.create(matrix, startX - 19, startY, 16, getHeight()).round(4).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "G", (int) (startX) - 14.5f, startY + 6.5F, ColorUtil.getRenderColor());
});
offsetY -= (getHeight() + 3) * anim;
}
} else {
float offsetY = 0;
for (Notification notification : list) {
float anim = notification.anim.getOutput().floatValue();
float width = font.getStringWidth(notification.text) + offsetX * 2;
float startY = getY() + offsetY;
float startX;
if (isLeft) {
startX = getX() + alignmentOffset;
} else {
startX = getX() + alignmentOffset - width / 2f + 8f;
}
MathUtil.setAlpha(anim, () -> {
blur.render(ShapeProperties.create(matrix, startX, startY, width, getHeight()).round(4)
.color(ColorUtil.getInterfaceColor()).build());
font.drawText(matrix, notification.text, (int) (startX + offsetX), startY + 6.5F);
blur.render(ShapeProperties.create(matrix, startX - 19, startY, 16, getHeight()).round(4).color(ColorUtil.getInterfaceColor()).build());
fontIcons.drawString(matrix, "G", (int) (startX) - 14.5f, startY + 6.5F, ColorUtil.getRenderColor());
});
offsetY += (getHeight() + 3) * anim;
}
}
}
private void addTextIfNotEmpty(TypePickUp type, String prefix) {
MutableText text = Text.empty();
List<Stack> list = stacks.stream().filter(stack -> stack.type.equals(type)).toList();
for (int i = 0, size = list.size(); i < size; i++) {
Stack stack = list.get(i);
if (stack.type != type) continue;
text.append(stack.text);
stacks.remove(stack);
if (text.getString().length() > 150) break;
if (i + 1 != size) text.append(" , ");
}
if (!text.equals(Text.empty())) addList(Text.empty().append(prefix).append(text), 8000);
}
public void addList(String text, long removeTime) {
addList(text,removeTime,null);
}
public void addList(Text text, long removeTime) {
addList(text,removeTime,null);
}
public void addList(String text, long removeTime, SoundEvent sound) {
addList(Text.empty().append(text), removeTime, sound);
}
public void addList(Text text, long removeTime, SoundEvent sound) {
list.add(new Notification(text, new DecelerateAnimation().setMs(300).setValue(1), System.currentTimeMillis() + removeTime));
if (list.size() > 12) list.removeFirst();
list.sort(Comparator.comparingDouble(notif -> -notif.removeTime));
if (sound != null) SoundManager.playSound(sound);
}
public record Notification(Text text, Animation anim, long removeTime) {}
public record Stack(TypePickUp type, MutableText text) {}
public enum TypePickUp {
INVENTORY, SHULKER, SHULKER_INVENTORY
}
}
Все остальное надеюсь сами найдете, пофиксите...
