Java Code Examples for net.minecraft.item.ItemStack#setCustomName()
The following examples show how to use
net.minecraft.item.ItemStack#setCustomName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenameCmd.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Override public void call(String[] args) throws CmdException { if(!MC.player.abilities.creativeMode) throw new CmdError("Creative mode only."); if(args.length == 0) throw new CmdSyntaxError(); String message = args[0]; for(int i = 1; i < args.length; i++) message += " " + args[i]; message = message.replace("$", "�").replace("��", "$"); ItemStack item = MC.player.inventory.getMainHandStack(); if(item == null) throw new CmdError("There is no item in your hand."); item.setCustomName(new LiteralText(message)); ChatUtils.message("Renamed item to \"" + message + "�r\"."); }
Example 2
Source File: TrollPotionHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { // check gamemode if(!MC.player.abilities.creativeMode) { ChatUtils.error("Creative mode only."); setEnabled(false); return; } // generate potion ItemStack stack = new ItemStack(Items.SPLASH_POTION); ListTag effects = new ListTag(); for(int i = 1; i <= 23; i++) { CompoundTag effect = new CompoundTag(); effect.putInt("Amplifier", Integer.MAX_VALUE); effect.putInt("Duration", Integer.MAX_VALUE); effect.putInt("Id", i); effects.add(effect); } CompoundTag nbt = new CompoundTag(); nbt.put("CustomPotionEffects", effects); stack.setTag(nbt); String name = "\u00a7rSplash Potion of Trolling"; stack.setCustomName(new LiteralText(name)); // give potion if(placeStackInHotbar(stack)) ChatUtils.message("Potion created."); else ChatUtils.error("Please clear a slot in your hotbar."); setEnabled(false); }
Example 3
Source File: KillPotionHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { // check gamemode if(!MC.player.abilities.creativeMode) { ChatUtils.error("Creative mode only."); setEnabled(false); return; } // generate potion ItemStack stack = new ItemStack(Items.SPLASH_POTION); CompoundTag effect = new CompoundTag(); effect.putInt("Amplifier", 125); effect.putInt("Duration", 2000); effect.putInt("Id", 6); ListTag effects = new ListTag(); effects.add(effect); CompoundTag nbt = new CompoundTag(); nbt.put("CustomPotionEffects", effects); stack.setTag(nbt); String name = "\u00a7rSplash Potion of \u00a74\u00a7lINSTANT DEATH"; stack.setCustomName(new LiteralText(name)); // give potion if(placeStackInHotbar(stack)) ChatUtils.message("Potion created."); else ChatUtils.error("Please clear a slot in your hotbar."); setEnabled(false); }
Example 4
Source File: CrashChestHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { if(!MC.player.abilities.creativeMode) { ChatUtils.error("Creative mode only."); setEnabled(false); return; } if(!MC.player.inventory.getArmorStack(0).isEmpty()) { ChatUtils.error("Please clear your shoes slot."); setEnabled(false); return; } // generate item ItemStack stack = new ItemStack(Blocks.CHEST); CompoundTag nbtCompound = new CompoundTag(); ListTag nbtList = new ListTag(); for(int i = 0; i < 40000; i++) nbtList.add(new ListTag()); nbtCompound.put("www.wurstclient.net", nbtList); stack.setTag(nbtCompound); stack.setCustomName(new LiteralText("Copy Me")); // give item MC.player.inventory.armor.set(0, stack); ChatUtils.message("Item has been placed in your shoes slot."); setEnabled(false); }
Example 5
Source File: CmdRename.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { if (!mc.player.abilities.creativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } ItemStack i = mc.player.inventory.getMainHandStack(); String name = ""; for (int j = 0; j < args.length; j++) name += args[j] += " "; i.setCustomName(new LiteralText(name.replace("&", "§").replace("§§", "&"))); BleachLogger.infoMessage("Renamed Item"); }
Example 6
Source File: CmdRename.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { if (!mc.player.abilities.creativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } ItemStack i = mc.player.inventory.getMainHandStack(); String name = ""; for (int j = 0; j < args.length; j++) name += args[j] += " "; i.setCustomName(new LiteralText(name.replace("&", "\u00a7").replace("\u00a7\u00a7", "&"))); BleachLogger.infoMessage("Renamed Item"); }
Example 7
Source File: CmdRename.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onCommand(String command, String[] args) throws Exception { if (!mc.player.abilities.creativeMode) { BleachLogger.errorMessage("Not In Creative Mode!"); return; } ItemStack i = mc.player.inventory.getMainHandStack(); String name = ""; for (int j = 0; j < args.length; j++) name += args[j] += " "; i.setCustomName(new LiteralText(name.replace("&", "§").replace("§§", "&"))); BleachLogger.infoMessage("Renamed Item"); }