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


Java Minecraft.getMinecraft方法代碼示例

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


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

示例1: getViewVector

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
{
    float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks);
    float f1 = (float)((double)entityIn.prevRotationYaw + (double)(entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks);

    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2)
    {
        f += 180.0F;
    }

    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    return new Vector3f(f3 * f4, f5, f2 * f4);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:RenderGlobal.java

示例2: manageData

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
@Override
		@SideOnly(Side.CLIENT)
		public void manageData(NBTTagCompound tag, MessageContext context) {
			World world = Minecraft.getMinecraft().world;

			if (world != null) {
				EntityPlayer player = (EntityPlayer) world.getEntityByID(tag.getInteger("PlayerID"));
				TileEntity tile = world.getTileEntity(new BlockPos(tag.getInteger("x"), tag.getInteger("y"), tag.getInteger("z")));
				Container container = player.openContainer;

//				if (tile instanceof PagedTileInventory) {
//					((PagedTileInventory) tile).pageChange(tag.getInteger("ButtonID"), player);
//				}
//
//				if (container instanceof PagedContainer) {
//					((PagedContainer) container).pageChange(tag.getInteger("ButtonID"), player);
//				}
			}
		}
 
開發者ID:Arez0101,項目名稱:Dynamic-GUIs,代碼行數:20,代碼來源:ButtonHandler.java

示例3: renderPlayer

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
@SubscribeEvent
public void renderPlayer(RenderPlayerEvent.Pre event) {
	if (event.getEntityPlayer() != Minecraft.getMinecraft().player) {
		renderBeam(event.getEntityPlayer(), event.getPartialRenderTick());
		/*
		 * InventoryWearables
		 * inventory=event.getEntityPlayer().getCapability(TF2weapons.
		 * INVENTORY_CAP, null); for(int
		 * i=0;i<inventory.getInventoryStackLimit();i++){ ItemStack
		 * stack=inventory.getStackInSlot(i); if(stack!=null){
		 * GlStateManager.pushMatrix();
		 * event.getRenderer().getMainModel().bipedHead.postRender(0.0625f);
		 * GlStateManager.translate(0.0F, -0.25F, 0.0F);
		 * GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
		 * GlStateManager.scale(0.625F, -0.625F, -0.625F);
		 * 
		 * Minecraft.getMinecraft().getItemRenderer().renderItem(event.
		 * getEntityPlayer(), stack,
		 * ItemCameraTransforms.TransformType.HEAD);
		 * GlStateManager.popMatrix(); } }
		 */
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:24,代碼來源:TF2EventsClient.java

示例4: initGui

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
@Override
public void initGui() {
    super.initGui();

    if (showSides()) {
        for (int i = 0; i < 6; i++) {
            String sideName = PneumaticCraftUtils.getOrientationName(EnumFacing.getFront(i));
            GuiCheckBox checkBox = new GuiCheckBox(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF404040, sideName);
            checkBox.checked = ((ProgWidgetInventoryBase) widget).getSides()[i];
            addWidget(checkBox);
        }
    }

    useItemCount = new GuiCheckBox(6, guiLeft + 4, guiTop + (showSides() ? 115 : 30), 0xFF404040, I18n.format("gui.progWidget.itemFilter.useItemCount"));
    useItemCount.setTooltip("gui.progWidget.itemFilter.useItemCount.tooltip");
    useItemCount.checked = ((ICountWidget) widget).useCount();
    addWidget(useItemCount);
    textField = new WidgetTextFieldNumber(Minecraft.getMinecraft().fontRenderer, guiLeft + 7, guiTop + (showSides() ? 128 : 43), 50, 11);
    textField.setValue(((ICountWidget) widget).getCount());
    textField.setEnabled(useItemCount.checked);
    addWidget(textField);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:23,代碼來源:GuiProgWidgetImportExport.java

示例5: onRenderTick

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
    purgeExpiredFragments(null);
    if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu))
        return;

    int displayWidth = Minecraft.getMinecraft().displayWidth;
    int displayHeight = Minecraft.getMinecraft().displayHeight;
    ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft(), displayWidth, displayHeight);
    int width = res.getScaledWidth();
    int height = res.getScaledHeight();
    float rx = (float) width / 1000f;
    float ry = (float) height / 1000f;

    synchronized(this.fragments)
    {
        for (TextCategory cat : TextCategory.values())
        {
            TextCategoryAttributes atts = this.attributes.get(cat);
            if (atts != null && (!atts.flashing || ((System.currentTimeMillis() / 500) % 3 != 0)) && shouldDisplay(atts.displayLevel))
            {
                int x = Math.round(rx * (float) atts.xOrg);
                int y = Math.round(ry * (float) atts.yOrg);
                ArrayList<TextFragment> frags = this.fragments.get(cat);
                if (frags != null && !frags.isEmpty())
                {
                    for (TextFragment frag : frags)
                    {
                        drawText(frag.text, x, y, atts.colour);
                        y += 10;
                    }
                }
            }
        }
    }
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:38,代碼來源:ScreenHelper.java

