net.minecraft.client.entity.EntityClientPlayerMP Java Examples

The following examples show how to use net.minecraft.client.entity.EntityClientPlayerMP. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MoCClientPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void sendEntityJumpPacket()
{
    // client sending horse jump command. 

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(21));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    EntityClientPlayerMP player = MoCClientProxy.mc.thePlayer;
    //System.out.println("MoCClientPacketHandler sending packet 21 to player " + player.toString());
    player.sendQueue.addToSendQueue(packet);
}
 
Example #2
Source File: MoCClientPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void sendInstaSpawnPacket(int ID, int number)
{
    // client sending insta spawn command. int ID, int number

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(22));
        data.writeInt(Integer.valueOf(ID));
        data.writeInt(Integer.valueOf(number));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    EntityClientPlayerMP player = MoCClientProxy.mc.thePlayer;
    player.sendQueue.addToSendQueue(packet);
}
 
Example #3
Source File: MoCClientPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void sendEntityDivePacket()
{
    // client sending entity dive command. 

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(24));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;

    EntityClientPlayerMP player = MoCClientProxy.mc.thePlayer;
    player.sendQueue.addToSendQueue(packet);
}
 
Example #4
Source File: MoCClientPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void sendEntityDismountPacket() 
{
	ByteArrayOutputStream bytes = new ByteArrayOutputStream();
       DataOutputStream data = new DataOutputStream(bytes);
       try
       {
           data.writeInt(Integer.valueOf(25));
       }
       catch (IOException e)
       {
           e.printStackTrace();
       }

       Packet250CustomPayload packet = new Packet250CustomPayload();
       packet.channel = "MoCreatures";
       packet.data = bytes.toByteArray();
       packet.length = packet.data.length;

       EntityClientPlayerMP player = MoCClientProxy.mc.thePlayer;
       player.sendQueue.addToSendQueue(packet);
	
}
 
Example #5
Source File: NowYouSeeMe.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isActive() {
    EntityClientPlayerMP player = Wrapper.INSTANCE.player();
    if (player == null) {
        return false;
    }

    if (player.isPotionActive(Potion.invisibility)) {
        PotionEffect activePotionEffect = player.getActivePotionEffect(Potion.invisibility);
        return activePotionEffect.getDuration() > 20000;
    }
    return false;
}
 
Example #6
Source File: ConfigEvent.java    From wailanbt with MIT License 5 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
@SubscribeEvent
public void onPlayerJoinWorld(EntityJoinWorldEvent event) {
    if(event.entity instanceof EntityClientPlayerMP){
        LogHelper.info("Initializing config");
        config.init(config.modConfigurationDirectory, (EntityPlayer)event.entity);
    }
}
 
Example #7
Source File: MoCClientPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Packets generated client side
 * 
 */

//-----------client side
public static void sendNameInfo(int entityId, String nameToSet)
{
    // client sending name info. int entityID and string name

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    DataOutputStream data = new DataOutputStream(bytes);
    try
    {
        data.writeInt(Integer.valueOf(20));
        data.writeInt(entityId);
        data.writeUTF(nameToSet);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }

    Packet250CustomPayload packet = new Packet250CustomPayload();
    packet.channel = "MoCreatures";
    packet.data = bytes.toByteArray();
    packet.length = packet.data.length;
    EntityClientPlayerMP player = MoCClientProxy.mc.thePlayer;
    player.sendQueue.addToSendQueue(packet);

    //EntityClientPlayerMP thePlayerMP = (EntityClientPlayerMP)player;
    //thePlayerMP.sendQueue.addToSendQueue(packet);

}
 
Example #8
Source File: MoCClientPacketHandler.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * New instaSpawn method with (key) name of entity and number to spawn
 * @param name
 * @param number
 */
public static void sendInstaSpawnPacket(String name, int number)
   {
       // client sending insta spawn command. int ID, int number

	if (name.isEmpty() || number < 1)
	{
		return;
	}
	
       ByteArrayOutputStream bytes = new ByteArrayOutputStream();
       DataOutputStream data = new DataOutputStream(bytes);
       try
       {
           data.writeInt(Integer.valueOf(26));
           data.writeUTF(name);
           data.writeInt(Integer.valueOf(number));
       }
       catch (IOException e)
       {
           e.printStackTrace();
       }

       Packet250CustomPayload packet = new Packet250CustomPayload();
       packet.channel = "MoCreatures";
       packet.data = bytes.toByteArray();
       packet.length = packet.data.length;

       EntityClientPlayerMP player = MoCClientProxy.mc.thePlayer;
       player.sendQueue.addToSendQueue(packet);
   }
 
Example #9
Source File: HGKeyHandler.java    From HexxitGear with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;

    if (player == null || tickEnd)
        return;

    if (kb.equals(activateHexxitArmor)) {
        if (ArmorSet.getPlayerArmorSet(player.username) != null) {
            Object[] data = new Object[] { player.username };
            PacketDispatcher.sendPacketToServer(PacketWrapper.createPacket(HexxitGear.modNetworkChannel, Packets.armorAbility, data));
            //ArmorSet.readArmorPacket(player.username);
        }
    }
}
 
Example #10
Source File: MwUtil.java    From mapwriter with MIT License 5 votes vote down vote up
public static void printBoth(String msg) {
	EntityClientPlayerMP thePlayer = Minecraft.getMinecraft().thePlayer;
	if (thePlayer != null) {
		thePlayer.addChatMessage(new ChatComponentText(msg));
	}
	MwUtil.log("%s", msg);
}
 
Example #11
Source File: Wrapper.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
public EntityClientPlayerMP player() {
    return Wrapper.INSTANCE.mc().thePlayer;
}
 
Example #12
Source File: OverlaySlime.java    From mapwriter with MIT License 4 votes vote down vote up
public static void askSeed(){
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
    if(player == null) return;
    player.sendChatMessage("/seed"); //Send the /seed command to the server
    seedAsked = true;
}