interaction screen changes
This commit is contained in:
@@ -4,25 +4,18 @@ import java.awt.Point;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import cloudburst.rejects.modules.InteractionMenu;
|
import cloudburst.rejects.modules.InteractionMenu;
|
||||||
import minegame159.meteorclient.MeteorClient;
|
import minegame159.meteorclient.MeteorClient;
|
||||||
import minegame159.meteorclient.systems.commands.commands.PeekCommand;
|
import minegame159.meteorclient.systems.commands.commands.PeekCommand;
|
||||||
import minegame159.meteorclient.systems.modules.Modules;
|
import minegame159.meteorclient.systems.modules.Modules;
|
||||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
|
||||||
import minegame159.meteorclient.utils.player.InvUtils;
|
|
||||||
import net.minecraft.client.gui.screen.ChatScreen;
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||||
import net.minecraft.client.options.KeyBinding;
|
import net.minecraft.client.options.KeyBinding;
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.entity.Saddleable;
|
|
||||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||||
import net.minecraft.entity.passive.HorseEntity;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.vehicle.ChestMinecartEntity;
|
|
||||||
import net.minecraft.entity.vehicle.StorageMinecartEntity;
|
import net.minecraft.entity.vehicle.StorageMinecartEntity;
|
||||||
import net.minecraft.inventory.Inventory;
|
|
||||||
import net.minecraft.inventory.SimpleInventory;
|
import net.minecraft.inventory.SimpleInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
@@ -34,9 +27,7 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@@ -56,6 +47,7 @@ public class InteractionScreen extends Screen {
|
|||||||
public InteractionScreen(Entity entity) {
|
public InteractionScreen(Entity entity) {
|
||||||
super(new LiteralText("Menu Screen"));
|
super(new LiteralText("Menu Screen"));
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
|
//MeteorClient.EVENT_BUS.subscribe(this);
|
||||||
functions = new HashMap<>();
|
functions = new HashMap<>();
|
||||||
functions.put("Stats", (Entity e) -> {
|
functions.put("Stats", (Entity e) -> {
|
||||||
closeScreen();
|
closeScreen();
|
||||||
@@ -67,25 +59,16 @@ public class InteractionScreen extends Screen {
|
|||||||
closeScreen();
|
closeScreen();
|
||||||
client.openScreen(new InventoryScreen((PlayerEntity) e));
|
client.openScreen(new InventoryScreen((PlayerEntity) e));
|
||||||
});
|
});
|
||||||
functions.put("Message", (Entity e) -> {
|
|
||||||
this.cursorMode(GLFW.GLFW_CURSOR);
|
|
||||||
closeScreen();
|
|
||||||
client.openScreen(new ChatScreen(String.format("/msg %s ", ((PlayerEntity)e).getGameProfile().getName())));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (entity instanceof HorseBaseEntity) {
|
else if (entity instanceof HorseBaseEntity) {
|
||||||
functions.put("Open Inventory", (Entity e) -> {
|
functions.put("Open Inventory", (Entity e) -> {
|
||||||
closeScreen();
|
closeScreen();
|
||||||
if (client.player.isRiding()) {
|
if (client.player.isRiding()) {
|
||||||
client.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, true));
|
client.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, true));
|
||||||
}
|
}
|
||||||
client.player.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, Hand.MAIN_HAND, false));
|
client.player.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, Hand.MAIN_HAND, true));
|
||||||
client.player.openRidingInventory();
|
client.player.setSneaking(false);
|
||||||
client.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, true));
|
|
||||||
});
|
|
||||||
functions.put("Ride", (Entity e) -> {
|
|
||||||
closeScreen();
|
|
||||||
client.player.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, Hand.MAIN_HAND, false));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (entity instanceof StorageMinecartEntity) {
|
else if (entity instanceof StorageMinecartEntity) {
|
||||||
@@ -126,12 +109,33 @@ public class InteractionScreen extends Screen {
|
|||||||
closeScreen();
|
closeScreen();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (entity.noClip) {
|
||||||
|
functions.put("Disable NoClip", (Entity e) -> {
|
||||||
|
entity.noClip = false;
|
||||||
|
closeScreen();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
functions.put("NoClip", (Entity e) -> {
|
||||||
|
entity.noClip = true;
|
||||||
|
closeScreen();
|
||||||
|
});
|
||||||
|
}
|
||||||
msgs = Modules.get().get(InteractionMenu.class).messages;
|
msgs = Modules.get().get(InteractionMenu.class).messages;
|
||||||
msgs.keySet().forEach((key) -> {
|
msgs.keySet().forEach((key) -> {
|
||||||
|
if (msgs.get(key).contains("{username}")) {
|
||||||
|
if (entity instanceof PlayerEntity) {
|
||||||
functions.put(key, (Entity e) -> {
|
functions.put(key, (Entity e) -> {
|
||||||
closeScreen();
|
closeScreen();
|
||||||
client.openScreen(new ChatScreen(replacePlaceholders(msgs.get(key), e)));
|
client.openScreen(new ChatScreen(replacePlaceholders(msgs.get(key), e)));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
functions.put(key, (Entity e) -> {
|
||||||
|
closeScreen();
|
||||||
|
client.openScreen(new ChatScreen(replacePlaceholders(msgs.get(key), e)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
functions.put("Cancel", (Entity e) -> {closeScreen();});
|
functions.put("Cancel", (Entity e) -> {closeScreen();});
|
||||||
}
|
}
|
||||||
@@ -156,6 +160,7 @@ public class InteractionScreen extends Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void closeScreen() {
|
private void closeScreen() {
|
||||||
|
//MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||||
client.openScreen((Screen) null);
|
client.openScreen((Screen) null);
|
||||||
//Modules.get().get(InteractionMenu.class).isOpen = false;
|
//Modules.get().get(InteractionMenu.class).isOpen = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package cloudburst.rejects.screens;
|
package cloudburst.rejects.screens;
|
||||||
|
|
||||||
import cloudburst.rejects.modules.InteractionMenu;
|
|
||||||
import minegame159.meteorclient.systems.modules.Modules;
|
|
||||||
import net.minecraft.client.resource.language.TranslationStorage;
|
import net.minecraft.client.resource.language.TranslationStorage;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
@@ -10,53 +8,86 @@ import net.minecraft.entity.effect.StatusEffectUtil;
|
|||||||
import net.minecraft.util.Language;
|
import net.minecraft.util.Language;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
|
|
||||||
|
import meteordevelopment.orbit.EventHandler;
|
||||||
|
import minegame159.meteorclient.MeteorClient;
|
||||||
|
import minegame159.meteorclient.events.world.TickEvent;
|
||||||
import minegame159.meteorclient.gui.GuiTheme;
|
import minegame159.meteorclient.gui.GuiTheme;
|
||||||
import minegame159.meteorclient.gui.GuiThemes;
|
import minegame159.meteorclient.gui.GuiThemes;
|
||||||
import minegame159.meteorclient.gui.WindowScreen;
|
import minegame159.meteorclient.gui.WindowScreen;
|
||||||
import minegame159.meteorclient.gui.widgets.containers.WSection;
|
import minegame159.meteorclient.gui.widgets.containers.WSection;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class StatsScreen extends WindowScreen {
|
public class StatsScreen extends WindowScreen {
|
||||||
public final Entity entity;
|
public final Entity entity;
|
||||||
|
private boolean effectListExpanded = true;
|
||||||
|
private boolean attribListExpanded = true;
|
||||||
|
private boolean dimensionExpanded = false;
|
||||||
public StatsScreen(Entity e) {
|
public StatsScreen(Entity e) {
|
||||||
super(GuiThemes.get(),e.getName().getString());
|
super(GuiThemes.get(),e.getName().getString());
|
||||||
this.entity = e;
|
this.entity = e;
|
||||||
GuiTheme theme = GuiThemes.get();
|
updateData();
|
||||||
add(theme.label(String.format("Age: %d", entity.age)));
|
MeteorClient.EVENT_BUS.subscribe(this);
|
||||||
if (entity instanceof LivingEntity) {
|
|
||||||
LivingEntity liv = (LivingEntity) entity;
|
|
||||||
add(theme.label(String.format("Health: %.2f/%.2f", liv.getHealth(), liv.getMaxHealth())));
|
|
||||||
|
|
||||||
Collection<StatusEffectInstance> statusEff = liv.getStatusEffects();
|
|
||||||
if (!statusEff.isEmpty()) {
|
|
||||||
WSection effectList = add(theme.section("Status Effects", true)).expandCellX().widget();
|
|
||||||
Language lang = TranslationStorage.getInstance();
|
|
||||||
statusEff.forEach((effect) -> {
|
|
||||||
String status = lang.get(effect.getTranslationKey());
|
|
||||||
if (effect.getAmplifier() != 0) {
|
|
||||||
status += (String.format(" %d (%s)", effect.getAmplifier()+1, StatusEffectUtil.durationToString(effect, 1)));
|
|
||||||
} else {
|
|
||||||
status += (String.format(" (%s)", StatusEffectUtil.durationToString(effect, 1)));
|
|
||||||
}
|
|
||||||
effectList.add(theme.label(status)).expandCellX();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
WSection dimension = add(theme.section("Dimensions", false)).expandCellX().widget();
|
|
||||||
dimension.add(theme.label(String.format("Position: %.2f, %.2f, %.2f", entity.getX(), entity.getY(), entity.getZ()))).expandCellX();
|
|
||||||
dimension.add(theme.label(String.format("Yaw: %.2f, Pitch: %.2f", entity.yaw, entity.pitch))).expandCellX();
|
|
||||||
Box box = entity.getBoundingBox();
|
|
||||||
dimension.add(theme.label(String.format("Bounding Box: [%.2f, %.2f, %.2f] -> [%.2f, %.2f, %.2f]",
|
|
||||||
box.minX, box.minY, box.minZ,
|
|
||||||
box.maxX, box.maxY, box.maxZ
|
|
||||||
))).expandCellX();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClosed() {
|
protected void onClosed() {
|
||||||
|
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||||
super.onClosed();
|
super.onClosed();
|
||||||
//Modules.get().get(InteractionMenu.class).isOpen = false;
|
}
|
||||||
|
|
||||||
|
private void updateData() {
|
||||||
|
clear();
|
||||||
|
GuiTheme theme = GuiThemes.get();
|
||||||
|
Language lang = TranslationStorage.getInstance();
|
||||||
|
add(theme.label(String.format("Type: %s", lang.get(entity.getType().getTranslationKey()))));
|
||||||
|
add(theme.label(String.format("Age: %d", entity.age)));
|
||||||
|
add(theme.label(String.format("UUID: %s", entity.getUuidAsString())));
|
||||||
|
if (entity instanceof LivingEntity) {
|
||||||
|
LivingEntity liv = (LivingEntity) entity;
|
||||||
|
add(theme.label(String.format("Health: %.2f/%.2f", liv.getHealth(), liv.getMaxHealth())));
|
||||||
|
add(theme.label(String.format("Armor: %d/20", liv.getArmor())));
|
||||||
|
|
||||||
|
WSection effectList = add(theme.section("Status Effects", effectListExpanded)).expandX().widget();
|
||||||
|
effectList.action = () -> {
|
||||||
|
effectListExpanded = effectList.isExpanded();
|
||||||
|
};
|
||||||
|
liv.getActiveStatusEffects().forEach((effect, instance) -> {
|
||||||
|
String status = lang.get(effect.getTranslationKey());
|
||||||
|
if (instance.getAmplifier() != 0) {
|
||||||
|
status += (String.format(" %d (%s)", instance.getAmplifier()+1, StatusEffectUtil.durationToString(instance, 1)));
|
||||||
|
} else {
|
||||||
|
status += (String.format(" (%s)", StatusEffectUtil.durationToString(instance, 1)));
|
||||||
|
}
|
||||||
|
effectList.add(theme.label(status)).expandX();
|
||||||
|
});
|
||||||
|
if (liv.getActiveStatusEffects().isEmpty()) {
|
||||||
|
effectList.add(theme.label("No effects")).expandX();
|
||||||
|
}
|
||||||
|
|
||||||
|
WSection attribList = add(theme.section("Attributes", attribListExpanded)).expandX().widget();
|
||||||
|
attribList.action = () -> {
|
||||||
|
attribListExpanded = attribList.isExpanded();
|
||||||
|
};
|
||||||
|
liv.getAttributes().getTracked().forEach((attrib) -> {
|
||||||
|
attribList.add(theme.label(String.format("%s: %.2f",
|
||||||
|
lang.get(attrib.getAttribute().getTranslationKey()),
|
||||||
|
attrib.getValue()
|
||||||
|
))).expandX();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
WSection dimension = add(theme.section("Dimensions", dimensionExpanded)).expandX().widget();
|
||||||
|
dimension.action = () -> {
|
||||||
|
dimensionExpanded = dimension.isExpanded();
|
||||||
|
};
|
||||||
|
dimension.add(theme.label(String.format("Position: %.2f, %.2f, %.2f", entity.getX(), entity.getY(), entity.getZ()))).expandX();
|
||||||
|
dimension.add(theme.label(String.format("Yaw: %.2f, Pitch: %.2f", entity.yaw, entity.pitch))).expandX();
|
||||||
|
Box box = entity.getBoundingBox();
|
||||||
|
dimension.add(theme.label(String.format("Bounding Box: %.2f, %.2f, %.2f",
|
||||||
|
box.maxX-box.minX, box.maxY-box.minY, box.maxZ-box.minZ
|
||||||
|
))).expandX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onTick(TickEvent.Post event) {
|
||||||
|
updateData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user