stuff before entity equipment slot

This commit is contained in:
HoosierTransfer 2024-06-30 10:00:53 -04:00
parent ca5e06d9f5
commit 449dd53039
54 changed files with 1243 additions and 305 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,8 +1,9 @@
package net.hoosiertransfer; package net.hoosiertransfer;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.Arrays;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class Config { public class Config {
@ -30,6 +31,6 @@ public class Config {
} }
public static boolean renderParticles() { public static boolean renderParticles() {
return false; return true;
} }
} }

View File

@ -1,5 +1,8 @@
package net.lax1dude.eaglercraft.v1_8.opengl; package net.lax1dude.eaglercraft.v1_8.opengl;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
/** /**
* Copyright (c) 2022 lax1dude. All Rights Reserved. * Copyright (c) 2022 lax1dude. All Rights Reserved.
* *
@ -27,5 +30,23 @@ public class OpenGlHelper {
GlStateManager.setActiveTexture(defaultTexUnit); GlStateManager.setActiveTexture(defaultTexUnit);
} }
public static void renderDirections(int p_188785_0_)
{
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer vertexbuffer = tessellator.getWorldRenderer();
vertexbuffer.begin(1, DefaultVertexFormats.POSITION_COLOR);
EaglercraftGPU.glLineWidth(2.0F);
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(255, 0, 0, 255).endVertex();
vertexbuffer.pos((double)p_188785_0_, 0.0D, 0.0D).color(255, 0, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(0, 255, 0, 255).endVertex();
vertexbuffer.pos(0.0D, (double)p_188785_0_, 0.0D).color(0, 255, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(0, 0, 255, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, (double)p_188785_0_).color(0, 0, 255, 255).endVertex();
tessellator.draw();
EaglercraftGPU.glLineWidth(1.0F);
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
}
} }

View File

@ -96,13 +96,13 @@ public class BlockEndRod extends Block {
double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F); double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);
if (rand.nextInt(5) == 0) { if (rand.nextInt(5) == 0) {
// worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double) worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double)
// enumfacing.getFrontOffsetX() * d3, enumfacing.getFrontOffsetX() * d3,
// d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double) d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double)
// enumfacing.getFrontOffsetZ() * d3, enumfacing.getFrontOffsetZ() * d3,
// rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
// rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
// new int[0]); new int[0]);
} }
} }

View File

@ -1190,7 +1190,6 @@ public class Minecraft implements IThreadListener {
private void clickMouse() { private void clickMouse() {
if (this.leftClickCounter <= 0) { if (this.leftClickCounter <= 0) {
this.thePlayer.swingItem();
if (this.objectMouseOver == null) { if (this.objectMouseOver == null) {
logger.error("Null returned as \'hitResult\', this shouldn\'t happen!"); logger.error("Null returned as \'hitResult\', this shouldn\'t happen!");
if (this.playerController.isNotCreative()) { if (this.playerController.isNotCreative()) {
@ -1213,9 +1212,13 @@ public class Minecraft implements IThreadListener {
if (this.playerController.isNotCreative()) { if (this.playerController.isNotCreative()) {
this.leftClickCounter = 10; this.leftClickCounter = 10;
} }
this.thePlayer.resetCooldown();
} }
} }
this.thePlayer.swingItem();
} }
} }
@ -2370,6 +2373,11 @@ public class Minecraft implements IThreadListener {
return modelManager; return modelManager;
} }
public float getRenderPartialTicks()
{
return this.timer.renderPartialTicks;
}
/** /**
* + * +
* Returns the save loader that is currently being used * Returns the save loader that is currently being used

View File

@ -23,6 +23,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
@ -169,7 +170,10 @@ public class GuiIngame extends Gui {
this.renderTooltip(scaledresolution, partialTicks); this.renderTooltip(scaledresolution, partialTicks);
} }
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(icons); this.mc.getTextureManager().bindTexture(icons);
GlStateManager.enableBlend();
this.renderAttackIndicator(partialTicks, scaledresolution);
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
this.mc.mcProfiler.startSection("bossHealth"); this.mc.mcProfiler.startSection("bossHealth");
this.renderBossHealth(); this.renderBossHealth();
@ -328,6 +332,65 @@ public class GuiIngame extends Gui {
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
} }
private void renderAttackIndicator(float p_184045_1_, ScaledResolution p_184045_2_)
{
GameSettings gamesettings = this.mc.gameSettings;
if (gamesettings.thirdPersonView == 0)
{
if (this.mc.playerController.isSpectator() && this.mc.pointedEntity == null)
{
MovingObjectPosition raytraceresult = this.mc.objectMouseOver;
if (raytraceresult == null || raytraceresult.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
{
return;
}
BlockPos blockpos = raytraceresult.getBlockPos();
if (!this.mc.theWorld.getBlockState(blockpos).getBlock().hasTileEntity() || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory))
{
return;
}
}
int l = p_184045_2_.getScaledWidth();
int i1 = p_184045_2_.getScaledHeight();
if (gamesettings.showDebugInfo && !gamesettings.hideGUI && !this.mc.thePlayer.hasReducedDebug() && !gamesettings.reducedDebugInfo)
{
// GlStateManager.pushMatrix();
// GlStateManager.translate((float)(l / 2), (float)(i1 / 2), this.zLevel);
// Entity entity = this.mc.getRenderViewEntity();
// GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_184045_1_, -1.0F, 0.0F, 0.0F);
// GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_184045_1_, 0.0F, 1.0F, 0.0F);
// GlStateManager.scale(-1.0F, -1.0F, -1.0F);
// OpenGlHelper.renderDirections(10);
// GlStateManager.popMatrix();
}
else
{
GlStateManager.tryBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_ONE, GL_ZERO);
GlStateManager.enableAlpha();
// this.drawTexturedModalRect(l / 2 - 7, i1 / 2 - 7, 0, 0, 16, 16);
if (this.mc.gameSettings.attackIndicator == 1)
{
float f = this.mc.thePlayer.getCooledAttackStrength(0.0F);
if (f < 1.0F)
{
int i = i1 / 2 - 7 + 16;
int j = l / 2 - 7;
int k = (int)(f * 17.0F);
this.drawTexturedModalRect(j, i, 36, 94, 16, 4);
this.drawTexturedModalRect(j, i, 52, 94, k, 4);
}
}
}
}
}
public void renderGameOverlayCrosshairs(int scaledResWidth, int scaledResHeight) { public void renderGameOverlayCrosshairs(int scaledResWidth, int scaledResHeight) {
if (this.showCrosshair()) { if (this.showCrosshair()) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
@ -362,6 +425,23 @@ public class GuiIngame extends Gui {
this.renderHotbarItem(j, k, l, partialTicks, entityplayer); this.renderHotbarItem(j, k, l, partialTicks, entityplayer);
} }
if (this.mc.gameSettings.attackIndicator == 2)
{
float f1 = this.mc.thePlayer.getCooledAttackStrength(0.0F);
if (f1 < 1.0F)
{
int i2 = sr.getScaledHeight() - 20;
int j2 = i + 91 + 6;
this.mc.getTextureManager().bindTexture(icons);
int k1 = (int)(f1 * 19.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(j2, i2, 0, 94, 18, 18);
this.drawTexturedModalRect(j2, i2 + 18 - k1, 18, 112 - k1, 18, k1);
}
}
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal(); GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend(); GlStateManager.disableBlend();

View File

@ -258,6 +258,7 @@ public class PlayerControllerMP {
this.isHittingBlock = false; this.isHittingBlock = false;
this.curBlockDamageMP = 0.0F; this.curBlockDamageMP = 0.0F;
this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1); this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1);
this.mc.thePlayer.resetCooldown();
} }
} }
@ -394,6 +395,8 @@ public class PlayerControllerMP {
if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR) { if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR) {
if (heldStack == null) { if (heldStack == null) {
return false; return false;
} else if (player.getCooldownTracker().hasCooldown(heldStack.getItem())) {
return false;
} else if (this.currentGameType.isCreative()) { } else if (this.currentGameType.isCreative()) {
int i = heldStack.getMetadata(); int i = heldStack.getMetadata();
int j = heldStack.stackSize; int j = heldStack.stackSize;
@ -417,6 +420,8 @@ public class PlayerControllerMP {
public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn) { public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn) {
if (this.currentGameType == WorldSettings.GameType.SPECTATOR) { if (this.currentGameType == WorldSettings.GameType.SPECTATOR) {
return false; return false;
} else if (playerIn.getCooldownTracker().hasCooldown(itemStackIn.getItem())) {
return false;
} else { } else {
this.syncCurrentPlayItem(); this.syncCurrentPlayItem();
this.netClientHandler this.netClientHandler
@ -449,8 +454,8 @@ public class PlayerControllerMP {
this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK)); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK));
if (this.currentGameType != WorldSettings.GameType.SPECTATOR) { if (this.currentGameType != WorldSettings.GameType.SPECTATOR) {
playerIn.attackTargetEntityWithCurrentItem(targetEntity); playerIn.attackTargetEntityWithCurrentItem(targetEntity);
playerIn.resetCooldown();
} }
} }
/** /**

View File

@ -183,6 +183,7 @@ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketCooldown;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.scoreboard.IScoreObjectiveCriteria; import net.minecraft.scoreboard.IScoreObjectiveCriteria;
import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.Score;
@ -1836,6 +1837,14 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} }
} }
public void handleCooldown(SPacketCooldown packetIn) {
if (packetIn.getTicks() == 0) {
this.gameController.thePlayer.getCooldownTracker().removeCooldown(packetIn.getItem());
} else {
this.gameController.thePlayer.getCooldownTracker().setCooldown(packetIn.getItem(), packetIn.getTicks());
}
}
/** /**
* + * +
* Returns this the NetworkManager instance registered with this * Returns this the NetworkManager instance registered with this

View File

@ -149,6 +149,10 @@ public class EffectRenderer {
this.registerParticle(EnumParticleTypes.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory()); this.registerParticle(EnumParticleTypes.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory());
this.registerParticle(EnumParticleTypes.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory()); this.registerParticle(EnumParticleTypes.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory());
this.registerParticle(EnumParticleTypes.MOB_APPEARANCE.getParticleID(), new MobAppearance.Factory()); this.registerParticle(EnumParticleTypes.MOB_APPEARANCE.getParticleID(), new MobAppearance.Factory());
this.registerParticle(EnumParticleTypes.DRAGON_BREATH.getParticleID(), new ParticleDragonBreath.Factory());
this.registerParticle(EnumParticleTypes.END_ROD.getParticleID(), new ParticleEndRod.Factory());
this.registerParticle(EnumParticleTypes.DAMAGE_INDICATOR.getParticleID(), new EntityCrit2FX.DamageIndicatorFactory());
this.registerParticle(EnumParticleTypes.SWEEP_ATTACK.getParticleID(), new ParticleSweepAttack.Factory());
} }
public void registerParticle(int id, IParticleFactory particleFactory) { public void registerParticle(int id, IParticleFactory particleFactory) {

View File

@ -101,6 +101,17 @@ public class EntityCrit2FX extends EntityFX {
} }
public static class DamageIndicatorFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX particle = new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn + 1.0D, zSpeedIn, 1.0F);
particle.setMaxAge(20);
particle.setParticleTextureIndex(67);
return particle;
}
}
public static class Factory implements IParticleFactory { public static class Factory implements IParticleFactory {
public EntityFX getEntityFX(int var1, World world, double d0, double d1, double d2, double d3, double d4, public EntityFX getEntityFX(int var1, World world, double d0, double d1, double d2, double d3, double d4,
double d5, int... var15) { double d5, int... var15) {

View File

@ -135,6 +135,11 @@ public class EntityFX extends Entity {
return this.particleAlpha; return this.particleAlpha;
} }
public void setMaxAge(int p_187114_1_)
{
this.particleMaxAge = p_187114_1_;
}
/** /**
* + * +
* returns if this entity triggers Block.onEntityWalking on the * returns if this entity triggers Block.onEntityWalking on the

View File

@ -0,0 +1,87 @@
package net.minecraft.client.particle;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ParticleDragonBreath extends EntityFX
{
private final float oSize;
private boolean hasHitGround;
protected ParticleDragonBreath(World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed)
{
super(worldIn, x, y, z, xSpeed, ySpeed, zSpeed);
this.motionX = xSpeed;
this.motionY = ySpeed;
this.motionZ = zSpeed;
this.particleRed = MathHelper.randomFloatClamp(this.rand, 0.7176471F, 0.8745098F);
this.particleGreen = MathHelper.randomFloatClamp(this.rand, 0.0F, 0.0F);
this.particleBlue = MathHelper.randomFloatClamp(this.rand, 0.8235294F, 0.9764706F);
this.particleScale *= 0.75F;
this.oSize = this.particleScale;
this.particleMaxAge = (int)(20.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D));
this.hasHitGround = false;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
else
{
this.setParticleTextureIndex(3 * this.particleAge / this.particleMaxAge + 5);
if (this.isCollided)
{
this.motionY = 0.0D;
this.hasHitGround = true;
}
if (this.hasHitGround)
{
this.motionY += 0.002D;
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY)
{
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.hasHitGround)
{
this.motionY *= 0.9599999785423279D;
}
}
}
/**
* Renders the particle
*/
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
this.particleScale = this.oSize * MathHelper.clamp_float(((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F, 0.0F, 1.0F);
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleDragonBreath(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@ -0,0 +1,31 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
public class ParticleEndRod extends ParticleSimpleAnimated
{
public ParticleEndRod(World p_i46580_1_, double p_i46580_2_, double p_i46580_4_, double p_i46580_6_, double p_i46580_8_, double p_i46580_10_, double p_i46580_12_)
{
super(p_i46580_1_, p_i46580_2_, p_i46580_4_, p_i46580_6_, 176, 8, -5.0E-4F);
this.motionX = p_i46580_8_;
this.motionY = p_i46580_10_;
this.motionZ = p_i46580_12_;
this.particleScale *= 0.75F;
this.particleMaxAge = 60 + this.rand.nextInt(12);
this.setColorFade(15916745);
}
public void moveEntity(double x, double y, double z)
{
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleEndRod(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@ -0,0 +1,105 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
public class ParticleSimpleAnimated extends EntityFX {
/**
* The base texture index. The texture index starts at this + (numAgingFrames -
* 1), and works its way down to this
* number as the particle decays.
*/
private final int textureIdx;
/**
* How many different textures there are to progress through as the particle
* decays
*/
private final int numAgingFrames;
/**
* Added to the ySpeed every tick. Usually a small (thousandths), negative
* value.
*/
private final float yAccel;
/** The red value to drift toward */
private float fadeTargetRed;
/** The green value to drift toward */
private float fadeTargetGreen;
/** The blue value to drift toward */
private float fadeTargetBlue;
/** True if setColorFade has been called */
private boolean fadingColor;
public ParticleSimpleAnimated(World worldIn, double x, double y, double z, int textureIdxIn, int numFrames,
float yAccelIn) {
super(worldIn, x, y, z);
this.textureIdx = textureIdxIn;
this.numAgingFrames = numFrames;
this.yAccel = yAccelIn;
}
public void setColor(int p_187146_1_) {
float f = (float) ((p_187146_1_ & 16711680) >> 16) / 255.0F;
float f1 = (float) ((p_187146_1_ & 65280) >> 8) / 255.0F;
float f2 = (float) ((p_187146_1_ & 255) >> 0) / 255.0F;
float f3 = 1.0F;
this.setRBGColorF(f * f3, f1 * f3, f2 * f3);
}
/**
* sets a color for the particle to drift toward (20% closer each tick, never
* actually getting very close)
*/
public void setColorFade(int rgb) {
this.fadeTargetRed = (float) ((rgb & 16711680) >> 16) / 255.0F;
this.fadeTargetGreen = (float) ((rgb & 65280) >> 8) / 255.0F;
this.fadeTargetBlue = (float) ((rgb & 255) >> 0) / 255.0F;
this.fadingColor = true;
}
public boolean isTransparent() {
return true;
}
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
this.setDead();
}
if (this.particleAge > this.particleMaxAge / 2) {
this.setAlphaF(1.0F
- ((float) this.particleAge - (float) (this.particleMaxAge / 2)) / (float) this.particleMaxAge);
if (this.fadingColor) {
this.particleRed += (this.fadeTargetRed - this.particleRed) * 0.2F;
this.particleGreen += (this.fadeTargetGreen - this.particleGreen) * 0.2F;
this.particleBlue += (this.fadeTargetBlue - this.particleBlue) * 0.2F;
}
}
this.setParticleTextureIndex(this.textureIdx
+ (this.numAgingFrames - 1 - this.particleAge * this.numAgingFrames / this.particleMaxAge));
this.motionY += (double) this.yAccel;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9100000262260437D;
this.motionY *= 0.9100000262260437D;
this.motionZ *= 0.9100000262260437D;
if (this.isCollided) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
public int getBrightnessForRender(float p_189214_1_) {
return 15728880;
}
}

View File

@ -0,0 +1,92 @@
package net.minecraft.client.particle;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class ParticleSweepAttack extends EntityFX
{
private static final ResourceLocation SWEEP_TEXTURE = new ResourceLocation("textures/entity/sweep.png");
private int life;
private int lifeTime;
private TextureManager textureManager;
private float size;
protected ParticleSweepAttack(TextureManager textureManagerIn, World worldIn, double x, double y, double z, double p_i46582_9_, double p_i46582_11_, double p_i46582_13_)
{
super(worldIn, x, y, z, 0.0D, 0.0D, 0.0D);
this.textureManager = textureManagerIn;
this.lifeTime = 4;
this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.6F + 0.4F;
this.size = 1.0F - (float)p_i46582_9_ * 0.5F;
}
/**
* Renders the particle
*/
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
int i = (int)(((float)this.life + partialTicks) * 3.0F / (float)this.lifeTime);
if (i <= 7)
{
this.textureManager.bindTexture(SWEEP_TEXTURE);
float f = (float)(i % 4) / 4.0F;
float f1 = f + 0.24975F;
float f2 = (float)(i / 2) / 2.0F;
float f3 = f2 + 0.4995F;
float f4 = 1.0F * this.size;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
worldRendererIn.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4 * 0.5F), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4 * 0.5F), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4 * 0.5F), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4 * 0.5F), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableLighting();
}
}
public int getBrightnessForRender(float p_189214_1_)
{
return 61680;
}
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
++this.life;
if (this.life == this.lifeTime)
{
this.setDead();
}
}
public int getFXLayer()
{
return 3;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new ParticleSweepAttack(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

View File

@ -1,5 +1,7 @@
package net.minecraft.client.renderer; package net.minecraft.client.renderer;
import com.google.common.base.Objects;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*; import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite; import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
@ -536,6 +538,11 @@ public class ItemRenderer {
flag = true; flag = true;
} }
float cooledAttackStength = entityplayersp.getCooledAttackStrength(1.0F);
this.equippedProgress += MathHelper
.clamp_float((com.google.common.base.Objects.equal(this.itemToRender, itemstack) ? cooledAttackStength * cooledAttackStength * cooledAttackStength : 0.0F)
- this.equippedProgress, -0.4F, 0.4F);
float f = 0.4F; float f = 0.4F;
float f1 = flag ? 0.0F : 1.0F; float f1 = flag ? 0.0F : 1.0F;
float f2 = MathHelper.clamp_float(f1 - this.equippedProgress, -f, f); float f2 = MathHelper.clamp_float(f1 - this.equippedProgress, -f, f);

View File

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.layers.LayerCustomHead; import net.minecraft.client.renderer.entity.layers.LayerCustomHead;
import net.minecraft.client.renderer.entity.layers.LayerHeldItem; import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
/** /**
@ -73,8 +74,15 @@ public class ArmorStandRenderer extends RendererLivingEntity<EntityArmorStand> {
return (ModelArmorStand) super.getMainModel(); return (ModelArmorStand) super.getMainModel();
} }
protected void rotateCorpse(EntityArmorStand var1, float var2, float f, float var4) { protected void rotateCorpse(EntityArmorStand entityLiving, float p_77043_2_, float p_77043_3_, float partialTicks)
GlStateManager.rotate(180.0F - f, 0.0F, 1.0F, 0.0F); {
GlStateManager.rotate(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F);
float f = (float)(entityLiving.worldObj.getTotalWorldTime() - entityLiving.punchCooldown) + partialTicks;
if (f < 5.0F)
{
GlStateManager.rotate(MathHelper.sin(f / 1.5F * (float)Math.PI) * 3.0F, 0.0F, 1.0F, 0.0F);
}
} }
protected boolean canRenderName(EntityArmorStand entityarmorstand) { protected boolean canRenderName(EntityArmorStand entityarmorstand) {

View File

@ -34,6 +34,7 @@ import net.minecraft.block.BlockStoneSlabNew;
import net.minecraft.block.BlockTallGrass; import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.BlockWall; import net.minecraft.block.BlockWall;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.ItemMeshDefinition;
@ -67,6 +68,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException; import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3i; import net.minecraft.util.Vec3i;
@ -531,6 +533,22 @@ public class RenderItem implements IResourceManagerReloadListener {
GlStateManager.enableDepth(); GlStateManager.enableDepth();
} }
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
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();
}
} }
} }

View File

@ -232,6 +232,8 @@ public class GameSettings {
public boolean disableAlpha = false; public boolean disableAlpha = false;
public int attackIndicator = 1; // TODO: add this as an option
public GameSettings(Minecraft mcIn) { public GameSettings(Minecraft mcIn) {
this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem, this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem,
this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump,

View File

@ -807,7 +807,7 @@ public abstract class Entity implements ICommandSender {
* Resets the entity's position to the center (planar) and * Resets the entity's position to the center (planar) and
* bottom (vertical) points of its bounding box. * bottom (vertical) points of its bounding box.
*/ */
private void resetPositionToBB() { public void resetPositionToBB() {
this.posX = (this.getEntityBoundingBox().minX + this.getEntityBoundingBox().maxX) / 2.0D; this.posX = (this.getEntityBoundingBox().minX + this.getEntityBoundingBox().maxX) / 2.0D;
this.posY = this.getEntityBoundingBox().minY; this.posY = this.getEntityBoundingBox().minY;
this.posZ = (this.getEntityBoundingBox().minZ + this.getEntityBoundingBox().maxZ) / 2.0D; this.posZ = (this.getEntityBoundingBox().minZ + this.getEntityBoundingBox().maxZ) / 2.0D;

View File

@ -61,6 +61,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.util.CombatRules;
/** /**
* + * +
@ -172,6 +173,9 @@ public abstract class EntityLivingBase extends Entity {
/** The BlockPos the entity had during the previous tick. */ /** The BlockPos the entity had during the previous tick. */
private BlockPos prevBlockpos; private BlockPos prevBlockpos;
protected int ticksSinceLastSwing;
/** /**
* + * +
* Called by the /kill command. * Called by the /kill command.
@ -204,6 +208,8 @@ public abstract class EntityLivingBase extends Entity {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ARMOR);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.field_189429_h);
} }
protected void updateFallState(double d0, boolean flag, Block block, BlockPos blockpos) { protected void updateFallState(double d0, boolean flag, Block block, BlockPos blockpos) {
@ -1053,16 +1059,8 @@ public abstract class EntityLivingBase extends Entity {
* InventoryPlayer.getTotalArmorValue * InventoryPlayer.getTotalArmorValue
*/ */
public int getTotalArmorValue() { public int getTotalArmorValue() {
int i = 0; IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.ARMOR);
return MathHelper.floor_double(iattributeinstance.getAttributeValue());
for (ItemStack itemstack : this.getInventory()) {
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
int j = ((ItemArmor) itemstack.getItem()).damageReduceAmount;
i += j;
}
}
return i;
} }
protected void damageArmor(float parFloat1) { protected void damageArmor(float parFloat1) {
@ -1074,10 +1072,9 @@ public abstract class EntityLivingBase extends Entity {
*/ */
protected float applyArmorCalculations(DamageSource source, float damage) { protected float applyArmorCalculations(DamageSource source, float damage) {
if (!source.isUnblockable()) { if (!source.isUnblockable()) {
int i = 25 - this.getTotalArmorValue();
float f = damage * (float) i;
this.damageArmor(damage); this.damageArmor(damage);
damage = f / 25.0F; damage = CombatRules.func_189427_a(damage, (float) this.getTotalArmorValue(),
(float) this.getEntityAttribute(SharedMonsterAttributes.field_189429_h).getAttributeValue());
} }
return damage; return damage;

View File

@ -1,8 +1,8 @@
package net.minecraft.entity; package net.minecraft.entity;
import java.util.Collection; import java.util.Collection;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
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.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
@ -54,6 +54,10 @@ public class SharedMonsterAttributes {
0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true); 0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true);
public static final IAttribute attackDamage = new RangedAttribute((IAttribute) null, "generic.attackDamage", 2.0D, public static final IAttribute attackDamage = new RangedAttribute((IAttribute) null, "generic.attackDamage", 2.0D,
0.0D, 2048.0D); 0.0D, 2048.0D);
public static final IAttribute ARMOR = (new RangedAttribute((IAttribute)null, "generic.armor", 0.0D, 0.0D, 30.0D)).setShouldWatch(true);
public static final IAttribute field_189429_h = (new RangedAttribute((IAttribute)null, "generic.armorToughness", 0.0D, 0.0D, 20.0D)).setShouldWatch(true);
public static final IAttribute ATTACK_SPEED = (new RangedAttribute((IAttribute)null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).setShouldWatch(true);
/** /**
* + * +

View File

@ -389,15 +389,6 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
public void setInWeb() { public void setInWeb() {
} }
/**
* +
* Returns the current armor value as determined by a call to
* InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue() {
return 4;
}
private double func_82214_u(int parInt1) { private double func_82214_u(int parInt1) {
if (parInt1 <= 0) { if (parInt1 <= 0) {
return this.posX; return this.posX;
@ -562,6 +553,7 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.6000000238418579D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.6000000238418579D);
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(4.0D);
} }
public float func_82207_a(int parInt1) { public float func_82207_a(int parInt1) {

View File

@ -65,7 +65,7 @@ public class EntityArmorStand extends EntityLivingBase {
private static final Rotations DEFAULT_RIGHTLEG_ROTATION = new Rotations(1.0F, 0.0F, 1.0F); private static final Rotations DEFAULT_RIGHTLEG_ROTATION = new Rotations(1.0F, 0.0F, 1.0F);
private final ItemStack[] contents; private final ItemStack[] contents;
private boolean canInteract; private boolean canInteract;
private long punchCooldown; public long punchCooldown;
private int disabledSlots; private int disabledSlots;
private boolean field_181028_bj; private boolean field_181028_bj;
private Rotations headRotation; private Rotations headRotation;

View File

@ -67,15 +67,6 @@ public class EntityMagmaCube extends EntitySlime {
&& !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox());
} }
/**
* +
* Returns the current armor value as determined by a call to
* InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue() {
return this.getSlimeSize() * 3;
}
public int getBrightnessForRender(float var1) { public int getBrightnessForRender(float var1) {
return 15728880; return 15728880;
} }
@ -100,6 +91,12 @@ public class EntityMagmaCube extends EntitySlime {
return Items.magma_cream; return Items.magma_cream;
} }
protected void setSlimeSize(int size)
{
super.setSlimeSize(size);
this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue((double)(size * 3));
}
/** /**
* + * +
* Drop 0-2 items of this living's type * Drop 0-2 items of this living's type

View File

@ -5,6 +5,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@ -118,31 +122,54 @@ public abstract class EntityMob extends EntityCreature implements IMob {
return i > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small"; return i > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small";
} }
public boolean attackEntityAsMob(Entity entity) { public boolean attackEntityAsMob(Entity entityIn)
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); {
float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
int i = 0; int i = 0;
if (entity instanceof EntityLivingBase) {
f += EnchantmentHelper.func_152377_a(this.getHeldItem(), if (entityIn instanceof EntityLivingBase)
((EntityLivingBase) entity).getCreatureAttribute()); {
f += EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)entityIn).getCreatureAttribute());
i += EnchantmentHelper.getKnockbackModifier(this); i += EnchantmentHelper.getKnockbackModifier(this);
} }
boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), f); boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);
if (flag) {
if (i > 0) { if (flag)
entity.addVelocity( {
(double) (-MathHelper.sin(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, if (i > 0 && entityIn instanceof EntityLivingBase)
(double) (MathHelper.cos(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F)); {
((EntityLivingBase)entityIn).knockBack(this, (float)i * 0.5F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
this.motionX *= 0.6D; this.motionX *= 0.6D;
this.motionZ *= 0.6D; this.motionZ *= 0.6D;
} }
int j = EnchantmentHelper.getFireAspectModifier(this); int j = EnchantmentHelper.getFireAspectModifier(this);
if (j > 0) {
entity.setFire(j * 4); if (j > 0)
{
entityIn.setFire(j * 4);
} }
this.applyEnchantments(this, entity); // if (entityIn instanceof EntityPlayer)
// {
// EntityPlayer entityplayer = (EntityPlayer)entityIn;
// ItemStack itemstack = this.getHeldItem();
// ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;
// if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
// {
// float f1 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
// if (this.rand.nextFloat() < f1)
// {
// entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
// this.worldObj.setEntityState(entityplayer, (byte)30);
// }
// }
// }
this.applyEnchantments(this, entityIn);
} }
return flag; return flag;

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.monster;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -122,6 +123,7 @@ public class EntityZombie extends EntityMob {
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(2.0D);
this.getAttributeMap().registerAttribute(reinforcementChance) this.getAttributeMap().registerAttribute(reinforcementChance)
.setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); .setBaseValue(this.rand.nextDouble() * 0.10000000149011612D);
} }
@ -133,20 +135,6 @@ public class EntityZombie extends EntityMob {
this.getDataWatcher().addObject(14, Byte.valueOf((byte) 0)); this.getDataWatcher().addObject(14, Byte.valueOf((byte) 0));
} }
/**
* +
* Returns the current armor value as determined by a call to
* InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue() {
int i = super.getTotalArmorValue() + 2;
if (i > 20) {
i = 20;
}
return i;
}
public boolean isBreakDoorsTaskSet() { public boolean isBreakDoorsTaskSet() {
return this.isBreakDoorsTaskSet; return this.isBreakDoorsTaskSet;
} }

View File

@ -20,6 +20,7 @@ import net.minecraft.entity.ai.EntityAIRunAroundLikeCrazy;
import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttribute; import net.minecraft.entity.ai.attributes.IAttribute;
import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.ai.attributes.RangedAttribute; import net.minecraft.entity.ai.attributes.RangedAttribute;
@ -323,6 +324,17 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
public void setHorseArmorStack(ItemStack itemStackIn) { public void setHorseArmorStack(ItemStack itemStackIn) {
this.dataWatcher.updateObject(22, Integer.valueOf(this.getHorseArmorIndex(itemStackIn))); this.dataWatcher.updateObject(22, Integer.valueOf(this.getHorseArmorIndex(itemStackIn)));
this.resetTexturePrefix(); this.resetTexturePrefix();
// TODO: implement ar
// if (!this.worldObj.isRemote)
// {
// this.getEntityAttribute(SharedMonsterAttributes.ARMOR).removeModifier(ARMOR_MODIFIER_UUID);
// int i = horsearmortype.getProtection();
// if (i != 0)
// {
// this.getEntityAttribute(SharedMonsterAttributes.ARMOR).applyModifier((new AttributeModifier(ARMOR_MODIFIER_UUID, "Horse armor bonus", (double)i, 0)).setSaved(false));
// }
// }
} }
public void setBreeding(boolean breeding) { public void setBreeding(boolean breeding) {

View File

@ -319,15 +319,6 @@ public class EntityRabbit extends EntityAnimal {
} }
} }
/**
* +
* Returns the current armor value as determined by a call to
* InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue() {
return this.getRabbitType() == 99 ? 8 : super.getTotalArmorValue();
}
/** /**
* + * +
* Called when the entity is attacked. * Called when the entity is attacked.
@ -398,6 +389,7 @@ public class EntityRabbit extends EntityAnimal {
public void setRabbitType(int rabbitTypeId) { public void setRabbitType(int rabbitTypeId) {
if (rabbitTypeId == 99) { if (rabbitTypeId == 99) {
this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(8.0D);
this.tasks.removeTask(this.aiAvoidWolves); this.tasks.removeTask(this.aiAvoidWolves);
this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this)); this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));

View File

@ -1,12 +1,15 @@
package net.minecraft.entity.player; package net.minecraft.entity.player;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBed; import net.minecraft.block.BlockBed;
import net.minecraft.block.BlockDirectional; import net.minecraft.block.BlockDirectional;
@ -47,6 +50,7 @@ import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemElytra; import net.minecraft.item.ItemElytra;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.play.server.S12PacketEntityVelocity; import net.minecraft.network.play.server.S12PacketEntityVelocity;
@ -65,6 +69,7 @@ import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.CooldownTracker;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
@ -76,6 +81,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.IInteractionObject; import net.minecraft.world.IInteractionObject;
import net.minecraft.world.LockCode; import net.minecraft.world.LockCode;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
/** /**
@ -157,8 +163,17 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
private int lastXPSound; private int lastXPSound;
private final GameProfile gameProfile; private final GameProfile gameProfile;
private boolean hasReducedDebug = false; private boolean hasReducedDebug = false;
private ItemStack itemStackMainHand = null;
private final CooldownTracker cooldownTracker = this.createCooldownTracker();
public EntityFishHook fishEntity; public EntityFishHook fishEntity;
protected CooldownTracker createCooldownTracker() {
return new CooldownTracker();
}
public EntityPlayer(World worldIn, GameProfile gameProfileIn) { public EntityPlayer(World worldIn, GameProfile gameProfileIn) {
super(worldIn); super(worldIn);
this.entityUniqueID = getUUID(gameProfileIn); this.entityUniqueID = getUUID(gameProfileIn);
@ -176,6 +191,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);
} }
protected void entityInit() { protected void entityInit() {
@ -353,6 +369,19 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.setPosition(d3, this.posY, d4); this.setPosition(d3, this.posY, d4);
} }
++this.ticksSinceLastSwing;
ItemStack itemstack = this.getHeldItem();
if (!ItemStack.areItemStacksEqual(this.itemStackMainHand, itemstack)) {
if (!ItemStack.areItemsEqualIgnoreDurability(this.itemStackMainHand, itemstack)) {
this.resetCooldown();
}
this.itemStackMainHand = itemstack == null ? null : itemstack.copy();
}
this.cooldownTracker.tick();
this.updateSize(); this.updateSize();
} }
@ -1001,15 +1030,6 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.inventory.damageArmor(f); this.inventory.damageArmor(f);
} }
/**
* +
* Returns the current armor value as determined by a call to
* InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue() {
return this.inventory.getTotalArmorValue();
}
/** /**
* + * +
* When searching for vulnerable players, if a player is * When searching for vulnerable players, if a player is
@ -1165,120 +1185,251 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
return -0.35D; return -0.35D;
} }
public float getCooledAttackStrength(float adjustTicks) {
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);
}
public void resetCooldown() {
this.ticksSinceLastSwing = 0;
}
public CooldownTracker getCooldownTracker() {
return this.cooldownTracker;
}
/** /**
* + * +
* Attacks for the player the targeted entity with the currently * Attacks for the player the targeted entity with the currently
* equipped item. The equipped item has hitEntity called on it. * equipped item. The equipped item has hitEntity called on it.
* Args: targetEntity * Args: targetEntity
*/ */
public void attackTargetEntityWithCurrentItem(Entity entity) { public void attackTargetEntityWithCurrentItem(Entity targetEntity) {
if (entity.canAttackWithItem()) { if (targetEntity.canAttackWithItem()) {
if (!entity.hitByEntity(this)) { if (!targetEntity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
int i = 0;
float f1 = 0.0F; float f1 = 0.0F;
if (entity instanceof EntityLivingBase) {
if (targetEntity instanceof EntityLivingBase) {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
((EntityLivingBase) entity).getCreatureAttribute()); ((EntityLivingBase) targetEntity).getCreatureAttribute());
} else { } else {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), EnumCreatureAttribute.UNDEFINED); f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
EnumCreatureAttribute.UNDEFINED);
} }
i = i + EnchantmentHelper.getKnockbackModifier(this); float f2 = this.getCooledAttackStrength(0.5F);
if (this.isSprinting()) { f = f * (0.2F + f2 * f2 * 0.8F);
++i; f1 = f1 * f2;
} this.resetCooldown();
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() boolean flag = f2 > 0.9F;
&& !this.isPotionActive(Potion.blindness) && this.ridingEntity == null
&& entity instanceof EntityLivingBase;
if (flag && f > 0.0F) {
f *= 1.5F;
}
f = f + f1;
boolean flag1 = false; boolean flag1 = false;
int j = EnchantmentHelper.getFireAspectModifier(this); boolean flag2 = false;
if (entity instanceof EntityLivingBase && j > 0 && !entity.isBurning()) { 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; flag1 = true;
entity.setFire(1);
} }
double d0 = entity.motionX; flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder()
double d1 = entity.motionY; && !this.isInWater() && !this.isPotionActive(Potion.blindness) && !this.isRiding()
double d2 = entity.motionZ; && targetEntity instanceof EntityLivingBase;
boolean flag2 = entity.attackEntityFrom(DamageSource.causePlayerDamage(this), f); flag2 = flag2 && !this.isSprinting();
if (flag2) { if (flag2) {
f *= 1.5F;
}
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 (itemstack != null && itemstack.getItem() instanceof ItemSword) {
flag3 = true;
}
}
float f4 = 0.0F;
boolean flag4 = false;
int j = EnchantmentHelper.getFireAspectModifier(this);
if (targetEntity instanceof EntityLivingBase) {
f4 = ((EntityLivingBase) targetEntity).getHealth();
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);
if (flag5) {
if (i > 0) { if (i > 0) {
entity.addVelocity( if (targetEntity instanceof EntityLivingBase) {
(double) (-MathHelper.sin(this.rotationYaw * 3.1415927F / 180.0F) * (float) i ((EntityLivingBase) targetEntity).knockBack(this, (float) i * 0.5F,
* 0.5F), (double) MathHelper.sin(this.rotationYaw * 0.017453292F),
0.1D, (double) (MathHelper.cos(this.rotationYaw * 3.1415927F / 180.0F) * (float) i (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
* 0.5F)); } 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.motionX *= 0.6D;
this.motionZ *= 0.6D; this.motionZ *= 0.6D;
this.setSprinting(false); this.setSprinting(false);
} }
if (entity instanceof EntityPlayerMP && entity.velocityChanged) { if (flag3) {
((EntityPlayerMP) entity).playerNetServerHandler for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(
.sendPacket(new S12PacketEntityVelocity(entity)); EntityLivingBase.class,
entity.velocityChanged = false; targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) {
entity.motionX = d0; if (entitylivingbase != this && entitylivingbase != targetEntity
entity.motionY = d1; && !this.isOnSameTeam(entitylivingbase)
entity.motionZ = d2; && 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();
}
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 && !flag3) {
if (flag) { if (flag) {
this.onCriticalHit(entity); // 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 (f1 > 0.0F) { if (f1 > 0.0F) {
this.onEnchantmentCritical(entity); 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 (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 (this.rand.nextFloat() < f3) {
// entityplayer.getCooldownTracker().setCooldown(Items.SHIsELD, 100);
// this.worldObj.setEntityState(entityplayer, (byte) 30);
// }
// }
// }
if (f >= 18.0F) { if (f >= 18.0F) {
this.triggerAchievement(AchievementList.overkill); this.triggerAchievement(AchievementList.overkill);
} }
this.setLastAttacker(entity); this.setLastAttacker(targetEntity);
if (entity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) entity, this); if (targetEntity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) targetEntity, this);
} }
EnchantmentHelper.applyArthropodEnchantments(this, entity); EnchantmentHelper.applyArthropodEnchantments(this, targetEntity);
ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = this.getHeldItem();
Object object = entity; Entity entity = targetEntity;
if (entity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) entity).entityDragonObj; if (targetEntity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) targetEntity).entityDragonObj;
if (ientitymultipart instanceof EntityLivingBase) { if (ientitymultipart instanceof EntityLivingBase) {
object = (EntityLivingBase) ientitymultipart; entity = (EntityLivingBase) ientitymultipart;
} }
} }
if (itemstack != null && object instanceof EntityLivingBase) { if (itemstack1 != null && entity instanceof EntityLivingBase) {
itemstack.hitEntity((EntityLivingBase) object, this); itemstack1.hitEntity((EntityLivingBase) entity, this);
if (itemstack.stackSize <= 0) {
this.destroyCurrentEquippedItem(); if (itemstack1.stackSize <= 0) {
this.setHeldItem((ItemStack) null);
} }
} }
if (entity instanceof EntityLivingBase) { if (targetEntity instanceof EntityLivingBase) {
this.addStat(StatList.damageDealtStat, Math.round(f * 10.0F)); float f5 = f4 - ((EntityLivingBase) targetEntity).getHealth();
this.addStat(StatList.damageDealtStat, Math.round(f5 * 10.0F));
if (j > 0) { if (j > 0) {
entity.setFire(j * 4); 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]);
} }
} }
this.addExhaustion(0.3F); this.addExhaustion(0.3F);
} else if (flag1) { } else {
entity.extinguish(); // this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ,
// SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F);
if (flag4) {
targetEntity.extinguish();
}
}
}
}
} }
} }
} public void setHeldItem(@Nullable ItemStack stack) {
} this.inventory.mainInventory[this.inventory.currentItem] = stack;
} }
/** /**
@ -1292,6 +1443,16 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
public void onEnchantmentCritical(Entity var1) { public void onEnchantmentCritical(Entity var1) {
} }
public void spawnSweepParticles() {
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]);
}
}
public void respawnPlayer() { public void respawnPlayer() {
} }

View File

@ -80,6 +80,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySign; import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.CooldownTracker;
import net.minecraft.util.CooldownTrackerServer;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource; import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
@ -288,6 +290,11 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
.sendPacket(new S42PacketCombatEvent(this.getCombatTracker(), S42PacketCombatEvent.Event.END_COMBAT)); .sendPacket(new S42PacketCombatEvent(this.getCombatTracker(), S42PacketCombatEvent.Event.END_COMBAT));
} }
protected CooldownTracker createCooldownTracker()
{
return new CooldownTrackerServer(this);
}
/** /**
* + * +
* Called to update the entity's position/logic. * Called to update the entity's position/logic.
@ -1213,6 +1220,12 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
return null; return null;
} }
public void swingItem()
{
super.swingItem();
this.resetCooldown();
}
public void setElytraFlying() { public void setElytraFlying() {
this.setFlag(7, true); this.setFlag(7, true);
} }

View File

@ -621,24 +621,6 @@ public class InventoryPlayer implements IInventory {
return this.armorInventory[parInt1]; return this.armorInventory[parInt1];
} }
/**
* +
* Based on the damage values and maximum damage values of each
* armor item, returns the current armor value.
*/
public int getTotalArmorValue() {
int i = 0;
for (int j = 0; j < this.armorInventory.length; ++j) {
if (this.armorInventory[j] != null && this.armorInventory[j].getItem() instanceof ItemArmor) {
int k = ((ItemArmor) this.armorInventory[j].getItem()).damageReduceAmount;
i += k;
}
}
return i;
}
/** /**
* + * +
* Damages armor in each slot by the specified amount. * Damages armor in each slot by the specified amount.

View File

@ -473,9 +473,9 @@ public class Bootstrap {
BiomeGenBase.doBootstrap(); BiomeGenBase.doBootstrap();
BlockFire.init(); BlockFire.init();
EntityEnderman.bootstrap(); EntityEnderman.bootstrap();
ItemAxe.bootstrap(); // ItemAxe.bootstrap();
ItemPickaxe.bootstrap(); // ItemPickaxe.bootstrap();
ItemSpade.bootstrap(); // ItemSpade.bootstrap();
Item.registerItems(); Item.registerItems();
Items.doBootstrap(); Items.doBootstrap();
EntityVillager.bootstrap(); EntityVillager.bootstrap();

View File

@ -83,8 +83,9 @@ import net.minecraft.world.World;
public class Item { public class Item {
public static final RegistryNamespaced<ResourceLocation, Item> itemRegistry = new RegistryNamespaced(); public static final RegistryNamespaced<ResourceLocation, Item> itemRegistry = new RegistryNamespaced();
private static final Map<Block, Item> BLOCK_TO_ITEM = Maps.newHashMap(); private static final Map<Block, Item> BLOCK_TO_ITEM = Maps.newHashMap();
protected static final EaglercraftUUID itemModifierUUID = EaglercraftUUID protected static final EaglercraftUUID ATTACK_DAMAGE_MODIFIER = EaglercraftUUID
.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); .fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
protected static final EaglercraftUUID ATTACK_SPEED_MODIFIER = EaglercraftUUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3");
private CreativeTabs tabToDisplayOn; private CreativeTabs tabToDisplayOn;
/** /**
* + * +
@ -1145,8 +1146,11 @@ public class Item {
} }
public static enum ToolMaterial { public static enum ToolMaterial {
WOOD(0, 59, 2.0F, 0.0F, 15), STONE(1, 131, 4.0F, 1.0F, 5), IRON(2, 250, 6.0F, 2.0F, 14), WOOD(0, 59, 2.0F, 0.0F, 15),
EMERALD(3, 1561, 8.0F, 3.0F, 10), GOLD(0, 32, 12.0F, 0.0F, 22); STONE(1, 131, 4.0F, 1.0F, 5),
IRON(2, 250, 6.0F, 2.0F, 14),
EMERALD(3, 1561, 8.0F, 3.0F, 10),
GOLD(0, 32, 12.0F, 0.0F, 22);
private final int harvestLevel; private final int harvestLevel;
private final int maxUses; private final int maxUses;

View File

@ -39,14 +39,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;
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() { public static void bootstrap() {
EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, 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 }); Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder, Blocks.wooden_button, Blocks.wooden_pressure_plate });
} }
protected ItemAxe(Item.ToolMaterial material) { protected ItemAxe(Item.ToolMaterial material)
super(3.0F, material, EFFECTIVE_ON); {
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) {

View File

@ -18,7 +18,7 @@ public class ItemChorusFruit extends ItemFood {
* the Item before the action is complete. * the Item before the action is complete.
*/ */
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer entityLiving) { public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer entityLiving) {
// TODO: Sound and cooldown // TODO: Sound
ItemStack itemstack = super.onItemUseFinish(stack, worldIn, entityLiving); ItemStack itemstack = super.onItemUseFinish(stack, worldIn, entityLiving);
if (!worldIn.isRemote) { if (!worldIn.isRemote) {
@ -43,9 +43,9 @@ public class ItemChorusFruit extends ItemFood {
break; break;
} }
} }
// if (entityLiving instanceof EntityPlayer) { if (entityLiving instanceof EntityPlayer) {
// ((EntityPlayer) entityLiving).getCooldownTracker().setCooldown(this, 20); ((EntityPlayer) entityLiving).getCooldownTracker().setCooldown(this, 20);
// } }
} }
return itemstack; return itemstack;

