mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-04-01 08:45:28 +02:00
35 lines
1.3 KiB
Java
35 lines
1.3 KiB
Java
package com.minelittlepony.unicopia.item;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import com.minelittlepony.unicopia.USounds;
|
|
import com.minelittlepony.unicopia.projectile.PhysicsBodyProjectileEntity;
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.sound.SoundEvent;
|
|
import net.minecraft.world.World;
|
|
|
|
public class HeavyProjectileItem extends ProjectileItem {
|
|
public HeavyProjectileItem(Settings settings, float projectileDamage) {
|
|
super(settings, projectileDamage);
|
|
}
|
|
|
|
@Override
|
|
public PhysicsBodyProjectileEntity createProjectile(ItemStack stack, World world, @Nullable PlayerEntity player) {
|
|
PhysicsBodyProjectileEntity projectile = player == null
|
|
? new PhysicsBodyProjectileEntity(world, stack)
|
|
: new PhysicsBodyProjectileEntity(world, player, stack);
|
|
if (player != null) {
|
|
projectile.setVelocity(player, player.getPitch(), player.getYaw(), 0, 1.5F, 1);
|
|
}
|
|
projectile.pickupType = PersistentProjectileEntity.PickupPermission.ALLOWED;
|
|
return projectile;
|
|
}
|
|
|
|
@Override
|
|
public SoundEvent getThrowSound(ItemStack stack) {
|
|
return USounds.ENTITY_JAR_THROW;
|
|
}
|
|
}
|