Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.TNT_Block_Unkown;
- import java.awt.Color;
- import java.util.Random;
- import io.netty.util.internal.ThreadLocalRandom;
- import net.minecraft.client.Minecraft;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.network.play.client.C10PacketCreativeInventoryAction;
- import net.minecraft.util.ResourceLocation;
- public class Utils {
- public static Boolean isFastPlace = false;
- public static Item getItem(ResourceLocation loc) {
- return (Item)Item.itemRegistry.getObject(loc);
- }
- public static Boolean isInt(String i) {
- Boolean isI = false;
- try {
- Integer.parseInt(i);
- isI = true;
- }
- catch(Exception e) {
- isI = false;
- }
- return isI;
- }
- public static Boolean isDouble(String d) {
- Boolean isD = false;
- try {
- Double.parseDouble(d);
- isD = true;
- }
- catch(Exception e) {
- isD = false;
- }
- return isD;
- }
- public static void giveItem(ItemStack stack) {
- Integer errorint = 0;
- for (int i = 0; i < 9; i++) {
- if (Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(i) == null)
- {
- Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36 + i, stack));
- return;
- }else {
- if (errorint==8) {
- ChatManager.addMessage("Bitte mache deine Schnellzugriffsleiste frei!");
- }else {
- errorint = errorint + 1;
- }
- }
- }
- }
- public static void onTick() {
- if (de.TNT_Block_Unkown.ChatManager.flybypass) {
- Minecraft.getMinecraft().thePlayer.setPosition(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY + 1, Minecraft.getMinecraft().thePlayer.posZ);
- Minecraft.getMinecraft().thePlayer.setPosition(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY - 1, Minecraft.getMinecraft().thePlayer.posZ);
- }
- if (de.TNT_Block_Unkown.ChatManager.isVulkan) {
- Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36, de.TNT_Block_Unkown.modules.Vulkan.generateVulkanItem(de.TNT_Block_Unkown.ChatManager.posVulkan[0], de.TNT_Block_Unkown.ChatManager.posVulkan[1], de.TNT_Block_Unkown.ChatManager.posVulkan[2], random(-1.0,1.0), 0.9, random(-1.0,1.0), generateRandomColor())));
- }
- }
- public static Double random(Double min, Double max) {
- return ThreadLocalRandom.current().nextDouble(min, max);
- }
- public static Color generateRandomColor() {
- Random randomGenerator = new Random();
- int red = randomGenerator.nextInt(255);
- int green = randomGenerator.nextInt(255);
- int blue = randomGenerator.nextInt(255);
- Color randomColour = new Color(red,green,blue);
- return randomColour;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement