Fixed particle failing to spawn if railcraft air block was in the way
This commit is contained in:
parent
aed4ea5f90
commit
aa0b050e70
3 changed files with 11 additions and 9 deletions
|
@ -2,6 +2,7 @@ package resonantinduction.atomic.machine.accelerator;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -51,9 +52,10 @@ public class EntityParticle extends Entity implements IEntityAdditionalSpawnData
|
|||
this.movementDirection = dir;
|
||||
}
|
||||
|
||||
public static boolean canRenderAcceleratedParticle(World world, Vector3 pos)
|
||||
public static boolean canSpawnParticle(World world, Vector3 pos)
|
||||
{
|
||||
if (pos.getBlockID(world) != 0)
|
||||
Block block = Block.blocksList[pos.getBlockID(world)];
|
||||
if (block != null && !block.isAirBlock(world, pos.intX(), pos.intY(), pos.intZ()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -178,7 +180,7 @@ public class EntityParticle extends Entity implements IEntityAdditionalSpawnData
|
|||
this.lastTurn--;
|
||||
|
||||
/** Checks if the current block condition allows the particle to exist */
|
||||
if (!canRenderAcceleratedParticle(this.worldObj, new Vector3(this)) || this.isCollided)
|
||||
if (!canSpawnParticle(this.worldObj, new Vector3(this)) || this.isCollided)
|
||||
{
|
||||
explode();
|
||||
return;
|
||||
|
|
|
@ -29,7 +29,7 @@ public class GuiAccelerator extends GuiContainerBase
|
|||
Vector3 position = new Vector3(this.tileEntity);
|
||||
position.translate(this.tileEntity.getDirection().getOpposite());
|
||||
|
||||
if (!EntityParticle.canRenderAcceleratedParticle(this.tileEntity.worldObj, position))
|
||||
if (!EntityParticle.canSpawnParticle(this.tileEntity.worldObj, position))
|
||||
{
|
||||
status = "\u00a74Fail to emit; try rotating.";
|
||||
}
|
||||
|
|
|
@ -151,16 +151,16 @@ public class TileAccelerator extends TileElectricalInventory implements IElectro
|
|||
// Creates a accelerated particle if one needs to exist (on world load for example or player login).
|
||||
if (getStackInSlot(0) != null && lastSpawnTick >= 40)
|
||||
{
|
||||
Vector3 spawnAcceleratedParticle = new Vector3(this);
|
||||
spawnAcceleratedParticle.translate(getDirection().getOpposite());
|
||||
spawnAcceleratedParticle.translate(0.5f);
|
||||
Vector3 spawn_vec = new Vector3(this);
|
||||
spawn_vec.translate(getDirection().getOpposite());
|
||||
spawn_vec.translate(0.5f);
|
||||
|
||||
// Only render the particle if container within the proper environment for it.
|
||||
if (EntityParticle.canRenderAcceleratedParticle(worldObj, spawnAcceleratedParticle))
|
||||
if (EntityParticle.canSpawnParticle(worldObj, spawn_vec))
|
||||
{
|
||||
// Spawn the particle.
|
||||
totalEnergyConsumed = 0;
|
||||
entityParticle = new EntityParticle(worldObj, spawnAcceleratedParticle, new Vector3(this), getDirection().getOpposite());
|
||||
entityParticle = new EntityParticle(worldObj, spawn_vec, new Vector3(this), getDirection().getOpposite());
|
||||
worldObj.spawnEntityInWorld(entityParticle);
|
||||
|
||||
// Grabs input block hardness if available, otherwise defaults are used.
|
||||
|
|
Loading…
Reference in a new issue