2016-06-23 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2019-02-10 22:57:03 +00:00
|
|
|
* Copyright (c) 2016-2019.
|
2016-06-23 03:49:47 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2013-04-18 01:55:06 +00:00
|
|
|
package net.minecraftforge.client.event;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2018-06-11 01:12:46 +00:00
|
|
|
import net.minecraftforge.eventbus.api.Cancelable;
|
|
|
|
import net.minecraftforge.eventbus.api.Event;
|
2018-09-06 01:00:14 +00:00
|
|
|
import net.minecraft.client.MainWindow;
|
2017-06-05 21:04:10 +00:00
|
|
|
import net.minecraft.client.gui.BossInfoClient;
|
2013-04-18 01:55:06 +00:00
|
|
|
|
2018-08-27 17:10:07 +00:00
|
|
|
@Cancelable
|
2013-04-18 01:55:06 +00:00
|
|
|
public class RenderGameOverlayEvent extends Event
|
|
|
|
{
|
2016-03-24 08:44:52 +00:00
|
|
|
public float getPartialTicks()
|
|
|
|
{
|
|
|
|
return partialTicks;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ElementType getType()
|
|
|
|
{
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2013-04-18 01:55:06 +00:00
|
|
|
public static enum ElementType
|
|
|
|
{
|
|
|
|
ALL,
|
|
|
|
HELMET,
|
|
|
|
PORTAL,
|
|
|
|
CROSSHAIRS,
|
2016-04-15 05:34:46 +00:00
|
|
|
BOSSHEALTH, // All boss bars
|
|
|
|
BOSSINFO, // Individual boss bar
|
2013-04-18 01:55:06 +00:00
|
|
|
ARMOR,
|
|
|
|
HEALTH,
|
|
|
|
FOOD,
|
|
|
|
AIR,
|
|
|
|
HOTBAR,
|
|
|
|
EXPERIENCE,
|
2013-07-01 05:32:11 +00:00
|
|
|
TEXT,
|
|
|
|
HEALTHMOUNT,
|
2013-09-29 15:43:29 +00:00
|
|
|
JUMPBAR,
|
2013-10-01 00:30:08 +00:00
|
|
|
CHAT,
|
2014-05-07 20:52:10 +00:00
|
|
|
PLAYER_LIST,
|
2016-03-08 07:34:40 +00:00
|
|
|
DEBUG,
|
|
|
|
POTION_ICONS,
|
2016-07-01 20:53:26 +00:00
|
|
|
SUBTITLES,
|
2017-09-06 21:19:56 +00:00
|
|
|
FPS_GRAPH,
|
|
|
|
VIGNETTE
|
2013-04-18 01:55:06 +00:00
|
|
|
}
|
|
|
|
|
2016-03-24 08:44:52 +00:00
|
|
|
private final float partialTicks;
|
|
|
|
private final ElementType type;
|
2013-04-18 01:55:06 +00:00
|
|
|
|
2018-09-06 01:00:14 +00:00
|
|
|
public RenderGameOverlayEvent(float partialTicks, MainWindow resolution)
|
2013-04-18 01:55:06 +00:00
|
|
|
{
|
|
|
|
this.partialTicks = partialTicks;
|
|
|
|
this.type = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type)
|
|
|
|
{
|
2016-03-24 08:44:52 +00:00
|
|
|
this.partialTicks = parent.getPartialTicks();
|
2013-04-18 01:55:06 +00:00
|
|
|
this.type = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class Pre extends RenderGameOverlayEvent
|
|
|
|
{
|
|
|
|
public Pre(RenderGameOverlayEvent parent, ElementType type)
|
|
|
|
{
|
|
|
|
super(parent, type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class Post extends RenderGameOverlayEvent
|
|
|
|
{
|
|
|
|
public Post(RenderGameOverlayEvent parent, ElementType type)
|
|
|
|
{
|
|
|
|
super(parent, type);
|
|
|
|
}
|
|
|
|
@Override public boolean isCancelable(){ return false; }
|
|
|
|
}
|
|
|
|
|
2016-04-15 05:34:46 +00:00
|
|
|
public static class BossInfo extends Pre
|
|
|
|
{
|
2017-06-05 21:04:10 +00:00
|
|
|
private final BossInfoClient bossInfo;
|
2016-04-15 05:34:46 +00:00
|
|
|
private final int x;
|
|
|
|
private final int y;
|
|
|
|
private int increment;
|
2017-06-05 21:04:10 +00:00
|
|
|
public BossInfo(RenderGameOverlayEvent parent, ElementType type, BossInfoClient bossInfo, int x, int y, int increment)
|
2016-04-15 05:34:46 +00:00
|
|
|
{
|
|
|
|
super(parent, type);
|
|
|
|
this.bossInfo = bossInfo;
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.increment = increment;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-06-05 21:04:10 +00:00
|
|
|
* @return The {@link BossInfoClient} currently being rendered
|
2016-04-15 05:34:46 +00:00
|
|
|
*/
|
2017-06-05 21:04:10 +00:00
|
|
|
public BossInfoClient getBossInfo()
|
2016-04-15 05:34:46 +00:00
|
|
|
{
|
|
|
|
return bossInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The current x position we are rendering at
|
|
|
|
*/
|
|
|
|
public int getX()
|
|
|
|
{
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The current y position we are rendering at
|
|
|
|
*/
|
|
|
|
public int getY()
|
|
|
|
{
|
|
|
|
return y;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return How much to move down before rendering the next bar
|
|
|
|
*/
|
|
|
|
public int getIncrement()
|
|
|
|
{
|
|
|
|
return increment;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the amount to move down before rendering the next bar
|
|
|
|
* @param increment The increment to set
|
|
|
|
*/
|
|
|
|
public void setIncrement(int increment)
|
|
|
|
{
|
|
|
|
this.increment = increment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-18 01:55:06 +00:00
|
|
|
public static class Text extends Pre
|
|
|
|
{
|
2016-03-24 08:44:52 +00:00
|
|
|
private final ArrayList<String> left;
|
|
|
|
private final ArrayList<String> right;
|
2013-04-18 01:55:06 +00:00
|
|
|
public Text(RenderGameOverlayEvent parent, ArrayList<String> left, ArrayList<String> right)
|
|
|
|
{
|
|
|
|
super(parent, ElementType.TEXT);
|
|
|
|
this.left = left;
|
|
|
|
this.right = right;
|
|
|
|
}
|
2016-03-24 08:44:52 +00:00
|
|
|
|
|
|
|
public ArrayList<String> getLeft()
|
|
|
|
{
|
|
|
|
return left;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ArrayList<String> getRight()
|
|
|
|
{
|
|
|
|
return right;
|
|
|
|
}
|
2013-04-18 01:55:06 +00:00
|
|
|
}
|
2013-09-30 21:32:12 +00:00
|
|
|
|
|
|
|
public static class Chat extends Pre
|
|
|
|
{
|
2016-03-24 08:44:52 +00:00
|
|
|
private int posX;
|
|
|
|
private int posY;
|
2013-09-30 21:32:12 +00:00
|
|
|
|
|
|
|
public Chat(RenderGameOverlayEvent parent, int posX, int posY)
|
|
|
|
{
|
|
|
|
super(parent, ElementType.CHAT);
|
2016-03-24 08:44:52 +00:00
|
|
|
this.setPosX(posX);
|
|
|
|
this.setPosY(posY);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getPosX()
|
|
|
|
{
|
|
|
|
return posX;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPosX(int posX)
|
|
|
|
{
|
2013-09-30 21:32:12 +00:00
|
|
|
this.posX = posX;
|
2016-03-24 08:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getPosY()
|
|
|
|
{
|
|
|
|
return posY;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPosY(int posY)
|
|
|
|
{
|
2013-09-30 21:32:12 +00:00
|
|
|
this.posY = posY;
|
|
|
|
}
|
|
|
|
}
|
2013-04-18 01:55:06 +00:00
|
|
|
}
|