This commit is contained in:
HoosierTransfer 2024-07-02 10:24:54 -04:00
parent 8661f9f0b0
commit 9f6220903d
57 changed files with 1379444 additions and 46367 deletions

4
.gitignore vendored
View File

@ -20,6 +20,10 @@ javascript/EaglercraftX_1.8_Offline_en_US.html
javascript/EaglercraftX_1.8_Offline_International.html javascript/EaglercraftX_1.8_Offline_International.html
javascript/EaglercraftL_1.9_Offline_en_US.html javascript/EaglercraftL_1.9_Offline_en_US.html
javascript/EaglercraftL_1.9_Offline_International.html javascript/EaglercraftL_1.9_Offline_International.html
javascript/EaglercraftL_1.9_Offline_Signed_Client.html
javascript/*.dat
javascript/*.cert
javascript/classes.js.map javascript/classes.js.map
resources/hashes/* resources/hashes/*
resources/optimizedResources/* resources/optimizedResources/*

View File

@ -1,4 +1,4 @@
@echo off @echo off
title MakeSignedClient title MakeSignedClient
java -cp "resources/MakeOfflineDownload.jar;resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html" java -cp "resources/MakeOfflineDownload.jar;resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftL_1.9_Offline_Signed_Client.html"
pause pause

View File

@ -23,7 +23,7 @@ dependencies {
} }
teavm.js { teavm.js {
obfuscated = false obfuscated = true
sourceMap = true sourceMap = true
targetFileName = "../classes.js" targetFileName = "../classes.js"
optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -28,12 +28,12 @@ Compile it yourself here: https://gitlab.com/lax1dude/eaglercraftx-1.8/
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EaglercraftX 1.8 Offline" /> <meta name="description" content="EaglercraftL 1.9 Offline" />
<meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" /> <meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" />
<title>EaglercraftX 1.8</title> <title>EaglercraftL 1.9</title>
<meta property="og:locale" content="en-US" /> <meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:title" content="EaglercraftX 1.8 Offline" /> <meta property="og:title" content="EaglercraftL 1.9 Offline" />
<meta property="og:description" content="this file is not a website, whoever uploaded it to this URL is a dumbass" /> <meta property="og:description" content="this file is not a website, whoever uploaded it to this URL is a dumbass" />
<script type="text/javascript"> <script type="text/javascript">
"use strict"; "use strict";

View File

@ -3,12 +3,12 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EaglercraftX 1.8 Offline" /> <meta name="description" content="EaglercraftL 1.9 Offline" />
<meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" /> <meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" />
<title>EaglercraftX 1.8</title> <title>EaglercraftL 1.9</title>
<meta property="og:locale" content="en-US" /> <meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:title" content="EaglercraftX 1.8" /> <meta property="og:title" content="EaglercraftL 1.9" />
<meta property="og:description" content="Play minecraft 1.8 in your browser" /> <meta property="og:description" content="Play minecraft 1.8 in your browser" />
<script type="text/javascript"> <script type="text/javascript">
"use strict"; "use strict";

View File

@ -6,3 +6,16 @@
# url: url here # url: url here
# ipfs: cid here # ipfs: cid here
# list: url to another list # list: url to another list
#use-gateway:https://gateway.ipfs.io/ipfs/$cid$/$path$
#use-gateway:https://dweb.link/ipfs/$cid$/$path$
url:https://update.temuzx.xyz/data
#use-gateway:https://nftstorage.link/ipfs/$cid$/$path$
#use-gateway:https://cloudflare-ipfs.com/ipfs/$cid$/$path$
#use-gateway:https://w3s.link/ipfs/$cid$/$path$
url:https://update.eagler.xyz/data
url:https://update.hoosiertransfer.xyz/data
#use-gateway:https://4everland.io/ipfs/$cid$/$path$
#use-gateway:https://$cid$.ipfs.gateway.ipfs.io/$path$
#use-gateway:https://$cid$.ipfs.dweb.link/$path$
#use-gateway:https://$cid$.ipfs.cf-ipfs.com/$path$
#use-gateway:https://$cid$.ipfs.nftstorage.link/$path$

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,12 +3,12 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EaglercraftX 1.8 Offline" /> <meta name="description" content="EaglercraftL 1.9 Offline" />
<meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" /> <meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" />
<title>EaglercraftX 1.8</title> <title>EaglercraftL 1.9</title>
<meta property="og:locale" content="en-US" /> <meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:title" content="EaglercraftX 1.8" /> <meta property="og:title" content="EaglercraftL 1.9" />
<meta property="og:description" content="Play minecraft 1.8 in your browser" /> <meta property="og:description" content="Play minecraft 1.8 in your browser" />
<script type="text/javascript"> <script type="text/javascript">
"use strict"; "use strict";

View File

@ -537,7 +537,7 @@ eaglercraft.lanInfo.title=Shared World Info
eaglercraft.lanInfo.desc.0=Eaglercraft shared worlds are NOT limited to your local network like vanilla LAN worlds. This means that anyone with an internet connection and connection to the invite relay can join your world provided they have the code. eaglercraft.lanInfo.desc.0=Eaglercraft shared worlds are NOT limited to your local network like vanilla LAN worlds. This means that anyone with an internet connection and connection to the invite relay can join your world provided they have the code.
eaglercraft.lanInfo.desc.1=Join a shared world from the %s screen, or create one with the %s button while in a world. eaglercraft.lanInfo.desc.1=Join a shared world from the %s screen, or create one with the %s button while in a world.
eaglercraft.lanServer.legacyClient=Please use EaglercraftX 1.8! eaglercraft.lanServer.legacyClient=Please use EaglercraftL 1.9!
eaglercraft.lanServer.pauseMenu0=Sharing World eaglercraft.lanServer.pauseMenu0=Sharing World
eaglercraft.lanServer.pauseMenu1=Relay URL: eaglercraft.lanServer.pauseMenu1=Relay URL:
@ -610,8 +610,8 @@ eaglercraft.update.signatureInvalid=Signature Invalid!
eaglercraft.updateList.title=Versions Available eaglercraft.updateList.title=Versions Available
eaglercraft.updateList.download=Download eaglercraft.updateList.download=Download
eaglercraft.updateList.refresh=Refresh eaglercraft.updateList.refresh=Refresh
eaglercraft.updateList.note.0=Note: Updates are digitally signed, EaglercraftX will block any eaglercraft.updateList.note.0=Note: Updates are digitally signed, EaglercraftL will block any
eaglercraft.updateList.note.1=updates that were not created by lax1dude or ayunami2000 eaglercraft.updateList.note.1=updates that were not created by HoosierTransfer
eaglercraft.voice.title=Voice Channel eaglercraft.voice.title=Voice Channel
eaglercraft.voice.titleNoVoice=Voice is disabled on this server eaglercraft.voice.titleNoVoice=Voice is disabled on this server
@ -2432,12 +2432,22 @@ mount.onboard=Press %1$s to dismount
build.tooHigh=Height limit for building is %s blocks build.tooHigh=Height limit for building is %s blocks
item.modifiers.mainhand=When in main hand:
item.modifiers.offhand=When in off hand:
item.modifiers.feet=When on feet:
item.modifiers.legs=When on legs:
item.modifiers.chest=When on body:
item.modifiers.head=When on head:
attribute.modifier.plus.0=+%d %s attribute.modifier.plus.0=+%d %s
attribute.modifier.plus.1=+%d%% %s attribute.modifier.plus.1=+%d%% %s
attribute.modifier.plus.2=+%d%% %s attribute.modifier.plus.2=+%d%% %s
attribute.modifier.take.0=-%d %s attribute.modifier.take.0=-%d %s
attribute.modifier.take.1=-%d%% %s attribute.modifier.take.1=-%d%% %s
attribute.modifier.take.2=-%d%% %s attribute.modifier.take.2=-%d%% %s
attribute.modifier.equals.0=%d %s
attribute.modifier.equals.1=%d%% %s
attribute.modifier.equals.2=%d%% %s
attribute.name.horse.jumpStrength=Horse Jump Strength attribute.name.horse.jumpStrength=Horse Jump Strength
attribute.name.zombie.spawnReinforcements=Zombie Reinforcements attribute.name.zombie.spawnReinforcements=Zombie Reinforcements
@ -2446,6 +2456,10 @@ attribute.name.generic.followRange=Mob Follow Range
attribute.name.generic.knockbackResistance=Knockback Resistance attribute.name.generic.knockbackResistance=Knockback Resistance
attribute.name.generic.movementSpeed=Speed attribute.name.generic.movementSpeed=Speed
attribute.name.generic.attackDamage=Attack Damage attribute.name.generic.attackDamage=Attack Damage
attribute.name.generic.attackSpeed=Attack Speed
attribute.name.generic.luck=Luck
attribute.name.generic.armor=Armor
attribute.name.generic.armorToughness=Armor Toughness
screenshot.success=Saved screenshot as %s screenshot.success=Saved screenshot as %s
screenshot.failure=Couldn't save screenshot: %s screenshot.failure=Couldn't save screenshot: %s

View File

@ -1431,6 +1431,55 @@
"mob/zombiepig/zpighurt2" "mob/zombiepig/zpighurt2"
] ]
}, },
"entity.player.attack.crit": {
"category": "player",
"sounds": [
"entity/player/attack/crit1",
"entity/player/attack/crit2",
"entity/player/attack/crit3"
]
},
"entity.player.attack.knockback": {
"category": "player",
"sounds": [
"entity/player/attack/knockback1",
"entity/player/attack/knockback2",
"entity/player/attack/knockback3",
"entity/player/attack/knockback4"
]
},
"entity.player.attack.strong": {
"category": "player",
"sounds": [
"entity/player/attack/strong1",
"entity/player/attack/strong2",
"entity/player/attack/strong3",
"entity/player/attack/strong4",
"entity/player/attack/strong5",
"entity/player/attack/strong6"
]
},
"entity.player.attack.sweep": {
"category": "player",
"sounds": [
"entity/player/attack/sweep1",
"entity/player/attack/sweep2",
"entity/player/attack/sweep3",
"entity/player/attack/sweep4",
"entity/player/attack/sweep5",
"entity/player/attack/sweep6",
"entity/player/attack/sweep7"
]
},
"entity.player.attack.weak": {
"category": "player",
"sounds": [
"entity/player/attack/weak1",
"entity/player/attack/weak2",
"entity/player/attack/weak3",
"entity/player/attack/weak4"
]
},
"note.bass": { "note.bass": {
"category": "record", "category": "record",
"sounds": [ "sounds": [

View File

@ -0,0 +1,96 @@
package net.hoosiertransfer;
import java.util.List;
import org.teavm.interop.Async;
import org.teavm.interop.AsyncCallback;
import org.teavm.jso.ajax.ProgressEvent;
import org.teavm.jso.ajax.XMLHttpRequest;
import org.teavm.jso.dom.events.Event;
import org.teavm.jso.dom.events.EventListener;
import org.teavm.jso.typedarrays.ArrayBuffer;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.TeaVMUtils;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.update.UpdateService;
public class EaglerLUpdateThread implements Runnable {
private static final Logger logger = LogManager.getLogger("EaglerLUpdateThread");
private final List<String> urls;
private static Thread updateThread = null;
public EaglerLUpdateThread(List<String> urls) {
this.urls = urls;
}
@SuppressWarnings("finally")
@Override
public void run() {
for (String url : urls) {
byte[] data = downloadFile(url);
boolean success = false;
if (data != null) {
try {
if (new String(data).contains("File not found")) {
logger.error("File not found: {}", url);
continue;
}
UpdateService.addCertificateToSet(data);
success = true;
} catch (Exception e) {
logger.error("Failed to add certificate to set: {}", url);
}
} else {
logger.error("Failed to download file: {}", url);
}
if (success) {
break;
}
}
}
@Async
private static native byte[] downloadFile(String url);
private static void downloadFile(String url, AsyncCallback<byte[]> callback) {
final XMLHttpRequest xhr = XMLHttpRequest.create();
xhr.open("GET", url);
xhr.setResponseType("arraybuffer");
TeaVMUtils.addEventListener(xhr, "readystatechange", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
if (xhr.getReadyState() == 4) {
if (xhr.getStatus() == 200) {
ArrayBuffer data = (ArrayBuffer) xhr.getResponse();
callback.complete(TeaVMUtils.wrapByteArrayBuffer(data));
} else {
logger.error("Got response code {} \"{}\" for url: {}", xhr.getStatus(), xhr.getStatusText(),
url);
callback.complete(null);
}
}
}
});
TeaVMUtils.addEventListener(xhr, "error", new EventListener<ProgressEvent>() {
@Override
public void handleEvent(ProgressEvent evt) {
logger.error("Exception caught downloading file: {}", url);
}
});
xhr.send();
}
public static void startClientUpdate(List<String> urls) {
if (updateThread == null || !updateThread.isAlive()) {
updateThread = new Thread(new EaglerLUpdateThread(urls), "EaglerLUpdateThread");
updateThread.setDaemon(true);
updateThread.start();
} else {
logger.error("Tried to start a new download while the current download thread was still alive!");
}
}
}

View File

@ -14,6 +14,7 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import net.hoosiertransfer.EaglerLUpdateThread;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformANGLE; import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformANGLE;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformAgent; import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformAgent;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformOS; import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformOS;
@ -78,6 +79,8 @@ public class EagRuntime {
UpdateService.initialize(); UpdateService.initialize();
EaglerXBungeeVersion.initialize(); EaglerXBungeeVersion.initialize();
EaglercraftGPU.warmUpCache(); EaglercraftGPU.warmUpCache();
List<String> urls = EaglercraftVersion.enableUpdateService ? EaglercraftVersion.updateURLs : null;
EaglerLUpdateThread.startClientUpdate(urls);
} }
public static void destroy() { public static void destroy() {

View File

@ -1,6 +1,7 @@
package net.lax1dude.eaglercraft.v1_8; package net.lax1dude.eaglercraft.v1_8;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List;
public class EaglercraftVersion { public class EaglercraftVersion {
@ -27,8 +28,13 @@ public class EaglercraftVersion {
public static final boolean enableUpdateService = true; public static final boolean enableUpdateService = true;
public static final List<String> updateURLs = List.of(
"https://update.temuzx.xyz/cert",
"https://update.eagler.xyz/cert",
"https://update.hoosiertransfer.xyz/cert");
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client"; public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 35; public static final int updateBundlePackageVersionInt = 1;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName; public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;

View File

@ -129,7 +129,7 @@ public class IntegratedServerPlayerNetworkManager {
DataOutputStream kickDAO = new DataOutputStream(kickPacketBAO); DataOutputStream kickDAO = new DataOutputStream(kickPacketBAO);
kickDAO.write(0); kickDAO.write(0);
kickDAO.write(0xFF); kickDAO.write(0xFF);
String msg = "This is an EaglercraftX 1.8 LAN world!"; String msg = "This is an EaglercraftL 1.9 LAN world!";
kickDAO.write(0x00); kickDAO.write(0x00);
kickDAO.write(msg.length()); kickDAO.write(msg.length());
for (int j = 0, l = msg.length(); j < l; ++j) { for (int j = 0, l = msg.length(); j < l; ++j) {

View File

@ -157,7 +157,8 @@ public class UpdateCertificate {
hash2048[1] = (byte) (signaturePayload.length & 0xFF); hash2048[1] = (byte) (signaturePayload.length & 0xFF);
if (!Arrays.equals(hash2048, rsa2048sumDec)) { if (!Arrays.equals(hash2048, rsa2048sumDec)) {
throw new CertificateInvalidException("SHA256 checksum of signature payload is invalid!"); UpdateService.logger.error("SHA256 checksum of signature payload is invalid!");
return null;
} }
UpdateCertificate cert; UpdateCertificate cert;
@ -166,6 +167,7 @@ public class UpdateCertificate {
} }
if (System.currentTimeMillis() < cert.sigTimestamp) { if (System.currentTimeMillis() < cert.sigTimestamp) {
throw new CertificateInvalidException("Update certificate timestamp is from the future!?"); throw new CertificateInvalidException("Update certificate timestamp is from the future!?");
} }

View File

@ -38,7 +38,7 @@ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
*/ */
public class UpdateService { public class UpdateService {
private static final Logger logger = LogManager.getLogger("UpdateService"); protected static final Logger logger = LogManager.getLogger("UpdateService");
private static UpdateCertificate myUpdateCert = null; private static UpdateCertificate myUpdateCert = null;
private static boolean isBundleDataValid = false; private static boolean isBundleDataValid = false;

View File

@ -16,12 +16,14 @@ import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream; import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion; import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.lax1dude.eaglercraft.v1_8.crypto.MD5Digest; import net.lax1dude.eaglercraft.v1_8.crypto.MD5Digest;
import net.lax1dude.eaglercraft.v1_8.crypto.SHA1Digest; import net.lax1dude.eaglercraft.v1_8.crypto.SHA1Digest;
import net.lax1dude.eaglercraft.v1_8.internal.EnumCursorType;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU; import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
@ -712,22 +714,21 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
// HoosierTransfer mod String lbl = "CREDITS.txt";
// String lbl = "CREDITS.txt"; int w = fontRendererObj.getStringWidth(lbl) * 3 / 4;
// int w = fontRendererObj.getStringWidth(lbl) * 3 / 4;
// if (i >= (this.width - w - 4) && i <= this.width && j >= 0 && j <= 9) { if (i >= (this.width - w - 4) && i <= this.width && j >= 0 && j <= 9) {
// Mouse.showCursor(EnumCursorType.HAND); Mouse.showCursor(EnumCursorType.HAND);
// drawRect((this.width - w - 4), 0, this.width, 10, 0x55000099); drawRect((this.width - w - 4), 0, this.width, 10, 0x55000099);
// } else { } else {
// drawRect((this.width - w - 4), 0, this.width, 10, 0x55200000); drawRect((this.width - w - 4), 0, this.width, 10, 0x55200000);
// } }
// GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
// GlStateManager.translate((this.width - w - 2), 2.0f, 0.0f); GlStateManager.translate((this.width - w - 2), 2.0f, 0.0f);
// GlStateManager.scale(0.75f, 0.75f, 0.75f); GlStateManager.scale(0.75f, 0.75f, 0.75f);
// drawString(fontRendererObj, lbl, 0, 0, 16777215); drawString(fontRendererObj, lbl, 0, 0, 16777215);
// GlStateManager.popMatrix(); GlStateManager.popMatrix();
this.updateCheckerOverlay.drawScreen(i, j, f); this.updateCheckerOverlay.drawScreen(i, j, f);
super.drawScreen(i, j, f); super.drawScreen(i, j, f);

View File

@ -541,10 +541,14 @@ public class RenderItem implements IResourceManagerReloadListener {
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.disableDepth(); GlStateManager.disableDepth();
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
Tessellator tessellator1 = Tessellator.getInstance(); Tessellator tessellator1 = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator1.getWorldRenderer(); WorldRenderer worldRenderer = tessellator1.getWorldRenderer();
this.func_181565_a(worldRenderer, xPosition, yPosition + MathHelper.floor_float(16.0F * (1.0F - f)), 16, this.func_181565_a(worldRenderer, xPosition, yPosition + MathHelper.floor_float(16.0F * (1.0F - f)), 16,
MathHelper.ceiling_float_int(16.0F * f), 255, 255, 255, 127); MathHelper.ceiling_float_int(16.0F * f), 255, 255, 255, 127);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
GlStateManager.enableLighting(); GlStateManager.enableLighting();
GlStateManager.enableDepth(); GlStateManager.enableDepth();

View File

@ -164,7 +164,6 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
private final GameProfile gameProfile; private final GameProfile gameProfile;
private boolean hasReducedDebug = false; private boolean hasReducedDebug = false;
private ItemStack itemStackMainHand = null; private ItemStack itemStackMainHand = null;
private final CooldownTracker cooldownTracker = this.createCooldownTracker(); private final CooldownTracker cooldownTracker = this.createCooldownTracker();
@ -1237,8 +1236,8 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
i = i + EnchantmentHelper.getKnockbackModifier(this); i = i + EnchantmentHelper.getKnockbackModifier(this);
if (this.isSprinting() && flag) { if (this.isSprinting() && flag) {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.knockback", 1.0F,
// SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F); 1.0F, false);
++i; ++i;
flag1 = true; flag1 = true;
} }
@ -1313,8 +1312,9 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
} }
} }
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.sweep",
// SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); 1.0F,
1.0F, false);
this.spawnSweepParticles(); this.spawnSweepParticles();
} }
@ -1328,18 +1328,21 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
} }
if (flag2) { if (flag2) {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.crit",
// SoundEvents.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F); 1.0F,
1.0F, false);
this.onCriticalHit(targetEntity); this.onCriticalHit(targetEntity);
} }
if (!flag2 && !flag3) { if (!flag2 && !flag3) {
if (flag) { if (flag) {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, this.worldObj.playSound(this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_STRONG, this.getSoundCategory(), 1.0F, 1.0F); "entity.player.attack.strong", 1.0F,
1.0F, false);
} else { } else {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, this.worldObj.playSound(this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F); "entity.player.attack.weak", 1.0F,
1.0F, false);
} }
} }
@ -1350,12 +1353,15 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
// if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer) { // if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer) {
// EntityPlayer entityplayer = (EntityPlayer) targetEntity; // EntityPlayer entityplayer = (EntityPlayer) targetEntity;
// ItemStack itemstack2 = this.getHeldItemMainhand(); // ItemStack itemstack2 = this.getHeldItemMainhand();
// ItemStack itemstack3 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() // ItemStack itemstack3 = entityplayer.isHandActive() ?
// entityplayer.getActiveItemStack()
// : null; // : null;
// if (itemstack2 != null && itemstack3 != null && itemstack2.getItem() instanceof ItemAxe // if (itemstack2 != null && itemstack3 != null && itemstack2.getItem()
// instanceof ItemAxe
// && itemstack3.getItem() == Items.SHIELD) { // && itemstack3.getItem() == Items.SHIELD) {
// float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F; // float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) *
// 0.05F;
// if (flag1) { // if (flag1) {
// f3 += 0.75F; // f3 += 0.75F;
@ -1416,8 +1422,8 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.addExhaustion(0.3F); this.addExhaustion(0.3F);
} else { } else {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.weak", 1.0F,
// SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F); 1.0F, false);
if (flag4) { if (flag4) {
targetEntity.extinguish(); targetEntity.extinguish();

View File

@ -38,17 +38,14 @@ import net.minecraft.init.Blocks;
* *
*/ */
public class ItemAxe extends ItemTool { public class ItemAxe extends ItemTool {
private static Set<Block> EFFECTIVE_ON; private static Set<Block> EFFECTIVE_ON = Sets
.newHashSet(new Block[] { Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2,
Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder,
Blocks.wooden_button, Blocks.wooden_pressure_plate });
private static final float[] ATTACK_DAMAGES = new float[] { 6.0F, 8.0F, 8.0F, 8.0F, 6.0F }; private static final float[] ATTACK_DAMAGES = new float[] { 6.0F, 8.0F, 8.0F, 8.0F, 6.0F };
private static final float[] ATTACK_SPEEDS = new float[] { -3.2F, -3.2F, -3.1F, -3.0F, -3.0F }; private static final float[] ATTACK_SPEEDS = new float[] { -3.2F, -3.2F, -3.1F, -3.0F, -3.0F };
public static void bootstrap() { protected ItemAxe(Item.ToolMaterial material) {
EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2,
Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder, Blocks.wooden_button, Blocks.wooden_pressure_plate });
}
protected ItemAxe(Item.ToolMaterial material)
{
super(material, EFFECTIVE_ON); super(material, EFFECTIVE_ON);
this.damageVsEntity = ATTACK_DAMAGES[material.ordinal()]; this.damageVsEntity = ATTACK_DAMAGES[material.ordinal()];
this.attackSpeed = ATTACK_SPEEDS[material.ordinal()]; this.attackSpeed = ATTACK_SPEEDS[material.ordinal()];

View File

@ -56,6 +56,7 @@ public class ItemEnderPearl extends Item {
--itemstack.stackSize; --itemstack.stackSize;
} }
world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
entityplayer.getCooldownTracker().setCooldown(this, 20);
if (!world.isRemote) { if (!world.isRemote) {
world.spawnEntityInWorld(new EntityEnderPearl(world, entityplayer)); world.spawnEntityInWorld(new EntityEnderPearl(world, entityplayer));
} }

View File

@ -458,9 +458,9 @@ public final class ItemStack {
: (stackA != null && stackB != null ? stackA.isItemEqual(stackB) : false); : (stackA != null && stackB != null ? stackA.isItemEqual(stackB) : false);
} }
public static boolean areItemsEqualIgnoreDurability(@Nullable ItemStack stackA, @Nullable ItemStack stackB) public static boolean areItemsEqualIgnoreDurability(@Nullable ItemStack stackA, @Nullable ItemStack stackB) {
{ return stackA == stackB ? true
return stackA == stackB ? true : (stackA != null && stackB != null ? stackA.isItemEqualIgnoreDurability(stackB) : false); : (stackA != null && stackB != null ? stackA.isItemEqualIgnoreDurability(stackB) : false);
} }
/** /**
@ -473,8 +473,7 @@ public final class ItemStack {
return other != null && this.item == other.item && this.itemDamage == other.itemDamage; return other != null && this.item == other.item && this.itemDamage == other.itemDamage;
} }
public boolean isItemEqualIgnoreDurability(@Nullable ItemStack stack) public boolean isItemEqualIgnoreDurability(@Nullable ItemStack stack) {
{
return !this.isItemStackDamageable() ? this.isItemEqual(stack) : stack != null && this.item == stack.item; return !this.isItemStackDamageable() ? this.isItemEqual(stack) : stack != null && this.item == stack.item;
} }
@ -650,230 +649,199 @@ public final class ItemStack {
* Return a list of strings containing information about the * Return a list of strings containing information about the
* item * item
*/ */
public List<String> getTooltip(EntityPlayer playerIn, boolean advanced) public List<String> getTooltip(EntityPlayer playerIn, boolean advanced) {
{
List<String> list = Lists.<String>newArrayList(); List<String> list = Lists.<String>newArrayList();
String s = this.getDisplayName(); String s = this.getDisplayName();
if (this.hasDisplayName()) if (this.hasDisplayName()) {
{
s = EnumChatFormatting.ITALIC + s; s = EnumChatFormatting.ITALIC + s;
} }
s = s + EnumChatFormatting.RESET; s = s + EnumChatFormatting.RESET;
if (advanced) if (advanced) {
{
String s1 = ""; String s1 = "";
if (!s.isEmpty()) if (!s.isEmpty()) {
{
s = s + " ("; s = s + " (";
s1 = ")"; s1 = ")";
} }
int i = Item.getIdFromItem(this.item); int i = Item.getIdFromItem(this.item);
if (this.getHasSubtypes()) if (this.getHasSubtypes()) {
{ s = s + String.format("#%04d/%d%s",
s = s + String.format("#%04d/%d%s", new Object[] {Integer.valueOf(i), Integer.valueOf(this.itemDamage), s1}); new Object[] { Integer.valueOf(i), Integer.valueOf(this.itemDamage), s1 });
} } else {
else
{
s = s + String.format("#%04d%s", new Object[] { Integer.valueOf(i), s1 }); s = s + String.format("#%04d%s", new Object[] { Integer.valueOf(i), s1 });
} }
} } else if (!this.hasDisplayName() && this.item == Items.filled_map) {
else if (!this.hasDisplayName() && this.item == Items.filled_map)
{
s = s + " #" + this.itemDamage; s = s + " #" + this.itemDamage;
} }
list.add(s); list.add(s);
int i1 = 0; int i1 = 0;
if (this.hasTagCompound() && this.stackTagCompound.hasKey("HideFlags", 99)) if (this.hasTagCompound() && this.stackTagCompound.hasKey("HideFlags", 99)) {
{
i1 = this.stackTagCompound.getInteger("HideFlags"); i1 = this.stackTagCompound.getInteger("HideFlags");
} }
if ((i1 & 32) == 0) if ((i1 & 32) == 0) {
{
this.item.addInformation(this, playerIn, list, advanced); this.item.addInformation(this, playerIn, list, advanced);
} }
if (this.hasTagCompound()) if (this.hasTagCompound()) {
{ if ((i1 & 1) == 0) {
if ((i1 & 1) == 0)
{
NBTTagList nbttaglist = this.getEnchantmentTagList(); NBTTagList nbttaglist = this.getEnchantmentTagList();
if (nbttaglist != null) if (nbttaglist != null) {
{ for (int j = 0; j < nbttaglist.tagCount(); ++j) {
for (int j = 0; j < nbttaglist.tagCount(); ++j)
{
int k = nbttaglist.getCompoundTagAt(j).getShort("id"); int k = nbttaglist.getCompoundTagAt(j).getShort("id");
int l = nbttaglist.getCompoundTagAt(j).getShort("lvl"); int l = nbttaglist.getCompoundTagAt(j).getShort("lvl");
if (Enchantment.getEnchantmentById(k) != null) if (Enchantment.getEnchantmentById(k) != null) {
{
list.add(Enchantment.getEnchantmentById(k).getTranslatedName(l)); list.add(Enchantment.getEnchantmentById(k).getTranslatedName(l));
} }
} }
} }
} }
if (this.stackTagCompound.hasKey("display", 10)) if (this.stackTagCompound.hasKey("display", 10)) {
{
NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
if (nbttagcompound.hasKey("color", 3)) if (nbttagcompound.hasKey("color", 3)) {
{ if (advanced) {
if (advanced) list.add("Color: #" + String.format("%06X",
{ new Object[] { Integer.valueOf(nbttagcompound.getInteger("color")) }));
list.add("Color: #" + String.format("%06X", new Object[] {Integer.valueOf(nbttagcompound.getInteger("color"))})); } else {
}
else
{
list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed")); list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed"));
} }
} }
if (nbttagcompound.getTagId("Lore") == 9) if (nbttagcompound.getTagId("Lore") == 9) {
{
NBTTagList nbttaglist3 = nbttagcompound.getTagList("Lore", 8); NBTTagList nbttaglist3 = nbttagcompound.getTagList("Lore", 8);
if (!nbttaglist3.hasNoTags()) if (!nbttaglist3.hasNoTags()) {
{ for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1) {
for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1) list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC
{ + nbttaglist3.getStringTagAt(l1));
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + nbttaglist3.getStringTagAt(l1));
} }
} }
} }
} }
} }
// for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values()) for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values()) {
// { Multimap<String, AttributeModifier> multimap = this.getAttributeModifiers(entityequipmentslot.getIndex());
// Multimap<String, AttributeModifier> multimap = this.getAttributeModifiers(entityequipmentslot.getIndex()); boolean isArmor = this.getItem() instanceof ItemArmor;
boolean isSword = this.getItem() instanceof ItemSword;
if (!multimap.isEmpty() && (i1 & 2) == 0) {
if (isArmor) {
list.add("");
list.add(StatCollector.translateToLocal("item.modifiers." + entityequipmentslot.getName()));
} else if (isSword) {
list.add("");
list.add(StatCollector.translateToLocal("item.modifiers.mainhand"));
}
// if (!multimap.isEmpty() && (i1 & 2) == 0) for (Entry<String, AttributeModifier> entry : multimap.entries()) {
// { AttributeModifier attributemodifier = (AttributeModifier) entry.getValue();
// list.add(""); double d0 = attributemodifier.getAmount();
// list.add(StatCollector.translateToLocal("item.modifiers." + entityequipmentslot.getName())); boolean flag = false;
// for (Entry<String, AttributeModifier> entry : multimap.entries()) if (attributemodifier.getID() == Item.ATTACK_DAMAGE_MODIFIER) {
// { d0 = d0 + playerIn.getEntityAttribute(SharedMonsterAttributes.attackDamage).getBaseValue();
// AttributeModifier attributemodifier = (AttributeModifier)entry.getValue(); d0 = d0 + (double) EnchantmentHelper.func_152377_a(this, EnumCreatureAttribute.UNDEFINED);
// double d0 = attributemodifier.getAmount(); flag = true;
// boolean flag = false; } else if (attributemodifier.getID() == Item.ATTACK_SPEED_MODIFIER) {
d0 += playerIn.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue();
flag = true;
}
// if (attributemodifier.getID() == Item.ATTACK_DAMAGE_MODIFIER) double d1;
// {
// d0 = d0 + playerIn.getEntityAttribute(SharedMonsterAttributes.attackDamage).getBaseValue();
// d0 = d0 + (double)EnchantmentHelper.func_152377_a(this, EnumCreatureAttribute.UNDEFINED);
// flag = true;
// }
// else if (attributemodifier.getID() == Item.ATTACK_SPEED_MODIFIER)
// {
// d0 += playerIn.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue();
// flag = true;
// }
// double d1; if (attributemodifier.getOperation() != 1 && attributemodifier.getOperation() != 2) {
d1 = d0;
} else {
d1 = d0 * 100.0D;
}
// if (attributemodifier.getOperation() != 1 && attributemodifier.getOperation() != 2) if (flag) {
// { list.add(" " + StatCollector.translateToLocalFormatted(
// d1 = d0; "attribute.modifier.equals." + attributemodifier.getOperation(),
// } new Object[] { DECIMALFORMAT.format(d1),
// else StatCollector.translateToLocal("attribute.name." + (String) entry.getKey()) }));
// { } else if (d0 > 0.0D) {
// d1 = d0 * 100.0D; list.add(EnumChatFormatting.BLUE + " " + StatCollector.translateToLocalFormatted(
// } "attribute.modifier.plus." + attributemodifier.getOperation(),
new Object[] { DECIMALFORMAT.format(d1),
StatCollector.translateToLocal("attribute.name." + (String) entry.getKey()) }));
} else if (d0 < 0.0D) {
d1 = d1 * -1.0D;
list.add(EnumChatFormatting.RED + " " + StatCollector.translateToLocalFormatted(
"attribute.modifier.take." + attributemodifier.getOperation(),
new Object[] { DECIMALFORMAT.format(d1),
StatCollector.translateToLocal("attribute.name." + (String) entry.getKey()) }));
}
}
}
// if (flag) if (!isArmor) {
// { break;
// list.add(" " + StatCollector.translateToLocalFormatted("attribute.modifier.equals." + attributemodifier.getOperation(), new Object[] {DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry.getKey())})); }
// } }
// else if (d0 > 0.0D)
// {
// list.add(EnumChatFormatting.BLUE + " " + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier.getOperation(), new Object[] {DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry.getKey())}));
// }
// else if (d0 < 0.0D)
// {
// d1 = d1 * -1.0D;
// list.add(EnumChatFormatting.RED + " " + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier.getOperation(), new Object[] {DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry.getKey())}));
// }
// }
// }
// }
if (this.hasTagCompound() && this.getTagCompound().getBoolean("Unbreakable") && (i1 & 4) == 0) if (this.hasTagCompound() && this.getTagCompound().getBoolean("Unbreakable") && (i1 & 4) == 0) {
{
list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("item.unbreakable")); list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("item.unbreakable"));
} }
if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9) && (i1 & 8) == 0) if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9) && (i1 & 8) == 0) {
{
NBTTagList nbttaglist1 = this.stackTagCompound.getTagList("CanDestroy", 8); NBTTagList nbttaglist1 = this.stackTagCompound.getTagList("CanDestroy", 8);
if (!nbttaglist1.hasNoTags()) if (!nbttaglist1.hasNoTags()) {
{
list.add(""); list.add("");
list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item.canBreak")); list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item.canBreak"));
for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) {
{
Block block = Block.getBlockFromName(nbttaglist1.getStringTagAt(j1)); Block block = Block.getBlockFromName(nbttaglist1.getStringTagAt(j1));
if (block != null) if (block != null) {
{
list.add(EnumChatFormatting.DARK_GRAY + block.getLocalizedName()); list.add(EnumChatFormatting.DARK_GRAY + block.getLocalizedName());
} } else {
else
{
list.add(EnumChatFormatting.DARK_GRAY + "missingno"); list.add(EnumChatFormatting.DARK_GRAY + "missingno");
} }
} }
} }
} }
if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9) && (i1 & 16) == 0) if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9) && (i1 & 16) == 0) {
{
NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanPlaceOn", 8); NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanPlaceOn", 8);
if (!nbttaglist2.hasNoTags()) if (!nbttaglist2.hasNoTags()) {
{
list.add(""); list.add("");
list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item.canPlace")); list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item.canPlace"));
for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1) for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1) {
{
Block block1 = Block.getBlockFromName(nbttaglist2.getStringTagAt(k1)); Block block1 = Block.getBlockFromName(nbttaglist2.getStringTagAt(k1));
if (block1 != null) if (block1 != null) {
{
list.add(EnumChatFormatting.DARK_GRAY + block1.getLocalizedName()); list.add(EnumChatFormatting.DARK_GRAY + block1.getLocalizedName());
} } else {
else
{
list.add(EnumChatFormatting.DARK_GRAY + "missingno"); list.add(EnumChatFormatting.DARK_GRAY + "missingno");
} }
} }
} }
} }
if (advanced) if (advanced) {
{ if (this.isItemDamaged()) {
if (this.isItemDamaged())
{
list.add("Durability: " + (this.getMaxDamage() - this.getItemDamage()) + " / " + this.getMaxDamage()); list.add("Durability: " + (this.getMaxDamage() - this.getItemDamage()) + " / " + this.getMaxDamage());
} }
list.add(EnumChatFormatting.DARK_GRAY + ((ResourceLocation)Item.itemRegistry.getNameForObject(this.item)).toString()); list.add(EnumChatFormatting.DARK_GRAY
+ ((ResourceLocation) Item.itemRegistry.getNameForObject(this.item)).toString());
if (this.hasTagCompound()) if (this.hasTagCompound()) {
{
list.add(EnumChatFormatting.DARK_GRAY + "NBT: " + this.getTagCompound().getKeySet().size() + " tag(s)"); list.add(EnumChatFormatting.DARK_GRAY + "NBT: " + this.getTagCompound().getKeySet().size() + " tag(s)");
} }
} }

