Armor GUI, CPS, Potion Effects GUI

This commit is contained in:
PeytonPlayz595 2024-06-03 00:13:01 -04:00
parent 0dfb8cf3cc
commit 4703cac0e9
14 changed files with 472 additions and 115 deletions

View File

@ -2338,4 +2338,8 @@ public class Minecraft implements IThreadListener {
}
return ret;
}
public float getPartialTicks() {
return this.timer.renderPartialTicks;
}
}

View File

@ -5,6 +5,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.util.ArrayList;
import java.util.Collection;
import net.PeytonPlayz585.shadow.ArmorGui;
import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.CustomColors;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
@ -77,7 +78,7 @@ public class GuiIngame extends Gui {
private static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png");
private final EaglercraftRandom rand = new EaglercraftRandom();
private final Minecraft mc;
private final RenderItem itemRenderer;
public final RenderItem itemRenderer;
private final GuiNewChat persistantChatGUI;
private int updateCounter;
/**+
@ -313,6 +314,8 @@ public class GuiIngame extends Gui {
this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1);
}
ArmorGui.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.enableAlpha();

View File

@ -269,6 +269,12 @@ public class GameSettings {
public boolean hidePassword = true;
public boolean fullBright = false;
public boolean leftHand = false;
public boolean entityCulling = true;
public boolean particleCulling = true;
public boolean armorgui = false;
public boolean cps = false;
public boolean keyStrokes = false;
public boolean potionGUI = false;
public boolean enableFNAWSkins = true;
public int voiceListenRadius = 16;
@ -928,6 +934,30 @@ public class GameSettings {
this.leftHand = !this.leftHand;
}
if(parOptions == GameSettings.Options.ENTITY_CULLING) {
this.entityCulling = !this.entityCulling;
}
if(parOptions == GameSettings.Options.PARTICLE_CULLING) {
this.particleCulling = !this.particleCulling;
}
if(parOptions == GameSettings.Options.ARMOR_GUI) {
this.armorgui = !this.armorgui;
}
if(parOptions == GameSettings.Options.CPS) {
this.cps = !this.cps;
}
if(parOptions == GameSettings.Options.KEYSTROKES) {
this.keyStrokes = !this.keyStrokes;
}
if(parOptions == GameSettings.Options.POTION_GUI) {
this.potionGUI = !this.potionGUI;
}
this.saveOptions();
}
@ -1058,6 +1088,16 @@ public class GameSettings {
return this.fullBright;
case LEFT_HAND:
return this.leftHand;
case ENTITY_CULLING:
return this.entityCulling;
case PARTICLE_CULLING:
return this.particleCulling;
case ARMOR_GUI:
return this.armorgui;
case CPS:
return this.cps;
case POTION_GUI:
return this.potionGUI;
default:
return false;
}
@ -1936,6 +1976,30 @@ public class GameSettings {
leftHand = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("particleCulling") && astring.length >= 2) {
particleCulling = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("entityCulling") && astring.length >= 2) {
entityCulling = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("armorgui") && astring.length >= 2) {
armorgui = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("cps") && astring.length >= 2) {
cps = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("keyStrokes") && astring.length >= 2) {
keyStrokes = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("potionGUI") && astring.length >= 2) {
potionGUI = Boolean.valueOf(astring[1]).booleanValue();
}
for (SoundCategory soundcategory : SoundCategory._VALUES) {
if (astring[0].equals("soundCategory_" + soundcategory.getCategoryName())) {
this.mapSoundLevels.put(soundcategory, Float.valueOf(this.parseFloat(astring[1])));
@ -2131,6 +2195,12 @@ public class GameSettings {
printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
printwriter.println("fullbright:" + this.fullBright);
printwriter.println("leftHand:" + this.leftHand);
printwriter.println("entityCulling:" + this.entityCulling);
printwriter.println("particleCulling:" + this.particleCulling);
printwriter.println("armorgui:" + this.armorgui);
printwriter.println("cps:" + this.cps);
printwriter.println("keyStrokes:" + this.keyStrokes);
printwriter.println("potionGUI:" + this.potionGUI);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -2344,7 +2414,13 @@ public class GameSettings {
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true),
FULLBRIGHT("Fullbright", false, true),
LEFT_HAND("Main Hand", false, true);
LEFT_HAND("Main Hand", false, true),
ENTITY_CULLING("Entity Culling", false, true),
PARTICLE_CULLING("Particle Culling", false, true),
ARMOR_GUI("Armor GUI", false, true),
CPS("CPS", false, true),
KEYSTROKES("Keystrokes", false, true),
POTION_GUI("Potion Effects GUI", false, true);
private final boolean enumFloat;
private final boolean enumBoolean;

View File

@ -36,8 +36,8 @@ public class KeyBinding implements Comparable<KeyBinding> {
private final String keyDescription;
private final int keyCodeDefault;
private final String keyCategory;
private int keyCode;
private boolean pressed;
public int keyCode;
public boolean pressed;
private int pressTime;
public static void onTick(int keyCode) {

View File

@ -0,0 +1,178 @@
package net.PeytonPlayz585.shadow;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
public class ArmorGui {
public static void draw() {
if(Minecraft.getMinecraft().gameSettings.potionGUI) {
renderPotEffects();
}
if(Minecraft.getMinecraft().gameSettings.armorgui) {
renderArmorDura();
}
if(Minecraft.getMinecraft().gameSettings.cps) {
renderCPS();
}
if(Minecraft.getMinecraft().gameSettings.keyStrokes) {
renderKeyStrokes();
}
}
public static void renderArmorDura() {
GlStateManager.enableLighting();
ItemStack boots = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[0];
ItemStack legs = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[1];
ItemStack chest = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[2];
ItemStack helmet = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[3];
ItemStack hand = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem();
if (helmet != null) {
ItemStack displayhelmet = helmet.copy();
displayhelmet.stackSize = 1;
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemAndEffectIntoGUI(displayhelmet, 5 + 3, 15 + 2);
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, displayhelmet, 5 + 3, 15 + 2, "");
}
if (chest != null) {
ItemStack displaychest = chest.copy();
displaychest.stackSize = 1;
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemAndEffectIntoGUI(displaychest, 5 + 3, 15 + 18);
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, displaychest, 5 + 3, 15 + 18, "");
}
if (legs != null) {
ItemStack displaylegs = legs.copy();
displaylegs.stackSize = 1;
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemAndEffectIntoGUI(displaylegs, 5 + 3, 10 + 38);
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, displaylegs, 5 + 3, 15 + 38, "");
}
if (boots != null) {
ItemStack displayboots = boots.copy();
displayboots.stackSize = 1;
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemAndEffectIntoGUI(displayboots, 5 + 3, 15 + 50);
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, displayboots, 5 + 3, 15 + 50, "");
}
RenderHelper.enableGUIStandardItemLighting();
if (hand != null) {
ItemStack displayhand = hand.copy();
float f = (float) displayhand.animationsToGo - Minecraft.getMinecraft().getPartialTicks();
if (f > 0.0F) {
GlStateManager.pushMatrix();
float f1 = 1.0F + f / 5.0F;
GlStateManager.translate((float) ((5 + 3) + 8), (float) ((15 + 66) + 12), 0.0F);
GlStateManager.scale(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F);
GlStateManager.translate((float) (-((5 + 3) + 8)), (float) (-((15 + 66) + 12)), 0.0F);
}
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemAndEffectIntoGUI(displayhand, 5 + 3, 15 + 66);
if (f > 0.0F) {
GlStateManager.popMatrix();
}
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemOverlays(Minecraft.getMinecraft().fontRendererObj, displayhand, 5 + 3, 15 + 66);
}
RenderHelper.disableStandardItemLighting();
}
public static void renderPotEffects() {
int i = 80;
int i2 = 16;
Collection <PotionEffect> collection = Minecraft.getMinecraft().thePlayer.getActivePotionEffects();
if (!collection.isEmpty()) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.enableAlpha();
int l = 33;
if (collection.size() > 5) l = 132 / (collection.size() - 1);
for (PotionEffect potioneffect: Minecraft.getMinecraft().thePlayer.getActivePotionEffects()) {
Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (potion.hasStatusIcon()) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
int i3 = potion.getStatusIconIndex();
GuiIngame guiIngame = new GuiIngame(Minecraft.getMinecraft());
guiIngame.drawTexturedModalRect(4 + 21 - 20, 110 + i2 - 14, 0 + i3 % 8 * 18, 198 + i3 / 8 * 18, 18, 18);
}
String s1 = I18n.format(potion.getName(), new Object[0]);
if (potioneffect.getAmplifier() == 1) {
s1 = String.valueOf(String.valueOf(s1)) + " " + I18n.format("enchantment.level.2", new Object[0]);
} else if (potioneffect.getAmplifier() == 2) {
s1 = String.valueOf(String.valueOf(s1)) + " " + I18n.format("enchantment.level.3", new Object[0]);
} else if (potioneffect.getAmplifier() == 3) {
s1 = String.valueOf(String.valueOf(s1)) + " " + I18n.format("enchantment.level.4", new Object[0]);
}
Minecraft.getMinecraft().fontRendererObj.drawString(s1, (4 + 21), (110 + i2 - 14), -1);
String s2 = Potion.getDurationString(potioneffect);
Minecraft.getMinecraft().fontRendererObj.drawString(s2, (4 + 21), (110 + i2 + 10 - 14), -1);
i2 += l;
}
}
}
public static boolean wasPressed;
public static long lastPressed;
private static List <Long> clicks = new ArrayList < > ();
public static void renderCPS() {
boolean pressed = Mouse.isButtonDown(0) || Mouse.isButtonDown(1);
if (pressed != wasPressed) {
lastPressed = System.currentTimeMillis();
wasPressed = pressed;
if (pressed) {
clicks.add(lastPressed);
}
}
final long time = System.currentTimeMillis();
FuncUtils.removeIf(clicks, sinceLast -> sinceLast + 1000 < time);
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
Minecraft.getMinecraft().fontRendererObj.drawString("[CPS: " + clicks.size() + "]", res.getScaledWidth() / 2 - 17, 5 + 2, -1);
}
public static void renderKeyStrokes() {
}
private static void renderHotbarItem(int xPos, int yPos, float partialTicks, ItemStack stack) {
ItemStack itemstack = stack;
if (itemstack != null) {
float f = (float) itemstack.animationsToGo - partialTicks;
if (f > 0.0F) {
GlStateManager.pushMatrix();
float f1 = 1.0F + f / 5.0F;
GlStateManager.translate((float) (xPos + 8), (float) (yPos + 12), 0.0F);
GlStateManager.scale(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F);
GlStateManager.translate((float) (-(xPos + 8)), (float) (-(yPos + 12)), 0.0F);
}
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemAndEffectIntoGUI(itemstack, xPos, yPos);
if (f > 0.0F) {
GlStateManager.popMatrix();
}
Minecraft.getMinecraft().ingameGUI.itemRenderer.renderItemOverlays(Minecraft.getMinecraft().fontRendererObj, itemstack, xPos, yPos);
}
}
}

View File

@ -0,0 +1,34 @@
package net.PeytonPlayz585.shadow;
import java.util.Collection;
import java.util.Iterator;
import java.util.function.Predicate;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
public class FuncUtils {
public static <T> boolean removeIf(Collection<T> collection, Predicate<T> pre) {
boolean ret = false;
Iterator<T> itr = collection.iterator();
while (itr.hasNext()) {
if (pre.test(itr.next())) {
itr.remove();
ret = true;
}
}
return ret;
}
public static boolean isInside(int mouseX, int mouseY, double x, double y, double width, double height) {
return (mouseX > x && mouseX < (x + width)) && (mouseY > y && mouseY < (y + height));
}
public static void setColor(int color) {
float f3 = (float) (color >> 24 & 255) / 255.0F;
float f = (float) (color >> 16 & 255) / 255.0F;
float f1 = (float) (color >> 8 & 255) / 255.0F;
float f2 = (float) (color & 255) / 255.0F;
GlStateManager.color(f, f1, f2, f3);
}
}

View File

@ -9,7 +9,7 @@ import net.minecraft.client.settings.GameSettings;
public class GuiShadow extends GuiScreen {
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.TOGGLE_SPRINT, GameSettings.Options.CHUNK_BORDERS, GameSettings.Options.HIDE_PASSWORD, GameSettings.Options.FULLBRIGHT, GameSettings.Options.LEFT_HAND};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.TOGGLE_SPRINT, GameSettings.Options.CHUNK_BORDERS, GameSettings.Options.HIDE_PASSWORD, GameSettings.Options.FULLBRIGHT, GameSettings.Options.LEFT_HAND, GameSettings.Options.ENTITY_CULLING, GameSettings.Options.PARTICLE_CULLING, GameSettings.Options.ARMOR_GUI, GameSettings.Options.CPS, GameSettings.Options.POTION_GUI};
private GuiScreen parentScreen;
protected String title;

View File

@ -43,109 +43,86 @@ public class ImageData {
public ImageData fillAlpha() {
for(int i = 0; i < pixels.length; ++i) {
pixels[i] = pixels[i] | 0xFF000000;
pixels[i] |= 0xFF000000;
}
return this;
}
public ImageData getSubImage(int x, int y, int pw, int ph) {
int[] img = new int[pw * ph];
for(int i = 0; i < ph; ++i) {
System.arraycopy(pixels, (i + y) * this.width + x, img, i * pw, pw);
}
return new ImageData(pw, ph, img, alpha);
}
int[] img = new int[pw * ph];
for (int i = 0; i < ph; ++i) {
System.arraycopy(pixels, (i + y) * this.width + x, img, i * pw, pw);
}
return new ImageData(pw, ph, img, alpha);
}
public static final ImageData loadImageFile(String path) {
byte[] fileData = EagRuntime.getResourceBytes(path);
if(fileData != null) {
return loadImageFile(fileData);
}else {
return null;
}
}
public static final ImageData loadImageFile(String path) {
byte[] fileData = EagRuntime.getResourceBytes(path);
return (fileData != null) ? loadImageFile(fileData) : null;
}
public static final ImageData loadImageFile(InputStream data) {
return PlatformAssets.loadImageFile(data);
}
public static final ImageData loadImageFile(InputStream data) {
return PlatformAssets.loadImageFile(data);
}
public static final ImageData loadImageFile(byte[] data) {
return PlatformAssets.loadImageFile(data);
}
public static final ImageData loadImageFile(byte[] data) {
return PlatformAssets.loadImageFile(data);
}
public void getRGB(int startX, int startY, int w, int h,
int[] rgbArray, int offset, int scansize) {
for(int y = 0; y < h; ++y) {
System.arraycopy(pixels, offset + (y + startY) * scansize + startX, rgbArray, y * w, w);
}
}
public void getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
for (int y = 0; y < h; ++y) {
System.arraycopy(pixels, offset + (y + startY) * scansize + startX, rgbArray, y * w, w);
}
}
public void copyPixelsFrom(ImageData input, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2) {
if(sx2 - sx1 != dx2 - dx1) {
throw new IllegalArgumentException("Width of the copied region must match the"
+ "width of the pasted region");
}
int cw = sx2 - sx1;
if(sy2 - sy1 != dy2 - dy1) {
throw new IllegalArgumentException("Height of the copied region must match the"
+ "height of the pasted region");
}
int ch = sy2 - sy1;
for(int y = 0; y < ch; ++y) {
System.arraycopy(input.pixels, sx1 + (sy1 + y) * cw, pixels, dx1 + (dy1 + y) * cw, cw);
}
}
public void copyPixelsFrom(ImageData input, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
int cw = sx2 - sx1;
int ch = sy2 - sy1;
for (int y = 0; y < ch; ++y) {
System.arraycopy(input.pixels, sx1 + (sy1 + y) * cw, pixels, dx1 + (dy1 + y) * cw, cw);
}
}
public void drawLayer(ImageData input, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2) {
if(sx2 - sx1 != dx2 - dx1) {
throw new IllegalArgumentException("Width of the copied region must match the"
+ "width of the pasted region");
}
int cw = sx2 - sx1;
if(sy2 - sy1 != dy2 - dy1) {
throw new IllegalArgumentException("Height of the copied region must match the"
+ "height of the pasted region");
}
int ch = sy2 - sy1;
for(int y = 0; y < ch; ++y) {
for(int x = 0; x < cw; ++x) {
int si = (sy1 + y) * cw + sx1 + x;
int di = (dy1 + y) * cw + dx1 + x;
int spx = input.pixels[si];
int dpx = pixels[di];
if((spx & 0xFF000000) == 0xFF000000 || (dpx & 0xFF000000) == 0) {
pixels[di] = spx;
}else {
int sa = (spx >> 24) & 0xFF;
int da = (dpx >> 24) & 0xFF;
int r = ((spx >> 16) & 0xFF) * sa / 255;
int g = ((spx >> 8) & 0xFF) * sa / 255;
int b = (spx & 0xFF) * sa / 255;
int aa = (255 - sa) * da;
r += ((dpx >> 16) & 0xFF) * aa / 65025;
g += ((dpx >> 8) & 0xFF) * aa / 65025;
b += (dpx & 0xFF) * aa / 65025;
sa += da;
if(sa > 0xFF) sa = 0xFF;
pixels[di] = ((sa) << 24) | (r << 16) | (g << 8) | b;
}
}
}
}
public void drawLayer(ImageData input, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
int cw = sx2 - sx1;
int ch = sy2 - sy1;
for (int y = 0; y < ch; ++y) {
for (int x = 0; x < cw; ++x) {
int si = (sy1 + y) * cw + sx1 + x;
int di = (dy1 + y) * cw + dx1 + x;
int spx = input.pixels[si];
int dpx = pixels[di];
public ImageData swapRB() {
for(int i = 0; i < pixels.length; ++i) {
int j = pixels[i];
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) |
((j & 0x000000FF) << 16);
}
return this;
}
if ((spx & 0xFF000000) == 0xFF000000 || (dpx & 0xFF000000) == 0) {
pixels[di] = spx;
} else {
int sa = (spx >> 24) & 0xFF;
int da = (dpx >> 24) & 0xFF;
int r = ((spx >> 16) & 0xFF) * sa >> 8;
int g = ((spx >> 8) & 0xFF) * sa >> 8;
int b = (spx & 0xFF) * sa >> 8;
int aa = (255 - sa) * da >> 8;
r += ((dpx >> 16) & 0xFF) * aa >> 8;
g += ((dpx >> 8) & 0xFF) * aa >> 8;
b += (dpx & 0xFF) * aa >> 8;
sa += da;
if (sa > 0xFF) sa = 0xFF;
pixels[di] = (sa << 24) | (r << 16) | (g << 8) | b;
}
}
}
}
public static int swapRB(int c) {
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
}
public ImageData swapRB() {
for (int i = 0; i < pixels.length; ++i) {
int j = pixels[i];
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) | ((j & 0x000000FF) << 16);
}
return this;
}
public static int swapRB(int c) {
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
}
}

View File

@ -64,22 +64,21 @@ public class EaglerIntegratedServerWorker {
List<IPCPacketData> pktList = ServerPlatformSingleplayer.recieveAllPacket();
if(pktList != null) {
IPCPacketData packetData;
for(int i = 0, l = pktList.size(); i < l; ++i) {
packetData = pktList.get(i);
if(packetData.channel.equals(SingleplayerServerController.IPC_CHANNEL)) {
for(IPCPacketData pkt : pktList) {
if(pkt.channel.equals(SingleplayerServerController.IPC_CHANNEL)) {
IPCPacketBase ipc;
try {
ipc = IPCPacketManager.IPCDeserialize(packetData.contents);
ipc = IPCPacketManager.IPCDeserialize(pkt.contents);
}catch(IOException ex) {
throw new RuntimeException("Failed to deserialize IPC packet", ex);
}
handleIPCPacket(ipc);
}else {
IntegratedServerPlayerNetworkManager netHandler = openChannels.get(packetData.channel);
IntegratedServerPlayerNetworkManager netHandler = openChannels.get(pkt.channel);
if(netHandler != null) {
netHandler.addRecievedPacket(packetData.contents);
netHandler.addRecievedPacket(pkt.contents);
}else {
logger.error("Recieved packet on channel that does not exist: \"{}\"", packetData.channel);
logger.error("Recieved packet on channel that does not exist: \"{}\"", pkt.channel);
}
}
}
@ -88,8 +87,8 @@ public class EaglerIntegratedServerWorker {
public static void tick() {
List<IntegratedServerPlayerNetworkManager> ocs = new ArrayList<>(openChannels.values());
for(int i = 0, l = ocs.size(); i < l; ++i) {
ocs.get(i).tick();
for(IntegratedServerPlayerNetworkManager netHandler : ocs) {
netHandler.tick();
}
}

View File

@ -506,7 +506,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) {
boolean b = true;
if(entityCantBeSeen(renderViewEntity)) {
if(this.mc.gameSettings.entityCulling && entityCantBeSeen(renderViewEntity)) {
return;
}
if (this.renderEntitiesStartupCounter > 0) {
@ -2293,7 +2293,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
private EntityFX spawnEntityFX(int p_174974_1_, boolean ignoreRange, double p_174974_3_, double p_174974_5_, double p_174974_7_, double p_174974_9_, double p_174974_11_, double p_174974_13_, int... p_174974_15_) {
if (this.mc != null && this.mc.getRenderViewEntity() != null && this.mc.effectRenderer != null) {
if(isBehindPlayer(new BlockPos(p_174974_3_, p_174974_5_, p_174974_7_))) {
if(this.mc.gameSettings.particleCulling && isBehindPlayer(new BlockPos(p_174974_3_, p_174974_5_, p_174974_7_))) {
return null;
}

View File

@ -2368,4 +2368,8 @@ public class Minecraft extends ModData implements IThreadListener {
}
return ret;
}
public float getPartialTicks() {
return this.timer.renderPartialTicks;
}
}

View File

@ -5,6 +5,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.util.ArrayList;
import java.util.Collection;
import net.PeytonPlayz585.shadow.ArmorGui;
import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.CustomColors;
import net.eaglerforge.api.ModAPI;
@ -79,7 +80,7 @@ public class GuiIngame extends Gui {
private static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png");
private final EaglercraftRandom rand = new EaglercraftRandom();
private final Minecraft mc;
private final RenderItem itemRenderer;
public final RenderItem itemRenderer;
private final GuiNewChat persistantChatGUI;
private int updateCounter;
/**+
@ -315,6 +316,9 @@ public class GuiIngame extends Gui {
this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1);
}
if(this.mc.gameSettings.armorgui) {
ArmorGui.draw();
}
ModAPI.callEvent("drawhud", new ModData());
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View File

@ -272,6 +272,12 @@ public class GameSettings extends ModData {
public boolean enableFNAWSkins = true;
public boolean fullBright = false;
public boolean leftHand = false;
public boolean entityCulling = true;
public boolean particleCulling = true;
public boolean armorgui = false;
public boolean cps = false;
public boolean keyStrokes = false;
public boolean potionGUI = false;
public int voiceListenRadius = 16;
public float voiceListenVolume = 0.5f;
@ -1092,6 +1098,30 @@ public class GameSettings extends ModData {
this.leftHand = !this.leftHand;
}
if(parOptions == GameSettings.Options.ENTITY_CULLING) {
this.entityCulling = !this.entityCulling;
}
if(parOptions == GameSettings.Options.PARTICLE_CULLING) {
this.particleCulling = !this.particleCulling;
}
if(parOptions == GameSettings.Options.ARMOR_GUI) {
this.armorgui = !this.armorgui;
}
if(parOptions == GameSettings.Options.CPS) {
this.cps = !this.cps;
}
if(parOptions == GameSettings.Options.KEYSTROKES) {
this.keyStrokes = !this.keyStrokes;
}
if(parOptions == GameSettings.Options.POTION_GUI) {
this.potionGUI = !this.potionGUI;
}
this.saveOptions();
}
@ -1220,6 +1250,18 @@ public class GameSettings extends ModData {
return this.fullBright;
case LEFT_HAND:
return this.leftHand;
case ENTITY_CULLING:
return this.entityCulling;
case PARTICLE_CULLING:
return this.particleCulling;
case ARMOR_GUI:
return this.armorgui;
case CPS:
return this.cps;
case POTION_GUI:
return this.potionGUI;
case KEYSTROKES:
return this.keyStrokes;
default:
return false;
}
@ -2098,6 +2140,30 @@ public class GameSettings extends ModData {
leftHand = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("particleCulling") && astring.length >= 2) {
particleCulling = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("entityCulling") && astring.length >= 2) {
entityCulling = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("armorgui") && astring.length >= 2) {
armorgui = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("cps") && astring.length >= 2) {
cps = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("keyStrokes") && astring.length >= 2) {
keyStrokes = Boolean.valueOf(astring[1]).booleanValue();
}
if(astring[0].equals("potionGUI") && astring.length >= 2) {
potionGUI = Boolean.valueOf(astring[1]).booleanValue();
}
for (SoundCategory soundcategory : SoundCategory._VALUES) {
if (astring[0].equals("soundCategory_" + soundcategory.getCategoryName())) {
this.mapSoundLevels.put(soundcategory, Float.valueOf(this.parseFloat(astring[1])));
@ -2293,6 +2359,12 @@ public class GameSettings extends ModData {
printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
printwriter.println("fullbright:" + this.fullBright);
printwriter.println("leftHand:" + this.leftHand);
printwriter.println("entityCulling:" + this.entityCulling);
printwriter.println("particleCulling:" + this.particleCulling);
printwriter.println("armorgui:" + this.armorgui);
printwriter.println("cps:" + this.cps);
printwriter.println("keyStrokes:" + this.keyStrokes);
printwriter.println("potionGUI:" + this.potionGUI);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -2506,7 +2578,13 @@ public class GameSettings extends ModData {
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true),
FULLBRIGHT("Fullbright", false, true),
LEFT_HAND("Main Hand", false, true);
LEFT_HAND("Main Hand", false, true),
ENTITY_CULLING("Entity Culling", false, true),
PARTICLE_CULLING("Particle Culling", false, true),
ARMOR_GUI("Armor GUI", false, true),
CPS("CPS", false, true),
KEYSTROKES("Keystrokes", false, true),
POTION_GUI("Potion Effects GUI", false, true);
private final boolean enumFloat;
private final boolean enumBoolean;

View File

@ -38,8 +38,8 @@ public class KeyBinding extends ModData implements Comparable<KeyBinding> {
private final String keyDescription;
private final int keyCodeDefault;
private final String keyCategory;
private int keyCode;
private boolean pressed;
public int keyCode;
public boolean pressed;
private int pressTime;
public static void onTick(int keyCode) {