Perfect soup

This commit is contained in:
IThundxr 2025-02-23 21:17:47 -05:00
parent a50fb9dac0
commit 20491b3caa
Failed to generate hash of commit
3 changed files with 12 additions and 3 deletions

View file

@ -87,6 +87,12 @@ public record PotatoCannonProjectileType(HolderSet<Item> items, int reloadTicks,
return onBlockHit.map(i -> i.execute(level, stack, ray)).orElse(false);
}
// Copy the stack so it's not mutated and lost
@Override
public ItemStack dropStack() {
return dropStack.copy();
}
public static class Builder {
private ResourceLocation id;

View file

@ -225,7 +225,7 @@ public interface PotatoProjectileEntityHitAction {
if (ray.getEntity() instanceof LivingEntity livingEntity)
SuspiciousStewItemAccessor.create$listPotionEffects(projectile, livingEntity::addEffect);
return true;
return false;
}
@Override

View file

@ -231,10 +231,10 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
if (!projectileType.onEntityHit(stack, ray) && onServer)
if (random.nextDouble() <= recoveryChance) {
recoverItem();
} else {
spawnAtLocation(projectileType.dropStack());
}
spawnAtLocation(projectileType.dropStack());
if (!(target instanceof LivingEntity livingentity)) {
playHitSound(level(), position());
kill();
@ -298,6 +298,9 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements
if (!getProjectileType().onBlockHit(level(), stack, ray) && !level().isClientSide)
if (random.nextDouble() <= recoveryChance)
recoverItem();
spawnAtLocation(getProjectileType().dropStack());
super.onHitBlock(ray);
kill();
}