本文整理匯總了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
}
示例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;
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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);
}
示例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());
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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();
}