mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
aeugh
This commit is contained in:
parent
6d6712aa98
commit
2f7bb54c3a
@ -1,80 +1,113 @@
|
||||
package com.hbm.extprop;
|
||||
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
|
||||
public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
|
||||
public static final String key = "NTM_EXT_PLAYER";
|
||||
public EntityPlayer player;
|
||||
|
||||
public boolean enableHUD = true;
|
||||
public boolean enableBackpack = true;
|
||||
|
||||
private boolean[] keysPressed = new boolean[EnumKeybind.values().length];
|
||||
|
||||
public HbmPlayerProps(EntityPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static HbmPlayerProps registerData(EntityPlayer player) {
|
||||
|
||||
player.registerExtendedProperties(key, new HbmPlayerProps(player));
|
||||
return (HbmPlayerProps) player.getExtendedProperties(key);
|
||||
}
|
||||
|
||||
public static HbmPlayerProps getData(EntityPlayer player) {
|
||||
|
||||
HbmPlayerProps props = (HbmPlayerProps) player.getExtendedProperties(key);
|
||||
return props != null ? props : registerData(player);
|
||||
}
|
||||
|
||||
public boolean getKeyPressed(EnumKeybind key) {
|
||||
return keysPressed[key.ordinal()];
|
||||
}
|
||||
|
||||
public boolean isJetpackActive() {
|
||||
return this.enableBackpack && getKeyPressed(EnumKeybind.JETPACK);
|
||||
}
|
||||
|
||||
public void setKeyPressed(EnumKeybind key, boolean pressed) {
|
||||
|
||||
if(!getKeyPressed(key) && pressed) {
|
||||
|
||||
if(key == EnumKeybind.TOGGLE_JETPACK) {
|
||||
this.enableBackpack = !this.enableBackpack;
|
||||
|
||||
if(this.enableBackpack)
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "Jetpack ON");
|
||||
else
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Jetpack OFF");
|
||||
}
|
||||
if(key == EnumKeybind.TOGGLE_HEAD) {
|
||||
this.enableHUD = !this.enableHUD;
|
||||
|
||||
if(this.enableHUD)
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "HUD ON");
|
||||
else
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "HUD OFF");
|
||||
}
|
||||
}
|
||||
|
||||
keysPressed[key.ordinal()] = pressed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Entity entity, World world) { }
|
||||
|
||||
@Override
|
||||
public void saveNBTData(NBTTagCompound compound) { }
|
||||
|
||||
@Override
|
||||
public void loadNBTData(NBTTagCompound compound) { }
|
||||
}
|
||||
package com.hbm.extprop;
|
||||
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
|
||||
public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
|
||||
public static final String key = "NTM_EXT_PLAYER";
|
||||
public EntityPlayer player;
|
||||
|
||||
public boolean enableHUD = true;
|
||||
public boolean enableBackpack = true;
|
||||
|
||||
private boolean[] keysPressed = new boolean[EnumKeybind.values().length];
|
||||
|
||||
public static final int dashCooldownLength = 10;
|
||||
public int dashCooldown = 0;
|
||||
|
||||
public int totalDashCount = 0;
|
||||
public int stamina = 0;
|
||||
|
||||
public HbmPlayerProps(EntityPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static HbmPlayerProps registerData(EntityPlayer player) {
|
||||
|
||||
player.registerExtendedProperties(key, new HbmPlayerProps(player));
|
||||
return (HbmPlayerProps) player.getExtendedProperties(key);
|
||||
}
|
||||
|
||||
public static HbmPlayerProps getData(EntityPlayer player) {
|
||||
|
||||
HbmPlayerProps props = (HbmPlayerProps) player.getExtendedProperties(key);
|
||||
return props != null ? props : registerData(player);
|
||||
}
|
||||
|
||||
public boolean getKeyPressed(EnumKeybind key) {
|
||||
return keysPressed[key.ordinal()];
|
||||
}
|
||||
|
||||
public boolean isJetpackActive() {
|
||||
return this.enableBackpack && getKeyPressed(EnumKeybind.JETPACK);
|
||||
}
|
||||
|
||||
public void setKeyPressed(EnumKeybind key, boolean pressed) {
|
||||
|
||||
if(!getKeyPressed(key) && pressed) {
|
||||
|
||||
if(key == EnumKeybind.TOGGLE_JETPACK) {
|
||||
this.enableBackpack = !this.enableBackpack;
|
||||
|
||||
if(this.enableBackpack)
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "Jetpack ON");
|
||||
else
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Jetpack OFF");
|
||||
}
|
||||
if(key == EnumKeybind.TOGGLE_HEAD) {
|
||||
this.enableHUD = !this.enableHUD;
|
||||
|
||||
if(this.enableHUD)
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "HUD ON");
|
||||
else
|
||||
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "HUD OFF");
|
||||
}
|
||||
}
|
||||
|
||||
keysPressed[key.ordinal()] = pressed;
|
||||
}
|
||||
|
||||
public void setDashCooldown(int cooldown) {
|
||||
this.dashCooldown = cooldown;
|
||||
return;
|
||||
}
|
||||
|
||||
public int getDashCooldown() {
|
||||
return this.dashCooldown;
|
||||
}
|
||||
|
||||
public void setStamina(int stamina) {
|
||||
this.stamina = stamina;
|
||||
return;
|
||||
}
|
||||
|
||||
public int getStamina() {
|
||||
return this.stamina;
|
||||
}
|
||||
|
||||
public void setDashCount(int count) {
|
||||
this.totalDashCount = count;
|
||||
return;
|
||||
}
|
||||
|
||||
public int getDashCount() {
|
||||
return this.totalDashCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Entity entity, World world) { }
|
||||
|
||||
@Override
|
||||
public void saveNBTData(NBTTagCompound compound) { }
|
||||
|
||||
@Override
|
||||
public void loadNBTData(NBTTagCompound compound) { }
|
||||
}
|
||||
|
||||
@ -4800,16 +4800,17 @@ public class ModItems {
|
||||
schrabidium_plate = new ArmorFSB(MainRegistry.aMatSchrab, 7, 1, RefStrings.MODID + ":textures/armor/schrabidium_1.png").cloneStats((ArmorFSB) schrabidium_helmet).setUnlocalizedName("schrabidium_plate").setTextureName(RefStrings.MODID + ":schrabidium_plate");
|
||||
schrabidium_legs = new ArmorFSB(MainRegistry.aMatSchrab, 7, 2, RefStrings.MODID + ":textures/armor/schrabidium_2.png").cloneStats((ArmorFSB) schrabidium_helmet).setCap(4F).setMod(0.1F).setUnlocalizedName("schrabidium_legs").setTextureName(RefStrings.MODID + ":schrabidium_legs");
|
||||
schrabidium_boots = new ArmorFSB(MainRegistry.aMatSchrab, 7, 3, RefStrings.MODID + ":textures/armor/schrabidium_1.png").cloneStats((ArmorFSB) schrabidium_helmet).setCap(4F).setMod(0.1F).setUnlocalizedName("schrabidium_boots").setTextureName(RefStrings.MODID + ":schrabidium_boots");
|
||||
bismuth_helmet = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png").setCap(8F).setMod(0.75F)
|
||||
bismuth_helmet = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png").setCap(8F).setMod(0.3F)
|
||||
.addResistance("fall", 0)
|
||||
.addEffect(new PotionEffect(Potion.jump.id, 20, 6))
|
||||
.addEffect(new PotionEffect(Potion.moveSpeed.id, 20, 6))
|
||||
.addEffect(new PotionEffect(Potion.regeneration.id, 20, 1))
|
||||
.addEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0))
|
||||
.setDashCount(3)
|
||||
.setUnlocalizedName("bismuth_helmet").setTextureName(RefStrings.MODID + ":bismuth_helmet");
|
||||
bismuth_plate = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 1, RefStrings.MODID + ":textures/armor/starmetal_2.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.75F).setUnlocalizedName("bismuth_plate").setTextureName(RefStrings.MODID + ":bismuth_plate");
|
||||
bismuth_legs = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 2, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.75F).setUnlocalizedName("bismuth_legs").setTextureName(RefStrings.MODID + ":bismuth_legs");
|
||||
bismuth_boots = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.75F).setUnlocalizedName("bismuth_boots").setTextureName(RefStrings.MODID + ":bismuth_boots");
|
||||
bismuth_plate = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 1, RefStrings.MODID + ":textures/armor/starmetal_2.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.3F).setUnlocalizedName("bismuth_plate").setTextureName(RefStrings.MODID + ":bismuth_plate");
|
||||
bismuth_legs = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 2, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.3F).setUnlocalizedName("bismuth_legs").setTextureName(RefStrings.MODID + ":bismuth_legs");
|
||||
bismuth_boots = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.3F).setUnlocalizedName("bismuth_boots").setTextureName(RefStrings.MODID + ":bismuth_boots");
|
||||
titanium_helmet = new ArmorFSB(MainRegistry.aMatTitan, 7, 0, RefStrings.MODID + ":textures/armor/titanium_1.png").setMod(0.85F).setUnlocalizedName("titanium_helmet").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":titanium_helmet");
|
||||
titanium_plate = new ArmorFSB(MainRegistry.aMatTitan, 7, 1, RefStrings.MODID + ":textures/armor/titanium_1.png").cloneStats((ArmorFSB) titanium_helmet).setUnlocalizedName("titanium_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":titanium_plate");
|
||||
titanium_legs = new ArmorFSB(MainRegistry.aMatTitan, 7, 2, RefStrings.MODID + ":textures/armor/titanium_2.png").cloneStats((ArmorFSB) titanium_helmet).setUnlocalizedName("titanium_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":titanium_legs");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -244,6 +244,15 @@ public class ModEventHandlerClient {
|
||||
tess.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
}
|
||||
if(ArmorFSB.hasFSBArmor(player)) {
|
||||
ArmorFSB chestplate = (ArmorFSB)player.inventory.armorInventory[2].getItem();
|
||||
if(chestplate.dashCount > 0) {
|
||||
HbmPlayerProps props = (HbmPlayerProps)player.getExtendedProperties("NTM_EXT_PLAYER");
|
||||
RenderScreenOverlay.renderDashBar(event.resolution, Minecraft.getMinecraft().ingameGUI, props);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,198 +1,241 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderScreenOverlay {
|
||||
|
||||
private static final ResourceLocation misc = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_misc.png");
|
||||
private static final RenderItem itemRenderer = RenderItem.getInstance();
|
||||
|
||||
private static long lastSurvey;
|
||||
private static float prevResult;
|
||||
private static float lastResult;
|
||||
|
||||
public static void renderRadCounter(ScaledResolution resolution, float in, Gui gui) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
float radiation = 0;
|
||||
|
||||
radiation = lastResult - prevResult;
|
||||
|
||||
if(System.currentTimeMillis() >= lastSurvey + 1000) {
|
||||
lastSurvey = System.currentTimeMillis();
|
||||
prevResult = lastResult;
|
||||
lastResult = in;
|
||||
}
|
||||
|
||||
int length = 74;
|
||||
int maxRad = 1000;
|
||||
|
||||
int bar = getScaled(in, maxRad, 74);
|
||||
|
||||
//if(radiation >= 1 && radiation <= 999)
|
||||
// bar -= (1 + Minecraft.getMinecraft().theWorld.rand.nextInt(3));
|
||||
|
||||
int posX = 16;
|
||||
int posY = resolution.getScaledHeight() - 18 - 2;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
gui.drawTexturedModalRect(posX, posY, 0, 0, 94, 18);
|
||||
gui.drawTexturedModalRect(posX + 1, posY + 1, 1, 19, bar, 16);
|
||||
|
||||
if(radiation >= 25) {
|
||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 36, 36, 18, 18);
|
||||
|
||||
} else if(radiation >= 10) {
|
||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 18, 36, 18, 18);
|
||||
|
||||
} else if(radiation >= 2.5) {
|
||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 0, 36, 18, 18);
|
||||
|
||||
}
|
||||
|
||||
if(radiation > 1000) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(">1000 RAD/s", posX, posY - 8, 0xFF0000);
|
||||
} else if(radiation >= 1) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(((int)Math.round(radiation)) + " RAD/s", posX, posY - 8, 0xFF0000);
|
||||
} else if(radiation > 0) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("<1 RAD/s", posX, posY - 8, 0xFF0000);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
private static int getScaled(double cur, double max, double scale) {
|
||||
|
||||
return (int) Math.min(cur / max * scale, scale);
|
||||
}
|
||||
|
||||
|
||||
public static void renderCustomCrosshairs(ScaledResolution resolution, Gui gui, Crosshair cross) {
|
||||
|
||||
if(cross == Crosshair.NONE) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
return;
|
||||
}
|
||||
|
||||
int size = cross.size;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0);
|
||||
gui.drawTexturedModalRect(resolution.getScaledWidth() / 2 - (size / 2), resolution.getScaledHeight() / 2 - (size / 2), cross.x, cross.y, size, size);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public static void renderAmmo(ScaledResolution resolution, Gui gui, Item ammo, int count, int max, int dura, boolean renderCount) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int pX = resolution.getScaledWidth() / 2 + 62 + 36;
|
||||
int pZ = resolution.getScaledHeight() - 21;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
gui.drawTexturedModalRect(pX, pZ + 16, 94, 0, 52, 3);
|
||||
gui.drawTexturedModalRect(pX + 1, pZ + 16, 95, 3, 50 - dura, 3);
|
||||
|
||||
String cap = max == -1 ? ("∞") : ("" + max);
|
||||
|
||||
if(renderCount)
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(count + " / " + cap, pX + 16, pZ + 6, 0xFFFFFF);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(ammo), pX, pZ);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public static void renderAmmoAlt(ScaledResolution resolution, Gui gui, Item ammo, int count) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int pX = resolution.getScaledWidth() / 2 + 62 + 36 + 18;
|
||||
int pZ = resolution.getScaledHeight() - 21 - 16;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(count + "x", pX + 16, pZ + 6, 0xFFFFFF);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(ammo), pX, pZ);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public enum Crosshair {
|
||||
|
||||
NONE(0, 0, 0),
|
||||
CROSS(1, 55, 16),
|
||||
CIRCLE(19, 55, 16),
|
||||
SEMI(37, 55, 16),
|
||||
KRUCK(55, 55, 16),
|
||||
DUAL(1, 73, 16),
|
||||
SPLIT(19, 73, 16),
|
||||
CLASSIC(37, 73, 16),
|
||||
BOX(55, 73, 16),
|
||||
L_CROSS(0, 90, 32),
|
||||
L_KRUCK(32, 90, 32),
|
||||
L_CLASSIC(64, 90, 32),
|
||||
L_CIRCLE(96, 90, 32),
|
||||
L_SPLIT(0, 122, 32),
|
||||
L_ARROWS(32, 122, 32),
|
||||
L_BOX(64, 122, 32),
|
||||
L_CIRCUMFLEX(96, 122, 32),
|
||||
L_RAD(0, 154, 32);
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int size;
|
||||
|
||||
private Crosshair(int x, int y, int size) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package com.hbm.render.util;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderScreenOverlay {
|
||||
|
||||
private static final ResourceLocation misc = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_misc.png");
|
||||
private static final RenderItem itemRenderer = RenderItem.getInstance();
|
||||
|
||||
private static long lastSurvey;
|
||||
private static float prevResult;
|
||||
private static float lastResult;
|
||||
|
||||
public static void renderRadCounter(ScaledResolution resolution, float in, Gui gui) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
float radiation = 0;
|
||||
|
||||
radiation = lastResult - prevResult;
|
||||
|
||||
if(System.currentTimeMillis() >= lastSurvey + 1000) {
|
||||
lastSurvey = System.currentTimeMillis();
|
||||
prevResult = lastResult;
|
||||
lastResult = in;
|
||||
}
|
||||
|
||||
int length = 74;
|
||||
int maxRad = 1000;
|
||||
|
||||
int bar = getScaled(in, maxRad, 74);
|
||||
|
||||
//if(radiation >= 1 && radiation <= 999)
|
||||
// bar -= (1 + Minecraft.getMinecraft().theWorld.rand.nextInt(3));
|
||||
|
||||
int posX = 16;
|
||||
int posY = resolution.getScaledHeight() - 18 - 2;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
gui.drawTexturedModalRect(posX, posY, 0, 0, 94, 18);
|
||||
gui.drawTexturedModalRect(posX + 1, posY + 1, 1, 19, bar, 16);
|
||||
|
||||
if(radiation >= 25) {
|
||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 36, 36, 18, 18);
|
||||
|
||||
} else if(radiation >= 10) {
|
||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 18, 36, 18, 18);
|
||||
|
||||
} else if(radiation >= 2.5) {
|
||||
gui.drawTexturedModalRect(posX + length + 2, posY - 18, 0, 36, 18, 18);
|
||||
|
||||
}
|
||||
|
||||
if(radiation > 1000) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(">1000 RAD/s", posX, posY - 8, 0xFF0000);
|
||||
} else if(radiation >= 1) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(((int)Math.round(radiation)) + " RAD/s", posX, posY - 8, 0xFF0000);
|
||||
} else if(radiation > 0) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("<1 RAD/s", posX, posY - 8, 0xFF0000);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
private static int getScaled(double cur, double max, double scale) {
|
||||
|
||||
return (int) Math.min(cur / max * scale, scale);
|
||||
}
|
||||
|
||||
|
||||
public static void renderCustomCrosshairs(ScaledResolution resolution, Gui gui, Crosshair cross) {
|
||||
|
||||
if(cross == Crosshair.NONE) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
return;
|
||||
}
|
||||
|
||||
int size = cross.size;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0);
|
||||
gui.drawTexturedModalRect(resolution.getScaledWidth() / 2 - (size / 2), resolution.getScaledHeight() / 2 - (size / 2), cross.x, cross.y, size, size);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public static void renderAmmo(ScaledResolution resolution, Gui gui, Item ammo, int count, int max, int dura, boolean renderCount) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int pX = resolution.getScaledWidth() / 2 + 62 + 36;
|
||||
int pZ = resolution.getScaledHeight() - 21;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
gui.drawTexturedModalRect(pX, pZ + 16, 94, 0, 52, 3);
|
||||
gui.drawTexturedModalRect(pX + 1, pZ + 16, 95, 3, 50 - dura, 3);
|
||||
|
||||
String cap = max == -1 ? ("∞") : ("" + max);
|
||||
|
||||
if(renderCount)
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(count + " / " + cap, pX + 16, pZ + 6, 0xFFFFFF);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(ammo), pX, pZ);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public static void renderAmmoAlt(ScaledResolution resolution, Gui gui, Item ammo, int count) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int pX = resolution.getScaledWidth() / 2 + 62 + 36 + 18;
|
||||
int pZ = resolution.getScaledHeight() - 21 - 16;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(misc);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(count + "x", pX + 16, pZ + 6, 0xFFFFFF);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), new ItemStack(ammo), pX, pZ);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public static void renderDashBar(ScaledResolution resolution, Gui gui, HbmPlayerProps props) {
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
int posX = 16;
|
||||
int posY = resolution.getScaledHeight() - 48 - 2;
|
||||
|
||||
mc.renderEngine.bindTexture(misc);
|
||||
|
||||
gui.drawTexturedModalRect(posX-10, posY, 99, 18, 7, 10);
|
||||
|
||||
int stamina = props.getStamina();
|
||||
|
||||
for(int x = 0; x < props.getDashCount(); x++) {
|
||||
int status = 3;
|
||||
int width = 22;
|
||||
gui.drawTexturedModalRect(posX + (width+2)*x, posY, 76, 48, 30, 10);
|
||||
if(stamina / 64 > x) {
|
||||
status = 1;
|
||||
} else if(stamina / 64 == x) {
|
||||
width = (int)( (float)(stamina % 64) * (width/64F) );
|
||||
status = 2;
|
||||
}
|
||||
gui.drawTexturedModalRect(posX + 24*x, posY, 76, 18+(10*status), width, 10);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
mc.renderEngine.bindTexture(Gui.icons);
|
||||
}
|
||||
|
||||
public enum Crosshair {
|
||||
|
||||
NONE(0, 0, 0),
|
||||
CROSS(1, 55, 16),
|
||||
CIRCLE(19, 55, 16),
|
||||
SEMI(37, 55, 16),
|
||||
KRUCK(55, 55, 16),
|
||||
DUAL(1, 73, 16),
|
||||
SPLIT(19, 73, 16),
|
||||
CLASSIC(37, 73, 16),
|
||||
BOX(55, 73, 16),
|
||||
L_CROSS(0, 90, 32),
|
||||
L_KRUCK(32, 90, 32),
|
||||
L_CLASSIC(64, 90, 32),
|
||||
L_CIRCLE(96, 90, 32),
|
||||
L_SPLIT(0, 122, 32),
|
||||
L_ARROWS(32, 122, 32),
|
||||
L_BOX(64, 122, 32),
|
||||
L_CIRCUMFLEX(96, 122, 32),
|
||||
L_RAD(0, 154, 32);
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int size;
|
||||
|
||||
private Crosshair(int x, int y, int size) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
BIN
src/main/resources/assets/hbm/textures/misc/overlay_dash.png
Normal file
BIN
src/main/resources/assets/hbm/textures/misc/overlay_dash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1004 B |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.9 KiB |
Loading…
x
Reference in New Issue
Block a user