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/EaglercraftL_1.9_Offline_en_US.html
javascript/EaglercraftL_1.9_Offline_International.html
javascript/EaglercraftL_1.9_Offline_Signed_Client.html
javascript/*.dat
javascript/*.cert
javascript/classes.js.map
resources/hashes/*
resources/optimizedResources/*

View File

@ -1,4 +1,4 @@
@echo off
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

View File

@ -23,7 +23,7 @@ dependencies {
}
teavm.js {
obfuscated = false
obfuscated = true
sourceMap = true
targetFileName = "../classes.js"
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>
<meta charset="UTF-8" />
<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" />
<title>EaglercraftX 1.8</title>
<title>EaglercraftL 1.9</title>
<meta property="og:locale" content="en-US" />
<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" />
<script type="text/javascript">
"use strict";

View File

@ -3,12 +3,12 @@
<head>
<meta charset="UTF-8" />
<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" />
<title>EaglercraftX 1.8</title>
<title>EaglercraftL 1.9</title>
<meta property="og:locale" content="en-US" />
<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" />
<script type="text/javascript">
"use strict";

View File

@ -6,3 +6,16 @@
# url: url here
# ipfs: cid here
# 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>
<meta charset="UTF-8" />
<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" />
<title>EaglercraftX 1.8</title>
<title>EaglercraftL 1.9</title>
<meta property="og:locale" content="en-US" />
<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" />
<script type="text/javascript">
"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.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.pauseMenu1=Relay URL:
@ -610,8 +610,8 @@ eaglercraft.update.signatureInvalid=Signature Invalid!
eaglercraft.updateList.title=Versions Available
eaglercraft.updateList.download=Download
eaglercraft.updateList.refresh=Refresh
eaglercraft.updateList.note.0=Note: Updates are digitally signed, EaglercraftX will block any
eaglercraft.updateList.note.1=updates that were not created by lax1dude or ayunami2000
eaglercraft.updateList.note.0=Note: Updates are digitally signed, EaglercraftL will block any
eaglercraft.updateList.note.1=updates that were not created by HoosierTransfer
eaglercraft.voice.title=Voice Channel
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
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.1=+%d%% %s
attribute.modifier.plus.2=+%d%% %s
attribute.modifier.take.0=-%d %s
attribute.modifier.take.1=-%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.zombie.spawnReinforcements=Zombie Reinforcements
@ -2446,6 +2456,10 @@ attribute.name.generic.followRange=Mob Follow Range
attribute.name.generic.knockbackResistance=Knockback Resistance
attribute.name.generic.movementSpeed=Speed
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.failure=Couldn't save screenshot: %s

View File

@ -1430,6 +1430,55 @@
"mob/zombiepig/zpighurt1",
"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": {
"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.function.Consumer;
import net.hoosiertransfer.EaglerLUpdateThread;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformANGLE;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformAgent;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformOS;
@ -78,6 +79,8 @@ public class EagRuntime {
UpdateService.initialize();
EaglerXBungeeVersion.initialize();
EaglercraftGPU.warmUpCache();
List<String> urls = EaglercraftVersion.enableUpdateService ? EaglercraftVersion.updateURLs : null;
EaglerLUpdateThread.startClientUpdate(urls);
}
public static void destroy() {

View File

@ -1,6 +1,7 @@
package net.lax1dude.eaglercraft.v1_8;
import java.math.BigInteger;
import java.util.List;
public class EaglercraftVersion {
@ -27,8 +28,13 @@ public class EaglercraftVersion {
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 int updateBundlePackageVersionInt = 35;
public static final int updateBundlePackageVersionInt = 1;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;

View File

@ -129,7 +129,7 @@ public class IntegratedServerPlayerNetworkManager {
DataOutputStream kickDAO = new DataOutputStream(kickPacketBAO);
kickDAO.write(0);
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(msg.length());
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);
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;
@ -166,6 +167,7 @@ public class UpdateCertificate {
}
if (System.currentTimeMillis() < cert.sigTimestamp) {
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 {
private static final Logger logger = LogManager.getLogger("UpdateService");
protected static final Logger logger = LogManager.getLogger("UpdateService");
private static UpdateCertificate myUpdateCert = null;
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.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import net.lax1dude.eaglercraft.v1_8.crypto.MD5Digest;
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.Logger;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
@ -712,22 +714,21 @@ public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback {
GlStateManager.popMatrix();
}
// HoosierTransfer mod
// String lbl = "CREDITS.txt";
// int w = fontRendererObj.getStringWidth(lbl) * 3 / 4;
String lbl = "CREDITS.txt";
int w = fontRendererObj.getStringWidth(lbl) * 3 / 4;
// if (i >= (this.width - w - 4) && i <= this.width && j >= 0 && j <= 9) {
// Mouse.showCursor(EnumCursorType.HAND);
// drawRect((this.width - w - 4), 0, this.width, 10, 0x55000099);
// } else {
// drawRect((this.width - w - 4), 0, this.width, 10, 0x55200000);
// }
if (i >= (this.width - w - 4) && i <= this.width && j >= 0 && j <= 9) {
Mouse.showCursor(EnumCursorType.HAND);
drawRect((this.width - w - 4), 0, this.width, 10, 0x55000099);
} else {
drawRect((this.width - w - 4), 0, this.width, 10, 0x55200000);
}
// GlStateManager.pushMatrix();
// GlStateManager.translate((this.width - w - 2), 2.0f, 0.0f);
// GlStateManager.scale(0.75f, 0.75f, 0.75f);
// drawString(fontRendererObj, lbl, 0, 0, 16777215);
// GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate((this.width - w - 2), 2.0f, 0.0f);
GlStateManager.scale(0.75f, 0.75f, 0.75f);
drawString(fontRendererObj, lbl, 0, 0, 16777215);
GlStateManager.popMatrix();
this.updateCheckerOverlay.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;
float f = entityplayersp == null ? 0.0F
: entityplayersp.getCooldownTracker().getCooldown(stack.getItem(),
Minecraft.getMinecraft().getRenderPartialTicks());
float f = entityplayersp == null ? 0.0F
: entityplayersp.getCooldownTracker().getCooldown(stack.getItem(),
Minecraft.getMinecraft().getRenderPartialTicks());
if (f > 0.0F) {
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
Tessellator tessellator1 = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator1.getWorldRenderer();
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);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
Tessellator tessellator1 = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator1.getWorldRenderer();
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);
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 boolean hasReducedDebug = false;
private ItemStack itemStackMainHand = null;
private final CooldownTracker cooldownTracker = this.createCooldownTracker();
public EntityFishHook fishEntity;
protected CooldownTracker createCooldownTracker() {
return new CooldownTracker();
}
return new CooldownTracker();
}
public EntityPlayer(World worldIn, GameProfile gameProfileIn) {
super(worldIn);
@ -191,7 +190,7 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
super.applyEntityAttributes();
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.10000000149011612D);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_SPEED);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_SPEED);
}
protected void entityInit() {
@ -369,17 +368,17 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.setPosition(d3, this.posY, d4);
}
++this.ticksSinceLastSwing;
ItemStack itemstack = this.getHeldItem();
++this.ticksSinceLastSwing;
ItemStack itemstack = this.getHeldItem();
if (!ItemStack.areItemStacksEqual(this.itemStackMainHand, itemstack)) {
if (!ItemStack.areItemsEqualIgnoreDurability(this.itemStackMainHand, itemstack)) {
this.resetCooldown();
}
if (!ItemStack.areItemsEqualIgnoreDurability(this.itemStackMainHand, itemstack)) {
this.resetCooldown();
}
this.itemStackMainHand = itemstack == null ? null : itemstack.copy();
}
this.itemStackMainHand = itemstack == null ? null : itemstack.copy();
}
this.cooldownTracker.tick();
this.updateSize();
@ -1186,22 +1185,22 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
}
public float getCooledAttackStrength(float adjustTicks) {
return MathHelper.clamp_float(((float) this.ticksSinceLastSwing + adjustTicks) / this.getCooldownPeriod(), 0.0F,
1.0F);
}
return MathHelper.clamp_float(((float) this.ticksSinceLastSwing + adjustTicks) / this.getCooldownPeriod(), 0.0F,
1.0F);
}
public float getCooldownPeriod() {
return (float) (1.0D / this.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getAttributeValue()
* 20.0D);
}
return (float) (1.0D / this.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getAttributeValue()
* 20.0D);
}
public void resetCooldown() {
this.ticksSinceLastSwing = 0;
}
this.ticksSinceLastSwing = 0;
}
public CooldownTracker getCooldownTracker() {
return this.cooldownTracker;
}
public CooldownTracker getCooldownTracker() {
return this.cooldownTracker;
}
/**
* +
@ -1210,223 +1209,230 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
* Args: targetEntity
*/
public void attackTargetEntityWithCurrentItem(Entity targetEntity) {
if (targetEntity.canAttackWithItem()) {
if (!targetEntity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
float f1 = 0.0F;
if (targetEntity.canAttackWithItem()) {
if (!targetEntity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
float f1 = 0.0F;
if (targetEntity instanceof EntityLivingBase) {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
((EntityLivingBase) targetEntity).getCreatureAttribute());
} else {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
EnumCreatureAttribute.UNDEFINED);
}
if (targetEntity instanceof EntityLivingBase) {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
((EntityLivingBase) targetEntity).getCreatureAttribute());
} else {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
EnumCreatureAttribute.UNDEFINED);
}
float f2 = this.getCooledAttackStrength(0.5F);
f = f * (0.2F + f2 * f2 * 0.8F);
f1 = f1 * f2;
this.resetCooldown();
float f2 = this.getCooledAttackStrength(0.5F);
f = f * (0.2F + f2 * f2 * 0.8F);
f1 = f1 * f2;
this.resetCooldown();
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
boolean flag2 = false;
boolean flag3 = false;
int i = 0;
i = i + EnchantmentHelper.getKnockbackModifier(this);
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
boolean flag2 = false;
boolean flag3 = false;
int i = 0;
i = i + EnchantmentHelper.getKnockbackModifier(this);
if (this.isSprinting() && flag) {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F);
++i;
flag1 = true;
}
if (this.isSprinting() && flag) {
this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.knockback", 1.0F,
1.0F, false);
++i;
flag1 = true;
}
flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder()
&& !this.isInWater() && !this.isPotionActive(Potion.blindness) && !this.isRiding()
&& targetEntity instanceof EntityLivingBase;
flag2 = flag2 && !this.isSprinting();
flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder()
&& !this.isInWater() && !this.isPotionActive(Potion.blindness) && !this.isRiding()
&& targetEntity instanceof EntityLivingBase;
flag2 = flag2 && !this.isSprinting();
if (flag2) {
f *= 1.5F;
if (flag2) {
f *= 1.5F;
}
f = f + f1;
double d0 = (double) (this.distanceWalkedModified - this.prevDistanceWalkedModified);
}
f = f + f1;
double d0 = (double) (this.distanceWalkedModified - this.prevDistanceWalkedModified);
if (flag && !flag2 && !flag1 && this.onGround && d0 < (double) this.getAIMoveSpeed()) {
ItemStack itemstack = this.getHeldItem();
if (flag && !flag2 && !flag1 && this.onGround && d0 < (double) this.getAIMoveSpeed()) {
ItemStack itemstack = this.getHeldItem();
if (itemstack != null && itemstack.getItem() instanceof ItemSword) {
flag3 = true;
}
}
if (itemstack != null && itemstack.getItem() instanceof ItemSword) {
flag3 = true;
}
}
float f4 = 0.0F;
boolean flag4 = false;
int j = EnchantmentHelper.getFireAspectModifier(this);
float f4 = 0.0F;
boolean flag4 = false;
int j = EnchantmentHelper.getFireAspectModifier(this);
if (targetEntity instanceof EntityLivingBase) {
f4 = ((EntityLivingBase) targetEntity).getHealth();
if (targetEntity instanceof EntityLivingBase) {
f4 = ((EntityLivingBase) targetEntity).getHealth();
if (j > 0 && !targetEntity.isBurning()) {
flag4 = true;
targetEntity.setFire(1);
}
}
if (j > 0 && !targetEntity.isBurning()) {
flag4 = true;
targetEntity.setFire(1);
}
}
double d1 = targetEntity.motionX;
double d2 = targetEntity.motionY;
double d3 = targetEntity.motionZ;
boolean flag5 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f);
double d1 = targetEntity.motionX;
double d2 = targetEntity.motionY;
double d3 = targetEntity.motionZ;
boolean flag5 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f);
if (flag5) {
if (i > 0) {
if (targetEntity instanceof EntityLivingBase) {
((EntityLivingBase) targetEntity).knockBack(this, (float) i * 0.5F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
} else {
targetEntity.addVelocity(
(double) (-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float) i * 0.5F),
0.1D,
(double) (MathHelper.cos(this.rotationYaw * 0.017453292F) * (float) i * 0.5F));
}
if (flag5) {
if (i > 0) {
if (targetEntity instanceof EntityLivingBase) {
((EntityLivingBase) targetEntity).knockBack(this, (float) i * 0.5F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
} else {
targetEntity.addVelocity(
(double) (-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float) i * 0.5F),
0.1D,
(double) (MathHelper.cos(this.rotationYaw * 0.017453292F) * (float) i * 0.5F));
}
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
this.setSprinting(false);
}
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
this.setSprinting(false);
}
if (flag3) {
for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(
EntityLivingBase.class,
targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) {
if (entitylivingbase != this && entitylivingbase != targetEntity
&& !this.isOnSameTeam(entitylivingbase)
&& this.getDistanceSqToEntity(entitylivingbase) < 9.0D) {
entitylivingbase.knockBack(this, 0.4F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F);
}
}
if (flag3) {
for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(
EntityLivingBase.class,
targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) {
if (entitylivingbase != this && entitylivingbase != targetEntity
&& !this.isOnSameTeam(entitylivingbase)
&& this.getDistanceSqToEntity(entitylivingbase) < 9.0D) {
entitylivingbase.knockBack(this, 0.4F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F);
}
}
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F);
this.spawnSweepParticles();
}
this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.sweep",
1.0F,
1.0F, false);
this.spawnSweepParticles();
}
if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) {
((EntityPlayerMP) targetEntity).playerNetServerHandler
.sendPacket(new S12PacketEntityVelocity(targetEntity));
targetEntity.velocityChanged = false;
targetEntity.motionX = d1;
targetEntity.motionY = d2;
targetEntity.motionZ = d3;
}
if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) {
((EntityPlayerMP) targetEntity).playerNetServerHandler
.sendPacket(new S12PacketEntityVelocity(targetEntity));
targetEntity.velocityChanged = false;
targetEntity.motionX = d1;
targetEntity.motionY = d2;
targetEntity.motionZ = d3;
}
if (flag2) {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F);
this.onCriticalHit(targetEntity);
}
if (flag2) {
this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.crit",
1.0F,
1.0F, false);
this.onCriticalHit(targetEntity);
}
if (!flag2 && !flag3) {
if (flag) {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_STRONG, this.getSoundCategory(), 1.0F, 1.0F);
} else {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F);
}
}
if (!flag2 && !flag3) {
if (flag) {
this.worldObj.playSound(this.posX, this.posY, this.posZ,
"entity.player.attack.strong", 1.0F,
1.0F, false);
} else {
this.worldObj.playSound(this.posX, this.posY, this.posZ,
"entity.player.attack.weak", 1.0F,
1.0F, false);
}
}
if (f1 > 0.0F) {
this.onEnchantmentCritical(targetEntity);
}
if (f1 > 0.0F) {
this.onEnchantmentCritical(targetEntity);
}
// TODO: implement shield
// if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer) {
// EntityPlayer entityplayer = (EntityPlayer) targetEntity;
// ItemStack itemstack2 = this.getHeldItemMainhand();
// ItemStack itemstack3 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack()
// : null;
// if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer) {
// EntityPlayer entityplayer = (EntityPlayer) targetEntity;
// ItemStack itemstack2 = this.getHeldItemMainhand();
// ItemStack itemstack3 = entityplayer.isHandActive() ?
// entityplayer.getActiveItemStack()
// : null;
// if (itemstack2 != null && itemstack3 != null && itemstack2.getItem() instanceof ItemAxe
// && itemstack3.getItem() == Items.SHIELD) {
// float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
// if (itemstack2 != null && itemstack3 != null && itemstack2.getItem()
// instanceof ItemAxe
// && itemstack3.getItem() == Items.SHIELD) {
// float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) *
// 0.05F;
// if (flag1) {
// f3 += 0.75F;
// }
// if (flag1) {
// f3 += 0.75F;
// }
// if (this.rand.nextFloat() < f3) {
// entityplayer.getCooldownTracker().setCooldown(Items.SHIsELD, 100);
// this.worldObj.setEntityState(entityplayer, (byte) 30);
// }
// }
// }
// if (this.rand.nextFloat() < f3) {
// entityplayer.getCooldownTracker().setCooldown(Items.SHIsELD, 100);
// this.worldObj.setEntityState(entityplayer, (byte) 30);
// }
// }
// }
if (f >= 18.0F) {
this.triggerAchievement(AchievementList.overkill);
}
if (f >= 18.0F) {
this.triggerAchievement(AchievementList.overkill);
}
this.setLastAttacker(targetEntity);
this.setLastAttacker(targetEntity);
if (targetEntity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) targetEntity, this);
}
if (targetEntity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) targetEntity, this);
}
EnchantmentHelper.applyArthropodEnchantments(this, targetEntity);
ItemStack itemstack1 = this.getHeldItem();
Entity entity = targetEntity;
EnchantmentHelper.applyArthropodEnchantments(this, targetEntity);
ItemStack itemstack1 = this.getHeldItem();
Entity entity = targetEntity;
if (targetEntity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) targetEntity).entityDragonObj;
if (targetEntity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) targetEntity).entityDragonObj;
if (ientitymultipart instanceof EntityLivingBase) {
entity = (EntityLivingBase) ientitymultipart;
}
}
if (ientitymultipart instanceof EntityLivingBase) {
entity = (EntityLivingBase) ientitymultipart;
}
}
if (itemstack1 != null && entity instanceof EntityLivingBase) {
itemstack1.hitEntity((EntityLivingBase) entity, this);
if (itemstack1 != null && entity instanceof EntityLivingBase) {
itemstack1.hitEntity((EntityLivingBase) entity, this);
if (itemstack1.stackSize <= 0) {
this.setHeldItem((ItemStack) null);
}
}
if (itemstack1.stackSize <= 0) {
this.setHeldItem((ItemStack) null);
}
}
if (targetEntity instanceof EntityLivingBase) {
float f5 = f4 - ((EntityLivingBase) targetEntity).getHealth();
this.addStat(StatList.damageDealtStat, Math.round(f5 * 10.0F));
if (targetEntity instanceof EntityLivingBase) {
float f5 = f4 - ((EntityLivingBase) targetEntity).getHealth();
this.addStat(StatList.damageDealtStat, Math.round(f5 * 10.0F));
if (j > 0) {
targetEntity.setFire(j * 4);
}
if (j > 0) {
targetEntity.setFire(j * 4);
}
if (this.worldObj instanceof WorldServer && f5 > 2.0F) {
int k = (int) ((double) f5 * 0.5D);
((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR,
targetEntity.posX, targetEntity.posY + (double) (targetEntity.height * 0.5F),
targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]);
}
}
if (this.worldObj instanceof WorldServer && f5 > 2.0F) {
int k = (int) ((double) f5 * 0.5D);
((WorldServer) this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR,
targetEntity.posX, targetEntity.posY + (double) (targetEntity.height * 0.5F),
targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]);
}
}
this.addExhaustion(0.3F);
} else {
// this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F);
this.addExhaustion(0.3F);
} else {
this.worldObj.playSound(this.posX, this.posY, this.posZ, "entity.player.attack.weak", 1.0F,
1.0F, false);
if (flag4) {
targetEntity.extinguish();
}
}
}
}
}
}
if (flag4) {
targetEntity.extinguish();
}
}
}
}
}
}
public void setHeldItem(@Nullable ItemStack stack) {
this.inventory.mainInventory[this.inventory.currentItem] = stack;
@ -1444,14 +1450,14 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
}
public void spawnSweepParticles() {
double d0 = (double) (-MathHelper.sin(this.rotationYaw * 0.017453292F));
double d1 = (double) MathHelper.cos(this.rotationYaw * 0.017453292F);
double d0 = (double) (-MathHelper.sin(this.rotationYaw * 0.017453292F));
double d1 = (double) MathHelper.cos(this.rotationYaw * 0.017453292F);
if (this.worldObj instanceof WorldServer) {
((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]);
}
}
if (this.worldObj instanceof WorldServer) {
((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]);
}
}
public void respawnPlayer() {
}

