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


Java Minecraft類代碼示例

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


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

示例1: drawItemTooltip

import net.minecraft.client.Minecraft; //導入依賴的package包/類
private void drawItemTooltip(int x, int y, ItemStack stack, boolean warn)
{
	if (stack == null)
	{
		return;
	}

	List<String> lines = new ArrayList<>();

	boolean adv = Minecraft.getMinecraft().gameSettings.advancedItemTooltips;
	int id = Item.getIdFromItem(stack.getItem());
	lines.addAll(stack.getTooltip(container.getOpeningPlayer(), adv ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL));
	lines.set(0, lines.get(0) + " " + id);

	if (warn)
	{
		lines.add(ChatUtil.RED + I18n.format("container.craftingdouble.warning"));
	}

	drawHoveringText(lines, x, y); //Draw tooltip
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:22,代碼來源:GuiDoubleWorkbench.java

示例2: run

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public void run()
{
    while (true)
    {
        try
        {
            this.processTask(this.chunkRenderDispatcher.getNextChunkUpdate());
        }
        catch (InterruptedException var3)
        {
            LOGGER.debug("Stopping due to interrupt");
            return;
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Batching chunks");
            Minecraft.getMinecraft().crashed(Minecraft.getMinecraft().addGraphicsAndWorldToCrashReport(crashreport));
            return;
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:ChunkRenderWorker.java

示例3: editRule

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public boolean editRule(String id, String name, int mode) {
	Rule rule = this.getRuleByIdInternal(id);
	
	if (rule == null)
		return false;
	
	if (this.getWorld().isRemote) {
		RezolvePacketHandler.INSTANCE.sendToServer(new RuleModificationMessage(
			Minecraft.getMinecraft().thePlayer, 
			this, id, name, mode
		));
			
		return true;
	}

	if (!"<players>".equals(rule.getName()) && !"<machines>".equals(rule.getName())) {
		rule.name = name;
	}
	
	rule.mode = mode;
	this.notifyUpdate();
	
	return true;
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:25,代碼來源:SecurityServerEntity.java

示例4: updateTextureMinMagFilter

import net.minecraft.client.Minecraft; //導入依賴的package包/類
static void updateTextureMinMagFilter()
{
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    ITextureObject itextureobject = texturemanager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    if (itextureobject != null)
    {
        MultiTexID multitexid = itextureobject.getMultiTexID();
        GlStateManager.bindTexture(multitexid.base);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]);
        GlStateManager.bindTexture(multitexid.norm);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]);
        GlStateManager.bindTexture(multitexid.spec);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]);
        GlStateManager.bindTexture(0);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:ShadersTex.java

示例5: sendChanges

import net.minecraft.client.Minecraft; //導入依賴的package包/類
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;
    }
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:26,代碼來源:AbsoluteMovementCommandsImplementation.java

示例6: init

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public void init(FMLInitializationEvent event)
{
       // Register for various events:
       FMLCommonHandler.instance().bus().register(this);
       MinecraftForge.EVENT_BUS.register(this);

       GameSettings settings = Minecraft.getMinecraft().gameSettings;
       setUpExtraKeys(settings);

       this.stateMachine = new ClientStateMachine(ClientState.WAITING_FOR_MOD_READY, this);
       
       this.originalMouseHelper = Minecraft.getMinecraft().mouseHelper;
       this.mouseHook = new MouseHook();
       this.mouseHook.isOverriding = true;
       Minecraft.getMinecraft().mouseHelper = this.mouseHook;
       setInputType(InputType.AI);
   }
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:18,代碼來源:MalmoModClient.java

示例7: rightClickEmpty

import net.minecraft.client.Minecraft; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void rightClickEmpty(RightClickEmpty event) {
	// System.out.println("RightClickEmpty,HandType="+event.getHand());
	if (event.getEntityPlayer().getEntityData().hasKey("renderViewCamera") && event.getSide().isClient()
			&& event.getHand().equals(EnumHand.MAIN_HAND)) {
		System.out.println("delay=" + ((EntityTripod) Minecraft.getMinecraft().theWorld
				.getEntityByID(Minecraft.getMinecraft().thePlayer.getEntityData().getInteger("renderViewCamera")))
						.getDelay());
		System.out.println("RightClickEmpty,HandType=" + event.getHand());
		ActiveTripod(Minecraft.getMinecraft().thePlayer.getName(),
				((EntityTripod) event.getWorld()
						.getEntityByID(event.getEntityPlayer().getEntityData().getInteger("renderViewCamera")))
								.getDelay());
	}
}
 
開發者ID:PorPit,項目名稱:MineCamera,代碼行數:17,代碼來源:EventLoader.java

示例8: onMessage

