当前位置: 首页>>代码示例>>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;未经允许,请勿转载。