View File

@ -1,5 +1,7 @@
package net.minecraft.item; package net.minecraft.item;
import com.google.common.collect.Multimap;
import net.hoosiertransfer.EaglerItems; import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockDirt;
@ -7,6 +9,8 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
@ -44,12 +48,15 @@ import net.minecraft.world.World;
*/ */
public class ItemHoe extends Item { public class ItemHoe extends Item {
protected Item.ToolMaterial theToolMaterial; protected Item.ToolMaterial theToolMaterial;
private final float speed;
public ItemHoe(Item.ToolMaterial material) { public ItemHoe(Item.ToolMaterial material) {
this.theToolMaterial = material; this.theToolMaterial = material;
this.maxStackSize = 1; this.maxStackSize = 1;
this.setMaxDamage(material.getMaxUses()); this.setMaxDamage(material.getMaxUses());
this.setCreativeTab(CreativeTabs.tabTools); this.setCreativeTab(CreativeTabs.tabTools);
this.speed = material.getDamageVsEntity() + 1.0F;
} }
/** /**
@ -102,11 +109,11 @@ public class ItemHoe extends Item {
} }
/** /**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * Current implementations of this method in child classes do not use the entry
* argument beside ev. They just raise
* the damage on the stack. * the damage on the stack.
*/ */
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
{
stack.damageItem(1, attacker); stack.damageItem(1, attacker);
return true; return true;
} }
@ -128,4 +135,15 @@ public class ItemHoe extends Item {
public String getMaterialName() { public String getMaterialName() {
return this.theToolMaterial.toString(); return this.theToolMaterial.toString();
} }
public Multimap<String, AttributeModifier> getItemAttributeModifiers() {
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 0.0D, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(),
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double) (this.speed - 4.0F), 0));
return multimap;
}
} }

