mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Perfect soup
This commit is contained in:
parent
a50fb9dac0
commit
20491b3caa
3 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ public interface PotatoProjectileEntityHitAction {
|
|||
if (ray.getEntity() instanceof LivingEntity livingEntity)
|
||||
SuspiciousStewItemAccessor.create$listPotionEffects(projectile, livingEntity::addEffect);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue