use of net.minecraft.entity.player.EntityPlayerMP in project MorePlanets by SteveKunG.
the class SlotBlackHoleStorageSchematic method onSlotChanged.
@Override
public void onSlotChanged() {
if (this.player instanceof EntityPlayerMP) {
int dimID = GCCoreUtil.getDimensionID(this.player.world);
GCCoreUtil.sendToAllAround(new PacketSimple(EnumSimplePacket.C_SPAWN_SPARK_PARTICLES, dimID, new Object[] { this.pos }), this.player.world, dimID, this.pos, 20);
}
}
use of net.minecraft.entity.player.EntityPlayerMP in project SecurityCraft by Geforce132.
the class BlockPortableRadar method searchForPlayers.
public static void searchForPlayers(World par1World, int par2, int par3, int par4, double searchRadius) {
if (!par1World.isRemote) {
double d0 = (searchRadius);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par2, par3, par4, par2 + 1, par3 + 1, par4 + 1).expand(d0, d0, d0);
axisalignedbb.maxY = 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) {
togglePowerOutput(par1World, par2, par3, par4, false);
return;
}
while (iterator.hasNext()) {
EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).getOwner().getName());
entityplayer = (EntityPlayer) iterator.next();
if (par1World.getTileEntity(par2, par3, par4) == null || !(par1World.getTileEntity(par2, par3, par4) instanceof CustomizableSCTE))
continue;
if (((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4)).hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(entityplayermp.getCommandSenderName().toLowerCase()))
continue;
if (PlayerUtils.isPlayerOnline(((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).getOwner().getName())) {
if (!((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).shouldSendMessage(entityplayer))
continue;
PlayerUtils.sendMessageToPlayer(entityplayermp, StatCollector.translateToLocal("tile.portableRadar.name"), ((INameable) par1World.getTileEntity(par2, par3, par4)).hasCustomName() ? (StatCollector.translateToLocal("messages.portableRadar.withName").replace("#p", EnumChatFormatting.ITALIC + entityplayer.getCommandSenderName() + EnumChatFormatting.RESET).replace("#n", EnumChatFormatting.ITALIC + ((INameable) par1World.getTileEntity(par2, par3, par4)).getCustomName() + EnumChatFormatting.RESET)) : (StatCollector.translateToLocal("messages.portableRadar.withoutName").replace("#p", EnumChatFormatting.ITALIC + entityplayer.getCommandSenderName() + EnumChatFormatting.RESET).replace("#l", Utils.getFormattedCoordinates(par2, par3, par4))), EnumChatFormatting.BLUE);
((TileEntityPortableRadar) par1World.getTileEntity(par2, par3, par4)).setSentMessage();
}
if (par1World.getTileEntity(par2, par3, par4) != null && par1World.getTileEntity(par2, par3, par4) instanceof TileEntityPortableRadar && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4)).hasModule(EnumCustomModules.REDSTONE))
togglePowerOutput(par1World, par2, par3, par4, true);
}
}
}
use of net.minecraft.entity.player.EntityPlayerMP in project SecurityCraft by Geforce132.
the class BlockPortableRadar method searchForPlayers.
public static void searchForPlayers(World par1World, BlockPos pos, IBlockState state) {
if (!par1World.isRemote) {
double d0 = (SecurityCraft.config.portableRadarSearchRadius);
AxisAlignedBB axisalignedbb = AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).expand(d0, d0, d0).addCoord(0.0D, par1World.getHeight(), 0.0D);
List<?> list = par1World.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator<?> iterator = list.iterator();
EntityPlayer entityplayer;
if (list.isEmpty())
if (par1World.getTileEntity(pos) != null && par1World.getTileEntity(pos) instanceof TileEntityPortableRadar && ((CustomizableSCTE) par1World.getTileEntity(pos)).hasModule(EnumCustomModules.REDSTONE) && ((Boolean) state.getValue(POWERED)).booleanValue()) {
togglePowerOutput(par1World, pos, false);
return;
}
if (!((CustomizableSCTE) par1World.getTileEntity(pos)).hasModule(EnumCustomModules.REDSTONE))
togglePowerOutput(par1World, pos, false);
while (iterator.hasNext()) {
EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(((TileEntityPortableRadar) par1World.getTileEntity(pos)).getOwner().getName());
entityplayer = (EntityPlayer) iterator.next();
if (entityplayermp != null && ((CustomizableSCTE) par1World.getTileEntity(pos)).hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(par1World, pos, EnumCustomModules.WHITELIST).contains(entityplayermp.getCommandSenderName().toLowerCase()))
continue;
if (PlayerUtils.isPlayerOnline(((TileEntityPortableRadar) par1World.getTileEntity(pos)).getOwner().getName())) {
if (!((TileEntityPortableRadar) par1World.getTileEntity(pos)).shouldSendMessage(entityplayer))
continue;
PlayerUtils.sendMessageToPlayer(entityplayermp, StatCollector.translateToLocal("tile.portableRadar.name"), ((INameable) par1World.getTileEntity(pos)).hasCustomName() ? (StatCollector.translateToLocal("messages.portableRadar.withName").replace("#p", EnumChatFormatting.ITALIC + entityplayer.getCommandSenderName() + EnumChatFormatting.RESET).replace("#n", EnumChatFormatting.ITALIC + ((INameable) par1World.getTileEntity(pos)).getCustomName() + EnumChatFormatting.RESET)) : (StatCollector.translateToLocal("messages.portableRadar.withoutName").replace("#p", EnumChatFormatting.ITALIC + entityplayer.getCommandSenderName() + EnumChatFormatting.RESET).replace("#l", Utils.getFormattedCoordinates(pos))), EnumChatFormatting.BLUE);
((TileEntityPortableRadar) par1World.getTileEntity(pos)).setSentMessage();
}
if (par1World.getTileEntity(pos) != null && par1World.getTileEntity(pos) instanceof TileEntityPortableRadar && ((CustomizableSCTE) par1World.getTileEntity(pos)).hasModule(EnumCustomModules.REDSTONE))
togglePowerOutput(par1World, pos, true);
}
}
}
use of net.minecraft.entity.player.EntityPlayerMP in project Almura by AlmuraDev.
the class ServerNickManager method onChangeNickname.
@Listener(order = Order.POST)
public void onChangeNickname(final NucleusChangeNicknameEvent event, @Getter("getTargetUser") final Player player) throws IllegalAccessException {
final EntityPlayerMP mcPlayer = (EntityPlayerMP) player;
final String oldNick = mcPlayer.getDisplayNameString();
final String newNick = TextSerializers.LEGACY_FORMATTING_CODE.serialize(event.getNewNickname());
if (!oldNick.equals(newNick)) {
// Tell the Forge mods
final String modNick = ForgeEventFactory.getPlayerDisplayName(mcPlayer, newNick);
final Text finalNick = TextSerializers.LEGACY_FORMATTING_CODE.deserialize(modNick);
if (!newNick.equals(modNick)) {
// Mod says our nick needs to be something else
this.game.getServiceManager().provide(NucleusNicknameService.class).ifPresent((service) -> {
try {
service.setNickname(player, finalNick);
} catch (NicknameException e) {
e.printStackTrace();
}
});
}
displayNameField.set(mcPlayer, modNick);
// Tell everyone about the new nick
this.network.sendToAll(this.getMappingMessage(player, Text.of("~" + finalNick.toPlain())));
}
}
use of net.minecraft.entity.player.EntityPlayerMP in project Almura by AlmuraDev.
the class SignEditFeature method interact.
@Listener
public void interact(final InteractBlockEvent.Secondary.MainHand event, @Root final Player player) {
if (!(player instanceof EntityPlayerMP) || !player.require(Keys.IS_SNEAKING)) {
return;
}
final BlockSnapshot snapshot = event.getTargetBlock();
final BlockType type = snapshot.getState().getType();
if (type == BlockTypes.STANDING_SIGN || type == BlockTypes.WALL_SIGN) {
snapshot.getLocation().flatMap(Location::getTileEntity).ifPresent((be) -> {
if (be instanceof TileEntitySign) {
((EntityPlayerMP) player).connection.sendPacket(new SPacketSignEditorOpen(VecHelper.toBlockPos(snapshot.getPosition())));
}
});
}
}
Aggregations