mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-27 18:38:14 -05:00
Update #37 - Touch support without userscript, many other feats
This commit is contained in:
@ -5,6 +5,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
@ -35,7 +36,7 @@ public class ChunkUpdateManager {
|
||||
private int chunkUpdatesQueuedLast = 0;
|
||||
private long chunkUpdatesTotalLastUpdate = 0l;
|
||||
|
||||
private final List<ChunkCompileTaskGenerator> queue = new LinkedList();
|
||||
private final List<ChunkCompileTaskGenerator> queue = new LinkedList<>();
|
||||
|
||||
public ChunkUpdateManager() {
|
||||
worldVertexUploader = new WorldVertexBufferUploader();
|
||||
@ -108,8 +109,8 @@ public class ChunkUpdateManager {
|
||||
return false;
|
||||
}else {
|
||||
boolean flag = false;
|
||||
long millis = System.currentTimeMillis();
|
||||
List<ChunkCompileTaskGenerator> droppedUpdates = new LinkedList();
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
List<ChunkCompileTaskGenerator> droppedUpdates = new LinkedList<>();
|
||||
while(!queue.isEmpty()) {
|
||||
ChunkCompileTaskGenerator generator = queue.remove(0);
|
||||
|
||||
@ -125,7 +126,7 @@ public class ChunkUpdateManager {
|
||||
|
||||
++chunkUpdatesTotal;
|
||||
|
||||
if(timeout < System.nanoTime()) {
|
||||
if(timeout < EagRuntime.nanoTime()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -176,7 +177,7 @@ public class ChunkUpdateManager {
|
||||
if (chunkcompiletaskgenerator == null) {
|
||||
return true;
|
||||
}
|
||||
chunkcompiletaskgenerator.goddamnFuckingTimeout = System.currentTimeMillis();
|
||||
chunkcompiletaskgenerator.goddamnFuckingTimeout = EagRuntime.steadyTimeMillis();
|
||||
if(queue.size() < 100) {
|
||||
chunkcompiletaskgenerator.addFinishRunnable(new Runnable() {
|
||||
@Override
|
||||
@ -219,7 +220,7 @@ public class ChunkUpdateManager {
|
||||
}
|
||||
|
||||
public String getDebugInfo() {
|
||||
long millis = System.currentTimeMillis();
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
|
||||
if(millis - chunkUpdatesTotalLastUpdate > 500l) {
|
||||
chunkUpdatesTotalLastUpdate = millis;
|
||||
|
@ -105,7 +105,7 @@ public class EaglerFolderResourcePack extends AbstractResourcePack {
|
||||
}
|
||||
try {
|
||||
JSONArray json = (new JSONObject(str)).getJSONArray("resourcePacks");
|
||||
List<EaglerFolderResourcePack> ret = new ArrayList(json.length());
|
||||
List<EaglerFolderResourcePack> ret = new ArrayList<>(json.length());
|
||||
for(int i = 0, l = json.length(); i < l; ++i) {
|
||||
JSONObject jp = json.getJSONObject(i);
|
||||
String folderName = jp.getString("folder");
|
||||
|
@ -30,6 +30,15 @@ public class EaglerFontRenderer extends FontRenderer {
|
||||
|
||||
private final int[] temporaryCodepointArray = new int[6553];
|
||||
|
||||
public static FontRenderer createSupportedFontRenderer(GameSettings gameSettingsIn, ResourceLocation location,
|
||||
TextureManager textureManagerIn, boolean unicode) {
|
||||
if(EaglercraftGPU.checkInstancingCapable()) {
|
||||
return new EaglerFontRenderer(gameSettingsIn, location, textureManagerIn, unicode);
|
||||
}else {
|
||||
return new FontRenderer(gameSettingsIn, location, textureManagerIn, unicode);
|
||||
}
|
||||
}
|
||||
|
||||
public EaglerFontRenderer(GameSettings gameSettingsIn, ResourceLocation location, TextureManager textureManagerIn,
|
||||
boolean unicode) {
|
||||
super(gameSettingsIn, location, textureManagerIn, unicode);
|
||||
@ -116,15 +125,16 @@ public class EaglerFontRenderer extends FontRenderer {
|
||||
++i;
|
||||
} else {
|
||||
int j = temporaryCodepointArray[i];
|
||||
if(j > 255) continue;
|
||||
|
||||
if (this.randomStyle && j != -1) {
|
||||
int k = this.getCharWidth(c0);
|
||||
String chars = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000";
|
||||
char[] chars = FontRenderer.codepointLookup;
|
||||
|
||||
char c1;
|
||||
while (true) {
|
||||
j = this.fontRandom.nextInt(chars.length());
|
||||
c1 = chars.charAt(j);
|
||||
j = this.fontRandom.nextInt(chars.length);
|
||||
c1 = chars[j];
|
||||
if (k == this.getCharWidth(c1)) {
|
||||
break;
|
||||
}
|
||||
@ -220,8 +230,7 @@ public class EaglerFontRenderer extends FontRenderer {
|
||||
|
||||
private boolean decodeASCIICodepointsAndValidate(String str) {
|
||||
for(int i = 0, l = str.length(); i < l; ++i) {
|
||||
int j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000\u00a7"
|
||||
.indexOf(str.charAt(i));
|
||||
int j = FontMappingHelper.lookupChar(str.charAt(i), true);
|
||||
if(j != -1) {
|
||||
temporaryCodepointArray[i] = j;
|
||||
}else {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -229,10 +228,10 @@ public class EaglerTextureAtlasSprite {
|
||||
int l = i;
|
||||
this.height = this.width;
|
||||
if (meta.getFrameCount() > 0) {
|
||||
Iterator iterator = meta.getFrameIndexSet().iterator();
|
||||
Iterator<Integer> iterator = meta.getFrameIndexSet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
int i1 = ((Integer) iterator.next()).intValue();
|
||||
int i1 = iterator.next().intValue();
|
||||
if (i1 >= j1) {
|
||||
throw new RuntimeException("invalid frameindex " + i1);
|
||||
}
|
||||
@ -243,7 +242,7 @@ public class EaglerTextureAtlasSprite {
|
||||
|
||||
this.animationMetadata = meta;
|
||||
} else {
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
List<AnimationFrame> arraylist = Lists.newArrayList();
|
||||
|
||||
for (int l1 = 0; l1 < j1; ++l1) {
|
||||
this.framesTextureData.add(getFrameTextureData(aint, k1, l, l1));
|
||||
@ -258,10 +257,10 @@ public class EaglerTextureAtlasSprite {
|
||||
}
|
||||
|
||||
public void generateMipmaps(int level) {
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
List<int[][]> arraylist = Lists.newArrayList();
|
||||
|
||||
for (int i = 0; i < this.framesTextureData.size(); ++i) {
|
||||
final int[][] aint = (int[][]) this.framesTextureData.get(i);
|
||||
final int[][] aint = this.framesTextureData.get(i);
|
||||
if (aint != null) {
|
||||
try {
|
||||
arraylist.add(TextureUtil.generateMipmapData(level, this.width, aint));
|
||||
|
@ -0,0 +1,20 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public enum EnumInputEvent {
|
||||
CLIPBOARD_COPY, CLIPBOARD_PASTE;
|
||||
}
|
@ -0,0 +1,525 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class FontMappingHelper {
|
||||
|
||||
public static int lookupChar(char c, boolean incSel) {
|
||||
switch(c) {
|
||||
case 167:
|
||||
return incSel ? 256 : -1;
|
||||
case 192:
|
||||
return 0;
|
||||
case 193:
|
||||
return 1;
|
||||
case 194:
|
||||
return 2;
|
||||
case 200:
|
||||
return 3;
|
||||
case 202:
|
||||
return 4;
|
||||
case 203:
|
||||
return 5;
|
||||
case 205:
|
||||
return 6;
|
||||
case 211:
|
||||
return 7;
|
||||
case 212:
|
||||
return 8;
|
||||
case 213:
|
||||
return 9;
|
||||
case 218:
|
||||
return 10;
|
||||
case 223:
|
||||
return 11;
|
||||
case 227:
|
||||
return 12;
|
||||
case 245:
|
||||
return 13;
|
||||
case 287:
|
||||
return 14;
|
||||
case 304:
|
||||
return 15;
|
||||
case 305:
|
||||
return 16;
|
||||
case 338:
|
||||
return 17;
|
||||
case 339:
|
||||
return 18;
|
||||
case 350:
|
||||
return 19;
|
||||
case 351:
|
||||
return 20;
|
||||
case 372:
|
||||
return 21;
|
||||
case 373:
|
||||
return 22;
|
||||
case 382:
|
||||
return 23;
|
||||
case 519:
|
||||
return 24;
|
||||
case 0:
|
||||
return 25;
|
||||
case 32:
|
||||
return 32;
|
||||
case 33:
|
||||
return 33;
|
||||
case 34:
|
||||
return 34;
|
||||
case 35:
|
||||
return 35;
|
||||
case 36:
|
||||
return 36;
|
||||
case 37:
|
||||
return 37;
|
||||
case 38:
|
||||
return 38;
|
||||
case 39:
|
||||
return 39;
|
||||
case 40:
|
||||
return 40;
|
||||
case 41:
|
||||
return 41;
|
||||
case 42:
|
||||
return 42;
|
||||
case 43:
|
||||
return 43;
|
||||
case 44:
|
||||
return 44;
|
||||
case 45:
|
||||
return 45;
|
||||
case 46:
|
||||
return 46;
|
||||
case 47:
|
||||
return 47;
|
||||
case 48:
|
||||
return 48;
|
||||
case 49:
|
||||
return 49;
|
||||
case 50:
|
||||
return 50;
|
||||
case 51:
|
||||
return 51;
|
||||
case 52:
|
||||
return 52;
|
||||
case 53:
|
||||
return 53;
|
||||
case 54:
|
||||
return 54;
|
||||
case 55:
|
||||
return 55;
|
||||
case 56:
|
||||
return 56;
|
||||
case 57:
|
||||
return 57;
|
||||
case 58:
|
||||
return 58;
|
||||
case 59:
|
||||
return 59;
|
||||
case 60:
|
||||
return 60;
|
||||
case 61:
|
||||
return 61;
|
||||
case 62:
|
||||
return 62;
|
||||
case 63:
|
||||
return 63;
|
||||
case 64:
|
||||
return 64;
|
||||
case 65:
|
||||
return 65;
|
||||
case 66:
|
||||
return 66;
|
||||
case 67:
|
||||
return 67;
|
||||
case 68:
|
||||
return 68;
|
||||
case 69:
|
||||
return 69;
|
||||
case 70:
|
||||
return 70;
|
||||
case 71:
|
||||
return 71;
|
||||
case 72:
|
||||
return 72;
|
||||
case 73:
|
||||
return 73;
|
||||
case 74:
|
||||
return 74;
|
||||
case 75:
|
||||
return 75;
|
||||
case 76:
|
||||
return 76;
|
||||
case 77:
|
||||
return 77;
|
||||
case 78:
|
||||
return 78;
|
||||
case 79:
|
||||
return 79;
|
||||
case 80:
|
||||
return 80;
|
||||
case 81:
|
||||
return 81;
|
||||
case 82:
|
||||
return 82;
|
||||
case 83:
|
||||
return 83;
|
||||
case 84:
|
||||
return 84;
|
||||
case 85:
|
||||
return 85;
|
||||
case 86:
|
||||
return 86;
|
||||
case 87:
|
||||
return 87;
|
||||
case 88:
|
||||
return 88;
|
||||
case 89:
|
||||
return 89;
|
||||
case 90:
|
||||
return 90;
|
||||
case 91:
|
||||
return 91;
|
||||
case 92:
|
||||
return 92;
|
||||
case 93:
|
||||
return 93;
|
||||
case 94:
|
||||
return 94;
|
||||
case 95:
|
||||
return 95;
|
||||
case 96:
|
||||
return 96;
|
||||
case 97:
|
||||
return 97;
|
||||
case 98:
|
||||
return 98;
|
||||
case 99:
|
||||
return 99;
|
||||
case 100:
|
||||
return 100;
|
||||
case 101:
|
||||
return 101;
|
||||
case 102:
|
||||
return 102;
|
||||
case 103:
|
||||
return 103;
|
||||
case 104:
|
||||
return 104;
|
||||
case 105:
|
||||
return 105;
|
||||
case 106:
|
||||
return 106;
|
||||
case 107:
|
||||
return 107;
|
||||
case 108:
|
||||
return 108;
|
||||
case 109:
|
||||
return 109;
|
||||
case 110:
|
||||
return 110;
|
||||
case 111:
|
||||
return 111;
|
||||
case 112:
|
||||
return 112;
|
||||
case 113:
|
||||
return 113;
|
||||
case 114:
|
||||
return 114;
|
||||
case 115:
|
||||
return 115;
|
||||
case 116:
|
||||
return 116;
|
||||
case 117:
|
||||
return 117;
|
||||
case 118:
|
||||
return 118;
|
||||
case 119:
|
||||
return 119;
|
||||
case 120:
|
||||
return 120;
|
||||
case 121:
|
||||
return 121;
|
||||
case 122:
|
||||
return 122;
|
||||
case 123:
|
||||
return 123;
|
||||
case 124:
|
||||
return 124;
|
||||
case 125:
|
||||
return 125;
|
||||
case 126:
|
||||
return 126;
|
||||
case 199:
|
||||
return 128;
|
||||
case 252:
|
||||
return 129;
|
||||
case 233:
|
||||
return 130;
|
||||
case 226:
|
||||
return 131;
|
||||
case 228:
|
||||
return 132;
|
||||
case 224:
|
||||
return 133;
|
||||
case 229:
|
||||
return 134;
|
||||
case 231:
|
||||
return 135;
|
||||
case 234:
|
||||
return 136;
|
||||
case 235:
|
||||
return 137;
|
||||
case 232:
|
||||
return 138;
|
||||
case 239:
|
||||
return 139;
|
||||
case 238:
|
||||
return 140;
|
||||
case 236:
|
||||
return 141;
|
||||
case 196:
|
||||
return 142;
|
||||
case 197:
|
||||
return 143;
|
||||
case 201:
|
||||
return 144;
|
||||
case 230:
|
||||
return 145;
|
||||
case 198:
|
||||
return 146;
|
||||
case 244:
|
||||
return 147;
|
||||
case 246:
|
||||
return 148;
|
||||
case 242:
|
||||
return 149;
|
||||
case 251:
|
||||
return 150;
|
||||
case 249:
|
||||
return 151;
|
||||
case 255:
|
||||
return 152;
|
||||
case 214:
|
||||
return 153;
|
||||
case 220:
|
||||
return 154;
|
||||
case 248:
|
||||
return 155;
|
||||
case 163:
|
||||
return 156;
|
||||
case 216:
|
||||
return 157;
|
||||
case 215:
|
||||
return 158;
|
||||
case 402:
|
||||
return 159;
|
||||
case 225:
|
||||
return 160;
|
||||
case 237:
|
||||
return 161;
|
||||
case 243:
|
||||
return 162;
|
||||
case 250:
|
||||
return 163;
|
||||
case 241:
|
||||
return 164;
|
||||
case 209:
|
||||
return 165;
|
||||
case 170:
|
||||
return 166;
|
||||
case 186:
|
||||
return 167;
|
||||
case 191:
|
||||
return 168;
|
||||
case 174:
|
||||
return 169;
|
||||
case 172:
|
||||
return 170;
|
||||
case 189:
|
||||
return 171;
|
||||
case 188:
|
||||
return 172;
|
||||
case 161:
|
||||
return 173;
|
||||
case 171:
|
||||
return 174;
|
||||
case 187:
|
||||
return 175;
|
||||
case 9617:
|
||||
return 176;
|
||||
case 9618:
|
||||
return 177;
|
||||
case 9619:
|
||||
return 178;
|
||||
case 9474:
|
||||
return 179;
|
||||
case 9508:
|
||||
return 180;
|
||||
case 9569:
|
||||
return 181;
|
||||
case 9570:
|
||||
return 182;
|
||||
case 9558:
|
||||
return 183;
|
||||
case 9557:
|
||||
return 184;
|
||||
case 9571:
|
||||
return 185;
|
||||
case 9553:
|
||||
return 186;
|
||||
case 9559:
|
||||
return 187;
|
||||
case 9565:
|
||||
return 188;
|
||||
case 9564:
|
||||
return 189;
|
||||
case 9563:
|
||||
return 190;
|
||||
case 9488:
|
||||
return 191;
|
||||
case 9492:
|
||||
return 192;
|
||||
case 9524:
|
||||
return 193;
|
||||
case 9516:
|
||||
return 194;
|
||||
case 9500:
|
||||
return 195;
|
||||
case 9472:
|
||||
return 196;
|
||||
case 9532:
|
||||
return 197;
|
||||
case 9566:
|
||||
return 198;
|
||||
case 9567:
|
||||
return 199;
|
||||
case 9562:
|
||||
return 200;
|
||||
case 9556:
|
||||
return 201;
|
||||
case 9577:
|
||||
return 202;
|
||||
case 9574:
|
||||
return 203;
|
||||
case 9568:
|
||||
return 204;
|
||||
case 9552:
|
||||
return 205;
|
||||
case 9580:
|
||||
return 206;
|
||||
case 9575:
|
||||
return 207;
|
||||
case 9576:
|
||||
return 208;
|
||||
case 9572:
|
||||
return 209;
|
||||
case 9573:
|
||||
return 210;
|
||||
case 9561:
|
||||
return 211;
|
||||
case 9560:
|
||||
return 212;
|
||||
case 9554:
|
||||
return 213;
|
||||
case 9555:
|
||||
return 214;
|
||||
case 9579:
|
||||
return 215;
|
||||
case 9578:
|
||||
return 216;
|
||||
case 9496:
|
||||
return 217;
|
||||
case 9484:
|
||||
return 218;
|
||||
case 9608:
|
||||
return 219;
|
||||
case 9604:
|
||||
return 220;
|
||||
case 9612:
|
||||
return 221;
|
||||
case 9616:
|
||||
return 222;
|
||||
case 9600:
|
||||
return 223;
|
||||
case 945:
|
||||
return 224;
|
||||
case 946:
|
||||
return 225;
|
||||
case 915:
|
||||
return 226;
|
||||
case 960:
|
||||
return 227;
|
||||
case 931:
|
||||
return 228;
|
||||
case 963:
|
||||
return 229;
|
||||
case 956:
|
||||
return 230;
|
||||
case 964:
|
||||
return 231;
|
||||
case 934:
|
||||
return 232;
|
||||
case 920:
|
||||
return 233;
|
||||
case 937:
|
||||
return 234;
|
||||
case 948:
|
||||
return 235;
|
||||
case 8734:
|
||||
return 236;
|
||||
case 8709:
|
||||
return 237;
|
||||
case 8712:
|
||||
return 238;
|
||||
case 8745:
|
||||
return 239;
|
||||
case 8801:
|
||||
return 240;
|
||||
case 177:
|
||||
return 241;
|
||||
case 8805:
|
||||
return 242;
|
||||
case 8804:
|
||||
return 243;
|
||||
case 8992:
|
||||
return 244;
|
||||
case 8993:
|
||||
return 245;
|
||||
case 247:
|
||||
return 246;
|
||||
case 8776:
|
||||
return 247;
|
||||
case 176:
|
||||
return 248;
|
||||
case 8729:
|
||||
return 249;
|
||||
case 183:
|
||||
return 250;
|
||||
case 8730:
|
||||
return 251;
|
||||
case 8319:
|
||||
return 252;
|
||||
case 178:
|
||||
return 253;
|
||||
case 9632:
|
||||
return 254;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.Mouse;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.EnumCursorType;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class GuiButtonWithStupidIcons extends GuiButton {
|
||||
|
||||
protected ResourceLocation leftIcon;
|
||||
protected float leftIconAspect;
|
||||
protected ResourceLocation rightIcon;
|
||||
protected float rightIconAspect;
|
||||
|
||||
public GuiButtonWithStupidIcons(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
|
||||
super(buttonId, x, y, widthIn, heightIn, buttonText);
|
||||
}
|
||||
|
||||
public GuiButtonWithStupidIcons(int buttonId, int x, int y, String buttonText) {
|
||||
super(buttonId, x, y, buttonText);
|
||||
}
|
||||
|
||||
public GuiButtonWithStupidIcons(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText,
|
||||
ResourceLocation leftIcon, float leftIconAspect, ResourceLocation rightIcon, float rightIconAspect) {
|
||||
super(buttonId, x, y, widthIn, heightIn, buttonText);
|
||||
this.leftIcon = leftIcon;
|
||||
this.leftIconAspect = leftIconAspect;
|
||||
this.rightIcon = rightIcon;
|
||||
this.rightIconAspect = rightIconAspect;
|
||||
}
|
||||
|
||||
public GuiButtonWithStupidIcons(int buttonId, int x, int y, String buttonText, ResourceLocation leftIcon,
|
||||
float leftIconAspect, ResourceLocation rightIcon, float rightIconAspect) {
|
||||
super(buttonId, x, y, buttonText);
|
||||
this.leftIcon = leftIcon;
|
||||
this.leftIconAspect = leftIconAspect;
|
||||
this.rightIcon = rightIcon;
|
||||
this.rightIconAspect = rightIconAspect;
|
||||
}
|
||||
|
||||
public ResourceLocation getLeftIcon() {
|
||||
return leftIcon;
|
||||
}
|
||||
|
||||
public ResourceLocation getRightIcon() {
|
||||
return rightIcon;
|
||||
}
|
||||
|
||||
public void setLeftIcon(ResourceLocation leftIcon, float aspectRatio) {
|
||||
this.leftIcon = leftIcon;
|
||||
this.leftIconAspect = aspectRatio;
|
||||
}
|
||||
|
||||
public void setRightIcon(ResourceLocation rightIcon, float aspectRatio) {
|
||||
this.rightIcon = rightIcon;
|
||||
this.rightIconAspect = aspectRatio;
|
||||
}
|
||||
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
FontRenderer fontrenderer = mc.fontRendererObj;
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
if (this.enabled && this.hovered) {
|
||||
Mouse.showCursor(EnumCursorType.HAND);
|
||||
}
|
||||
int i = this.getHoverState(this.hovered);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2,
|
||||
46 + i * 20, this.width / 2, this.height);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int j = 14737632;
|
||||
if (!this.enabled) {
|
||||
j = 10526880;
|
||||
} else if (this.hovered) {
|
||||
j = 16777120;
|
||||
}
|
||||
|
||||
int strWidth = fontrenderer.getStringWidth(displayString);
|
||||
int strWidthAdj = strWidth - (leftIcon != null ? (int) (16 * leftIconAspect) : 0)
|
||||
+ (rightIcon != null ? (int) (16 * rightIconAspect) : 0);
|
||||
this.drawString(fontrenderer, this.displayString, this.xPosition + (this.width - strWidthAdj) / 2,
|
||||
this.yPosition + (this.height - 8) / 2, j);
|
||||
if(leftIcon != null) {
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
mc.getTextureManager().bindTexture(leftIcon);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(this.xPosition + (this.width - strWidthAdj) / 2 - 3 - 16 * leftIconAspect, this.yPosition + 2, 0.0f);
|
||||
float f = 16.0f / 256.0f;
|
||||
GlStateManager.scale(f * leftIconAspect, f, f);
|
||||
this.drawTexturedModalRect(0, 0, 0, 0, 256, 256);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
if(rightIcon != null) {
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
mc.getTextureManager().bindTexture(rightIcon);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(this.xPosition + (this.width - strWidthAdj) / 2 + strWidth + 3, this.yPosition + 2, 0.0f);
|
||||
float f = 16.0f / 256.0f;
|
||||
GlStateManager.scale(f * rightIconAspect, f, f);
|
||||
this.drawTexturedModalRect(0, 0, 0, 0, 256, 256);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@ -26,8 +28,8 @@ public class GuiScreenGenericErrorMessage extends GuiScreen {
|
||||
private GuiScreen cont;
|
||||
|
||||
public GuiScreenGenericErrorMessage(String str1, String str2, GuiScreen cont) {
|
||||
this.str1 = I18n.format(str1);
|
||||
this.str2 = I18n.format(str2);
|
||||
this.str1 = StringUtils.isAllEmpty(str1) ? "" : I18n.format(str1);
|
||||
this.str2 = StringUtils.isAllEmpty(str2) ? "" : I18n.format(str2);
|
||||
this.cont = cont;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,144 @@
|
||||
package net.lax1dude.eaglercraft.v1_8.minecraft;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.Display;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class GuiScreenVisualViewport extends GuiScreen {
|
||||
|
||||
protected int offsetX;
|
||||
protected int offsetY;
|
||||
|
||||
@Override
|
||||
public final void setWorldAndResolution(Minecraft mc, int width, int height) {
|
||||
Display.wasVisualViewportResized(); // clear state
|
||||
offsetX = Display.getVisualViewportX() * width / mc.displayWidth;
|
||||
offsetY = Display.getVisualViewportY() * height / mc.displayHeight;
|
||||
setWorldAndResolution0(mc, Display.getVisualViewportW() * width / mc.displayWidth,
|
||||
Display.getVisualViewportH() * height / mc.displayHeight);
|
||||
}
|
||||
|
||||
protected void setWorldAndResolution0(Minecraft mc, int width, int height) {
|
||||
super.setWorldAndResolution(mc, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void updateScreen() {
|
||||
if(Display.wasVisualViewportResized()) {
|
||||
setWorldAndResolution(mc, mc.scaledResolution.getScaledWidth(), mc.scaledResolution.getScaledHeight());
|
||||
}
|
||||
updateScreen0();
|
||||
}
|
||||
|
||||
protected void updateScreen0() {
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void drawScreen(int i, int j, float var3) {
|
||||
i -= offsetX;
|
||||
j -= offsetY;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(offsetX, offsetY, 0.0f);
|
||||
drawScreen0(i, j, var3);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
protected void drawScreen0(int i, int j, float var3) {
|
||||
super.drawScreen(i, j, var3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void mouseClicked(int parInt1, int parInt2, int parInt3) {
|
||||
parInt1 -= offsetX;
|
||||
parInt2 -= offsetY;
|
||||
mouseClicked0(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
protected void mouseClicked0(int parInt1, int parInt2, int parInt3) {
|
||||
super.mouseClicked(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void mouseReleased(int i, int j, int k) {
|
||||
i -= offsetX;
|
||||
j -= offsetY;
|
||||
mouseReleased0(i, j, k);
|
||||
}
|
||||
|
||||
protected void mouseReleased0(int i, int j, int k) {
|
||||
super.mouseReleased(i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void mouseClickMove(int var1, int var2, int var3, long var4) {
|
||||
var1 -= offsetX;
|
||||
var2 -= offsetY;
|
||||
mouseClickMove0(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
protected void mouseClickMove0(int var1, int var2, int var3, long var4) {
|
||||
super.mouseClickMove(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void touchEndMove(int parInt1, int parInt2, int parInt3) {
|
||||
parInt1 -= offsetX;
|
||||
parInt2 -= offsetY;
|
||||
touchEndMove0(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
protected void touchEndMove0(int parInt1, int parInt2, int parInt3) {
|
||||
super.touchEndMove(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void touchMoved(int parInt1, int parInt2, int parInt3) {
|
||||
parInt1 -= offsetX;
|
||||
parInt2 -= offsetY;
|
||||
touchMoved0(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
protected void touchMoved0(int parInt1, int parInt2, int parInt3) {
|
||||
super.touchMoved(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void touchStarted(int parInt1, int parInt2, int parInt3) {
|
||||
parInt1 -= offsetX;
|
||||
parInt2 -= offsetY;
|
||||
touchStarted0(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
protected void touchStarted0(int parInt1, int parInt2, int parInt3) {
|
||||
super.touchStarted(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void touchTapped(int parInt1, int parInt2, int parInt3) {
|
||||
parInt1 -= offsetX;
|
||||
parInt2 -= offsetY;
|
||||
touchTapped0(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
protected void touchTapped0(int parInt1, int parInt2, int parInt3) {
|
||||
super.touchTapped(parInt1, parInt2, parInt3);
|
||||
}
|
||||
|
||||
}
|
@ -54,8 +54,8 @@ public class TextureAnimationCache {
|
||||
for(int i = 0; i < cacheTextures.length; ++i) {
|
||||
cacheTextures[i] = GlStateManager.generateTexture();
|
||||
GlStateManager.bindTexture(cacheTextures[i]);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
@ -123,6 +123,8 @@ public class TextureAnimationCache {
|
||||
if(cacheTextures == null) {
|
||||
throw new IllegalStateException("Cannot copy from uninitialized TextureAnimationCache");
|
||||
}
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.bindTexture(cacheTextures[level]);
|
||||
TextureCopyUtil.srcSize(width >> level, (height >> level) * frameCount);
|
||||
TextureCopyUtil.blitTextureUsingViewports(0, h * animationFrame, dx, dy, w, h);
|
||||
|
Reference in New Issue
Block a user