View File

@ -8,46 +8,36 @@ import com.google.common.collect.Maps;
import net.minecraft.item.Item; import net.minecraft.item.Item;
public class CooldownTracker public class CooldownTracker {
{
private final Map<Item, CooldownTracker.Cooldown> cooldowns = Maps.<Item, CooldownTracker.Cooldown>newHashMap(); private final Map<Item, CooldownTracker.Cooldown> cooldowns = Maps.<Item, CooldownTracker.Cooldown>newHashMap();
private int ticks; private int ticks;
public boolean hasCooldown(Item itemIn) public boolean hasCooldown(Item itemIn) {
{
return this.getCooldown(itemIn, 0.0F) > 0.0F; return this.getCooldown(itemIn, 0.0F) > 0.0F;
} }
public float getCooldown(Item itemIn, float partialTicks) public float getCooldown(Item itemIn, float partialTicks) {
{
CooldownTracker.Cooldown cooldowntracker$cooldown = (CooldownTracker.Cooldown) this.cooldowns.get(itemIn); CooldownTracker.Cooldown cooldowntracker$cooldown = (CooldownTracker.Cooldown) this.cooldowns.get(itemIn);
if (cooldowntracker$cooldown != null) if (cooldowntracker$cooldown != null) {
{
float f = (float) (cooldowntracker$cooldown.expireTicks - cooldowntracker$cooldown.createTicks); float f = (float) (cooldowntracker$cooldown.expireTicks - cooldowntracker$cooldown.createTicks);
float f1 = (float) cooldowntracker$cooldown.expireTicks - ((float) this.ticks + partialTicks); float f1 = (float) cooldowntracker$cooldown.expireTicks - ((float) this.ticks + partialTicks);
return MathHelper.clamp_float(f1 / f, 0.0F, 1.0F); return MathHelper.clamp_float(f1 / f, 0.0F, 1.0F);
} } else {
else
{
return 0.0F; return 0.0F;
} }
} }
public void tick() public void tick() {
{
++this.ticks; ++this.ticks;
if (!this.cooldowns.isEmpty()) if (!this.cooldowns.isEmpty()) {
{
Iterator<Entry<Item, CooldownTracker.Cooldown>> iterator = this.cooldowns.entrySet().iterator(); Iterator<Entry<Item, CooldownTracker.Cooldown>> iterator = this.cooldowns.entrySet().iterator();
while (iterator.hasNext()) while (iterator.hasNext()) {
{
Entry<Item, CooldownTracker.Cooldown> entry = (Entry) iterator.next(); Entry<Item, CooldownTracker.Cooldown> entry = (Entry) iterator.next();
if (((CooldownTracker.Cooldown)entry.getValue()).expireTicks <= this.ticks) if (((CooldownTracker.Cooldown) entry.getValue()).expireTicks <= this.ticks) {
{
iterator.remove(); iterator.remove();
this.notifyOnRemove((Item) entry.getKey()); this.notifyOnRemove((Item) entry.getKey());
} }
@ -55,33 +45,27 @@ public class CooldownTracker
} }
} }
public void setCooldown(Item itemIn, int ticksIn) public void setCooldown(Item itemIn, int ticksIn) {
{
this.cooldowns.put(itemIn, new CooldownTracker.Cooldown(this.ticks, this.ticks + ticksIn)); this.cooldowns.put(itemIn, new CooldownTracker.Cooldown(this.ticks, this.ticks + ticksIn));
this.notifyOnSet(itemIn, ticksIn); this.notifyOnSet(itemIn, ticksIn);
} }
public void removeCooldown(Item itemIn) public void removeCooldown(Item itemIn) {
{
this.cooldowns.remove(itemIn); this.cooldowns.remove(itemIn);
this.notifyOnRemove(itemIn); this.notifyOnRemove(itemIn);
} }
protected void notifyOnSet(Item itemIn, int ticksIn) protected void notifyOnSet(Item itemIn, int ticksIn) {
{
} }
protected void notifyOnRemove(Item itemIn) protected void notifyOnRemove(Item itemIn) {
{
} }
class Cooldown class Cooldown {
{
final int createTicks; final int createTicks;
final int expireTicks; final int expireTicks;
private Cooldown(int createTicksIn, int expireTicksIn) private Cooldown(int createTicksIn, int expireTicksIn) {
{
this.createTicks = createTicksIn; this.createTicks = createTicksIn;
this.expireTicks = expireTicksIn; this.expireTicks = expireTicksIn;
} }

View File

@ -287,7 +287,7 @@ public class PlatformApplication {
newWin.focus(); newWin.focus();
documentWrite(newWin.getDocument(), "<!DOCTYPE html><html><head><meta charset=\"UTF-8\" />" documentWrite(newWin.getDocument(), "<!DOCTYPE html><html><head><meta charset=\"UTF-8\" />"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /><title>EaglercraftX 1.8 Credits</title>" + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /><title>EaglercraftL 1.9 Credits</title>"
+ "<link type=\"image/png\" rel=\"shortcut icon\" href=\"" + PlatformApplication.faviconURLTeaVM() + "<link type=\"image/png\" rel=\"shortcut icon\" href=\"" + PlatformApplication.faviconURLTeaVM()
+ "\" />" + "\" />"
+ "</head><body><pre style=\"font:15px Consolas,monospace;\">" + text + "</pre></body></html>"); + "</head><body><pre style=\"font:15px Consolas,monospace;\">" + text + "</pre></body></html>");