net.minecraft.client.entity.EntityOtherPlayerMP Java Examples

The following examples show how to use net.minecraft.client.entity.EntityOtherPlayerMP. 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: NPCUtils.java    From SkyblockAddons with MIT License 6 votes vote down vote up
/**
 * Checks if the given entity is an NPC
 *
 * @param entity the entity to check
 * @return {@code true} if the entity is an NPC, {@code false} otherwise
 */
public static boolean isNPC(Entity entity) {
    if (entity instanceof EntityOtherPlayerMP) {
        EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity;
        ScorePlayerTeam playerTeam = (ScorePlayerTeam) player.getTeam();

        // If it doesn't have a team, it's likely not a player.
        if (player.getTeam() == null) {
            return false;
        }

        // If it doesn't have a color prefix, it's not a player.
        return playerTeam.getColorPrefix().equals("");
    } else if (entity instanceof EntityArmorStand) {
        return entity.isInvisible();
    } else {
        return false;
    }
}
 
Example #2
Source File: EntityRendererHook.java    From SkyblockAddons with MIT License 6 votes vote down vote up
public static void removeEntities(List<Entity> list) {
    SkyblockAddons main = SkyblockAddons.getInstance();
    if (main.getUtils().isOnSkyblock()) {

        int keyCode = Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode();
        boolean isUseKeyDown = false;
        try {
            if (keyCode < 0) {
                isUseKeyDown = Mouse.isButtonDown(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode() + 100);
            } else {
                isUseKeyDown = Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode());
            }
        } catch (Throwable ex) {
            ex.printStackTrace();
            // Uhh I messed up something with the key detection... fix?
        }

        if (!GuiScreen.isCtrlKeyDown() && isUseKeyDown && main.getConfigValues().isEnabled(Feature.IGNORE_ITEM_FRAME_CLICKS)) {
            list.removeIf(listEntity -> listEntity instanceof EntityItemFrame &&
                    (((EntityItemFrame)listEntity).getDisplayedItem() != null || Minecraft.getMinecraft().thePlayer.getHeldItem() == null));
        }
        if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) {
            list.removeIf(entity -> entity instanceof EntityOtherPlayerMP && NPCUtils.isNearAnyNPCWithTag(entity, Tag.IMPORTANT) && !NPCUtils.isNPC(entity));
        }
    }
}
 
Example #3
Source File: FreeCamModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onEnable() {
    super.onEnable();
    final Minecraft mc = Minecraft.getMinecraft();
    if (mc.world != null) {
        if (mc.player.getRidingEntity() != null) {
            this.riding = mc.player.getRidingEntity();
            mc.player.dismountRidingEntity();
        }
        this.entity = new EntityOtherPlayerMP(mc.world, mc.session.getProfile());
        this.entity.copyLocationAndAnglesFrom(mc.player);
        this.entity.rotationYaw = mc.player.rotationYaw;
        this.entity.rotationYawHead = mc.player.rotationYawHead;
        this.entity.inventory.copyInventory(mc.player.inventory);
        mc.world.addEntityToWorld(69420, this.entity);
        this.position = mc.player.getPositionVector();
        this.yaw = mc.player.rotationYaw;
        this.pitch = mc.player.rotationPitch;
        mc.player.noClip = true;
    }
}
 
Example #4
Source File: FreeCam.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onEnable() {
    if(mc.thePlayer == null)
        return;

    oldX = mc.thePlayer.posX;
    oldY = mc.thePlayer.posY;
    oldZ = mc.thePlayer.posZ;

    fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());
    fakePlayer.clonePlayer(mc.thePlayer, true);

    fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;
    fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);

    mc.theWorld.addEntityToWorld(-1000, fakePlayer);

    if(noClipValue.get())
        mc.thePlayer.noClip = true;
}
 
Example #5
Source File: Blink.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onEnable() {
    if(mc.thePlayer == null)
        return;

    if (!pulseValue.get()) {
        fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());
        fakePlayer.clonePlayer(mc.thePlayer, true);
        fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);
        fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;
        mc.theWorld.addEntityToWorld(-1337, fakePlayer);
    }

    synchronized(positions) {
        positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + (mc.thePlayer.getEyeHeight() / 2), mc.thePlayer.posZ});
        positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});
    }

    pulseTimer.reset();
}
 
Example #6
Source File: FreecamMod.java    From ForgeHax with MIT License 6 votes vote down vote up
@Override
public void onEnabled() {
  if (getLocalPlayer() == null || getWorld() == null) {
    return;
  }
  
  if (isRidingEntity = getLocalPlayer().isRiding()) {
    ridingEntity = getLocalPlayer().getRidingEntity();
    getLocalPlayer().dismountRidingEntity();
  } else {
    pos = getLocalPlayer().getPositionVector();
  }
  
  angle = LocalPlayerUtils.getViewAngles();
  
  originalPlayer = new EntityOtherPlayerMP(getWorld(), MC.getSession().getProfile());
  originalPlayer.copyLocationAndAnglesFrom(getLocalPlayer());
  originalPlayer.rotationYawHead = getLocalPlayer().rotationYawHead;
  originalPlayer.inventory = getLocalPlayer().inventory;
  originalPlayer.inventoryContainer = getLocalPlayer().inventoryContainer;
  getWorld().addEntityToWorld(-100, originalPlayer);
}
 
