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

@ -1430,6 +1430,55 @@
"mob/zombiepig/zpighurt1", "mob/zombiepig/zpighurt1",
"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",

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

@ -534,21 +534,25 @@ public class RenderItem implements IResourceManagerReloadListener {
} }
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer; EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
float f = entityplayersp == null ? 0.0F float f = entityplayersp == null ? 0.0F
: entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(),
Minecraft.getMinecraft().getRenderPartialTicks()); Minecraft.getMinecraft().getRenderPartialTicks());
if (f > 0.0F) { if (f > 0.0F) {
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.disableDepth(); GlStateManager.disableDepth();
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
Tessellator tessellator1 = Tessellator.getInstance(); GlStateManager.enableAlpha();
WorldRenderer worldRenderer = tessellator1.getWorldRenderer(); GlStateManager.enableBlend();
this.func_181565_a(worldRenderer, xPosition, yPosition + MathHelper.floor_float(16.0F * (1.0F - f)), 16, Tessellator tessellator1 = Tessellator.getInstance();
MathHelper.ceiling_float_int(16.0F * f), 255, 255, 255, 127); WorldRenderer worldRenderer = tessellator1.getWorldRenderer();
GlStateManager.enableTexture2D(); this.func_181565_a(worldRenderer, xPosition, yPosition + MathHelper.floor_float(16.0F * (1.0F - f)), 16,
GlStateManager.enableLighting(); MathHelper.ceiling_float_int(16.0F * f), 255, 255, 255, 127);
GlStateManager.enableDepth(); GlStateManager.disableBlend();
} GlStateManager.disableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
} }
} }

View File

