Java Code Examples for net.minecraft.item.Items#SPLASH_POTION
The following examples show how to use
net.minecraft.item.Items#SPLASH_POTION .
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: AutoPotionHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private int findPotion(int startSlot, int endSlot) { for(int i = startSlot; i < endSlot; i++) { ItemStack stack = MC.player.inventory.getStack(i); // filter out non-splash potion items if(stack.getItem() != Items.SPLASH_POTION) continue; // search for instant health effects if(hasEffect(stack, StatusEffects.INSTANT_HEALTH)) return i; } return -1; }
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); }