本文整理汇总了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);
}
示例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);
// }
}
}
示例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(); } }
*/
}
}
示例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);
}
示例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;
}
}
}
}
}
}
示例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.
}
示例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);
}
}
示例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)));
}
示例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;
}
示例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;
}
示例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_);
}
示例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));
}
示例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);
}
示例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;
}
}
}
示例15: getLocalPlayer
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
public static EntityPlayer getLocalPlayer() {
return Minecraft.getMinecraft().player;
}