View File

@ -38,22 +38,19 @@ import net.minecraft.init.Blocks;
*
*/
public class ItemAxe extends ItemTool {
private static Set<Block> EFFECTIVE_ON;
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 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_SPEEDS = new float[] { -3.2F, -3.2F, -3.1F, -3.0F, -3.0F };
public static void bootstrap() {
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);
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) {
return block.getMaterial() != Material.wood && block.getMaterial() != Material.plants
&& block.getMaterial() != Material.vine ? super.getStrVsBlock(itemstack, block)

View File

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

View File

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

View File

@ -8,80 +8,64 @@ import com.google.common.collect.Maps;
import net.minecraft.item.Item;
public class CooldownTracker
{
public class CooldownTracker {
private final Map<Item, CooldownTracker.Cooldown> cooldowns = Maps.<Item, CooldownTracker.Cooldown>newHashMap();
private int ticks;
public boolean hasCooldown(Item itemIn)
{
public boolean hasCooldown(Item itemIn) {
return this.getCooldown(itemIn, 0.0F) > 0.0F;
}
public float getCooldown(Item itemIn, float partialTicks)
{
CooldownTracker.Cooldown cooldowntracker$cooldown = (CooldownTracker.Cooldown)this.cooldowns.get(itemIn);
public float getCooldown(Item itemIn, float partialTicks) {
CooldownTracker.Cooldown cooldowntracker$cooldown = (CooldownTracker.Cooldown) this.cooldowns.get(itemIn);
if (cooldowntracker$cooldown != null)
{
float f = (float)(cooldowntracker$cooldown.expireTicks - cooldowntracker$cooldown.createTicks);
float f1 = (float)cooldowntracker$cooldown.expireTicks - ((float)this.ticks + partialTicks);
if (cooldowntracker$cooldown != null) {
float f = (float) (cooldowntracker$cooldown.expireTicks - cooldowntracker$cooldown.createTicks);
float f1 = (float) cooldowntracker$cooldown.expireTicks - ((float) this.ticks + partialTicks);
return MathHelper.clamp_float(f1 / f, 0.0F, 1.0F);
}
else
{
} else {
return 0.0F;
}
}
public void tick()
{
public void tick() {
++this.ticks;
if (!this.cooldowns.isEmpty())
{
if (!this.cooldowns.isEmpty()) {
Iterator<Entry<Item, CooldownTracker.Cooldown>> iterator = this.cooldowns.entrySet().iterator();
while (iterator.hasNext())
{
Entry<Item, CooldownTracker.Cooldown> entry = (Entry)iterator.next();
while (iterator.hasNext()) {
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();
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.notifyOnSet(itemIn, ticksIn);
}
public void removeCooldown(Item itemIn)
{
public void removeCooldown(Item itemIn) {
this.cooldowns.remove(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 expireTicks;
private Cooldown(int createTicksIn, int expireTicksIn)
{
private Cooldown(int createTicksIn, int expireTicksIn) {
this.createTicks = createTicksIn;
this.expireTicks = expireTicksIn;
}

View File

@ -287,7 +287,7 @@ public class PlatformApplication {
newWin.focus();
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()
+ "\" />"
+ "</head><body><pre style=\"font:15px Consolas,monospace;\">" + text + "</pre></body></html>");