Search in sources :

Example 61 with EntityPlayerMP

use of net.minecraft.entity.player.EntityPlayerMP in project RecurrentComplex by Ivorforce.

the class PacketOpenGuiHandler method processServer.

@Override
public void processServer(PacketOpenGui message, MessageContext ctx, WorldServer world) {
    EntityPlayerMP playerEntity = ctx.getServerHandler().player;
    IvGuiRegistry.INSTANCE.openGui(playerEntity, message.modId, message.modGuiId, message.data);
}
Also used : EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 62 with EntityPlayerMP

use of net.minecraft.entity.player.EntityPlayerMP in project RecurrentComplex by Ivorforce.

the class BlockScript method onBlockActivated.

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
    if (!worldIn.isRemote && playerIn instanceof EntityPlayerMP && playerIn.canUseCommand(2, "")) {
        TileEntity tileEntity = worldIn.getTileEntity(pos);
        RecurrentComplex.network.sendTo(new PacketEditTileEntity((TileEntityBlockScript) tileEntity), (EntityPlayerMP) playerIn);
    }
    return true;
}
Also used : PacketEditTileEntity(ivorius.reccomplex.network.PacketEditTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) PacketEditTileEntity(ivorius.reccomplex.network.PacketEditTileEntity) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 63 with EntityPlayerMP

use of net.minecraft.entity.player.EntityPlayerMP in project RecurrentComplex by Ivorforce.

the class IvGuiRegistry method openGui.

// From FMLNetworkHandler.openGui
public void openGui(EntityPlayer entityPlayer, String modid, int modGuiId, ByteBuf data) {
    IvGuiHandler handler = handlers.get(modid);
    if (handler == null)
        return;
    if (entityPlayer instanceof EntityPlayerMP && !(entityPlayer instanceof FakePlayer)) {
        EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer;
        ByteBuf dataCopy = data.copy();
        Container remoteGuiContainer = handler.getServerGuiElement(modGuiId, entityPlayerMP, data);
        entityPlayerMP.getNextWindowId();
        entityPlayerMP.closeContainer();
        int windowId = entityPlayerMP.currentWindowId;
        RecurrentComplex.network.sendTo(new PacketOpenGui(windowId, modid, modGuiId, dataCopy), entityPlayerMP);
        if (// If null, it's client only
        remoteGuiContainer != null) {
            entityPlayerMP.openContainer = remoteGuiContainer;
            entityPlayerMP.openContainer.windowId = windowId;
            entityPlayerMP.openContainer.addListener(entityPlayerMP);
        }
    } else if (entityPlayer instanceof FakePlayer) {
    // NO OP - I won't even log a message!
    } else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT)) {
        RecurrentComplex.network.sendToServer(new PacketOpenGui(0, modid, modGuiId, data));
    } else {
        FMLLog.fine("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUI ID: %s,%d", modid, modGuiId);
    }
}
Also used : Container(net.minecraft.inventory.Container) PacketOpenGui(ivorius.reccomplex.network.PacketOpenGui) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ByteBuf(io.netty.buffer.ByteBuf) FakePlayer(net.minecraftforge.common.util.FakePlayer)

Example 64 with EntityPlayerMP

use of net.minecraft.entity.player.EntityPlayerMP in project NewHorizonsCoreMod by GTNewHorizons.

the class CustomDropsCommand method canCommandSenderUseCommand.

@Override
public boolean canCommandSenderUseCommand(ICommandSender pCommandSender) {
    if (pCommandSender instanceof EntityPlayerMP) {
        EntityPlayerMP tEP = (EntityPlayerMP) pCommandSender;
        boolean tPlayerOpped = MinecraftServer.getServer().getConfigurationManager().func_152596_g(tEP.getGameProfile());
        // && tIncreative;
        return tPlayerOpped;
    } else if (pCommandSender instanceof MinecraftServer)
        return true;
    else
        return false;
}
Also used : EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) MinecraftServer(net.minecraft.server.MinecraftServer)

Example 65 with EntityPlayerMP

use of net.minecraft.entity.player.EntityPlayerMP in project NewHorizonsCoreMod by GTNewHorizons.

the class CustomToolTipsCommand method canCommandSenderUseCommand.

@Override
public boolean canCommandSenderUseCommand(ICommandSender pCommandSender) {
    if (pCommandSender instanceof EntityPlayerMP) {
        EntityPlayerMP tEP = (EntityPlayerMP) pCommandSender;
        boolean tPlayerOpped = MinecraftServer.getServer().getConfigurationManager().func_152596_g(tEP.getGameProfile());
        // && tIncreative;
        return tPlayerOpped;
    } else if (pCommandSender instanceof MinecraftServer)
        return true;
    else
        return false;
}
Also used : EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) MinecraftServer(net.minecraft.server.MinecraftServer)

Aggregations

EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)163 EntityPlayer (net.minecraft.entity.player.EntityPlayer)32 ItemStack (net.minecraft.item.ItemStack)23 TileEntity (net.minecraft.tileentity.TileEntity)18 Entity (net.minecraft.entity.Entity)17 EntityLivingBase (net.minecraft.entity.EntityLivingBase)15 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)15 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)14 BlockPos (net.minecraft.util.math.BlockPos)14 Block (net.minecraft.block.Block)11 IBlockState (net.minecraft.block.state.IBlockState)8 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)8 World (net.minecraft.world.World)8 WrongUsageException (net.minecraft.command.WrongUsageException)7 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)7 NetHandlerPlayServer (net.minecraft.network.NetHandlerPlayServer)7 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)6 TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)5 TileEntityReceiver (club.nsdn.nyasamatelecom.api.tileentity.TileEntityReceiver)5 GenericStructure (ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure)5