Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.vipamod.altaccount.commands.impl;
- import de.vipamod.altaccount.commands.AbstractCommandExecutor;
- import de.vipamod.altaccount.commands.CommandType;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.entity.EntityPlayerSP;
- import net.minecraft.init.Items;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.JsonToNBT;
- import net.minecraft.nbt.NBTException;
- import net.minecraft.network.play.client.C10PacketCreativeInventoryAction;
- public class Hologram extends AbstractCommandExecutor
- {
- public static double x;
- public static double y;
- public static double z;
- public static int radius;
- public Hologram() {
- super("Holo", "#Holo erstellt ein Hologram.", CommandType.EXPLOITS);
- }
- @Override
- public void onRunCommand(String[] args) {
- if (args.length == 1) {
- if (args[0].equalsIgnoreCase("stop")) {
- HOLO.stop();
- return;
- }
- }
- x = Minecraft.getMinecraft().thePlayer.posX;
- y = Minecraft.getMinecraft().thePlayer.posY;
- z = Minecraft.getMinecraft().thePlayer.posZ;
- if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) {
- if (args.length > 1) {
- radius = Integer.valueOf(args[0]);
- String name = "§f";
- for (int i = 1; i < args.length; i++) {
- String s = args[i];
- if (i == args.length - 1) {
- name = name + s;
- } else {
- name = name + s + " ";
- }
- }
- name = name.replace("&", "§");
- HOLO.start(name, Minecraft.getMinecraft().thePlayer);
- sendJson("Du hast ein Item erhalten.");
- } else {
- sendJson("§a#Holo [radius] [Text]");
- sendJson("§a#holo stop");
- }
- } else {
- sendJson("§cDu must im Creative mode sein§4§l!");
- }
- }
- public static class HOLO {
- public static Thread thread;
- public static boolean run;
- public static void start(final String name, final EntityPlayerSP entityplayer) {
- if (thread == null) {
- run = true;
- thread = new Thread(new Runnable() {
- @Override
- public void run() {
- while (run) {
- try {
- Item item = Items.armor_stand;
- ItemStack itemstack = new ItemStack(item, 1, 0);
- double rX = (Math.random() * 2 * radius) - radius;
- double rY = Math.random() * radius;
- double rZ = (Math.random() * 2 * radius) - radius;
- itemstack.setTagCompound(
- JsonToNBT.getTagFromJson("{EntityTag:{Pos:[" + (x + rX) + "," + (y + rY) + ","
- + (z + rZ) + "],NoGravity:1,Invisible:1,CustomNameVisible:1,CustomName:"
- + '"' + name + '"' + "}}"));
- entityplayer.sendQueue
- .addToSendQueue(new C10PacketCreativeInventoryAction(36, itemstack));
- } catch (NBTException e) {
- e.printStackTrace();
- }
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- });
- thread.start();
- } else {
- thread.stop();
- run = false;
- thread = null;
- start(name, entityplayer);
- }
- }
- public static void stop() {
- if (thread != null) {
- thread.stop();
- run = false;
- thread = null;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement