本文整理匯總了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderGameOverlayEvent.getType方法的具體用法?Java RenderGameOverlayEvent.getType怎麽用?Java RenderGameOverlayEvent.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.client.event.RenderGameOverlayEvent
的用法示例。
在下文中一共展示了RenderGameOverlayEvent.getType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
if (!Config.getInstance().isSivIntegration())
return;
if (event.getType() != RenderGameOverlayEvent.ElementType.PLAYER_LIST)
{
return;
}
if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped())
{
return;
}
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution resolution = new ScaledResolution(mc);
guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
if (guiServerInfo.renderServerInfo())
{
event.setCanceled(true);
}
}
示例2: onScreenRenderEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onScreenRenderEvent(RenderGameOverlayEvent event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
World world = AuraCascade.proxy.getWorld();
EntityPlayer player = AuraCascade.proxy.getPlayer();
Vec3d vec3 = player.getPositionEyes(1.0F);
Vec3d vec3a = player.getLook(1.0F);
Vec3d vec3b = vec3.addVector(vec3a.xCoord * 3, vec3a.yCoord * 3, vec3a.zCoord * 3);
RayTraceResult movingobjectposition = world.rayTraceBlocks(vec3, vec3b);
if (movingobjectposition != null && movingobjectposition.typeOfHit == RayTraceResult.Type.BLOCK) {
Block block = world.getBlockState(movingobjectposition.getBlockPos()).getBlock();
ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());
int centerX = (resolution.getScaledWidth() - Minecraft.getMinecraft().fontRendererObj.getStringWidth("hi")) / 2;
int centerY = (resolution.getScaledHeight() - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT) / 2;
if (block instanceof IToolTip) {
IToolTip toolTip = (IToolTip) block;
VazkiiRenderHelper.renderTooltip(centerX, centerY, toolTip.getTooltipData(world, player, movingobjectposition.getBlockPos()), 0x5577ff, 0x505000ff);
}
}
}
}
示例3: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event) {
if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) {
return;
}
if (!this.mc.inGameHasFocus) {
return;
}
if (FMLClientHandler.instance().getClient().currentScreen != null ) {
return;
}
drawMetalOverlay();
}
示例4: renderOverlayEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderOverlayEvent(RenderGameOverlayEvent e) {
if ((ModGlobals.GUI_DANKNULL_ISOPEN) && ((e.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) || (e.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS) || (e.getType() == RenderGameOverlayEvent.ElementType.EXPERIENCE) || (e.getType() == RenderGameOverlayEvent.ElementType.FOOD) || (e.getType() == RenderGameOverlayEvent.ElementType.HEALTH) || (e.getType() == RenderGameOverlayEvent.ElementType.ARMOR))) {
e.setCanceled(true);
}
}
示例5: renderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
if (LithiumMod.getCurrentLithiumOverlay() != null) {
LOverlay o = LithiumMod.getCurrentLithiumOverlay();
if (o.getControls() != null) {
for (LControl lControl : o.getControls()) {
ILithiumControlRenderer renderer = null;
if (lControl.getClass().equals(LImage.class)) {
renderer = new ImageRenderer();
if (!ImageManager.isImageHandled((LImage) lControl)) {
ImageManager.handleImage((LImage) lControl);
}
} else if (lControl.getClass().equals(LProgressBar.class)) {
renderer = new ProgressBarRenderer();
} else if (lControl.getClass().equals(LTextLabel.class)) {
renderer = new TextLabelRenderer();
}
if (renderer != null) {
renderer.renderLithiumControl(lControl, this);
}
}
}
}
}
}
示例6: renderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(bar);
float oneUnit = (float)bar_width / mc.player.getMaxHealth();
int currentWidth = (int)(oneUnit * mc.player.getHealth());
System.out.println((int)mc.player.getHealth());
drawTexturedModalRect(0, 0, 0, 0, tex_width, tex_height);
drawTexturedModalRect(1, 0, 1, tex_height, currentWidth, tex_height);
}
}
示例7: onRenderGui
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderGui(RenderGameOverlayEvent event)
{
if (event.isCancelable() || event.getType() != ElementType.TEXT)
{
return;
}
PlayerAether player = PlayerAether.get(this.mc.thePlayer);
if (player.poisonInstance() != null)
{
AetherOverlay.renderCure(this.mc);
AetherOverlay.renderPoison(this.mc);
}
if (player.thePlayer != null)
{
AetherOverlay.renderIronBubble(this.mc);
AetherOverlay.renderCooldown(this.mc);
AetherOverlay.renderJumps(this.mc);
AetherOverlay.renderBossHP(this.mc);
}
float portalTime = player.portalAnimTime * 1.2F + (player.prevPortalAnimTime - player.portalAnimTime);
if(portalTime > 0.0F)
{
if (portalTime > 0.0F)
{
AetherOverlay.renderAetherPortal(portalTime, new ScaledResolution(this.mc));
}
}
}
示例8: guiOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
/** Override vanilla subtitles with this module's subtitles. */
@SubscribeEvent
public static void guiOverlay(RenderGameOverlayEvent event) {
if (event.getType() == ElementType.SUBTITLES) {
event.setCanceled(true);
guiSubtitles.renderSubtitles(event.getResolution());
}
}
示例9: onRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRender(RenderGameOverlayEvent evt)
{
Minecraft mc = Minecraft.getMinecraft();
// if ((showScopeOverlap || showSpyglassOverlay) && (mc.player.getActiveItemStack() != selected || !Mouse.isButtonDown(0))) {
// showScopeOverlap = false;
// showSpyglassOverlay = false;
// }
if (showScopeOverlap || showSpyglassOverlay) {
// Render scope
if (evt.getType() == RenderGameOverlayEvent.ElementType.HELMET) {
if (mc.gameSettings.thirdPersonView == 0) {
evt.setCanceled(true);
if (showScopeOverlap)
showScope();
else if (showSpyglassOverlay)
showSpyglass();
}
}
// Remove crosshairs
else if (evt.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && (showScopeOverlap || showSpyglassOverlay))
evt.setCanceled(true);
}
ItemStack stack = mc.player.getActiveItemStack();
if (evt.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && (stack != null && stack.getItem() instanceof ItemRangedWeapon))
evt.setCanceled(true);
else if (evt.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && !Minecraft.getMinecraft().isGamePaused()) {
RayTraceResult mop = rayTrace(mc.player, 8, evt.getPartialTicks());
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) {
TileEntity tile = mc.world.getTileEntity(mop.getBlockPos());
if (tile instanceof TileEntityCropPlot) {
tile = ((TileEntityCropPlot) tile).getCenter();
}
if (tile instanceof IHoverInfo) {
ClientUtils.drawIHoverInfoTooltip((IHoverInfo) tile, mc.fontRendererObj, evt, mop.getBlockPos());
}
}
}
}
示例10: renderGuiText
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
/**
* Debugging text renderer
*/
@SubscribeEvent
public void renderGuiText(RenderGameOverlayEvent event){
if (this.enableDebug == false){
return;
}
if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT){
EntityPlayerSP player = this.mc.thePlayer;
if (player == null){
return;
}
double distFromCenter = player.getDistance(0, player.posY, 0);
double playerAngle = Math.toDegrees(Math.PI - Math.atan2(player.posX, player.posZ));
String angleText = String.valueOf(playerAngle);
String centerText = String.valueOf(distFromCenter);
int maxWidth = angleText.lastIndexOf('.')+2;
if (maxWidth < angleText.length()-1){
angleText = angleText.substring(0, maxWidth);
}
maxWidth = centerText.lastIndexOf('.') + 2;
if (maxWidth < centerText.length()-1){
centerText = centerText.substring(0, maxWidth);
}
String displayString = angleText + " deg " + centerText + " m";
if (currentWorldName != null){
displayString += " " + currentWorldName.substring(0,10) + "...";
}
else{
displayString += "no_world_name";
}
int textWidth = this.mc.fontRendererObj.getStringWidth(displayString);
ScaledResolution scaledResolution = new ScaledResolution(this.mc);
int xPos = scaledResolution.getScaledWidth()/2 - textWidth/2;
this.mc.fontRendererObj.drawString(displayString, xPos, 5, 0xFFFF0000);
}
}
示例11: onRenderOverlayPost
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent (priority = EventPriority.NORMAL)
public void onRenderOverlayPost (RenderGameOverlayEvent event) {
if(mc.player.getCapability(ModCapabilities.PLAYER_STATS, null).getHudMode()){
if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT && !mc.ingameGUI.getChatGUI().getChatOpen() && MainConfig.displayGUI()) {
GL11.glPushMatrix();
{
drawCommandMenu(event.getResolution().getScaledWidth(), event.getResolution().getScaledHeight());
}
GL11.glPopMatrix();
}
}
}
示例12: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onRenderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS && GuiRadialMenu.active) {
event.setCanceled(true);
}
if (!(event instanceof RenderGameOverlayEvent.Post) || event.getType() != RenderGameOverlayEvent.ElementType.ALL) {
return;
}
Minecraft mc = Minecraft.getMinecraft();
if (mc.world != null && !mc.gameSettings.hideGUI && !mc.isGamePaused() && GuiRadialMenu.active) {
renderText(event.getResolution());
}
}
示例13: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) {
if (!enabled || event.isCancelable() || event.getType() != ElementType.TEXT) {
return;
}
getClientDragon();
getServerDragon();
if (dragonClient != null) {
GuiIngameForge ingameGUI = (GuiIngameForge) mc.ingameGUI;
res = ingameGUI.getResolution();
renderTitle();
try {
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
renderNavigation();
renderAttributes();
renderBreedPoints();
} else {
renderEntityInfo();
renderAITasks();
// renderWatchedObjects();
}
renderProbe();
} catch (Exception ex) {
renderException(ex);
}
if (dragonClient.isDead) {
dragonClient = null;
dragonServer = null;
}
}
}
示例14: onRenderGame
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
public static void onRenderGame(RenderGameOverlayEvent event) {
if (event.isCancelable() || event.getType() != RenderGameOverlayEvent.ElementType.EXPERIENCE) {
return;
}
if (!(hasGlasses() || hasHelmet())) {
return;
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
poisonTicks--;
if (poisonTicks <= 0) {
poisonTicks = 9; // Not in sync with the world poison ticker to get more accurate averages
BlockPos pos = Minecraft.getMinecraft().player.getPosition().up();
NTBMessages.INSTANCE.sendToServer(new PacketSendServerCommand(NeedToBreathe.MODID, CommandHandler.CMD_REQUESTPOISON,
Arguments.builder().value(pos).build()));
}
int p = 0;
int maxp = 0;
for (int pois : poison) {
p += pois;
if (pois > maxp) {
maxp = pois;
}
}
p = p / poison.length;
int x = 200;
x = fontRenderer.drawString("Poison ", x, 10, 0xffffffff);
if (p > 0) {
x = fontRenderer.drawString("avg ", x, 10, 0xffffffff);
x = fontRenderer.drawString("" + (p * 100 / 255) + "%", x, 10, 0xffff0000);
x = fontRenderer.drawString(" max ", x, 10, 0xffffffff);
x = fontRenderer.drawString("" + (maxp * 100 / 255) + "%", x, 10, 0xffff0000);
} else {
x = fontRenderer.drawString("NONE", x, 10, 0xff00ff00);
}
}
示例15: isRunEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
protected boolean isRunEvent(RenderGameOverlayEvent event) {
return enabled && event.getType() == ElementType.EXPERIENCE;
}