示例6: shouldCreateWorld

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
@Override
public boolean shouldCreateWorld(MissionInit missionInit)
{
    if (this.fwparams != null && this.fwparams.isForceReset())
        return true;

    World world = null;
    MinecraftServer server = MinecraftServer.getServer();
    if (server.worldServers != null && server.worldServers.length != 0)
        world = server.getEntityWorld();

    if (world == null)
        return true;   // There is no world, so we definitely need to create one.

    String name = (world != null) ? world.getWorldInfo().getWorldName() : "";
    // Extract the name from the path (need to cope with backslashes or forward slashes.)
    String mapfile = (this.mapFilename == null) ? "" : this.mapFilename;    // Makes no sense to have an empty filename, but createWorld will deal with it graciously.
    String[] parts = mapfile.split("[\\\\/]");
    if (name.length() > 0 && parts[parts.length - 1].equalsIgnoreCase(name) && Minecraft.getMinecraft().theWorld != null)
        return false;	// We don't check whether the game modes match - it's up to the server state machine to sort that out.

    return true;	// There's no world, or the world is different to the basemap file, so create.
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:24,代碼來源:FileWorldGeneratorImplementation.java

示例7: initGameSettings

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
public static void initGameSettings(GameSettings p_initGameSettings_0_)
{
    if (gameSettings == null)
    {
        gameSettings = p_initGameSettings_0_;
        minecraft = Minecraft.getMinecraft();
        desktopDisplayMode = Display.getDesktopDisplayMode();
        updateAvailableProcessors();
        ReflectorForge.putLaunchBlackboard("optifine.ForgeSplashCompatible", Boolean.TRUE);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:12,代碼來源:Config.java

示例8: sendMessage

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
private void sendMessage(String message, Object... replacements) {
    if (Minecraft.getMinecraft().thePlayer == null) return; // Safety first! :)

    try {
        message = String.format(message, replacements);
    } catch (Exception ex) { }
    Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText(ChatColor.translateAlternateColorCodes('&', message)));
}
 
開發者ID:boomboompower,項目名稱:TextDisplayer,代碼行數:9,代碼來源:TextEvents.java

示例9: entityHitInstanceOf

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
public static boolean entityHitInstanceOf(EntityType type) {
	if (!isMouseOver()) {
		return false;
	}
	if (type.equals(EntityType.ENTITY_LIVING_BASE)) {
		return Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityLivingBase;
	}
	return false;
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:10,代碼來源:IMinecraft.java

示例10: getAnimatedStat

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public GuiAnimatedStat getAnimatedStat() {
    if (searchInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft);
        searchInfo = new GuiAnimatedStat(null, "Currently searching for:", CraftingRegistrator.getUpgrade(EnumUpgrade.SEARCH), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        searchInfo.setMinDimensionsAndReset(0, 0);
    }
    return searchInfo;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:12,代碼來源:SearchUpgradeHandler.java

示例11: copyToBufferPos

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
private static void copyToBufferPos(int[] p_110994_0_, int p_110994_1_, int p_110994_2_)
{
    int[] aint = p_110994_0_;

    if (Minecraft.getMinecraft().gameSettings.anaglyph)
    {
        aint = updateAnaglyph(p_110994_0_);
    }

    dataBuffer.clear();
    dataBuffer.put(aint, p_110994_1_, p_110994_2_);
    dataBuffer.position(0).limit(p_110994_2_);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:TextureUtil.java

示例12: getCurrentRenderOffset

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
public Vec2f getCurrentRenderOffset(float x, float z) {
    Minecraft mc = Minecraft.getMinecraft();
    double sc = new ScaledResolution(mc).getScaleFactor();
    double oX = x + 16D / sc;
    double oZ = z + 16D / sc;
    Vec3d tr = getCurrentMachineTranslate();
    return new Vec2f((float) (oX + tr.x), (float) (oZ + tr.z));
}
 
開發者ID:HellFirePvP,項目名稱:ModularMachinery,代碼行數:9,代碼來源:DynamicMachineRenderContext.java

示例13: setFocused

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
/**
 * Sets focus to this gui element
 */
public void setFocused(boolean isFocusedIn)
{
	if(isFocusedIn && !isFocused)
		cursorCounter = 0;
	
	isFocused = isFocusedIn;
	
	if(Minecraft.getMinecraft().currentScreen != null)
		Minecraft.getMinecraft().currentScreen.func_193975_a(isFocusedIn);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12-OF,代碼行數:14,代碼來源:PasswordField.java

示例14: update

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
public void update()
{
	Minecraft mc = Minecraft.getMinecraft();
	ItemStack shieldStack = EntityUtil.getActivePlayerShield(mc.player);
	if(shieldStack.isEmpty())
		return;

	ItemAnimaShield shieldItem = (ItemAnimaShield) shieldStack.getItem();

	float currentCharge = shieldItem.getShieldCharge(shieldStack);
	float maxCharge = shieldItem.getMaxShieldCharge(shieldStack);
	boolean drawFill = currentCharge > 0;

	int asPercent = drawFill ? (int) ((currentCharge * 100)/ maxCharge) : 999;
	float fillWidth = maxBarWidth - (int) (maxBarWidth * ((float)asPercent/100));

	int drawWidth = maxBarWidth - (int)fillWidth;
	if(moveSecondary)
	{
		if(drawWidth < secondaryWidth)
		{
			secondaryWidth--;
		}
		if(drawWidth > secondaryWidth)
		{
			secondaryWidth++;
		}

		if(!drawFill)
		{
			secondaryWidth = 0;
		}
	}
}
 
開發者ID:Lemonszz,項目名稱:Anima-Mundi,代碼行數:35,代碼來源:GuiShield.java

示例15: getLocalPlayer

import net.minecraft.client.Minecraft; //導入方法依賴的package包/類
public static EntityPlayer getLocalPlayer() {
	return Minecraft.getMinecraft().player;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:4,代碼來源:ClientProxy.java


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