Skip to content

Commit 9118584

Browse files
committed
Only create Ender Air Bottles when aiming at nothing (HitResult.Type.MISS)
Some mods add features that rely on using empty Glass Bottles on *blocks*, not just fluids. This commit allows that to happen by only creating Ender Air Bottles when the player is aiming at *nothing* - not a block *or* a fluid (instead of only checking for fluids) Fixes VazkiiMods#4273 Signed-off-by: unilock <[email protected]>
1 parent 92f78d7 commit 9118584

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Xplat/src/main/java/vazkii/botania/common/item/material/EnderAirItem.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
package vazkii.botania.common.item.material;
1010

11-
import net.minecraft.core.BlockPos;
1211
import net.minecraft.core.particles.ParticleTypes;
1312
import net.minecraft.sounds.SoundEvents;
1413
import net.minecraft.sounds.SoundSource;
@@ -48,7 +47,7 @@ public static InteractionResultHolder<ItemStack> onPlayerInteract(Player player,
4847
return InteractionResultHolder.pass(stack);
4948
}
5049

51-
if ((world.dimension() == Level.END && isClearFromDragonBreath(world, player.getBoundingBox().inflate(3.5)) && notAimingAtFluid(world, player))
50+
if ((world.dimension() == Level.END && isClearFromDragonBreath(world, player.getBoundingBox().inflate(3.5)) && aimingAtNothing(world, player))
5251
|| pickupFromEntity(world, player.getBoundingBox().inflate(1.0))) {
5352

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

68-
private static boolean notAimingAtFluid(Level world, Player player) {
67+
private static boolean aimingAtNothing(Level world, Player player) {
6968
BlockHitResult hitResult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.ANY);
70-
if (hitResult.getType() == HitResult.Type.BLOCK) {
71-
BlockPos pos = hitResult.getBlockPos();
72-
return world.mayInteract(player, pos) && world.getFluidState(pos).isEmpty();
73-
}
74-
return true;
69+
return hitResult.getType() == HitResult.Type.MISS;
7570
}
7671

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

0 commit comments

Comments
 (0)