當前位置: 首頁>>代碼示例>>Java>>正文


Java FMLClientHandler類代碼示例

本文整理匯總了Java中net.minecraftforge.fml.client.FMLClientHandler的典型用法代碼示例。如果您正苦於以下問題:Java FMLClientHandler類的具體用法?Java FMLClientHandler怎麽用?Java FMLClientHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FMLClientHandler類屬於net.minecraftforge.fml.client包,在下文中一共展示了FMLClientHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: playerTick

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@SubscribeEvent
public void playerTick(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        EntityPlayer player = event.player;
        if (player == mc.player) {
            ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                if (player.world.isRemote) {
                    update(mc.player);
                }
            } else {
                CommonHUDHandler.getHandlerForPlayer(player).ticksExisted = 0;
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:HUDHandler.java

示例2: onKeyPress

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void onKeyPress(KeyBinding key) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    if (mc.inGameHasFocus) {
        if (key == KeyHandler.getInstance().keybindOpenOptions) {
            ItemStack helmetStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                FMLCommonHandler.instance().showGuiScreen(GuiHelmetMainScreen.getInstance());
            }
        } else if (key == KeyHandler.getInstance().keybindHack && HackUpgradeRenderHandler.enabledForPlayer(mc.player)) {
            getSpecificRenderer(BlockTrackUpgradeHandler.class).hack();
            getSpecificRenderer(EntityTrackUpgradeHandler.class).hack();
        } else if (key == KeyHandler.getInstance().keybindDebuggingDrone && DroneDebugUpgradeHandler.enabledForPlayer(PneumaticCraftRepressurized.proxy.getPlayer())) {
            getSpecificRenderer(EntityTrackUpgradeHandler.class).selectAsDebuggingTarget();
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:HUDHandler.java

示例3: getSearchedItemCount

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
private int getSearchedItemCount() {
        TileEntity te = world.getTileEntity(pos);
        if (te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)) {
//        if (world.getTileEntity(pos) instanceof IInventory) {
            IItemHandler handler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
            int itemCount = 0;
//            IInventory inventory = (IInventory) world.getTileEntity(pos);
            ItemStack searchStack = ItemPneumaticArmor.getSearchedStack(FMLClientHandler.instance().getClient().player.getItemStackFromSlot(EntityEquipmentSlot.HEAD));
            if (searchStack.isEmpty()) return 0;
            for (int l = 0; l < handler.getSlots(); l++) {
                if (!handler.getStackInSlot(l).isEmpty()) {
                    itemCount += getSearchedItemCount(handler.getStackInSlot(l), searchStack);
                }
            }
            return itemCount;
        }
        return 0;
    }
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:19,代碼來源:RenderSearchItemBlock.java

示例4: RenderBlockTarget

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
public RenderBlockTarget(World world, EntityPlayer player, BlockPos pos, TileEntity te,
                         BlockTrackUpgradeHandler blockTracker) {
    this.world = world;
    this.player = player;
    this.pos = pos;
    this.te = te;
    this.blockTracker = blockTracker;
    // oldTicksExisted = entity.ticksExisted;
    String title = world.getBlockState(pos).getBlock().getLocalizedName();
    if (title.contains(".name")) {
        try {
            IBlockState state = world.getBlockState(pos);
            ItemStack stack = state.getBlock().getPickBlock(state, FMLClientHandler.instance().getClient().objectMouseOver, world, pos, FMLClientHandler.instance().getClientPlayerEntity());
            if (!stack.isEmpty()) title = stack.getDisplayName();
        } catch (Throwable e) {
        }
    }
    if (title.contains(".name")) {
        ITextComponent text = te.getDisplayName();
        title = text == null ? "???" : te.getDisplayName().getFormattedText();
    }
    stat = new GuiAnimatedStat(null, title, "", 20, -20, 0x3000AA00, null, false);
    stat.setMinDimensionsAndReset(0, 0);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:25,代碼來源:RenderBlockTarget.java

示例5: render

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void render(T te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    // boilerplate translation code, common to all model renders, done here

    if (!shouldRender(te)) return;

    GlStateManager.pushMatrix();
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture(te));
    GlStateManager.translate((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); // size
    GlStateManager.scale(1.0F, -1F, -1F); // to make your block have a normal positioning. comment out to see what happens

    // actual model rendering work
    renderModel(te, partialTicks);

    GlStateManager.popMatrix();
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:17,代碼來源:AbstractModelRenderer.java

示例6: renderDynamic

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
protected void renderDynamic(float scale, float partialTicks) {
    shape1.render(scale);
    shape2.render(scale);

    float pressure = 0f;
    float dangerPressure = 5f;
    float critPressure = 7f;
    if (gaugeModule != null && gaugeModule.getTube() instanceof TileEntityPneumaticBase) {
        TileEntityPneumaticBase base = (TileEntityPneumaticBase) gaugeModule.getTube();
        pressure = base.getPressure();
        critPressure = base.criticalPressure;
        dangerPressure = base.dangerPressure;
    }
    GL11.glTranslated(0, 1, 0.378);
    double widgetScale = 0.007D;
    GL11.glScaled(widgetScale, widgetScale, widgetScale);
    GL11.glRotated(180, 0, 1, 0);
    GL11.glDisable(GL11.GL_LIGHTING);
    GuiUtils.drawPressureGauge(FMLClientHandler.instance().getClient().fontRenderer, -1, critPressure, dangerPressure, -1, pressure, 0, 0, 0);
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:23,代碼來源:ModelGauge.java

示例7: renderLiquid

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
public void renderLiquid(FluidTankInfo info, RenderInfo renderInfo, World world) {
    if (info.fluid.getFluid().getBlock() != null) {
        renderInfo.baseBlock = info.fluid.getFluid().getBlock();
    } else {
        renderInfo.baseBlock = Blocks.WATER;
    }
    renderInfo.texture = info.fluid.getFluid().getStill(info.fluid); //TODO 1.8 still or flowing?
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    // Tessellator.instance.setColorOpaque_I();
    int color = info.fluid.getFluid().getColor(info.fluid);
    int red = color >> 16 & 255;
    int green = color >> 8 & 255;
    int blue = color & 255;
    GL11.glColor4ub((byte) red, (byte) green, (byte) blue, (byte) 255);
    RenderUtils.INSTANCE.renderBlock(renderInfo, world, 0, 0, 0, false, true);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:17,代碼來源:RenderUtils.java

示例8: onSlotHack

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
protected void onSlotHack(int slot, boolean nuked) {
    if (!nuked && gui instanceof GuiSecurityStationHacking) {
        ((GuiSecurityStationHacking) gui).onSlotHack(slot);
    }
    ItemStack stack = station.getPrimaryInventory().getStackInSlot(slot);
    if (stack.getItemDamage() == ItemNetworkComponents.NETWORK_REGISTRY || stack.getItemDamage() == ItemNetworkComponents.DIAGNOSTIC_SUBROUTINE) {
        hackedSuccessfully = true;
        EntityPlayer player = FMLClientHandler.instance().getClient().player;
        NetworkHandler.sendToServer(new PacketSecurityStationAddHacker(station, player.getName()));
        FMLClientHandler.instance().getClient().player.closeScreen();
        player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "Hacking successful! This Security Station now doesn't protect the area any longer!"), false);
        if (gui instanceof GuiSecurityStationHacking)
            ((GuiSecurityStationHacking) gui).removeUpdatesOnConnectionHandlers();
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:17,代碼來源:NetworkConnectionPlayerHandler.java

示例9: actionPerformed

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void actionPerformed(GuiButton button) throws IOException {
    if (button.id == 0) {
        searchGui = new GuiSearcher(FMLClientHandler.instance().getClient().player);
        searchGui.setSearchStack(widg.getFilter());
        FMLClientHandler.instance().showGuiScreen(searchGui);
    } else if (button.id == 1) {
        invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
        invSearchGui.setSearchStack(widg.getFilter());
        FMLClientHandler.instance().showGuiScreen(invSearchGui);
    } else if (button.id == 2) {
        if (--widg.specificMeta < 0) widg.specificMeta = 15;
    } else if (button.id == 3) {
        if (++widg.specificMeta > 15) widg.specificMeta = 0;
    }
    super.actionPerformed(button);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:GuiProgWidgetItemFilter.java

示例10: actionPerformed

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void actionPerformed(GuiButton button) throws IOException {
    if (button.id == 0 || button.id == 1) {
        invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
        invSearchGui.setStackPredicate(itemStack -> itemStack.getItem() instanceof IPositionProvider);
        ItemStack gps = new ItemStack(Itemss.GPS_TOOL);
        if (button.id == 0) {
            ItemGPSTool.setGPSLocation(gps, new BlockPos(widget.x1, widget.y1, widget.z1));
        } else {
            ItemGPSTool.setGPSLocation(gps, new BlockPos(widget.x2, widget.y2, widget.z2));
        }
        invSearchGui.setSearchStack(ItemGPSTool.getGPSLocation(gps) != null ? gps : ItemStack.EMPTY);
        FMLClientHandler.instance().showGuiScreen(invSearchGui);
        pointSearched = button.id;
    }
    super.actionPerformed(button);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:GuiProgWidgetArea.java

示例11: actionPerformed

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void actionPerformed(IGuiWidget widget) {
    if (widget.getID() == 6 || widget.getID() == 7) {
        gpsSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClientPlayerEntity());
        gpsSearchGui.setStackPredicate(itemStack -> itemStack.getItem() instanceof IPositionProvider);
        isSettingInput = widget.getID() == 6;
        ItemStack gps = new ItemStack(Itemss.GPS_TOOL);
        BlockPos pos;
        if (widget.getID() == 6) {
            pos = getInputPosition();
        } else {
            pos = getOutputPosition();
        }
        if (pos != null) ItemGPSTool.setGPSLocation(gps, pos);
        gpsSearchGui.setSearchStack(ItemGPSTool.getGPSLocation(gps) != null ? gps : null);
        FMLClientHandler.instance().showGuiScreen(gpsSearchGui);
    }
    super.actionPerformed(widget);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:20,代碼來源:GuiAmadronAddTrade.java

示例12: actionPerformed

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void actionPerformed(GuiButton button) {
    switch (button.id) {
        case 10:
            FMLClientHandler.instance().getClient().player.closeScreen();
            FMLCommonHandler.instance().showGuiScreen(new GuiMoveStat(renderHandler));
            break;
        case 11:
            FMLClientHandler.instance().getClient().player.closeScreen();
            renderHandler.testMessageStat = new GuiAnimatedStat(null, "Test Message, keep in mind messages can be long!", renderHandler.messagesStatX, renderHandler.messagesStatY, 0x7000AA00, null, renderHandler.messagesStatLeftSided);
            renderHandler.testMessageStat.openWindow();
            FMLCommonHandler.instance().showGuiScreen(new GuiMoveStat(renderHandler, renderHandler.testMessageStat));
            break;
        case 12:
            changingKeybinding = !changingKeybinding;
            updateKeybindingButtonText();
            break;
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:20,代碼來源:GuiHelmetMainOptions.java

示例13: render

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void render() {
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());
    int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0);
    int height = getHeight() + (hasStepOutput() ? 10 : 0);
    Pair<Double, Double> maxUV = getMaxUV();
    double u = maxUV.getLeft();
    double v = maxUV.getRight();
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    wr.pos(0, 0, 0).tex(0, 0).endVertex();
    wr.pos(0, height, 0).tex(0, v).endVertex();
    wr.pos(width, height, 0).tex(u, v).endVertex();
    wr.pos(width, 0, 0).tex(u, 0).endVertex();
    Tessellator.getInstance().draw();
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:17,代碼來源:ProgWidget.java

示例14: drawLine

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
public static void drawLine(double x, double y, double x2, double y2, float red, float green, float blue, float lineWidth) {
    int count = FMLClientHandler.instance().getClient().player.ticksExisted;
    float alpha = 0.3F + MathHelper.sin((float) (count + x)) * 0.3F + 0.3F;
    Tessellator tess = Tessellator.getInstance();
    VertexBuffer buff = tess.getBuffer();
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS | GL11.GL_LIGHTING_BIT);
    GL11.glLineWidth(lineWidth);
    GL11.glDisable(GL_TEXTURE_2D);
    GL11.glBlendFunc(770, 1);
    buff.begin(3, DefaultVertexFormats.POSITION_COLOR);
    buff.pos(x, y, 0).color(red, green, blue, alpha).endVertex();
    buff.pos(x2, y2, 0).color(red, green, blue, alpha).endVertex();
    tess.draw();
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(32826);
    GL11.glEnable(GL_TEXTURE_2D);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopAttrib();
    GL11.glPopMatrix();
    
}
 
開發者ID:jaredlll08,項目名稱:Machines-and-Stuff,代碼行數:23,代碼來源:RenderUtils.java

示例15: preInit

import net.minecraftforge.fml.client.FMLClientHandler; //導入依賴的package包/類
@Override
public void preInit(FMLPreInitializationEvent e) {
    super.preInit(e);
    ModItems.initClient();
    ModelLoaderRegistry.registerLoader(new BakedModelLoader());
    ModelLoaderRegistry.registerLoader(ModelSeed.LoaderSeeds.INSTANCE);
    ModelLoaderRegistry.registerLoader(ModelWrappedFood.LoaderWrappedFood.INSTANCE);
    IResourceManager manager = FMLClientHandler.instance().getClient().getResourceManager();
    if(manager !=null && manager instanceof IReloadableResourceManager){
    	((IReloadableResourceManager)manager).registerReloadListener(new GuidePageLoader());
    	((IReloadableResourceManager)manager).registerReloadListener(this);
    }
    MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
    MinecraftForge.EVENT_BUS.register(new DisguiseClientHandler());
    ModBlocks.initClient();
    ModEntites.initClient();
    OBJLoader.INSTANCE.addDomain(CrystalMod.MODID);
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:19,代碼來源:ClientProxy.java


注:本文中的net.minecraftforge.fml.client.FMLClientHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。