Merge branch 'mc1.20.1/feature-dev' into mc1.21.1/dev

This commit is contained in:
IThundxr 2025-02-23 21:19:00 -05:00
commit e7e1b2cd61
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

@ -232,7 +232,7 @@ public interface PotatoProjectileEntityHitAction {
livingEntity.addEffect(effect.createEffectInstance());
}
return true;
return false;
}
@Override

View file

@ -224,10 +224,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();
@ -290,6 +290,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();
}