@ -164,15 +164,14 @@ 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();
public EntityFishHook fishEntity; public EntityFishHook fishEntity;
protected CooldownTracker createCooldownTracker() { protected CooldownTracker createCooldownTracker() {
return new CooldownTracker(); return new CooldownTracker();
} }
public EntityPlayer(World worldIn, GameProfile gameProfileIn) { public EntityPlayer(World worldIn, GameProfile gameProfileIn) {
super(worldIn); super(worldIn);
@ -191,7 +190,7 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
super.applyEntityAttributes(); super.applyEntityAttributes();
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.10000000149011612D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.10000000149011612D);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_SPEED); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_SPEED);
} }
protected void entityInit() { protected void entityInit() {
@ -369,17 +368,17 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.setPosition(d3, this.posY, d4); this.setPosition(d3, this.posY, d4);
} }
++this.ticksSinceLastSwing; ++this.ticksSinceLastSwing;
ItemStack itemstack = this.getHeldItem(); ItemStack itemstack = this.getHeldItem();
if (!ItemStack.areItemStacksEqual(this.itemStackMainHand, itemstack)) { if (!ItemStack.areItemStacksEqual(this.itemStackMainHand, itemstack)) {
if (!ItemStack.areItemsEqualIgnoreDurability(this.itemStackMainHand, itemstack)) { if (!ItemStack.areItemsEqualIgnoreDurability(this.itemStackMainHand, itemstack)) {
this.resetCooldown(); this.resetCooldown();
} }
this.itemStackMainHand = itemstack == null ? null : itemstack.copy(); this.itemStackMainHand = itemstack == null ? null : itemstack.copy();
} }
this.cooldownTracker.tick(); this.cooldownTracker.tick();
this.updateSize(); this.updateSize();
@ -1186,22 +1185,22 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
} }
public float getCooledAttackStrength(float adjustTicks) { public float getCooledAttackStrength(float adjustTicks) {
return MathHelper.clamp_float(((float) this.ticksSinceLastSwing + adjustTicks) / this.getCooldownPeriod(), 0.0F, return MathHelper.clamp_float(((float) this.ticksSinceLastSwing + adjustTicks) / this.getCooldownPeriod(), 0.0F,
1.0F); 1.0F);
} }
public float getCooldownPeriod() { public float getCooldownPeriod() {
return (float) (1.0D / this.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getAttributeValue() return (float) (1.0D / this.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getAttributeValue()
* 20.0D); * 20.0D);
} }
public void resetCooldown() { public void resetCooldown() {
this.ticksSinceLastSwing = 0; this.ticksSinceLastSwing = 0;
} }
public CooldownTracker getCooldownTracker() { public CooldownTracker getCooldownTracker() {
return this.cooldownTracker; return this.cooldownTracker;
} }
/** /**
* + * +
@ -1210,223 +1209,230 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
* Args: targetEntity * Args: targetEntity
*/ */
public void attackTargetEntityWithCurrentItem(Entity targetEntity) { public void attackTargetEntityWithCurrentItem(Entity targetEntity) {
if (targetEntity.canAttackWithItem()) { if (targetEntity.canAttackWithItem()) {
if (!targetEntity.hitByEntity(this)) { if (!targetEntity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
float f1 = 0.0F; float f1 = 0.0F;
if (targetEntity instanceof EntityLivingBase) { if (targetEntity instanceof EntityLivingBase) {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
((EntityLivingBase) targetEntity).getCreatureAttribute()); ((EntityLivingBase) targetEntity).getCreatureAttribute());
} else { } else {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
EnumCreatureAttribute.UNDEFINED); EnumCreatureAttribute.UNDEFINED);
} }
float f2 = this.getCooledAttackStrength(0.5F); float f2 = this.getCooledAttackStrength(0.5F);
f = f * (0.2F + f2 * f2 * 0.8F); f = f * (0.2F + f2 * f2 * 0.8F);
f1 = f1 * f2; f1 = f1 * f2;
this.resetCooldown(); this.resetCooldown();
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F; boolean flag = f2 > 0.9F;
boolean flag1 = false; boolean flag1 = false;
boolean flag2 = false; boolean flag2 = false;
boolean flag3 = false; boolean flag3 = false;
int i = 0; int i = 0;
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;
} }
flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder()
&& !this.isInWater() && !this.isPotionActive(Potion.blindness) && !this.isRiding() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && !this.isRiding()
&& targetEntity instanceof EntityLivingBase; && targetEntity instanceof EntityLivingBase;
flag2 = flag2 && !this.isSprinting(); flag2 = flag2 && !this.isSprinting();
if (flag2) { if (flag2) {
f *= 1.5F; f *= 1.5F;
} }
f = f + f1; f = f + f1;
double d0 = (double) (this.distanceWalkedModified - this.prevDistanceWalkedModified); double d0 = (double) (this.distanceWalkedModified - this.prevDistanceWalkedModified);
if (flag && !flag2 && !flag1 && this.onGround && d0 < (double) this.getAIMoveSpeed()) { if (flag && !flag2 && !flag1 && this.onGround && d0 < (double) this.getAIMoveSpeed()) {
ItemStack itemstack = this.getHeldItem(); ItemStack itemstack = this.getHeldItem();
if (itemstack != null && itemstack.getItem() instanceof ItemSword) { if (itemstack != null && itemstack.getItem() instanceof ItemSword) {
flag3 = true; flag3 = true;
} }
} }
float f4 = 0.0F; float f4 = 0.0F;
boolean flag4 = false; boolean flag4 = false;
int j = EnchantmentHelper.getFireAspectModifier(this); int j = EnchantmentHelper.getFireAspectModifier(this);
if (targetEntity instanceof EntityLivingBase) { if (targetEntity instanceof EntityLivingBase) {
f4 = ((EntityLivingBase) targetEntity).getHealth(); f4 = ((EntityLivingBase) targetEntity).getHealth();
if (j > 0 && !targetEntity.isBurning()) { if (j > 0 && !targetEntity.isBurning()) {
flag4 = true; flag4 = true;
targetEntity.setFire(1); targetEntity.setFire(1);
} }
} }
double d1 = targetEntity.motionX; double d1 = targetEntity.motionX;
double d2 = targetEntity.motionY; double d2 = targetEntity.motionY;
double d3 = targetEntity.motionZ; double d3 = targetEntity.motionZ;
boolean flag5 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f); boolean flag5 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f);
if (flag5) { if (flag5) {
if (i > 0) { if (i > 0) {
if (targetEntity instanceof EntityLivingBase) { if (targetEntity instanceof EntityLivingBase) {
((EntityLivingBase) targetEntity).knockBack(this, (float) i * 0.5F, ((EntityLivingBase) targetEntity).knockBack(this, (float) i * 0.5F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F))); (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
} else { } else {
targetEntity.addVelocity( targetEntity.addVelocity(
(double) (-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float) i * 0.5F), (double) (-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float) i * 0.5F),
0.1D, 0.1D,
(double) (MathHelper.cos(this.rotationYaw * 0.017453292F) * (float) i * 0.5F)); (double) (MathHelper.cos(this.rotationYaw * 0.017453292F) * (float) i * 0.5F));
} }
this.motionX *= 0.6D; this.motionX *= 0.6D;
this.motionZ *= 0.6D; this.motionZ *= 0.6D;
this.setSprinting(false); this.setSprinting(false);
} }
if (flag3) { if (flag3) {
for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB( for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(
EntityLivingBase.class, EntityLivingBase.class,
targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) { targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) {
if (entitylivingbase != this && entitylivingbase != targetEntity if (entitylivingbase != this && entitylivingbase != targetEntity
&& !this.isOnSameTeam(entitylivingbase) && !this.isOnSameTeam(entitylivingbase)
&& this.getDistanceSqToEntity(entitylivingbase) < 9.0D) { && this.getDistanceSqToEntity(entitylivingbase) < 9.0D) {
entitylivingbase.knockBack(this, 0.4F, entitylivingbase.knockBack(this, 0.4F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F))); (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F); entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F);
} }
} }
// 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,
this.spawnSweepParticles(); 1.0F, false);
} this.spawnSweepParticles();
}
if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) { if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) {
((EntityPlayerMP) targetEntity).playerNetServerHandler ((EntityPlayerMP) targetEntity).playerNetServerHandler
.sendPacket(new S12PacketEntityVelocity(targetEntity)); .sendPacket(new S12PacketEntityVelocity(targetEntity));
targetEntity.velocityChanged = false; targetEntity.velocityChanged = false;
targetEntity.motionX = d1; targetEntity.motionX = d1;
targetEntity.motionY = d2; targetEntity.motionY = d2;
targetEntity.motionZ = d3; targetEntity.motionZ = d3;
} }
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,
this.onCriticalHit(targetEntity); 1.0F, false);
} 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,
} else { 1.0F, false);
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, } else {
// SoundEvents.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F); this.worldObj.playSound(this.posX, this.posY, this.posZ,
} "entity.player.attack.weak", 1.0F,
} 1.0F, false);
}
}
if (f1 > 0.0F) { if (f1 > 0.0F) {
this.onEnchantmentCritical(targetEntity); this.onEnchantmentCritical(targetEntity);
} }
// TODO: implement shield // TODO: implement shield
// 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() ?
// : null; // entityplayer.getActiveItemStack()
// : null;
// if (itemstack2 != null && itemstack3 != null && itemstack2.getItem() instanceof ItemAxe // if (itemstack2 != null && itemstack3 != null && itemstack2.getItem()
// && itemstack3.getItem() == Items.SHIELD) { // instanceof ItemAxe
// float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F; // && itemstack3.getItem() == Items.SHIELD) {
// float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) *
// 0.05F;
// if (flag1) { // if (flag1) {
// f3 += 0.75F; // f3 += 0.75F;
// } // }
// if (this.rand.nextFloat() < f3) { // if (this.rand.nextFloat() < f3) {
// entityplayer.getCooldownTracker().setCooldown(Items.SHIsELD, 100); // entityplayer.getCooldownTracker().setCooldown(Items.SHIsELD, 100);
// this.worldObj.setEntityState(entityplayer, (byte) 30); // this.worldObj.setEntityState(entityplayer, (byte) 30);
// } // }
// } // }
// } // }
if (f >= 18.0F) { if (f >= 18.0F) {
this.triggerAchievement(AchievementList.overkill); this.triggerAchievement(AchievementList.overkill);
} }
this.setLastAttacker(targetEntity); this.setLastAttacker(targetEntity);
if (targetEntity instanceof EntityLivingBase) { if (targetEntity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) targetEntity, this); EnchantmentHelper.applyThornEnchantments((EntityLivingBase) targetEntity, this);
} }
EnchantmentHelper.applyArthropodEnchantments(this, targetEntity); EnchantmentHelper.applyArthropodEnchantments(this, targetEntity);
ItemStack itemstack1 = this.getHeldItem(); ItemStack itemstack1 = this.getHeldItem();
Entity entity = targetEntity; Entity entity = targetEntity;
if (targetEntity instanceof EntityDragonPart) { if (targetEntity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) targetEntity).entityDragonObj; IEntityMultiPart ientitymultipart = ((EntityDragonPart) targetEntity).entityDragonObj;
if (ientitymultipart instanceof EntityLivingBase) { if (ientitymultipart instanceof EntityLivingBase) {
entity = (EntityLivingBase) ientitymultipart; entity = (EntityLivingBase) ientitymultipart;
} }
} }
if (itemstack1 != null && entity instanceof EntityLivingBase) { if (itemstack1 != null && entity instanceof EntityLivingBase) {
itemstack1.hitEntity((EntityLivingBase) entity, this); itemstack1.hitEntity((EntityLivingBase) entity, this);
if (itemstack1.stackSize <= 0) { if (itemstack1.stackSize <= 0) {
this.setHeldItem((ItemStack) null); this.setHeldItem((ItemStack) null);
} }
} }
if (targetEntity instanceof EntityLivingBase) { if (targetEntity instanceof EntityLivingBase) {
float f5 = f4 - ((EntityLivingBase) targetEntity).getHealth(); float f5 = f4 - ((EntityLivingBase) targetEntity).getHealth();
this.addStat(StatList.damageDealtStat, Math.round(f5 * 10.0F)); this.addStat(StatList.damageDealtStat, Math.round(f5 * 10.0F));
if (j > 0) { if (j > 0) {
targetEntity.setFire(j * 4); targetEntity.setFire(j * 4);
} }
if (this.worldObj instanceof WorldServer && f5 > 2.0F) { if (this.worldObj instanceof WorldServer && f5 > 2.0F) {
int k = (int) ((double) f5 * 0.5D); int k = (int) ((double) f5 * 0.5D);
((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR, ((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR,
targetEntity.posX, targetEntity.posY + (double) (targetEntity.height * 0.5F), targetEntity.posX, targetEntity.posY + (double) (targetEntity.height * 0.5F),
targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]); targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]);
} }
} }
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();
} }
} }
} }
} }
} }
} }
public void setHeldItem(@Nullable ItemStack stack) { public void setHeldItem(@Nullable ItemStack stack) {
this.inventory.mainInventory[this.inventory.currentItem] = stack; this.inventory.mainInventory[this.inventory.currentItem] = stack;
@ -1444,14 +1450,14 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
} }
public void spawnSweepParticles() { public void spawnSweepParticles() {
double d0 = (double) (-MathHelper.sin(this.rotationYaw * 0.017453292F)); double d0 = (double) (-MathHelper.sin(this.rotationYaw * 0.017453292F));
double d1 = (double) MathHelper.cos(this.rotationYaw * 0.017453292F); double d1 = (double) MathHelper.cos(this.rotationYaw * 0.017453292F);
if (this.worldObj instanceof WorldServer) { if (this.worldObj instanceof WorldServer) {
((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.SWEEP_ATTACK, this.posX + d0, ((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.SWEEP_ATTACK, this.posX + d0,
this.posY + (double) this.height * 0.5D, this.posZ + d1, 0, d0, 0.0D, d1, 0.0D, new int[0]); this.posY + (double) this.height * 0.5D, this.posZ + d1, 0, d0, 0.0D, d1, 0.0D, new int[0]);
} }
} }
public void respawnPlayer() { public void respawnPlayer() {
} }

View File

@ -38,22 +38,19 @@ 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
private static final float[] ATTACK_DAMAGES = new float[] {6.0F, 8.0F, 8.0F, 8.0F, 6.0F}; .newHashSet(new Block[] { Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2,
private static final float[] ATTACK_SPEEDS = new float[] { -3.2F, -3.2F, -3.1F, -3.0F, -3.0F}; 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_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, super(material, EFFECTIVE_ON);
Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder, Blocks.wooden_button, Blocks.wooden_pressure_plate }); this.damageVsEntity = ATTACK_DAMAGES[material.ordinal()];
this.attackSpeed = ATTACK_SPEEDS[material.ordinal()];
} }
protected ItemAxe(Item.ToolMaterial material)
{
super(material, EFFECTIVE_ON);
this.damageVsEntity = ATTACK_DAMAGES[material.ordinal()];
this.attackSpeed = ATTACK_SPEEDS[material.ordinal()];
}
public float getStrVsBlock(ItemStack itemstack, Block block) { public float getStrVsBlock(ItemStack itemstack, Block block) {
return block.getMaterial() != Material.wood && block.getMaterial() != Material.plants return block.getMaterial() != Material.wood && block.getMaterial() != Material.plants
&& block.getMaterial() != Material.vine ? super.getStrVsBlock(itemstack, block) && block.getMaterial() != Material.vine ? super.getStrVsBlock(itemstack, block)

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,10 +458,10 @@ 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,10 +473,9 @@ 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; }
}
public String getUnlocalizedName() { public String getUnlocalizedName() {
return this.item.getUnlocalizedName(this); return this.item.getUnlocalizedName(this);
@ -650,236 +649,205 @@ 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) {
} s = s + " #" + this.itemDamage;
} }
else if (!this.hasDisplayName() && this.item == Items.filled_map)
{
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 l = nbttaglist.getCompoundTagAt(j).getShort("lvl");
int k = nbttaglist.getCompoundTagAt(j).getShort("id");
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 {
} list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed"));
else }
{ }
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 {
} list.add(EnumChatFormatting.DARK_GRAY + "missingno");
else }
{ }
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 {
} list.add(EnumChatFormatting.DARK_GRAY + "missingno");
else }
{ }
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)"); }
} }
}
return list; return list;
} }
public boolean hasEffect() { public boolean hasEffect() {
return this.getItem().hasEffect(this); return this.getItem().hasEffect(this);

View File

@ -8,80 +8,64 @@ 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());
} }
} }
} }
} }
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>");