mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Check if the block is loaded when spawning a firework
Supposedly closes #416
This commit is contained in:
parent
35daf62fde
commit
45d30b82de
1 changed files with 6 additions and 2 deletions
|
@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
@ -40,8 +41,11 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp
|
|||
|
||||
double newX = x+MathHelper.nextDouble(this.world.rand, 0, range*2)-range;
|
||||
double newZ = z+MathHelper.nextDouble(this.world.rand, 0, range*2)-range;
|
||||
EntityFireworkRocket rocket = new EntityFireworkRocket(world, newX, y+0.5, newZ, firework);
|
||||
world.spawnEntity(rocket);
|
||||
|
||||
if(world.isBlockLoaded(new BlockPos(newX, y, newZ))){
|
||||
EntityFireworkRocket rocket = new EntityFireworkRocket(world, newX, y+0.5, newZ, firework);
|
||||
world.spawnEntity(rocket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue