Fixed NPE in siren
This commit is contained in:
parent
e3980c1bd8
commit
209dd99820
|
@ -1,6 +1,7 @@
|
||||||
package resonantinduction.atomic.blocks;
|
package resonantinduction.atomic.blocks;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonant.lib.content.module.TileBlock;
|
import resonant.lib.content.module.TileBlock;
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
|
@ -30,30 +31,26 @@ public class TileSiren extends TileBlock
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void updateEntity()
|
||||||
{
|
{
|
||||||
if (worldObj == null)
|
World world = worldObj;
|
||||||
|
if (world != null)
|
||||||
{
|
{
|
||||||
return;
|
int metadata = world.getBlockMetadata(x(), y(), z());
|
||||||
}
|
|
||||||
|
|
||||||
int metadata = worldObj.getBlockMetadata(x(), y(), z());
|
if (world.getBlockPowerInput(x(), y(), z()) > 0)
|
||||||
|
|
||||||
if (worldObj.getBlockPowerInput(x(), y(), z()) > 0)
|
|
||||||
{
|
|
||||||
float volume = 0.5f;
|
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
{
|
||||||
Vector3 check = position().translate(ForgeDirection.getOrientation(i));
|
float volume = 0.5f;
|
||||||
int blockID = check.getBlockID(worldObj);
|
for (int i = 0; i < 6; i++)
|
||||||
|
|
||||||
if (blockID == blockID())
|
|
||||||
{
|
{
|
||||||
volume *= 1.5f;
|
Vector3 check = position().translate(ForgeDirection.getOrientation(i));
|
||||||
|
if (check.getBlockID(world) == blockID())
|
||||||
|
{
|
||||||
|
volume *= 1.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
worldObj.playSoundEffect(x(), y(), z(), Reference.PREFIX + "alarm", volume, 1f - 0.18f * (metadata / 15f));
|
world.playSoundEffect(x(), y(), z(), Reference.PREFIX + "alarm", volume, 1f - 0.18f * (metadata / 15f));
|
||||||
scheduelTick(30);
|
scheduelTick(30);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue