本文整理匯總了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.isCancelable方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderGameOverlayEvent.isCancelable方法的具體用法?Java RenderGameOverlayEvent.isCancelable怎麽用?Java RenderGameOverlayEvent.isCancelable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.client.event.RenderGameOverlayEvent
的用法示例。
在下文中一共展示了RenderGameOverlayEvent.isCancelable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: eventHandler
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOW)
public void eventHandler(RenderGameOverlayEvent event) {
if (event.isCancelable() || event.type == RenderGameOverlayEvent.ElementType.DEBUG) return; //NOT To draw when debug is open
//Prepare rendering
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
if (GuiModMain.nightMode) color = 0xff5e5e5e;
else color = 0xffdddddd;
EntityPlayer player = mc.thePlayer;
World world = player.worldObj;
BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
Block lookingblock;
if (blockpos != null) lookingblock = world.getBlockState(blockpos).getBlock();
else lookingblock = null;
verPos = 3;
drawLeft(world, player, blockpos, lookingblock);
}
示例2: onRenderExperienceBar
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event) {
if (event.isCancelable() || event.type != ElementType.EXPERIENCE) {
return;
}
if (!mc.thePlayer.capabilities.isCreativeMode) {
int posX = event.resolution.getScaledWidth() / 2 + 10;
int posY = event.resolution.getScaledHeight() - 48;
ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) Minecraft.getMinecraft().thePlayer);
float maxMana = props.getMaxMana();
int manabarwidth = (int) ((float) props.getMana() / maxMana * 48);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
this.mc.getTextureManager().bindTexture(texturepath);
mc.renderEngine.bindTexture(new ResourceLocation(TheDarkEra.MODID + ":textures/gui/SoulBar.png"));
mc.ingameGUI.drawTexturedModalRect(posX, posY, 0, 0, 50, 5);
mc.ingameGUI.drawTexturedModalRect(posX + 1, posY + 1, 0, 6, manabarwidth, 3);
String a = ""+props.getMaxMana();
String b = ""+props.getMana();
mc.fontRenderer.drawStringWithShadow(a, posX, posY, 0xFFFFFF);
mc.fontRenderer.drawStringWithShadow(b, posX, posY+8, 0xFFFFFF);
System.out.println(maxMana);
}
}
示例3: onRenderExperienceBar
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event)
{
if (event.isCancelable() || event.type != EXPERIENCE) {
return;
}
int width = event.resolution.getScaledWidth();
int height = event.resolution.getScaledHeight();
int k2 = height - 20;
int blink = mc.thePlayer.getDataWatcher().getWatchableObjectInt(BLINK);
int i4 = width / 2 + 91;
int bar = MathHelper.ceiling_double_int((double) (blink + 2) * 10.0D
/ MAX_BLINK);
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
glDisable(GL_LIGHTING);
mc.getTextureManager().bindTexture(icons);
drawTexturedModalRect(i4 - 281, k2 - 1, 0, 18, 83, 11);
drawTexturedModalRect(i4 - 301, k2 - 1, 83, 18, 17, 11);
for (int i = 0; i < 10; ++i) {
if (i < bar) {
drawTexturedModalRect(i4 + i * 8 - 280, k2, 100, 18, 9, 9);
}
}
}
示例4: onRenderMountHealth
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderMountHealth(RenderGameOverlayEvent event)
{
if (event.type == ElementType.EXPERIENCE || event.type == ElementType.FOOD || event.type == ElementType.JUMPBAR )
{
YesOrNo = true;
}
if (!event.isCancelable() || !YesOrNo)return;
if(this.mc.thePlayer.ridingEntity != null)
{
GuiIngameForge.renderFood = true;
}
if(GuiIngameForge.renderExperiance)
{
if(this.mc.thePlayer.ridingEntity instanceof EntityHorse)
{
GuiIngameForge.renderJumpBar = Keyboard.isKeyDown(Keyboard.KEY_SPACE);
}
}
}
示例5: 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();
}
示例6: onRenderOfOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderOfOverlay(RenderGameOverlayEvent event) {
// Check the event is not cancellable
if (event.isCancelable()) {
return;
}
// Check it's not for experience
if (event.type != ElementType.EXPERIENCE) {
return;
}
// Check if hud enabled
if (!RadioUtils.inProgress) {
return;
}
// Otherwise, proceed to render icon
ScaledResolution screenResolution = new ScaledResolution(mc,
mc.displayWidth, mc.displayHeight);
int height = screenResolution.getScaledHeight();
height = height - mc.fontRendererObj.FONT_HEIGHT;
mc.fontRendererObj.drawString(statusIndicator, 1, height,
0xFFFFFF);
}
示例7: hideHealth
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void hideHealth(RenderGameOverlayEvent event) {
if(mc.thePlayer.getActivePotionEffect(ModPotions.lessening) != null && event.type.equals(ElementType.HEALTH) && event.isCancelable()) {
event.setCanceled(true);
mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "/textures/gui/icons.png"));
GL11.glPushMatrix();
for (int i = 0; i < Math.round(mc.thePlayer.getMaxHealth()/2); i++) {
drawTexturedModalRect((int) (mc.displayWidth/6.5+(i*9)), mc.displayHeight/2-38, 0, 0, 9, 9);
}
for (int i = 0; i < Math.round(mc.thePlayer.getHealth()/2); i++) {
drawTexturedModalRect((int) (mc.displayWidth/6.5+(i*9)), mc.displayHeight/2-38, 9, 0, 9, 9);
}
GL11.glPopMatrix();
mc.getTextureManager().bindTexture(new ResourceLocation("minecraft:textures/gui/icons.png"));
}
}
示例8: 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));
}
}
}
示例9: render
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
public void render(RenderGameOverlayEvent event) {
// Check if hotbar should render
if (!(event.getType().equals(RenderGameOverlayEvent.ElementType.HOTBAR) && event.isCancelable()))
return;
event.setCanceled(true);
// Render
GlStateManager.color(1, 1, 1, 1);
//GlStateManager.disableLighting();
if (Config.stackedHotbars && !HotbarLogic.shouldShowDefault()) {
for (int hotbar = 0; hotbar < Config.numberOfHotbars; hotbar++)
drawSingle(hotbar);
}
else if (Config.numberOfHotbars == 1 || HotbarLogic.shouldShowDefault())
drawSingle(0);
else if (Config.numberOfHotbars == 2)
drawDouble(0);
else if (Config.numberOfHotbars == 3) {
drawDouble(0);
drawSingle(2);
} else if (Config.numberOfHotbars == 4) {
drawDouble(0);
drawDouble(2);
}
drawSelection();
drawItems();
drawTooltip();
if (Minecraft.getMinecraft().player != null &&
!Minecraft.getMinecraft().player.inventory.offHandInventory.get(0).isEmpty()) {
drawOffhandSlot();
drawOffhandItem();
}
}
示例10: onRenderBar
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderBar(RenderGameOverlayEvent event) {
if (event.isCancelable() || event.type != ElementType.ALL || mc.thePlayer.getHeldItem() == null ||
!(mc.thePlayer.getHeldItem().getItem() instanceof IMagicalItem)) {
return;
}
IMagicalItem f = (IMagicalItem) mc.thePlayer.getHeldItem().getItem();
// Starting position for the buff bar - 2 pixels from the top left corner.
int xPos = 2;
int yPos = 100;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("dynamiccraft", "textures/gui/magic.png"));
this.drawTexturedModalRect(xPos, yPos, 6, 0, 5, 70);
int i1;
if (f.getMagic(mc.thePlayer.getHeldItem()) > 0) {
i1 = f.getMagic(mc.thePlayer.getHeldItem()) * 70 / f.getMaxMagic(mc.thePlayer.getHeldItem());
this.drawTexturedModalRect(xPos, yPos + 70 - i1, 0, 70 - i1, 5, i1);
}
}
示例11: onRenderExperienceBar
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderExperienceBar(RenderGameOverlayEvent event)
{
if (event.isCancelable() || event.type != ElementType.ALL)
return;
LocX = ConfigBaublesHud.hudPositionX;
LocY = ConfigBaublesHud.hudPositionY;
isVertical = ConfigBaublesHud.isVertical;
scale = ConfigBaublesHud.hudScale;
if(isVertical == 0)
{
LocOffsetY = 15;
LocOffsetX = 0;
}
if(isVertical == 1)
{
LocOffsetY = 0;
LocOffsetX = 15;
}
if (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat) || (mc.currentScreen instanceof GuiHud) && !mc.gameSettings.showDebugInfo)
{
if(ConfigBaublesHud.enable == 0)
drawBaublesHudIcons(event.resolution);
}
}
示例12: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onRenderOverlay(RenderGameOverlayEvent event) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL)
return;
if(event.isCancelable() || !Minecraft.getMinecraft().thePlayer.isInsideOfMaterial(ModBlocks.materialFluidTime)) {
return;
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(0, 0, 0, 0, event.resolution.getScaledWidth(), event.resolution.getScaledHeight());
}
示例13: ShoutBarRun
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
public static void ShoutBarRun(RenderGameOverlayEvent event) {
if (!event.isCancelable() && event.type == ElementType.EXPERIENCE) {
Minecraft mc = Minecraft.getMinecraft();
int posX = ((event.resolution.getScaledWidth() / 4) * 3) + 10;
int posY = event.resolution.getScaledHeight() - 22;
NumberIconLocation = Shout * 16;
mc.renderEngine.bindTexture(new ResourceLocation(TheDarkEra.MODID + ":textures/gui/ShoutBar.png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
mc.ingameGUI.drawTexturedModalRect(posX, posY, 0, 0, 22, 21);
mc.ingameGUI.drawTexturedModalRect(posX + 3, posY + 3, NumberIconLocation, 22, 16, 16);
if (FontDuration > 0) {
mc.fontRenderer.drawStringWithShadow(ShoutNames[Shout], posX, posY, 0xFFFFFF);
FontDuration--;
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
}
}
示例14: SoulBarRun
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
public static void SoulBarRun(RenderGameOverlayEvent event) {
if (!event.isCancelable() && event.type == ElementType.EXPERIENCE) {
Minecraft mc = Minecraft.getMinecraft();
if (!mc.thePlayer.capabilities.isCreativeMode) {
//int posX = event.resolution.getScaledWidth() / 2 + 10;
//int posY = event.resolution.getScaledHeight() - 48;
mc.renderEngine.bindTexture(new ResourceLocation(ResourceHelper.getGuiResourceName() + "SoulBar.png"));
// mc.ingameGUI.drawTexturedModalRect(posX, posY, 0, 0, 50, 5);
// mc.ingameGUI.drawTexturedModalRect(posX + 1, posY + 1, 0, 6, (int) manaBar, 3);
}
}
}
示例15: onRenderHotBar
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
(priority = EventPriority.NORMAL)
public void onRenderHotBar(RenderGameOverlayEvent event) {
FontRenderer fontRender = this.mc.fontRenderer;
if (event.isCancelable() || event.type != ElementType.HOTBAR || mc.gameSettings.showDebugInfo) return;
fontRender.drawStringWithShadow(Temperature.getTemp(mc.theWorld, mc.thePlayer), ConfigHandler.xPos_actual, ConfigHandler.yPos_actual, ConfigHandler.color_actual);
}