Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. package de.vipamod.altaccount.commands.impl;
  2.  
  3. import de.vipamod.altaccount.commands.AbstractCommandExecutor;
  4. import de.vipamod.altaccount.commands.CommandType;
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.client.entity.EntityPlayerSP;
  7. import net.minecraft.init.Items;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.nbt.JsonToNBT;
  11. import net.minecraft.nbt.NBTException;
  12. import net.minecraft.network.play.client.C10PacketCreativeInventoryAction;
  13.  
  14. public class Hologram extends AbstractCommandExecutor
  15. {
  16.  
  17. public static double x;
  18. public static double y;
  19. public static double z;
  20. public static int radius;
  21.  
  22. public Hologram() {
  23. super("Holo", "#Holo erstellt ein Hologram.", CommandType.EXPLOITS);
  24. }
  25.  
  26. @Override
  27. public void onRunCommand(String[] args) {
  28. if (args.length == 1) {
  29. if (args[0].equalsIgnoreCase("stop")) {
  30. HOLO.stop();
  31. return;
  32. }
  33. }
  34.  
  35. x = Minecraft.getMinecraft().thePlayer.posX;
  36. y = Minecraft.getMinecraft().thePlayer.posY;
  37. z = Minecraft.getMinecraft().thePlayer.posZ;
  38. if (Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) {
  39. if (args.length > 1) {
  40. radius = Integer.valueOf(args[0]);
  41. String name = "§f";
  42. for (int i = 1; i < args.length; i++) {
  43. String s = args[i];
  44. if (i == args.length - 1) {
  45. name = name + s;
  46. } else {
  47. name = name + s + " ";
  48. }
  49. }
  50. name = name.replace("&", "§");
  51. HOLO.start(name, Minecraft.getMinecraft().thePlayer);
  52. sendJson("Du hast ein Item erhalten.");
  53. } else {
  54. sendJson("§a#Holo [radius] [Text]");
  55. sendJson("§a#holo stop");
  56. }
  57. } else {
  58. sendJson("§cDu must im Creative mode sein§4§l!");
  59. }
  60. }
  61.  
  62. public static class HOLO {
  63.  
  64. public static Thread thread;
  65. public static boolean run;
  66.  
  67. public static void start(final String name, final EntityPlayerSP entityplayer) {
  68. if (thread == null) {
  69. run = true;
  70. thread = new Thread(new Runnable() {
  71. @Override
  72. public void run() {
  73. while (run) {
  74. try {
  75. Item item = Items.armor_stand;
  76. ItemStack itemstack = new ItemStack(item, 1, 0);
  77. double rX = (Math.random() * 2 * radius) - radius;
  78. double rY = Math.random() * radius;
  79. double rZ = (Math.random() * 2 * radius) - radius;
  80. itemstack.setTagCompound(
  81. JsonToNBT.getTagFromJson("{EntityTag:{Pos:[" + (x + rX) + "," + (y + rY) + ","
  82. + (z + rZ) + "],NoGravity:1,Invisible:1,CustomNameVisible:1,CustomName:"
  83. + '"' + name + '"' + "}}"));
  84. entityplayer.sendQueue
  85. .addToSendQueue(new C10PacketCreativeInventoryAction(36, itemstack));
  86. } catch (NBTException e) {
  87. e.printStackTrace();
  88. }
  89. try {
  90. Thread.sleep(100);
  91. } catch (InterruptedException e) {
  92. e.printStackTrace();
  93. }
  94. }
  95. }
  96. });
  97. thread.start();
  98. } else {
  99. thread.stop();
  100. run = false;
  101. thread = null;
  102. start(name, entityplayer);
  103. }
  104. }
  105.  
  106. public static void stop() {
  107. if (thread != null) {
  108. thread.stop();
  109. run = false;
  110. thread = null;
  111. }
  112. }
  113. }
  114.  
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement