mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +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.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
@ -40,10 +41,13 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp
|
||||||
|
|
||||||
double newX = x+MathHelper.nextDouble(this.world.rand, 0, range*2)-range;
|
double newX = x+MathHelper.nextDouble(this.world.rand, 0, range*2)-range;
|
||||||
double newZ = z+MathHelper.nextDouble(this.world.rand, 0, range*2)-range;
|
double newZ = z+MathHelper.nextDouble(this.world.rand, 0, range*2)-range;
|
||||||
|
|
||||||
|
if(world.isBlockLoaded(new BlockPos(newX, y, newZ))){
|
||||||
EntityFireworkRocket rocket = new EntityFireworkRocket(world, newX, y+0.5, newZ, firework);
|
EntityFireworkRocket rocket = new EntityFireworkRocket(world, newX, y+0.5, newZ, firework);
|
||||||
world.spawnEntity(rocket);
|
world.spawnEntity(rocket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ItemStack makeFirework(){
|
private ItemStack makeFirework(){
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
|
|
Loading…
Reference in a new issue