本文整理匯總了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.Pre方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderGameOverlayEvent.Pre方法的具體用法?Java RenderGameOverlayEvent.Pre怎麽用?Java RenderGameOverlayEvent.Pre使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.client.event.RenderGameOverlayEvent
的用法示例。
在下文中一共展示了RenderGameOverlayEvent.Pre方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPreGuiRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPreGuiRender(RenderGameOverlayEvent.Pre event)
{
final Minecraft minecraft = FMLClientHandler.instance().getClient();
final EntityClientPlayerMP player = minecraft.thePlayer;
if (event.type == RenderGameOverlayEvent.ElementType.ALL)
{
if (player != null && player.ridingEntity != null && player.ridingEntity instanceof IIgnoreShift && ((IIgnoreShift) player.ridingEntity).shouldIgnoreShiftExit())
{
// Remove "Press shift to dismount" message when shift-exiting is disabled (not ideal, but the only option)
String str = I18n.format("mount.onboard", new Object[] { GameSettings.getKeyDisplayString(minecraft.gameSettings.keyBindSneak.getKeyCode()) });
if (minecraft.ingameGUI.recordPlaying.equals(str))
{
minecraft.ingameGUI.recordPlaying = "";
}
}
}
}
示例2: onTick
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onTick(RenderGameOverlayEvent.Pre event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.AIR) {
EntityPlayer player = FMLClientHandler.instance().getClient().player;
IChoke choke = player.getCapability(ChokeProvider.AIR_CAP, null);
int air = choke.getAir();
if (choke.isActive() && !player.isInsideOfMaterial(Material.WATER)) {
final ScaledResolution res = new ScaledResolution(FMLClientHandler.instance().getClient());
GL11.glEnable(GL11.GL_BLEND);
final int left = res.getScaledWidth() / 2 + 91;
final int top = res.getScaledHeight() - 49;
final int full = MathHelper.ceil((air - 2) * 10 / 300D);
final int partial = MathHelper.ceil(air * 10 / 300D) - full;
for (int i = 0; i < full + partial; i++) {
FMLClientHandler.instance().getClient().ingameGUI.drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
}
GL11.glDisable(GL11.GL_BLEND);
}
}
}
示例3: renderTime
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
public void renderTime(RenderGameOverlayEvent.Pre event, int width, int height, EntityPlayer player)
{
GL11.glPushMatrix();
float scale = 2.0F;
GL11.glScalef(scale, scale, scale);
long time = player.worldObj.getWorldTime() % 24000;
int hours = (int)time / 1000 + 6 > 24 ? (int)time / 1000 + 6 - 24 : (int)time / 1000 + 6;
String AM = hours + (hours == 12 ? " PM" : " AM");
String PM = hours - 12 + (hours - 12 == 12 ? " AM" : " PM");
String s = hours > 12 ? PM :AM;
drawString(mc.fontRenderer, s, (int)(width / scale - mc.fontRenderer.getStringWidth(s) - 2), 2, 0xffffff);
float scale1 = 0.75F;
GL11.glScalef(scale1, scale1, scale1);
int day = (int)player.worldObj.getWorldTime() / 24000 + 1;
// String s1 = (hours == 24 || hours < 6 ? "Night" : "Day") + " " + day;
// drawString(mc.fontRenderer, s1, (int)(width / scale / scale1 - mc.fontRenderer.getStringWidth(s1) - 2), 15, 0xffffff);
GL11.glPopMatrix();
}
示例4: onEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(receiveCanceled = true)
public void onEvent(RenderGameOverlayEvent.Pre event) {
EntityPlayerSP entityPlayerSP = Minecraft.getMinecraft().player;
if (entityPlayerSP == null) return; // just in case
if (!entityPlayerSP.isCreative()) {
boolean foundInHotbar = false;
for (int i = 1; i < 5; i++) {
if (entityPlayerSP.getCapability(IAdvProvider.Adv_Inv, null).getStackInSlot(i).getItem() == ItemInit.aem &&
entityPlayerSP.getCapability(IAdvProvider.Adv_Inv, null).getStackInSlot(0).getItem() != ItemInit.pipbuck) {
foundInHotbar = true;
}
}
if (!foundInHotbar) return;
}
switch (event.getType()) {
case HEALTH:
new RadsOverlay(Minecraft.getMinecraft());
event.setCanceled(true);
break;
default: // If it's not one of the above cases, do nothing
break;
}
}
示例5: onEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(receiveCanceled = true)
public void onEvent(RenderGameOverlayEvent.Pre event) {
EntityPlayerSP entityPlayerSP = Minecraft.getMinecraft().player;
if (entityPlayerSP == null) return; // just in case
if (!entityPlayerSP.isCreative()) {
// look for the ItemHUDactivator in the hotbar. If not present, return without changing the HUD.
boolean foundInHotbar = false;
if (entityPlayerSP.getCapability(IAdvProvider.Adv_Inv, null).getStackInSlot(0).getItem() == ItemInit.pipbuck) {
foundInHotbar = true;
}
if (!foundInHotbar) return;
}
switch (event.getType()) {
case HEALTH:
new PipBuckOverlay(Minecraft.getMinecraft(), event.getResolution().getScaledWidth(), event.getResolution().getScaledHeight());
//statusBarRenderer.renderStatusBar(event.getResolution().getScaledWidth(), event.getResolution().getScaledHeight()); /* Call a helper method so that this method stays organized */
new RadsOverlay(Minecraft.getMinecraft());
new APBar(Minecraft.getMinecraft());
new Compass_Overlay(Minecraft.getMinecraft());
event.setCanceled(true);
break;
default: // If it's not one of the above cases, do nothing
break;
}
}
示例6: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Pre event) {
if (event.type != ElementType.ALL)
return;
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution var5 = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight);
int var6 = var5.getScaledWidth();
int var7 = var5.getScaledHeight();
mc.entityRenderer.setupOverlayRendering();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
bindOverlayTexture();
zLevel = -90f;
this.drawTexturedModalRect(0, var7 / 6, 0, 0, 147, 182);
fontRenderer.setUnicodeFlag(true);
int i = 0;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
示例7: onPreRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre e) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.thePlayer != null) {
if (e.type == ElementType.CROSSHAIRS) {
if (mc.thePlayer.getHeldItem() != null) {
ItemStack held = mc.thePlayer.getHeldItem();
if (held.getItem() == FarragoMod.RIFLE) {
RifleRenderer.renderCrosshairs(mc, held, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight());
RifleRenderer.renderHotbar(mc, held, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight());
e.setCanceled(true);
}
}
} else if (e.type == ElementType.HOTBAR) {
if (mc.thePlayer.inventory.armorInventory[1] != null) {
ItemStack legs = mc.thePlayer.inventory.armorInventory[1];
if (legs.getItem() == FarragoMod.UTILITY_BELT) {
UtilityBeltRenderer.render(mc, legs, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight());
e.setCanceled(true);
}
}
}
}
}
示例8: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Pre event)
{
if (event.getType() == ElementType.HEALTH)
{
event.setCanceled(true);
}
/*
* Repositions other Gui elements.
*/
if (event.getType() == ElementType.ARMOR)
{
GuiIngameForge.left_height = 49;
}
if (event.getType() == ElementType.FOOD)
{
GuiIngameForge.right_height = 49;
}
if (event.getType() == ElementType.AIR)
{
GuiIngameForge.right_height = 59;
}
}
示例9: renderGame
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@HarshenEvent
public void renderGame(RenderGameOverlayEvent.Pre event)
{
for(Entity e : net.minecraft.client.Minecraft.getMinecraft().world.getLoadedEntityList())
e.setGlowing(e instanceof EntityLivingBase &&
net.minecraft.client.Minecraft.getMinecraft().player.getDistance(e) < AccessoryConfig.enderPendantDistance);
}
示例10: renderGameOverlayEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void renderGameOverlayEvent(RenderGameOverlayEvent.Pre event) {
if (event.getType() != RenderGameOverlayEvent.ElementType.TEXT) {
return;
}
BalloonRenderer.renderBalloon();
}
示例11: overlayEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void overlayEvent(RenderGameOverlayEvent.Pre event)
{
if (event.getType() != RenderGameOverlayEvent.ElementType.CROSSHAIRS)
return;
if (Minecraft.getMinecraft().currentScreen instanceof GuiRadialMenu)
{
event.setCanceled(true);
}
}
示例12: renderMessage
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void renderMessage(RenderGameOverlayEvent.Pre e)
{
if (e.getType() == RenderGameOverlayEvent.ElementType.TEXT)
{
DisplayMessage msg = DisplayMessageQuery.getMessage();
if (msg != null)
{
if (!isDMDisplayed)
{
Minecraft.getMinecraft().player.playSound(SoundRegistry.NOTIFICATION, 1, 1);
timerDM.schedule(new TimerTask()
{
@Override
public void run()
{
isDMDisplayed = false;
DisplayMessageQuery.removeMessage();
}
}, 5000); //5 seconds
}
isDMDisplayed = true;
GlStateManager.color(1, 1, 1);
msg.draw(0, 0);
}
}
}
示例13: preRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void preRender(RenderGameOverlayEvent.Pre event) {
RenderGameOverlayEvent.ElementType type = event.getType();
if (type == RenderGameOverlayEvent.ElementType.HEALTH && !FirstAidConfig.overlay.showVanillaHealthBar) {
event.setCanceled(true);
}
}
示例14: onPostRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPostRenderOverlay(RenderGameOverlayEvent.Pre event) {
if (event.getType() != ElementType.HOTBAR) {
return;
}
ScaledResolution resolution = event.getResolution();
if (hud == null) {
hud = new CivilizationOverlayHandler(Minecraft.getMinecraft());
}
hud.render(resolution.getScaledWidth(), resolution.getScaledHeight());
}
示例15: doRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@Override
public void doRender(@Nonnull final RenderGameOverlayEvent.Pre event) {
if (event.getType() == ElementType.TEXT && this.textPanel.hasText()) {
final int centerX = event.getResolution().getScaledWidth() / 2;
final int centerY = 80;
this.textPanel.render(centerX, centerY, Reference.TOP_CENTER);
}
}