View File

@ -38,19 +38,16 @@ import net.minecraft.init.Blocks;
* *
*/ */
public class ItemPickaxe extends ItemTool { public class ItemPickaxe extends ItemTool {
private static Set<Block> EFFECTIVE_ON; private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.activator_rail, Blocks.coal_ore, Blocks.cobblestone,
public static void bootstrap() {
EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.activator_rail, Blocks.coal_ore, Blocks.cobblestone,
Blocks.detector_rail, Blocks.diamond_block, Blocks.diamond_ore, Blocks.double_stone_slab, Blocks.detector_rail, Blocks.diamond_block, Blocks.diamond_ore, Blocks.double_stone_slab,
Blocks.golden_rail, Blocks.gold_block, Blocks.gold_ore, Blocks.ice, Blocks.iron_block, Blocks.iron_ore, Blocks.golden_rail, Blocks.gold_block, Blocks.gold_ore, Blocks.ice, Blocks.iron_block, Blocks.iron_ore,
Blocks.lapis_block, Blocks.lapis_ore, Blocks.lit_redstone_ore, Blocks.mossy_cobblestone, Blocks.lapis_block, Blocks.lapis_ore, Blocks.lit_redstone_ore, Blocks.mossy_cobblestone,
Blocks.netherrack, Blocks.packed_ice, Blocks.rail, Blocks.redstone_ore, Blocks.sandstone, Blocks.netherrack, Blocks.packed_ice, Blocks.rail, Blocks.redstone_ore, Blocks.sandstone,
Blocks.red_sandstone, Blocks.stone, Blocks.stone_slab, Blocks.stone_button, Blocks.stone_pressure_plate }); Blocks.red_sandstone, Blocks.stone, Blocks.stone_slab, Blocks.stone_button, Blocks.stone_pressure_plate });
}
protected ItemPickaxe(Item.ToolMaterial material) { protected ItemPickaxe(Item.ToolMaterial material)
super(2.0F, material, EFFECTIVE_ON); {
super(1.0F, -2.8F, material, EFFECTIVE_ON);
} }
/** /**

View File

@ -46,16 +46,12 @@ import net.minecraft.world.World;
* *
*/ */
public class ItemSpade extends ItemTool { public class ItemSpade extends ItemTool {
private static Set<Block> EFFECTIVE_ON; private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.clay, Blocks.dirt, Blocks.farmland, Blocks.grass,
public static void bootstrap() {
EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.clay, Blocks.dirt, Blocks.farmland, Blocks.grass,
Blocks.gravel, Blocks.mycelium, Blocks.sand, Blocks.snow, Blocks.snow_layer, Blocks.soul_sand, Blocks.gravel, Blocks.mycelium, Blocks.sand, Blocks.snow, Blocks.snow_layer, Blocks.soul_sand,
EaglerItems.getEaglerBlock("grass_path") }); EaglerItems.getEaglerBlock("grass_path") });
}
public ItemSpade(Item.ToolMaterial material) { public ItemSpade(Item.ToolMaterial material) {
super(1.0F, material, EFFECTIVE_ON); super(1.5F, -3.0F, material, EFFECTIVE_ON);
} }
/** /**

View File

@ -8,11 +8,14 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.HString; import net.lax1dude.eaglercraft.v1_8.HString;
import java.util.Set; import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentDurability; import net.minecraft.enchantment.EnchantmentDurability;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
@ -454,6 +457,11 @@ 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)
{
return stackA == stackB ? true : (stackA != null && stackB != null ? stackA.isItemEqualIgnoreDurability(stackB) : false);
}
/** /**
* + * +
* compares ItemStack argument to the instance ItemStack; * compares ItemStack argument to the instance ItemStack;
@ -464,6 +472,11 @@ 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)
{
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);
} }
@ -716,8 +729,16 @@ public final class ItemStack {
for (Entry entry : (Set<Entry>) multimap.entries()) { for (Entry entry : (Set<Entry>) multimap.entries()) {
AttributeModifier attributemodifier = (AttributeModifier) entry.getValue(); AttributeModifier attributemodifier = (AttributeModifier) entry.getValue();
double d0 = attributemodifier.getAmount(); double d0 = attributemodifier.getAmount();
if (attributemodifier.getID() == Item.itemModifierUUID) { boolean flag = false;
d0 += (double) EnchantmentHelper.func_152377_a(this, EnumCreatureAttribute.UNDEFINED);
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;
@ -726,8 +747,12 @@ public final class ItemStack {
} else { } else {
d1 = d0 * 100.0D; d1 = d0 * 100.0D;
} }
if (flag) {
if (d0 > 0.0D) { arraylist.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) {
arraylist.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted( arraylist.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted(
"attribute.modifier.plus." + attributemodifier.getOperation(), "attribute.modifier.plus." + attributemodifier.getOperation(),
new Object[] { DECIMALFORMAT.format(d1), new Object[] { DECIMALFORMAT.format(d1),

View File

@ -169,7 +169,9 @@ public class ItemSword extends Item {
public Multimap<String, AttributeModifier> getItemAttributeModifiers() { public Multimap<String, AttributeModifier> getItemAttributeModifiers() {
Multimap multimap = super.getItemAttributeModifiers(); Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(itemModifierUUID, "Weapon modifier", (double) this.attackDamage, 0)); new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) this.attackDamage, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
return multimap; return multimap;
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.Set;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
@ -44,19 +45,34 @@ import net.minecraft.world.World;
public class ItemTool extends Item { public class ItemTool extends Item {
private Set<Block> effectiveBlocks; private Set<Block> effectiveBlocks;
protected float efficiencyOnProperMaterial = 4.0F; protected float efficiencyOnProperMaterial = 4.0F;
private float damageVsEntity; protected float damageVsEntity;
protected float attackSpeed;
protected Item.ToolMaterial toolMaterial; protected Item.ToolMaterial toolMaterial;
protected ItemTool(float attackDamage, Item.ToolMaterial material, Set<Block> effectiveBlocks) { protected ItemTool(float attackDamageIn, float attackSpeedIn, Item.ToolMaterial materialIn, Set<Block> effectiveBlocksIn)
this.toolMaterial = material; {
this.effectiveBlocks = effectiveBlocks; this.efficiencyOnProperMaterial = 4.0F;
this.toolMaterial = materialIn;
this.effectiveBlocks = effectiveBlocksIn;
this.maxStackSize = 1; this.maxStackSize = 1;
this.setMaxDamage(material.getMaxUses()); this.setMaxDamage(materialIn.getMaxUses());
this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); this.efficiencyOnProperMaterial = materialIn.getEfficiencyOnProperMaterial();
this.damageVsEntity = attackDamage + material.getDamageVsEntity(); this.damageVsEntity = attackDamageIn + materialIn.getDamageVsEntity();
this.attackSpeed = attackSpeedIn;
this.setCreativeTab(CreativeTabs.tabTools); this.setCreativeTab(CreativeTabs.tabTools);
} }
protected ItemTool(Item.ToolMaterial materialIn, Set<Block> effectiveBlocksIn)
{
this(0.0F, 0.0F, materialIn, effectiveBlocksIn);
}
public float getStrVsBlock(ItemStack stack, IBlockState state)
{
return this.effectiveBlocks.contains(state.getBlock()) ? this.efficiencyOnProperMaterial : 1.0F;
}
public float getStrVsBlock(ItemStack var1, Block block) { public float getStrVsBlock(ItemStack var1, Block block) {
return this.effectiveBlocks.contains(block) ? this.efficiencyOnProperMaterial : 1.0F; return this.effectiveBlocks.contains(block) ? this.efficiencyOnProperMaterial : 1.0F;
} }
@ -124,10 +140,16 @@ public class ItemTool extends Item {
: super.getIsRepairable(itemstack, itemstack1); : super.getIsRepairable(itemstack, itemstack1);
} }
public Multimap<String, AttributeModifier> getItemAttributeModifiers() { public Multimap<String, AttributeModifier> getItemAttributeModifiers()
Multimap multimap = super.getItemAttributeModifiers(); {
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers();
new AttributeModifier(itemModifierUUID, "Tool modifier", (double) this.damageVsEntity, 0));
// if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
// {
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", (double)this.damageVsEntity, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", (double)this.attackSpeed, 0));
// }
return multimap; return multimap;
} }
} }

View File

@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import net.minecraft.network.handshake.client.C00Handshake; import net.minecraft.network.handshake.client.C00Handshake;
import net.minecraft.network.login.client.C00PacketLoginStart; import net.minecraft.network.login.client.C00PacketLoginStart;
import net.minecraft.network.login.client.C01PacketEncryptionResponse; import net.minecraft.network.login.client.C01PacketEncryptionResponse;
@ -107,6 +108,7 @@ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketCooldown;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
/** /**
@ -220,6 +222,9 @@ public enum EnumConnectionState {
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class); this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketCooldown.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class); this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class);

View File

@ -72,6 +72,7 @@ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend; import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketCooldown;
/** /**
* + * +
@ -503,4 +504,6 @@ public interface INetHandlerPlayClient extends INetHandler {
void handleResourcePack(S48PacketResourcePackSend var1); void handleResourcePack(S48PacketResourcePackSend var1);
void handleEntityNBT(S49PacketUpdateEntityNBT var1); void handleEntityNBT(S49PacketUpdateEntityNBT var1);
void handleCooldown(SPacketCooldown var1);
} }

View File

@ -0,0 +1,59 @@
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.item.Item;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class SPacketCooldown implements Packet<INetHandlerPlayClient>
{
private Item item;
private int ticks;
public SPacketCooldown()
{
}
public SPacketCooldown(Item itemIn, int ticksIn)
{
this.item = itemIn;
this.ticks = ticksIn;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.item = Item.getItemById(buf.readVarIntFromBuffer());
this.ticks = buf.readVarIntFromBuffer();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeVarIntToBuffer(Item.getIdFromItem(this.item));
buf.writeVarIntToBuffer(this.ticks);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient handler)
{
handler.handleCooldown(this);
}
public Item getItem()
{
return this.item;
}
public int getTicks()
{
return this.ticks;
}
}

View File

@ -3,10 +3,10 @@ package net.minecraft.potion;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
@ -69,7 +69,7 @@ public class Potion {
public static final Potion digSlowdown = (new Potion(4, new ResourceLocation("mining_fatigue"), true, 4866583)) public static final Potion digSlowdown = (new Potion(4, new ResourceLocation("mining_fatigue"), true, 4866583))
.setPotionName("potion.digSlowDown").setIconIndex(3, 0); .setPotionName("potion.digSlowDown").setIconIndex(3, 0);
public static final Potion damageBoost = (new PotionAttackDamage(5, new ResourceLocation("strength"), false, public static final Potion damageBoost = (new PotionAttackDamage(5, new ResourceLocation("strength"), false,
9643043)).setPotionName("potion.damageBoost").setIconIndex(4, 0).registerPotionAttributeModifier( 9643043, 3.0D)).setPotionName("potion.damageBoost").setIconIndex(4, 0).registerPotionAttributeModifier(
SharedMonsterAttributes.attackDamage, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 2.5D, 2); SharedMonsterAttributes.attackDamage, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 2.5D, 2);
public static final Potion heal = (new PotionHealth(6, new ResourceLocation("instant_health"), false, 16262179)) public static final Potion heal = (new PotionHealth(6, new ResourceLocation("instant_health"), false, 16262179))
.setPotionName("potion.heal"); .setPotionName("potion.heal");
@ -127,7 +127,7 @@ public class Potion {
* + * +
* The weakness Potion object. * The weakness Potion object.
*/ */
public static final Potion weakness = (new PotionAttackDamage(18, new ResourceLocation("weakness"), true, 4738376)) public static final Potion weakness = (new PotionAttackDamage(18, new ResourceLocation("weakness"), true, 4738376, -4.0D))
.setPotionName("potion.weakness").setIconIndex(5, 0).registerPotionAttributeModifier( .setPotionName("potion.weakness").setIconIndex(5, 0).registerPotionAttributeModifier(
SharedMonsterAttributes.attackDamage, "22653B89-116E-49DC-9B6B-9971489B5BE5", 2.0D, 0); SharedMonsterAttributes.attackDamage, "22653B89-116E-49DC-9B6B-9971489B5BE5", 2.0D, 0);
/** /**

View File

@ -33,12 +33,15 @@ import net.minecraft.util.ResourceLocation;
* *
*/ */
public class PotionAttackDamage extends Potion { public class PotionAttackDamage extends Potion {
protected PotionAttackDamage(int potionID, ResourceLocation location, boolean badEffect, int potionColor) { protected final double bonusPerLevel;
protected PotionAttackDamage(int potionID, ResourceLocation location, boolean badEffect, int potionColor, double bonusPerLevelIn) {
super(potionID, location, badEffect, potionColor); super(potionID, location, badEffect, potionColor);
this.bonusPerLevel = bonusPerLevelIn;
} }
public double getAttributeModifierAmount(int modifier, AttributeModifier parAttributeModifier) { public double getAttributeModifierAmount(int amplifier, AttributeModifier modifier) {
return this.id == Potion.weakness.id ? (double) (-0.5F * (float) (modifier + 1)) return this.bonusPerLevel * (double)(amplifier + 1);
: 1.3D * (double) (modifier + 1);
} }
} }

