Skip to content

Commit

Permalink
Fixes flares replacing blocks (Closes #112)
Browse files Browse the repository at this point in the history
- Fixed flares being able to replace blocks
  • Loading branch information
Prospector committed Feb 11, 2021
1 parent 5f0489c commit 51ed437
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class FlareEntity extends ThrownItemEntity {
Expand Down Expand Up @@ -57,7 +58,10 @@ protected void onSwimmingStart() {
public void onCollision(HitResult hitResult) {
if (hitResult.getType().equals(HitResult.Type.BLOCK)) {
if (!getLandingBlockState().isAir()) {
world.setBlockState(getLandingPos().up(), CampanionBlocks.FLARE_BLOCK.getDefaultState());
BlockPos pos = getLandingPos().up();
if (world.getBlockState(pos).isAir()) {
world.setBlockState(pos, CampanionBlocks.FLARE_BLOCK.getDefaultState());
}
if (!this.world.isClient) {
this.remove();
this.world.sendEntityStatus(this, (byte) 3);
Expand Down

0 comments on commit 51ed437

Please sign in to comment.