本文整理汇总了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.setCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java RenderGameOverlayEvent.setCanceled方法的具体用法?Java RenderGameOverlayEvent.setCanceled怎么用?Java RenderGameOverlayEvent.setCanceled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.event.RenderGameOverlayEvent
的用法示例。
在下文中一共展示了RenderGameOverlayEvent.setCanceled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
if (!Config.getInstance().isSivIntegration())
return;
if (event.type != 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, mc.displayWidth, mc.displayHeight);
guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
if (guiServerInfo.renderServerInfo())
{
event.setCanceled(true);
}
}
示例2: 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);
}
}
示例3: renderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent evt) {
if (activated && evt.type == ElementType.CROSSHAIRS) {
glEnable(GL_BLEND);
mat.setUniforms(mat.newUniformBlock().setFloat("aspect",
(float) evt.resolution.getScaledWidth() / evt.resolution.getScaledHeight()));
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
for (Instance i : instances) {
pipeline.draw(mat, mesh, i, 0);
}
pipeline.flush();
evt.setCanceled(true);
}
}
示例4: onRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRender(RenderGameOverlayEvent evt)
{
if (showScopeOverlap && (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != selected || !Mouse
.isButtonDown(0)))
{
showScopeOverlap = false;
}
if (showScopeOverlap)
{
// Render scope
if (evt.type == RenderGameOverlayEvent.ElementType.HELMET)
{
if (mc.gameSettings.thirdPersonView == 0)
{
evt.setCanceled(true);
showScope();
}
}
// Remove crosshairs
else if (evt.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS && showScopeOverlap) evt
.setCanceled(true);
}
}
示例5: 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"));
}
}
示例6: renderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void renderGameOverlay (RenderGameOverlayEvent event) {
if (event.type == RenderGameOverlayEvent.ElementType.FOOD) {
if (!HungerStrike.config.isHungerBarHidden())
return;
switch (HungerStrike.config.getMode()) {
case NONE:
break;
case ALL:
event.setCanceled(true);
break;
case LIST:
if (playerHandler.isOnHungerStrike(Minecraft.getMinecraft().thePlayer))
event.setCanceled(true);
break;
}
}
}
示例7: 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);
}
}
示例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: 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: 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());
}
}
}
}
示例11: overlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void overlay(RenderGameOverlayEvent event)
{
if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
{
event.setCanceled(true);
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
mc.getTextureManager().bindTexture(overlayTextures);
EntityPlayerSP player = mc.thePlayer;
int scaledWidth = res.getScaledWidth();
int scaledHeight = res.getScaledHeight();
drawTexturedModalRect(scaledWidth - 20, scaledHeight - 20, 15, 0, 15, 15);
drawTexturedModalRect(scaledWidth - 20, scaledHeight - 20, 0, 0, 15, 15 - getScaled((int) player.getHealth(), (int) player.getMaxHealth(), 15));
drawTexturedModalRect(scaledWidth - 20, scaledHeight - 40, 45, 0, 15, 15);
drawTexturedModalRect(scaledWidth - 20, scaledHeight - 40, 30, 0, 15, 15 - getScaled(player.getFoodStats().getFoodLevel(), 20, 15));
if (player.getAir() < 300)
{
drawTexturedModalRect(scaledWidth - 20, scaledHeight - 60, 75, 0, 15, 15);
drawTexturedModalRect(scaledWidth - 20, scaledHeight - 60, 60, 0, 15, 15 - getScaled(player.getAir(), 300, 15));
}
}
}
示例12: renderGUI
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderGUI(RenderGameOverlayEvent event) {
if (EntityCamera.isActive()) {
event.setCanceled(true);
}
}
示例13: 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());
}
}
示例14: renderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderGameOverlay(RenderGameOverlayEvent event) {
if ((Minecraft.getMinecraft().getRenderViewEntity() instanceof EntityTripod)) {
if (event.getType().equals(ElementType.HOTBAR)) {
String TEXTURE_PATH = MineCamera.MODID + ":" + "textures/gui/image/cameragui.png";
ResourceLocation TEXTURE = new ResourceLocation(TEXTURE_PATH);
GlStateManager.color(1F, 1F, 1F);
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
Minecraft.getMinecraft().ingameGUI.drawTexturedModalRect(0, 0, 0, 0, 82, 82);
Minecraft.getMinecraft().ingameGUI.drawTexturedModalRect(Minecraft.getMinecraft().displayWidth / 2 - 81,
0, 82, 0, 81, 81);
Minecraft.getMinecraft().ingameGUI.drawTexturedModalRect(0,
Minecraft.getMinecraft().displayHeight / 2 - 81, 0, 82, 81, 81);
Minecraft.getMinecraft().ingameGUI.drawTexturedModalRect(Minecraft.getMinecraft().displayWidth / 2 - 81,
Minecraft.getMinecraft().displayHeight / 2 - 82, 82, 82, 81, 81);
Minecraft.getMinecraft().ingameGUI.drawTexturedModalRect(
Minecraft.getMinecraft().displayWidth / 2 / 2 - 46,
Minecraft.getMinecraft().displayHeight / 2 / 2 - 46, 163, 0, 93, 93);
String locked = I18n.format("gui.camgameoverlay.locked");
String unlocked = I18n.format("gui.camgameoverlay.unlocked");
Minecraft.getMinecraft().ingameGUI.drawString(Minecraft.getMinecraft().ingameGUI.getFontRenderer(),
TextFormatting.GREEN.BOLD + (EntityTripod.islock ? locked : unlocked), 82,
Minecraft.getMinecraft().displayHeight / 2 - 40, 0x99FFFF);
}
if (event.getType().equals(ElementType.EXPERIENCE)) {
event.setCanceled(true);
}
}
// GlStateManager.pushMatrix();
// GlStateManager.disableDepth();
// GlStateManager.enableBlend();
// String TEXTURE_PATH = MineCamera.MODID + ":" +
// "textures/gui/container/gui_camera.png";
// ResourceLocation TEXTURE = new ResourceLocation(TEXTURE_PATH);
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
// Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
// GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
// GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
// GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
// e
// GlStateManager.popMatrix();
// Minecraft.getMinecraft().displayGuiScreen(new GuiScreenDemo());
// OpenGlHelper.renderDirections(10);
}
示例15: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event) {
if (event.getType().equals(RenderGameOverlayEvent.ElementType.HELMET) ||
event.getType().equals(RenderGameOverlayEvent.ElementType.PORTAL))
event.setCanceled(true);
}