Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DreadKyller

Members
  • Joined

  • Last visited

Everything posted by DreadKyller

  1. I am attempting to create a mod, which so far is working well. In this mod I've created a class that extends Entity witch, and I am using events to intercept when a potion is being thrown by this new witch. I tested it out in single player, in Minecraft, the entity for a potion is ThrownPotion, while in the code ThrownPotion doesn't exist and is instead EntityPotion (from what I can tell). In game with command blocks I can execute this command and it works perfectly: /summon ThrownPotion ~ ~2 ~ {Potion:{Count:1,id:373,Damage:16428,tag:{CustomPotionEffects:[{Id:20,Amplifier:0,Duration:200}]}}} It was my belief that the same NBT structure should work for EntityPotion as well. Since I'm adding a wither potion effect I can't just set the damage, as id=20 is above the 15 allowed in the first 4 bits of the id, which define the potion effect, so I have to use custom potion effects. The problem is the nbt format isn't working. The following is the code: @SubscribeEvent public void onEntitySpawn(EntityJoinWorldEvent event) { Entity e = event.entity; if(e instanceof EntityPotion) { EntityPotion ep = (EntityPotion)e; if(ep.getThrower() instanceof ChargedWitch) { if(ep.getPotionDamage() != 32660) return;// Only alter the poison potion thrown by the witch ep.setPotionDamage(16461); // If this line is here, potion becomes instant damage, is commented potion is still poison // (proving nbt didn't work) NBTTagCompound nbt = ep.getEntityData(); NBTTagCompound potion = nbt.getCompoundTag("Potion"); NBTTagCompound tag = new NBTTagCompound(); potion.setShort("id", (short) 373); potion.setShort("Damage", (short) 16461); potion.setByte("Count", (byte) 1); tag.setTag("CustomPotionEffects", makePotion()); potion.setTag("tag", tag); nbt.setTag("Potion", potion); } } } public NBTTagList makePotion() { NBTTagList list = new NBTTagList(); NBTTagCompound potionType = new NBTTagCompound(); potionType.setByte("Id", (byte) Potion.wither.getId()); potionType.setByte("Amplifier", (byte) 0); potionType.setInteger("Duration", 200); potionType.setByte("Ambient", (byte) 0); //Not ambient list.appendTag(potionType); return list; } I'm unsure why this isn't working. I guess my main question is why is it ThrownPotion in game, but no sign of any "ThrownPotion" class in the project. If it's not possible I can easily make my own potion entity, I know enough to do so, I've just never experienced this issue before with inconsistent NBT structures. !EDIT: Changed topic title to fit the format most posts are using. !!EDIT: Thanks for the help, for anyone else looking to add custom effects to Potion Entities but don't know how:

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.