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);
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations