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.

Will6

Members
  • Joined

  • Last visited

Everything posted by Will6

  1. What is the best way to make a splash potion drop on the ground upon right clicking with a custom item? I overrode use but I'm not quite sure about how to get the splash potion to drop. import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.projectile.ThrowableProjectile; import net.minecraft.world.entity.projectile.ThrownPotion; import net.minecraft.world.item.*; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import java.util.Objects; public class TitaniumLongswordItem extends SwordItem { private static Properties properties = new Item.Properties().tab(CreativeModeTab.TAB_COMBAT); public static Item INSTANCE = new TitaniumLongswordItem(Tiers.IRON, 17, 2147483646, properties).setRegistryName(BaseMod.MODID,"titaniumlongsword"); public TitaniumLongswordItem(Tier tier, int attackDamageIn, float attackSpeedIn, Properties properties) { super(tier, attackDamageIn, attackSpeedIn, properties); } @Override public InteractionResultHolder<ItemStack> use(Level level, Player playerIn, InteractionHand handIn){ ItemStack itemstack = playerIn.getItemInHand(handIn); BlockPos location = Utils.getBlockAtCursor(playerIn, 20.0d, true); Entity entity = new ThrownPotion(EntityType.POTION);// new MobEffectInstance(MobEffects.HARM); //float explosionRadius = 0f; if(location != null){ //Utils.strikeLightning(level, location); //Utils.createExplosion(level, location, explosionRadius); Utils.spawnEntity(level, entity, location); } BlockPos blockPos = Utils.getBlockAtCursor(playerIn, 20.0d, true); if(blockPos != null){ playerIn.teleportTo(blockPos.getX(), blockPos.getY()+1, blockPos.getZ()); playerIn.fallDistance = 2.0F; playerIn.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 50, 150)); playerIn.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 400, 2)); return InteractionResultHolder.pass(itemstack); } return InteractionResultHolder.pass(itemstack); } }

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.