View File

@ -301,6 +301,8 @@ public class ItemInWorldManager {
public boolean tryUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack) { public boolean tryUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack) {
if (this.gameType == WorldSettings.GameType.SPECTATOR) { if (this.gameType == WorldSettings.GameType.SPECTATOR) {
return false; return false;
} else if (entityplayer.getCooldownTracker().hasCooldown(itemstack.getItem())) {
return false;
} else { } else {
int i = itemstack.stackSize; int i = itemstack.stackSize;
int j = itemstack.getMetadata(); int j = itemstack.getMetadata();
@ -366,6 +368,8 @@ public class ItemInWorldManager {
if (itemstack == null) { if (itemstack == null) {
return false; return false;
} else if (entityplayer.getCooldownTracker().hasCooldown(itemstack.getItem())) {
return false;
} else if (this.isCreative()) { } else if (this.isCreative()) {
int j = itemstack.getMetadata(); int j = itemstack.getMetadata();
int i = itemstack.stackSize; int i = itemstack.stackSize;

View File

@ -0,0 +1,17 @@
package net.minecraft.util;
public class CombatRules
{
public static float func_189427_a(float p_189427_0_, float p_189427_1_, float p_189427_2_)
{
float f = 2.0F + p_189427_2_ / 4.0F;
float f1 = MathHelper.clamp_float(p_189427_1_ - p_189427_0_ / f, p_189427_1_ * 0.2F, 20.0F);
return p_189427_0_ * (1.0F - f1 / 25.0F);
}
public static float getDamageAfterMagicAbsorb(float p_188401_0_, float p_188401_1_)
{
float f = MathHelper.clamp_float(p_188401_1_, 0.0F, 20.0F);
return p_188401_0_ * (1.0F - f / 25.0F);
}
}

View File

@ -0,0 +1,89 @@
package net.minecraft.util;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.collect.Maps;
import net.minecraft.item.Item;
public class CooldownTracker
{
private final Map<Item, CooldownTracker.Cooldown> cooldowns = Maps.<Item, CooldownTracker.Cooldown>newHashMap();
private int ticks;
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);
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
{
return 0.0F;
}
}
public void tick()
{
++this.ticks;
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();
if (((CooldownTracker.Cooldown)entry.getValue()).expireTicks <= this.ticks)
{
iterator.remove();
this.notifyOnRemove((Item)entry.getKey());
}
}
}
}
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)
{
this.cooldowns.remove(itemIn);
this.notifyOnRemove(itemIn);
}
protected void notifyOnSet(Item itemIn, int ticksIn)
{
}
protected void notifyOnRemove(Item itemIn)
{
}
class Cooldown
{
final int createTicks;
final int expireTicks;
private Cooldown(int createTicksIn, int expireTicksIn)
{
this.createTicks = createTicksIn;
this.expireTicks = expireTicksIn;
}
}
}

View File

@ -0,0 +1,27 @@
package net.minecraft.util;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.network.play.server.SPacketCooldown;
public class CooldownTrackerServer extends CooldownTracker
{
private final EntityPlayerMP player;
public CooldownTrackerServer(EntityPlayerMP playerIn)
{
this.player = playerIn;
}
protected void notifyOnSet(Item itemIn, int ticksIn)
{
super.notifyOnSet(itemIn, ticksIn);
this.player.playerNetServerHandler.sendPacket(new SPacketCooldown(itemIn, ticksIn));
}
protected void notifyOnRemove(Item itemIn)
{
super.notifyOnRemove(itemIn);
this.player.playerNetServerHandler.sendPacket(new SPacketCooldown(itemIn, 0));
}
}

View File

@ -50,7 +50,10 @@ public enum EnumParticleTypes {
SNOWBALL("snowballpoof", 31, false), SNOW_SHOVEL("snowshovel", 32, false), SLIME("slime", 33, false), SNOWBALL("snowballpoof", 31, false), SNOW_SHOVEL("snowshovel", 32, false), SLIME("slime", 33, false),
HEART("heart", 34, false), BARRIER("barrier", 35, false), ITEM_CRACK("iconcrack_", 36, false, 2), HEART("heart", 34, false), BARRIER("barrier", 35, false), ITEM_CRACK("iconcrack_", 36, false, 2),
BLOCK_CRACK("blockcrack_", 37, false, 1), BLOCK_DUST("blockdust_", 38, false, 1), WATER_DROP("droplet", 39, false), BLOCK_CRACK("blockcrack_", 37, false, 1), BLOCK_DUST("blockdust_", 38, false, 1), WATER_DROP("droplet", 39, false),
ITEM_TAKE("take", 40, false), MOB_APPEARANCE("mobappearance", 41, true); ITEM_TAKE("take", 40, false), MOB_APPEARANCE("mobappearance", 41, true), DRAGON_BREATH("dragonbreath", 42, false),
END_ROD("endRod", 43, false),
DAMAGE_INDICATOR("damageIndicator", 44, true),
SWEEP_ATTACK("sweepAttack", 45, true);
public static final EnumParticleTypes[] _VALUES = values(); public static final EnumParticleTypes[] _VALUES = values();