use of org.freeforums.geforce.securitycraft.tileentity.TileEntityPortableRadar in project SecurityCraft by Geforce132.
the class HelpfulMethods method checkBlocksAndDisable.
private static void checkBlocksAndDisable(World par1World, int par2, int par3, int par4, Block par5, int radius, boolean isClient) {
if (!isClient) {
for (int i = 0; i < radius; i++) {
for (int j = 0; j < radius; j++) {
if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.empedWire) {
par1World.setBlock(par2 + i, par3, par4 + j, Blocks.redstone_wire, par1World.getBlockMetadata(par2 + i, par3, par4 + j), 3);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.MineCut) {
par1World.setBlock(par2 + i, par3, par4 + j, mod_SecurityCraft.Mine);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.portableRadar) {
TileEntityPortableRadar TEPR = (TileEntityPortableRadar) par1World.getTileEntity(par2 + i, par3, par4 + j);
TEPR.setEmped(false);
par1World.setTileEntity(par2 + i, par3, par4 + j, TEPR);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.Keypad) {
// int metadata = par1World.getBlockMetadata(par2 + i, par3, par4 + j);
// TileEntityKeypad TEK = (TileEntityKeypad) par1World.getBlockTileEntity(par2 + i, par3, par4 + j);
// par1World.setBlock(par2 + i, par3, par4 + j, mod_SecurityCraft.Keypad.blockID, metadata, 3);
// par1World.setBlockTileEntity(par2 + i, par3, par4 + j, TEK);
par1World.setBlockMetadataWithNotify(par2 + i, par3, par4 + j, par1World.getBlockMetadata(par2 + i, par3, par4 + j) - 5, 3);
par1World.notifyBlocksOfNeighborChange(par2 + i, par3, par4 + j, par1World.getBlock(par2 + i, par3, par4 + j));
}
updateAndNotify(par1World, par2 + i, par3, par4 + j, par1World.getBlock(par2 + i, par3, par4 + j), 1, false);
}
}
} else {
for (int i = 0; i < radius; i++) {
for (int j = 0; j < radius; j++) {
if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.empedWire) {
par1World.spawnParticle("largeexplode", par2 + i, par3 + 0.5D, par4 + j, 1.0D, 0.0D, 0.0D);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.MineCut) {
par1World.spawnParticle("largeexplode", par2 + i, par3 + 0.5D, par4 + j, 1.0D, 0.0D, 0.0D);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.portableRadar) {
par1World.spawnParticle("largeexplode", par2 + i, par3 + 0.5D, par4 + j, 1.0D, 0.0D, 0.0D);
}
}
}
}
}
use of org.freeforums.geforce.securitycraft.tileentity.TileEntityPortableRadar in project SecurityCraft by Geforce132.
the class HelpfulMethods method checkBlocksAndReplace.
private static void checkBlocksAndReplace(World par1World, int par2, int par3, int par4, Block par5, int radius, boolean isClient) {
if (!isClient) {
for (int i = 0; i < radius; i++) {
for (int j = 0; j < radius; j++) {
if (par1World.getBlock(par2 + i, par3, par4 + j) == Blocks.redstone_wire) {
par1World.setBlock(par2 + i, par3, par4 + j, mod_SecurityCraft.empedWire, par1World.getBlockMetadata(par2 + i, par3, par4 + j), 3);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.Mine) {
par1World.setBlock(par2 + i, par3, par4 + j, mod_SecurityCraft.MineCut);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.portableRadar) {
TileEntityPortableRadar TEPR = (TileEntityPortableRadar) par1World.getTileEntity(par2 + i, par3, par4 + j);
TEPR.setEmped(true);
par1World.setTileEntity(par2 + i, par3, par4 + j, TEPR);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.Keypad) {
// int metadata = par1World.getBlockMetadata(par2 + i, par3, par4 + j);
// TileEntityKeypad TEK = (TileEntityKeypad) par1World.getBlockTileEntity(par2 + i, par3, par4 + j);
// par1World.setBlock(par2 + i, par3, par4 + j, mod_SecurityCraft.KeypadActive.blockID, metadata, 3);
// par1World.setBlockTileEntity(par2 + i, par3, par4 + j, TEK);
par1World.setBlockMetadataWithNotify(par2 + i, par3, par4 + j, par1World.getBlockMetadata(par2 + i, par3, par4 + j) + 5, 3);
}
updateAndNotify(par1World, par2 + i, par3, par4 + j, par1World.getBlock(par2 + i, par3, par4 + j), 1, false);
}
}
} else {
for (int i = 0; i < radius; i++) {
for (int j = 0; j < radius; j++) {
if (par1World.getBlock(par2 + i, par3, par4 + j) == Blocks.redstone_wire) {
par1World.spawnParticle("largeexplode", par2 + i, par3 + 0.5D, par4 + j, 1.0D, 0.0D, 0.0D);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.Mine) {
par1World.spawnParticle("largeexplode", par2 + i, par3 + 0.5D, par4 + j, 1.0D, 0.0D, 0.0D);
} else if (par1World.getBlock(par2 + i, par3, par4 + j) == mod_SecurityCraft.portableRadar) {
par1World.spawnParticle("largeexplode", par2 + i, par3 + 0.5D, par4 + j, 1.0D, 0.0D, 0.0D);
}
}
}
}
}
use of org.freeforums.geforce.securitycraft.tileentity.TileEntityPortableRadar in project SecurityCraft by Geforce132.
the class BlockPortableRadar method addEffectsToPlayers.
public void addEffectsToPlayers(World par1World, int par2, int par3, int par4) {
if (par1World.isRemote) {
return;
} else {
// double d0 = (double)(5 * 10);
double d0 = (double) (mod_SecurityCraft.configHandler.portableRadarSearchRadius);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) par2, (double) par3, (double) par4, (double) (par2 + 1), (double) (par3 + 1), (double) (par4 + 1)).expand(d0, d0, d0);
axisalignedbb.maxY = (double) par1World.getHeight();
List list = par1World.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityPlayer entityplayer;
if (list.isEmpty()) {
if (par1World.getTileEntity(par2, par3, par4) != null && par1World.getTileEntity(par2, par3, par4) instanceof TileEntityPortableRadar && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4)).hasModule(EnumCustomModules.REDSTONE) && par1World.getBlockMetadata(par2, par3, par4) == 1) {
this.togglePowerOutput(par1World, par2, par3, par4, false);
return;
}
}
while (iterator.hasNext()) {
EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).getUsername());
entityplayer = (EntityPlayer) iterator.next();
if (this.isOwnerOnline(((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).getUsername())) {
if (!((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).isEmped()) {
HelpfulMethods.sendMessageToPlayer(entityplayermp, ((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).hasCustomName() ? (EnumChatFormatting.ITALIC + entityplayer.getCommandSenderName() + EnumChatFormatting.RESET + " is near your portable radar named " + EnumChatFormatting.ITALIC + ((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).getCustomName() + EnumChatFormatting.RESET + ".") : (EnumChatFormatting.ITALIC + entityplayer.getCommandSenderName() + EnumChatFormatting.RESET + " is near a portable radar (at X: " + par2 + " Y:" + par3 + " Z:" + par4 + ")."), null);
} else {
HelpfulMethods.sendMessageToPlayer(entityplayermp, "xxxxxxxxxx", EnumChatFormatting.OBFUSCATED);
}
}
if (par1World.getTileEntity(par2, par3, par4) != null && par1World.getTileEntity(par2, par3, par4) instanceof TileEntityPortableRadar && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4)).hasModule(EnumCustomModules.REDSTONE)) {
this.togglePowerOutput(par1World, par2, par3, par4, true);
}
}
}
}
Aggregations