Java 类net.minecraft.client.entity.EntityPlayerSP 实例源码

项目:needtobreath    文件:NTBOverlayRenderer.java   
public static void onRenderWorld(RenderWorldLastEvent event) {
//        EntityPlayerSP player = Minecraft.getMinecraft().player;
//        if (player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
//            return;
//        }

//        if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.radiationMonitorItem) {
//            return;
//        }


        if (cleanAir != null) {
            EntityPlayerSP p = Minecraft.getMinecraft().player;
            if (hasGlasses()) {
                int cnt = cleanAir.size();
                if (cnt != prevCnt) {
                    System.out.println("cleanAir = " + cnt);
                    prevCnt = cnt;
                }
                renderHighlightedBlocks(event, p, cleanAir);
            }
        }
    }
项目:Backmemed    文件:CrystalAura.java   
@Override
public void onUpdate(EntityPlayerSP player) {
    if(isEnabled()) {
        currentMS = System.nanoTime() / 1000000;
        if(hasDelayRun((long)(1000 / crystalSpeed.getValue())))
        {
            for (Entity e : Wrapper.getWorld().loadedEntityList) {
                if (player.getDistanceToEntity(e) < crystalRange.getValue()) {
                    if (e instanceof EntityEnderCrystal) {
                        Wrapper.getMinecraft().playerController.attackEntity(player, e);
                        player.swingArm(EnumHand.MAIN_HAND);
                        lastMS = System.nanoTime() / 1000000;
                        break;
                    }
                }
            }
        }
    }
}
项目:interactionwheel    文件:RenderHandler.java   
private static void renderBlocks(RenderWorldLastEvent evt, Set<BlockPos> blocks) {
    EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());

    double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
    double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
    double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();

    GlStateManager.pushMatrix();
    GlStateManager.translate(-doubleX, -doubleY, -doubleZ);

    GlStateManager.disableDepth();
    GlStateManager.enableTexture2D();

    for (BlockPos pos : blocks) {
        renderBoxOutline(pos);
    }

    GlStateManager.enableDepth();

    GlStateManager.popMatrix();
}
项目:DecompiledMinecraft    文件:RenderPlayer.java   
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    if (!entity.isUser() || this.renderManager.livingPlayer == entity)
    {
        double d0 = y;

        if (entity.isSneaking() && !(entity instanceof EntityPlayerSP))
        {
            d0 = y - 0.125D;
        }

        this.setModelVisibilities(entity);
        super.doRender(entity, x, d0, z, entityYaw, partialTicks);
    }
}
项目:Wurst-MC-1.12    文件:RepairCmd.java   
@Override
public void call(String[] args) throws CmdException
{
    if(args.length > 0)
        throw new CmdSyntaxError();

    // check for creative mode
    EntityPlayerSP player = WMinecraft.getPlayer();
    if(!player.capabilities.isCreativeMode)
        throw new CmdError("Creative mode only.");

    // validate item
    ItemStack item = player.inventory.getCurrentItem();
    if(item == null)
        throw new CmdError("You need an item in your hand.");
    if(!item.isItemStackDamageable())
        throw new CmdError("This item can't take damage.");
    if(!item.isItemDamaged())
        throw new CmdError("This item is not damaged.");

    // repair item
    item.setItemDamage(0);
    WConnection.sendPacket(new CPacketCreativeInventoryAction(
        36 + player.inventory.currentItem, item));
}
项目:Proyecto-DASI    文件:AbsoluteMovementCommandsImplementation.java   
private void sendChanges()
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player == null)
        return;

    // Send any changes requested over the wire to the server:
    double x = this.setX ? this.x : 0;
    double y = this.setY ? this.y : 0;
    double z = this.setZ ? this.z : 0;
    float yaw = this.setYaw ? this.rotationYaw : 0;
    float pitch = this.setPitch ? this.rotationPitch : 0;

    if (this.setX || this.setY || this.setZ || this.setYaw || this.setPitch)
    {
        MalmoMod.network.sendToServer(new TeleportMessage(x, y, z, yaw, pitch, this.setX, this.setY, this.setZ, this.setYaw, this.setPitch));
        if (this.setYaw || this.setPitch)
        {
            // Send a message that the ContinuousMovementCommands can pick up on:
            Event event = new CommandForWheeledRobotNavigationImplementation.ResetPitchAndYawEvent(this.setYaw, this.rotationYaw, this.setPitch, this.rotationPitch);
            MinecraftForge.EVENT_BUS.post(event);
        }
        this.setX = this.setY = this.setZ = this.setYaw = this.setPitch = false;
    }
}
项目:BaseClient    文件:RenderUtils.java   
public static void drawBeacon(BlockPos pos, int color, int colorIn, float partialTicks) {
    GlStateManager.pushMatrix();
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
    double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
    double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
    GL11.glLineWidth((float)1.0f);
    AxisAlignedBB var11 = new AxisAlignedBB((double)(pos.getX() + 1), (double)pos.getY(), (double)(pos.getZ() + 1), (double)pos.getX(), (double)(pos.getY() + 200), (double)pos.getZ());
    AxisAlignedBB var12 = new AxisAlignedBB(var11.minX - x, var11.minY - y, var11.minZ - z, var11.maxX - x, var11.maxY - y, var11.maxZ - z);
    if (color != 0) {
        GlStateManager.disableDepth();
        RenderUtils.filledBox(var12, colorIn, true);
        RenderUtils.disableLighting();
        drawOutlinedBoundingBox((AxisAlignedBB)var12, (int)color);
    }
    GlStateManager.popMatrix();
}
项目:Backmemed    文件:AutoEat.java   
@Override
public void onUpdate(EntityPlayerSP player) {
       ItemStack curStack = player.inventory.getCurrentItem();

    if(isEnabled()) {

        if(!shouldEat()) {
            Wrapper.getMinecraft().gameSettings.keyBindUseItem.pressed = false;
            return;
        }

        FoodStats foodStats = player.getFoodStats();
           if (foodStats.getFoodLevel() <= hungerFactor.getValue() && shouldEat()) 
           {
            eatFood();
           }
    }
}
项目:BaseClient    文件:RenderUtils.java   
public static void drawBeacon(BlockPos pos, int color, int colorIn, float partialTicks) {
    GlStateManager.pushMatrix();
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
    double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
    double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
    GL11.glLineWidth((float)1.0f);
    AxisAlignedBB var11 = new AxisAlignedBB((double)(pos.getX() + 1), (double)pos.getY(), (double)(pos.getZ() + 1), (double)pos.getX(), (double)(pos.getY() + 200), (double)pos.getZ());
    AxisAlignedBB var12 = new AxisAlignedBB(var11.minX - x, var11.minY - y, var11.minZ - z, var11.maxX - x, var11.maxY - y, var11.maxZ - z);
    if (color != 0) {
        GlStateManager.disableDepth();
        RenderUtils.filledBox(var12, colorIn);
        RenderUtils.disableLighting();
        drawOutlinedBoundingBox((AxisAlignedBB)var12, (int)color);
    }
    GlStateManager.popMatrix();
}
项目:Solar    文件:ItemAngstrom.java   
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand); //Not entirely convinced it works
    RayTraceResult result = world.isRemote ? RayTraceHelper.tracePlayerHighlight((EntityPlayerSP) player) : RayTraceHelper.tracePlayerHighlight((EntityPlayerMP) player);
    if(result.typeOfHit != RayTraceResult.Type.BLOCK) {
        if(!world.isRemote) {
            Vector3 vec = Vector3.create(player.posX, player.posY + player.getEyeHeight(), player.posZ);
            vec.add(Vector3.create(player.getLookVec()).multiply(2.5D));
            BlockPos pos = new BlockPos(vec.toVec3d());
            IBlockState replaced = world.getBlockState(pos);
            if(world.isAirBlock(pos) || replaced.getBlock().isReplaceable(world, pos)) {
                IBlockState state = ModBlocks.ANGSTROM.getDefaultState();
                SoundType type = ModBlocks.ANGSTROM.getSoundType(state, world, pos, player);
                world.setBlockState(pos, state);
                world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), type.getPlaceSound(), SoundCategory.BLOCKS, 0.75F, 0.8F);
            }
            if(!player.capabilities.isCreativeMode) {
                stack.shrink(1);
            }
        }
        return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
    }
    return ActionResult.newResult(EnumActionResult.PASS, stack);
}
项目:Proyecto-DASI    文件:PositionHelper.java   
public static List<BlockPos> getTouchingBlocks(EntityPlayerSP player)
{
    // Determine which blocks we are touching.
    // This code is adapted from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
    BlockPos blockposmin = new BlockPos(player.getEntityBoundingBox().minX - 0.001D, player.getEntityBoundingBox().minY - 0.001D, player.getEntityBoundingBox().minZ - 0.001D);
    BlockPos blockposmax = new BlockPos(player.getEntityBoundingBox().maxX + 0.001D, player.getEntityBoundingBox().maxY + 0.001D, player.getEntityBoundingBox().maxZ + 0.001D);
    List<BlockPos> blocks = new ArrayList<BlockPos>();

    if (player.worldObj.isAreaLoaded(blockposmin, blockposmax))
    {
        for (int i = blockposmin.getX(); i <= blockposmax.getX(); ++i)
        {
            for (int j = blockposmin.getY(); j <= blockposmax.getY(); ++j)
            {
                for (int k = blockposmin.getZ(); k <= blockposmax.getZ(); ++k)
                {
                    blocks.add(new BlockPos(i, j, k));
                }
            }
        }
    }
    return blocks;
}
项目:Proyecto-DASI    文件:CommandForWheeledRobotNavigationImplementation.java   
@Override
public void install(MissionInit missionInit)
{
    // Create our movement hook, which allows us to override the Minecraft movement.
    this.overrideMovement = new MovementHook(Minecraft.getMinecraft().gameSettings);
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player != null)
    {
        // Insert it into the player, keeping a record of the original movement object
        // so we can restore it later.
        this.originalMovement = player.movementInput;
        player.movementInput = this.overrideMovement;
    }

    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(this);
}
项目:Proyecto-DASI    文件:RewardForTouchingBlockTypeImplementation.java   
private void calculateReward(MultidimensionalReward reward)
{
    // Determine what blocks we are touching.
    // This code is largely cribbed from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;

    List<BlockPos> touchingBlocks = PositionHelper.getTouchingBlocks(player);
    for (BlockPos pos : touchingBlocks) {
        IBlockState iblockstate = player.worldObj.getBlockState(pos);
        for (BlockMatcher bm : this.matchers) {
            if (bm.applies(pos) && bm.matches(pos, iblockstate))
            {
                float reward_value = bm.reward();
                float adjusted_reward = adjustAndDistributeReward(reward_value, this.params.getDimension(), bm.spec.getDistribution());
                reward.add( this.params.getDimension(), adjusted_reward );
            }
        }
    }
}
项目:Proyecto-DASI    文件:ObservationFromFullInventoryImplementation.java   
public static void getInventoryJSON(JsonObject json, String prefix, int maxSlot)
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    int nSlots = Math.min(player.inventory.getSizeInventory(), maxSlot);
    for (int i = 0; i < nSlots; i++)
    {
        ItemStack is = player.inventory.getStackInSlot(i);
        if (is != null)
        {
            json.addProperty(prefix + i + "_size", is.stackSize);
            DrawItem di = MinecraftTypeHelper.getDrawItemFromItemStack(is);
            String name = di.getType();
            if (di.getColour() != null)
                json.addProperty(prefix + i + "_colour",  di.getColour().value());
            if (di.getVariant() != null)
                json.addProperty(prefix + i + "_variant", di.getVariant().getValue());
            json.addProperty(prefix + i + "_item", name);
        }
    }        
}
项目:Proyecto-DASI    文件:AbsoluteMovementCommandsImplementation.java   
private void sendChanges()
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player == null)
        return;

    // Send any changes requested over the wire to the server:
    double x = this.setX ? this.x : 0;
    double y = this.setY ? this.y : 0;
    double z = this.setZ ? this.z : 0;
    float yaw = this.setYaw ? this.rotationYaw : 0;
    float pitch = this.setPitch ? this.rotationPitch : 0;

    if (this.setX || this.setY || this.setZ || this.setYaw || this.setPitch)
    {
        MalmoMod.network.sendToServer(new TeleportMessage(x, y, z, yaw, pitch, this.setX, this.setY, this.setZ, this.setYaw, this.setPitch));
        if (this.setYaw || this.setPitch)
        {
            // Send a message that the ContinuousMovementCommands can pick up on:
            Event event = new CommandForWheeledRobotNavigationImplementation.ResetPitchAndYawEvent(this.setYaw, this.rotationYaw, this.setPitch, this.rotationPitch);
            MinecraftForge.EVENT_BUS.post(event);
        }
        this.setX = this.setY = this.setZ = this.setYaw = this.setPitch = false;
    }
}
项目:Backmemed    文件:HitSpheres.java   
@Override
public void onRender() {
    if(isEnabled()) {
        for(Entity ep : Wrapper.getWorld().loadedEntityList) {
            if(ep instanceof EntityPlayerSP) continue;
            if(ep instanceof EntityPlayer) {
                double d = ep.lastTickPosX + (ep.posX - ep.lastTickPosX) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
                double d1 = ep.lastTickPosY + (ep.posY - ep.lastTickPosY) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
                double d2 = ep.lastTickPosZ + (ep.posZ - ep.lastTickPosZ) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
                if(Wrapper.getFriends().isFriend(((EntityPlayer)ep).getName())) {
                    GL11.glColor4f(0.15F, 0.15F, 1.0F, 1.0F);
                } else {
                    if(Wrapper.getPlayer().getDistanceToEntity(ep) >= 64) {
                        GL11.glColor4f(0.0F, 1.0F, 0.0F, 1.0F);
                    } else {
                        GL11.glColor4f(1.0F, Wrapper.getPlayer().getDistanceToEntity(ep) / 150, 0.0F, 1.0F);
                    }
                }
                RenderUtils.drawSphere(d, d1, d2, KillAura.auraRange.getValue(), 20, 15);
            }
        }
    }
}
项目:Proyecto-DASI    文件:ObservationFromFullInventoryImplementation.java   
public static void getInventoryJSON(JsonObject json, String prefix, int maxSlot)
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    int nSlots = Math.min(player.inventory.getSizeInventory(), maxSlot);
    for (int i = 0; i < nSlots; i++)
    {
        ItemStack is = player.inventory.getStackInSlot(i);
        if (is != null)
        {
            json.addProperty(prefix + i + "_size", is.stackSize);
            DrawItem di = MinecraftTypeHelper.getDrawItemFromItemStack(is);
            String name = di.getType();
            if (di.getColour() != null)
                json.addProperty(prefix + i + "_colour",  di.getColour().value());
            if (di.getVariant() != null)
                json.addProperty(prefix + i + "_variant", di.getVariant().getValue());
            json.addProperty(prefix + i + "_item", name);
        }
    }        
}
项目:Proyecto-DASI    文件:ChatCommandsImplementation.java   
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit)
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player == null)
    {
        return false;
    }

    if (!verb.equalsIgnoreCase(ChatCommand.CHAT.value()))
    {
        return false;
    }

    player.sendChatMessage( parameter );
    return true;
}
项目:Whoosh    文件:EventHandlerClient.java   
@SubscribeEvent
public void onMouseEvent(MouseEvent event) {
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if(event.getDwheel() != 0 && player != null && player.isSneaking()) {
        ItemStack stack = player.getHeldItemMainhand();
        Item item = stack.getItem();
        if(item instanceof ItemTransporter) {
            if(((ItemTransporter) item).getMode(stack) == 1) {

                ItemTransporter.cycleSelected(stack, event.getDwheel());
                PacketWhoosh.sendCycleSelectedPacketToServer(event.getDwheel());
                event.setCanceled(true);
            }
        }
    }
}
项目:rezolve    文件:GhostSlotUpdateMessage.java   
public GhostSlotUpdateMessage(EntityPlayerSP player, TileEntity entity, int slot, ItemStack itemStack) {
    this.playerId = player.getUniqueID().toString();

    BlockPos pos = entity.getPos();
    this.x = pos.getX();
    this.y = pos.getY();
    this.z = pos.getZ();

    this.slot = slot;
    this.stack = itemStack;
}
项目:Lector    文件:GuiManual.java   
@Override
public void initGui() {
    super.initGui();

    guiLeft = (this.width - WIDTH) / 2;
    guiTop = (this.height - HEIGHT) / 2;

    EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());
    ItemStack book = player.getHeldItemMainhand();
    if (ItemStackTools.isValid(book) && book.getItem() instanceof IBook) {
        json = ((IBook) book.getItem()).getJson();
        BookParser parser = new BookParser();
        pages = parser.parse(json, WIDTH_FACTOR, HEIGHT_FACTOR);
        pageNumber = 0;
        result = null;
    } else {
        json = null;    // Shouldn't be possible
        pages = new ArrayList<>();
        pages.add(new BookPage());
        RenderSection section = new RenderSection("Error");
        TextElementFormat fmt = new TextElementFormat("red,bold");
        section.addElement(new RenderElementText("Error!", 10, 10, (int) ClientProxy.font.getWidth("Error!"), (int) ClientProxy.font.getHeight(), fmt));
        pages.get(0).addSection(section);
        pageNumber = 0;
        result = null;
    }
}
项目:Whoosh    文件:EventHandlerClient.java   
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post event) {
    if(event.getType() != RenderGameOverlayEvent.ElementType.EXPERIENCE) {
        return;
    }

    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayerSP player = mc.player;
    ItemStack stack = player.getHeldItemMainhand();
    if(stack == null || !(stack.getItem() instanceof ItemTransporter))
        return;

    if(!ItemTransporter.canPlayerAccess(stack, player))
        return;

    if(stack.getTagCompound().getInteger("Mode") == 0)
        return;

    int selected = ItemTransporter.getSelected(stack);
    List<TeleportPosition> positions = ItemTransporter.getPositions(stack);
    if(selected != -1 && positions.size() > 0) {
        if(selected >= positions.size()) {
            ItemTransporter.setSelected(stack, positions.size() - 1);
            return;
        }

        int h = event.getResolution().getScaledHeight();
        int w = event.getResolution().getScaledWidth();
        String name = positions.get(selected).name;

        int width = mc.fontRenderer.getStringWidth(name);
        int height = player.capabilities.isCreativeMode ? 33 : 70;
        mc.fontRenderer.drawStringWithShadow(name, (w - width) / 2, h - height, 0xFFFFFF);
    }
}
项目:Scripty    文件:ScriptyNetworkHandler.java   
@SideOnly(Side.CLIENT)
public static void handleContentMessage(ScriptyPacketContent content) {
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if (!(Minecraft.getMinecraft().currentScreen instanceof ScriptyBlockGUI)) {
        player.openGui(ScriptyMod.INSTANCE, 0x0, player.world, content.getPos().getX(), content.getPos().getY(), content.getPos().getZ());
    }
    if (Minecraft.getMinecraft().currentScreen instanceof ScriptyBlockGUI) {
        ((ScriptyBlockGUI) Minecraft.getMinecraft().currentScreen).setLanguage(content.getLanguage());
        ((ScriptyBlockGUI) Minecraft.getMinecraft().currentScreen).setContent(content.getContent());
        ((ScriptyBlockGUI) Minecraft.getMinecraft().currentScreen).setPos(content.getPos());
        ((ScriptyBlockGUI) Minecraft.getMinecraft().currentScreen).setParsing(content.isParsing());
    }
}
项目:Etheric    文件:SeeingStoneHandler.java   
private static void rotateArm(float p_187458_1_) {
    EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
    float f = entityplayersp.prevRenderArmPitch
            + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * p_187458_1_;
    float f1 = entityplayersp.prevRenderArmYaw
            + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * p_187458_1_;
    GlStateManager.rotate((entityplayersp.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate((entityplayersp.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
}
项目:ForgeHax    文件:AutoFishMod.java   
private boolean isCorrectSplashPacket(SPacketSoundEffect packet) {
    EntityPlayerSP me = getLocalPlayer();
    return packet.getSound().equals(SoundEvents.ENTITY_BOBBER_SPLASH) &&
            (
                    me != null &&
                    me.fishEntity != null &&
                            (
                                    max_sound_distance.get() == 0 || // disables this check
                                    (me.fishEntity.getPositionVector().distanceTo(new Vec3d(packet.getX(), packet.getY(), packet.getZ())) <= max_sound_distance.get())
                            )
            );
}
项目:interactionwheel    文件:InputHandler.java   
private void checkWheelKey() {
    if (KeyBindings.keyOpenWheel.isPressed()) {
        EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());
        RayTraceResult mouseOver = Minecraft.getMinecraft().objectMouseOver;
        if (mouseOver != null && mouseOver.typeOfHit == RayTraceResult.Type.BLOCK) {
            BlockPos pos = mouseOver.getBlockPos();
            player.openGui(InteractionWheel.instance, GuiProxy.GUI_WHEEL, player.getEntityWorld(), pos.getX(), pos.getY(), pos.getZ());
        } else {
            player.openGui(InteractionWheel.instance, GuiProxy.GUI_WHEEL, player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ());
        }
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
 * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
 */
public void handleOpenWindow(S2DPacketOpenWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayerSP entityplayersp = this.gameController.thePlayer;

    if ("minecraft:container".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("minecraft:villager".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayVillagerTradeGui(new NpcMerchant(entityplayersp, packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("EntityHorse".equals(packetIn.getGuiId()))
    {
        Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

        if (entity instanceof EntityHorse)
        {
            entityplayersp.displayGUIHorse((EntityHorse)entity, new AnimalChest(packetIn.getWindowTitle(), packetIn.getSlotCount()));
            entityplayersp.openContainer.windowId = packetIn.getWindowId();
        }
    }
    else if (!packetIn.hasSlots())
    {
        entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else
    {
        ContainerLocalMenu containerlocalmenu = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount());
        entityplayersp.displayGUIChest(containerlocalmenu);
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
}
项目:DecompiledMinecraft    文件:RendererLivingEntity.java   
protected boolean canRenderName(T entity)
{
    EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

    if (entity instanceof EntityPlayer && entity != entityplayersp)
    {
        Team team = entity.getTeam();
        Team team1 = entityplayersp.getTeam();

        if (team != null)
        {
            Team.EnumVisible team$enumvisible = team.getNameTagVisibility();

            switch (team$enumvisible)
            {
                case ALWAYS:
                    return true;

                case NEVER:
                    return false;

                case HIDE_FOR_OTHER_TEAMS:
                    return team1 == null || team.isSameTeam(team1);

                case HIDE_FOR_OWN_TEAM:
                    return team1 == null || !team.isSameTeam(team1);

                default:
                    return true;
            }
        }
    }

    return Minecraft.isGuiEnabled() && entity != this.renderManager.livingPlayer && !entity.isInvisibleToPlayer(entityplayersp) && entity.riddenByEntity == null;
}
项目:Backmemed    文件:EntitySpeed.java   
@Override
public void onUpdate(EntityPlayerSP player) {
    if(isEnabled()) {
        if (player.ridingEntity != null) {
            MovementInput movementInput = player.movementInput;
            double forward = movementInput.moveForward;
            double strafe = movementInput.moveStrafe;
            float yaw = player.rotationYaw;
            if ((forward == 0.0D) && (strafe == 0.0D)) {
                player.ridingEntity.motionX = 0.0D;
                player.ridingEntity.motionZ = 0.0D;
            }else{
                if (forward != 0.0D) {
                    if (strafe > 0.0D) {
                        yaw += (forward > 0.0D ? -45 : 45);
                    }else if (strafe < 0.0D) {
                        yaw += (forward > 0.0D ? 45 : -45);
                    }
                    strafe = 0.0D;
                    if (forward > 0.0D) {
                        forward = 1.0D;
                    }else if (forward < 0.0D) {
                        forward = -1.0D;
                    }
                }
                player.ridingEntity.motionX = (forward * entitySpeed.getValue() * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * entitySpeed.getValue() * Math.sin(Math.toRadians(yaw + 90.0F)));
                player.ridingEntity.motionZ = (forward * entitySpeed.getValue() * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * entitySpeed.getValue() * Math.cos(Math.toRadians(yaw + 90.0F)));
            }
        }
    }
}
项目:DecompiledMinecraft    文件:Minecraft.java   
public void setDimensionAndSpawnPlayer(int dimension)
{
    this.theWorld.setInitialSpawnLocation();
    this.theWorld.removeAllEntities();
    int i = 0;
    String s = null;

    if (this.thePlayer != null)
    {
        i = this.thePlayer.getEntityId();
        this.theWorld.removeEntity(this.thePlayer);
        s = this.thePlayer.getClientBrand();
    }

    this.renderViewEntity = null;
    EntityPlayerSP entityplayersp = this.thePlayer;
    this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter());
    this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched());
    this.thePlayer.dimension = dimension;
    this.renderViewEntity = this.thePlayer;
    this.thePlayer.preparePlayerToSpawn();
    this.thePlayer.setClientBrand(s);
    this.theWorld.spawnEntityInWorld(this.thePlayer);
    this.playerController.flipPlayer(this.thePlayer);
    this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
    this.thePlayer.setEntityId(i);
    this.playerController.setPlayerCapabilities(this.thePlayer);
    this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug());

    if (this.currentScreen instanceof GuiGameOver)
    {
        this.displayGuiScreen((GuiScreen)null);
    }
}
项目:Autotip    文件:UniversalUtil.java   
private static void chatMessage(Object component) {
    EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
    try {
        switch (Autotip.MC_VERSION) {
            case V1_8:
            case V1_8_8:
            case V1_8_9:
                // Original method name: addChatMessage
                getMethod(
                        EntityPlayerSP.class,
                        "func_145747_a",
                        getClazz("net.minecraft.util.IChatComponent")
                ).invoke(thePlayer, component);
                break;
            case V1_9:
            case V1_9_4:
            case V1_10:
            case V1_10_2:
                // Original method name: addChatComponentMessage
                getMethod(
                        EntityPlayerSP.class,
                        "func_146105_b",
                        getClazz("net.minecraft.util.text.ITextComponent")
                ).invoke(thePlayer, component);
                break;
            case V1_11:
            case V1_11_2:
                // Original method name: addChatMessage / sendMessage
                getMethod(
                        EntityPlayerSP.class,
                        "func_145747_a",
                        getClazz("net.minecraft.util.text.ITextComponent")
                ).invoke(thePlayer, component);
                break;
        }
    } catch (InvocationTargetException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
项目:CustomWorldGen    文件:ElytraSound.java   
public ElytraSound(EntityPlayerSP p_i47113_1_)
{
    super(SoundEvents.ITEM_ELYTRA_FLYING, SoundCategory.PLAYERS);
    this.player = p_i47113_1_;
    this.repeat = true;
    this.repeatDelay = 0;
    this.volume = 0.1F;
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
 * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
 */
public void handleOpenWindow(S2DPacketOpenWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayerSP entityplayersp = this.gameController.thePlayer;

    if ("minecraft:container".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("minecraft:villager".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayVillagerTradeGui(new NpcMerchant(entityplayersp, packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("EntityHorse".equals(packetIn.getGuiId()))
    {
        Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

        if (entity instanceof EntityHorse)
        {
            entityplayersp.displayGUIHorse((EntityHorse)entity, new AnimalChest(packetIn.getWindowTitle(), packetIn.getSlotCount()));
            entityplayersp.openContainer.windowId = packetIn.getWindowId();
        }
    }
    else if (!packetIn.hasSlots())
    {
        entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else
    {
        ContainerLocalMenu containerlocalmenu = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount());
        entityplayersp.displayGUIChest(containerlocalmenu);
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
}
项目:Backmemed    文件:PlayerControllerOF.java   
public EnumActionResult processRightClickBlock(EntityPlayerSP player, WorldClient worldIn, BlockPos stack, EnumFacing pos, Vec3d facing, EnumHand vec)
{
    this.acting = true;
    EnumActionResult enumactionresult = super.processRightClickBlock(player, worldIn, stack, pos, facing, vec);
    this.acting = false;
    return enumactionresult;
}
项目:BaseClient    文件:ItemRenderer.java   
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks)
{
    float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
    float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks;
    GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
 * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
 */
public void handleOpenWindow(SPacketOpenWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayerSP entityplayersp = this.gameController.player;

    if ("minecraft:container".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("minecraft:villager".equals(packetIn.getGuiId()))
    {
        entityplayersp.displayVillagerTradeGui(new NpcMerchant(entityplayersp, packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else if ("EntityHorse".equals(packetIn.getGuiId()))
    {
        Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

        if (entity instanceof AbstractHorse)
        {
            entityplayersp.openGuiHorseInventory((AbstractHorse)entity, new ContainerHorseChest(packetIn.getWindowTitle(), packetIn.getSlotCount()));
            entityplayersp.openContainer.windowId = packetIn.getWindowId();
        }
    }
    else if (!packetIn.hasSlots())
    {
        entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
    else
    {
        IInventory iinventory = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount());
        entityplayersp.displayGUIChest(iinventory);
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
}
项目:Zombe-Modpack    文件:Fly.java   
@SuppressWarnings("ConstantConditions")
@Override
protected Object handle(String name, Object arg) {
    if (name.equals("ignorePlayerInsideOpaqueBlock"))
        return getNoclip();
    if (name.equals("allowVanillaFly"))
        return allowVanillaFly();
    if (name.equals("allowVanillaSprint"))
        return allowVanillaSprint();
    if (name.equals("isFlying"))
        return isFlying(arg);
    if (name.equals("isNoclip"))
        return isNoclip(arg);
    if (name.equals("isPlayerOnGround"))
        return isPlayerOnGround();
    if (name.equals("beforePlayerMove"))
        return beforeMove(getPlayer(), (Vec3d) arg);
    if (name.equals("afterPlayerMove"))
        afterMove(ZWrapper.getPlayer(), (Vec3d) arg);
    if (name.equals("beforeViewMove"))
        return beforeMove((EntityPlayer) getView(), (Vec3d) arg);
    if (name.equals("afterViewMove"))
        afterMove((EntityPlayer) getView(), (Vec3d) arg);
    if (name.equals("onPlayerJump"))
        onPlayerJump((EntityPlayer) arg);
    if (name.equals("onClientUpdate"))
        onClientUpdate((EntityPlayerSP) arg);
    if (name.equals("onViewUpdate"))
        onViewUpdate((EntityPlayer) arg);
    if (name.equals("onServerUpdate"))
        onServerUpdate((EntityPlayerMP) arg);
    return arg;
}
项目:BaseClient    文件:Minecraft.java   
public void setDimensionAndSpawnPlayer(int dimension)
{
    this.theWorld.setInitialSpawnLocation();
    this.theWorld.removeAllEntities();
    int i = 0;
    String s = null;

    if (this.thePlayer != null)
    {
        i = this.thePlayer.getEntityId();
        this.theWorld.removeEntity(this.thePlayer);
        s = this.thePlayer.getClientBrand();
    }

    this.renderViewEntity = null;
    EntityPlayerSP entityplayersp = this.thePlayer;
    this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter());
    this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched());
    this.thePlayer.dimension = dimension;
    this.renderViewEntity = this.thePlayer;
    this.thePlayer.preparePlayerToSpawn();
    this.thePlayer.setClientBrand(s);
    this.theWorld.spawnEntityInWorld(this.thePlayer);
    this.playerController.flipPlayer(this.thePlayer);
    this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
    this.thePlayer.setEntityId(i);
    this.playerController.setPlayerCapabilities(this.thePlayer);
    this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug());

    if (this.currentScreen instanceof GuiGameOver)
    {
        this.displayGuiScreen((GuiScreen)null);
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace,
 * Dispenser, Enchanting table, Brewing stand, Villager merchant, Beacon, Anvil,
 * Hopper, Dropper, Horse
 */
public void handleOpenWindow(S2DPacketOpenWindow packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    EntityPlayerSP entityplayersp = this.gameController.thePlayer;

    if ("minecraft:container".equals(packetIn.getGuiId())) {
        entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    } else if ("minecraft:villager".equals(packetIn.getGuiId())) {
        entityplayersp.displayVillagerTradeGui(new NpcMerchant(entityplayersp, packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    } else if ("EntityHorse".equals(packetIn.getGuiId())) {
        Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

        if (entity instanceof EntityHorse) {
            entityplayersp.displayGUIHorse((EntityHorse) entity,
                    new AnimalChest(packetIn.getWindowTitle(), packetIn.getSlotCount()));
            entityplayersp.openContainer.windowId = packetIn.getWindowId();
        }
    } else if (!packetIn.hasSlots()) {
        entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    } else {
        ContainerLocalMenu containerlocalmenu = new ContainerLocalMenu(packetIn.getGuiId(),
                packetIn.getWindowTitle(), packetIn.getSlotCount());
        entityplayersp.displayGUIChest(containerlocalmenu);
        entityplayersp.openContainer.windowId = packetIn.getWindowId();
    }
}
项目:Mods    文件:TF2EventsClient.java   
@SubscribeEvent
public void entityConstructing(final EntityEvent.EntityConstructing event) {

    if (event.getEntity() instanceof EntityPlayerSP) {
        //System.out.println("Constructing player");
    }
}