Example #7
Source File: RenderManagerHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValue) {
    SkyblockAddons main = SkyblockAddons.getInstance();

    if (main.getUtils().isOnSkyblock()) {
        Location currentLocation = main.getUtils().getLocation();

        if (entityIn instanceof EntityItem &&
                entityIn.ridingEntity instanceof EntityArmorStand && entityIn.ridingEntity.isInvisible()) { // Conditions for skeleton helmet flying bones
            if (main.getConfigValues().isEnabled(Feature.HIDE_BONES)) {
                returnValue.cancel();
            }
        }
        if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) {
            if (entityIn instanceof EntityOtherPlayerMP && NPCUtils.isNearAnyNPCWithTag(entityIn, Tag.IMPORTANT) && !NPCUtils.isNPC(entityIn)) {
                returnValue.cancel();
            }
        }
        if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_IN_LOBBY)) {
            if (currentLocation == Location.VILLAGE || currentLocation == Location.AUCTION_HOUSE ||
                    currentLocation == Location.BANK) {
                if ((entityIn instanceof EntityOtherPlayerMP || entityIn instanceof EntityFX || entityIn instanceof EntityItemFrame) &&
                        entityIn.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) > 7) {
                    returnValue.cancel();
                }
            }
        }
        if(main.getConfigValues().isEnabled(Feature.HIDE_SVEN_PUP_NAMETAGS)) {
            if (entityIn instanceof EntityArmorStand && entityIn.hasCustomName()) {
                String customNameTag = entityIn.getCustomNameTag();

                if (customNameTag.contains("Sven Pup")) {
                    returnValue.cancel();
                }
            }
        }
    }
}
 
Example #8
Source File: MinecraftHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static void rightClickMouse(ReturnValue<?> returnValue) {
    SkyblockAddons main = SkyblockAddons.getInstance();
    if (main.getUtils().isOnSkyblock()) {
        Minecraft mc = Minecraft.getMinecraft();
        if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
            Entity entityIn = mc.objectMouseOver.entityHit;
            if (main.getConfigValues().isEnabled(Feature.DONT_OPEN_PROFILES_WITH_BOW)) {
                if (entityIn instanceof EntityOtherPlayerMP && !NPCUtils.isNPC(entityIn)) {
                    ItemStack item = mc.thePlayer.inventory.getCurrentItem();
                    ItemStack itemInUse = mc.thePlayer.getItemInUse();
                    if ((isItemBow(item) || isItemBow(itemInUse))) {
                        if (System.currentTimeMillis() - lastProfileMessage > 20000) {
                            lastProfileMessage = System.currentTimeMillis();
                            main.getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DONT_OPEN_PROFILES_WITH_BOW) +
                                    Message.MESSAGE_STOPPED_OPENING_PROFILE.getMessage());
                        }
                        returnValue.cancel();
                        return;
                    }
                }
            }
            if (main.getConfigValues().isEnabled(Feature.LOCK_SLOTS) && entityIn instanceof EntityItemFrame && ((EntityItemFrame)entityIn).getDisplayedItem() == null) {
                int slot = mc.thePlayer.inventory.currentItem + 36;
                if (main.getConfigValues().getLockedSlots().contains(slot) && slot >= 9) {
                    main.getUtils().playLoudSound("note.bass", 0.5);
                    main.getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DROP_CONFIRMATION) + Message.MESSAGE_SLOT_LOCKED.getMessage());
                    returnValue.cancel();
                }
            }
        }
    }
}
 
Example #9
Source File: BlinkModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onEnable() {
    super.onEnable();
    final Minecraft mc = Minecraft.getMinecraft();
    if (mc.world != null) {
        this.entity = new EntityOtherPlayerMP(mc.world, mc.session.getProfile());
        this.entity.copyLocationAndAnglesFrom(mc.player);
        this.entity.rotationYaw = mc.player.rotationYaw;
        this.entity.rotationYawHead = mc.player.rotationYawHead;
        this.entity.inventory.copyInventory(mc.player.inventory);
        mc.world.addEntityToWorld(6942069, this.entity);
    }
}
 
Example #10
Source File: WrapperEntityOtherPlayerMP.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperEntityOtherPlayerMP(EntityOtherPlayerMP var1) {
    super(var1);
    this.real = var1;
}
 
Example #11
Source File: WrapperEntityOtherPlayerMP.java    From ClientBase with MIT License 4 votes vote down vote up
public EntityOtherPlayerMP unwrap() {
    return this.real;
}