import net.minecraft.client.Minecraft; //導入依賴的package包/類
@Override
public void onMessage(MalmoMessageType messageType, Map<String, String> data)
{
    if (messageType == MalmoMessageType.SERVER_TEXT)
    {
        String chat = data.get("chat");
        if (chat != null)
            Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(chat), 1);
        else
        {
            String text = data.get("text");
            ScreenHelper.TextCategory category = ScreenHelper.TextCategory.valueOf(data.get("category"));
            String strtime = data.get("displayTime");
            Integer time = (strtime != null) ? Integer.valueOf(strtime) : null;
            this.getScreenHelper().addFragment(text, category, time);
        }
    }
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:19,代碼來源:ClientStateMachine.java

示例9: updateTextureMinMagFilter

import net.minecraft.client.Minecraft; //導入依賴的package包/類
static void updateTextureMinMagFilter()
{
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    ITextureObject itextureobject = texturemanager.getTexture(TextureMap.locationBlocksTexture);

    if (itextureobject != null)
    {
        MultiTexID multitexid = itextureobject.getMultiTexID();
        GlStateManager.bindTexture(multitexid.base);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]);
        GlStateManager.bindTexture(multitexid.norm);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]);
        GlStateManager.bindTexture(multitexid.spec);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]);
        GlStateManager.bindTexture(0);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:ShadersTex.java

示例10: onRenderWorld

import net.minecraft.client.Minecraft; //導入依賴的package包/類
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);
            }
        }
    }
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:24,代碼來源:NTBOverlayRenderer.java

示例11: drawBatch

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public void drawBatch(int p_drawBatch_1_)
{
    this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled())
    {
        GlStateManager.shadeModel(7425);
    }
    else
    {
        GlStateManager.shadeModel(7424);
    }

    if (p_drawBatch_1_ > 0)
    {
        this.batchBuffer.getBuffer().sortVertexData((float)staticPlayerX, (float)staticPlayerY, (float)staticPlayerZ);
    }

    this.batchBuffer.draw();
    RenderHelper.enableStandardItemLighting();
    this.drawingBatch = false;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:TileEntityRendererDispatcher.java

示例12: mousePressed

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY)
{
    if (super.mousePressed(mc, mouseX, mouseY))
    {
        this.volume = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8);
        this.volume = MathHelper.clamp(this.volume, 0.0F, 1.0F);
        mc.gameSettings.setSoundLevel(this.category, this.volume);
        mc.gameSettings.saveOptions();
        this.displayString = this.categoryName + ": " + GuiScreenOptionsSounds.this.getDisplayString(this.category);
        this.pressed = true;
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:18,代碼來源:GuiScreenOptionsSounds.java

示例13: jump

import net.minecraft.client.Minecraft; //導入依賴的package包/類
/**
 * Causes this entity to do an upwards motion (jumping).
 */
public void jump()
{
	if (this == Minecraft.getMinecraft().thePlayer)
	{
	    JumpEvent event = new JumpEvent();
	    event.call();

	    if (event.isCancelled()) return;
	}

    super.jump();
    this.triggerAchievement(StatList.jumpStat);

    if (this.isSprinting())
    {
        this.addExhaustion(0.8F);
    }
    else
    {
        this.addExhaustion(0.2F);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:EntityPlayer.java

示例14: searchBox

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public static void searchBox(BlockPos blockPos) {
	double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
	double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
	double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
	GL11.glBlendFunc(770, 771);
	GL11.glEnable(GL_BLEND);
	GL11.glLineWidth(1.0F);
	float sinus = 1F - MathHelper
			.abs(MathHelper.sin(Minecraft.getSystemTime() % 10000L / 10000.0F * (float) Math.PI * 4.0F) * 1F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL_DEPTH_TEST);
	GL11.glDepthMask(false);
	GL11.glColor4f(1F - sinus, sinus, 0F, 0.15F);
	drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), 1F - sinus, sinus, 0F, 0.15F);
	GL11.glColor4d(0, 0, 0, 0.5);
	drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL_BLEND);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:22,代碼來源:RenderUtils.java

示例15: renderBlockModel

import net.minecraft.client.Minecraft; //導入依賴的package包/類
public static void renderBlockModel(World world, BlockPos pos, IBlockState state) {
    VertexBuffer wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
    BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
    IBakedModel ibakedmodel = modelShapes.getModelForState(state);
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    
    for(BlockRenderLayer layer : BlockRenderLayer.values()) {
        if(state.getBlock().canRenderInLayer(state, layer)) {
            ForgeHooksClient.setRenderLayer(layer);
            blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, state, pos, wr, true);
        }
    }
    ForgeHooksClient.setRenderLayer(null);
    wr.setTranslation(0, 0, 0);
    Tessellator.getInstance().draw();
}
 
開發者ID:jaredlll08,項目名稱:Machines-and-Stuff,代碼行數:20,代碼來源:RenderAccumulator.java


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