Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only create Ender Air Bottles when aiming at nothing #4392

Open
wants to merge 1 commit into
base: 1.19.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
package vazkii.botania.common.item.material;

import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
Expand Down Expand Up @@ -48,7 +47,7 @@ public static InteractionResultHolder<ItemStack> onPlayerInteract(Player player,
return InteractionResultHolder.pass(stack);
}

if ((world.dimension() == Level.END && isClearFromDragonBreath(world, player.getBoundingBox().inflate(3.5)) && notAimingAtFluid(world, player))
if ((world.dimension() == Level.END && isClearFromDragonBreath(world, player.getBoundingBox().inflate(3.5)) && aimingAtNothing(world, player))
|| pickupFromEntity(world, player.getBoundingBox().inflate(1.0))) {

if (!world.isClientSide) {
Expand All @@ -65,13 +64,9 @@ public static InteractionResultHolder<ItemStack> onPlayerInteract(Player player,
return InteractionResultHolder.pass(stack);
}

private static boolean notAimingAtFluid(Level world, Player player) {
private static boolean aimingAtNothing(Level world, Player player) {
BlockHitResult hitResult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.ANY);
if (hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = hitResult.getBlockPos();
return world.mayInteract(player, pos) && world.getFluidState(pos).isEmpty();
}
return true;
return hitResult.getType() == HitResult.Type.MISS;
}

public static boolean isClearFromDragonBreath(Level world, AABB aabb) {
Expand Down