use of net.geforcemods.securitycraft.api.IOwnable in project SecurityCraft by Geforce132.
the class ItemKeyPanel method onItemUse.
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (!par3World.isRemote) {
if (par3World.getBlock(par4, par5, par6) == mod_SecurityCraft.frame) {
Owner owner = ((IOwnable) par3World.getTileEntity(par4, par5, par6)).getOwner();
par3World.setBlock(par4, par5, par6, mod_SecurityCraft.keypad, par3World.getBlockMetadata(par4, par5, par6), 3);
((IOwnable) par3World.getTileEntity(par4, par5, par6)).getOwner().set(owner);
par1ItemStack.stackSize -= 1;
}
return true;
}
return false;
}
use of net.geforcemods.securitycraft.api.IOwnable in project SecurityCraft by Geforce132.
the class ItemUniversalOwnerChanger method onItemUse.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float f1, float f2, float f3) {
TileEntity te = world.getTileEntity(x, y, z);
String newOwner = stack.getDisplayName();
if (!world.isRemote) {
if (!stack.hasDisplayName()) {
PlayerUtils.sendMessageToPlayer(player, StatCollector.translateToLocal("item.universalOwnerChanger.name"), StatCollector.translateToLocal("messages.universalOwnerChanger.noName"), EnumChatFormatting.RED);
return false;
}
if (!(te instanceof IOwnable)) {
PlayerUtils.sendMessageToPlayer(player, StatCollector.translateToLocal("item.universalOwnerChanger.name"), StatCollector.translateToLocal("messages.universalOwnerChanger.cantChange"), EnumChatFormatting.RED);
return false;
}
if (!((IOwnable) te).getOwner().isOwner(player)) {
PlayerUtils.sendMessageToPlayer(player, StatCollector.translateToLocal("item.universalOwnerChanger.name"), StatCollector.translateToLocal("messages.universalOwnerChanger.notOwned"), EnumChatFormatting.RED);
return false;
}
if (world.getBlock(x, y, z) instanceof BlockReinforcedDoor) {
if (world.getBlock(x, y + 1, z) instanceof BlockReinforcedDoor)
((IOwnable) world.getTileEntity(x, y + 1, z)).getOwner().set(PlayerUtils.isPlayerOnline(newOwner) ? PlayerUtils.getPlayerFromName(newOwner).getUniqueID().toString() : "ownerUUID", newOwner);
else
((IOwnable) world.getTileEntity(x, y - 1, z)).getOwner().set(PlayerUtils.isPlayerOnline(newOwner) ? PlayerUtils.getPlayerFromName(newOwner).getUniqueID().toString() : "ownerUUID", newOwner);
}
if (te instanceof IOwnable)
((IOwnable) te).getOwner().set(PlayerUtils.isPlayerOnline(newOwner) ? PlayerUtils.getPlayerFromName(newOwner).getUniqueID().toString() : "ownerUUID", newOwner);
MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(te.getDescriptionPacket());
PlayerUtils.sendMessageToPlayer(player, StatCollector.translateToLocal("item.universalOwnerChanger.name"), StatCollector.translateToLocal("messages.universalOwnerChanger.changed").replace("#", newOwner), EnumChatFormatting.GREEN);
return true;
}
return false;
}
use of net.geforcemods.securitycraft.api.IOwnable in project SecurityCraft by Geforce132.
the class ItemBlockReinforcedSlabs method func_150946_a.
private boolean func_150946_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) {
if (par7 == 0) {
--par5;
}
if (par7 == 1) {
++par5;
}
if (par7 == 2) {
--par6;
}
if (par7 == 3) {
++par6;
}
if (par7 == 4) {
--par4;
}
if (par7 == 5) {
++par4;
}
Block block = par3World.getBlock(par4, par5, par6);
int i1 = par3World.getBlockMetadata(par4, par5, par6);
int j1 = i1 & 7;
Owner owner = null;
if (par3World.getTileEntity(par4, par5, par6) instanceof IOwnable) {
owner = ((IOwnable) par3World.getTileEntity(par4, par5, par6)).getOwner();
}
if (block == this.singleSlab && j1 == par1ItemStack.getItemDamage()) {
if (par3World.checkNoEntityCollision(this.getBlockVariant(i1).getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.getBlockVariant(i1), j1, 3)) {
par3World.playSoundEffect(par4 + 0.5F, par5 + 0.5F, par6 + 0.5F, this.getBlockVariant(i1).stepSound.func_150496_b(), (this.getBlockVariant(i1).stepSound.getVolume() + 1.0F) / 2.0F, this.getBlockVariant(i1).stepSound.getPitch() * 0.8F);
--par1ItemStack.stackSize;
if (owner != null) {
((IOwnable) par3World.getTileEntity(par4, par5, par6)).getOwner().set(owner.getUUID(), owner.getName());
}
}
return true;
} else {
return false;
}
}
use of net.geforcemods.securitycraft.api.IOwnable in project SecurityCraft by Geforce132.
the class BlockClaymore method defuseMine.
public void defuseMine(World world, int par2, int par3, int par4) {
if (!world.isRemote) {
Owner owner = ((IOwnable) world.getTileEntity(par2, par3, par4)).getOwner();
world.setBlock(par2, par3, par4, mod_SecurityCraft.claymoreDefused);
((IOwnable) world.getTileEntity(par2, par3, par4)).setOwner(owner.getUUID(), owner.getName());
}
}
use of net.geforcemods.securitycraft.api.IOwnable in project SecurityCraft by Geforce132.
the class BlockMine method defuseMine.
public void defuseMine(World world, int par2, int par3, int par4) {
if (!world.isRemote) {
Owner owner = ((IOwnable) world.getTileEntity(par2, par3, par4)).getOwner();
world.setBlock(par2, par3, par4, mod_SecurityCraft.mineCut);
((IOwnable) world.getTileEntity(par2, par3, par4)).setOwner(owner.getUUID(), owner.getName());
}
}
Aggregations