1
0
Fork 0

end rods and offhand shit

This commit is contained in:
HoosierTransfer 2024-05-27 10:28:25 -04:00
parent 11b196d681
commit d6847afd57
58 changed files with 2473 additions and 1041 deletions

View File

@ -0,0 +1,45 @@
{
"display": {
"head": {
"rotation": [ -60, 0, 0 ],
"translation": [ 0, 5, -9],
"scale":[ 1, 1, 1]
},
"thirdperson_righthand": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"ambientocclusion": false,
"textures": {
"end_rod": "blocks/end_rod",
"particle": "blocks/end_rod"
},
"elements": [
{
"from": [ 6, 0, 6 ],
"to": [ 10, 1, 10 ],
"faces": {
"down": { "uv": [ 6, 6, 2, 2 ], "texture": "#end_rod" },
"up": { "uv": [ 2, 2, 6, 6 ], "texture": "#end_rod" },
"north": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" },
"south": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" },
"west": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" },
"east": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" }
}
},
{
"from": [ 7, 1, 7 ],
"to": [ 9, 16, 9 ],
"faces": {
"down": { "uv": [ 4, 2, 2, 0 ], "texture": "#end_rod" },
"up": { "uv": [ 2, 0, 4, 2 ], "texture": "#end_rod" },
"north": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" },
"south": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" },
"west": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" },
"east": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" }
}
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/end_rod",
"textures": {
"layer0": "blocks/end_rod"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -19,6 +19,8 @@ public class Config {
public static int protocolVersion = 110;
public static boolean developmentBuild = true;
public static boolean disableAlpha() {
return Minecraft.getMinecraft().gameSettings.disableAlpha && !Minecraft.getMinecraft().gameSettings.shaders;
}
@ -36,6 +38,6 @@ public class Config {
}
public static boolean renderParticles() {
return false;
return true;
}
}

View File

@ -4,10 +4,14 @@ import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Quaternion;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
/**
@ -34,7 +38,7 @@ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
*
*/
public class GlStateManager {
private static final FloatBuffer BUF_FLOAT_16 = EagRuntime.allocateFloatBuffer(16);
static final Logger logger = LogManager.getLogger("GlStateManager");
static boolean stateDepthTest = false;
@ -854,6 +858,41 @@ public class GlStateManager {
private static final Vector3f paramVector = new Vector3f();
private static final float toRad = 0.0174532925f;
public static FloatBuffer quatToGlMatrix(FloatBuffer p_187418_0_, Quaternion p_187418_1_) {
p_187418_0_.clear();
float f = p_187418_1_.x * p_187418_1_.x;
float f1 = p_187418_1_.x * p_187418_1_.y;
float f2 = p_187418_1_.x * p_187418_1_.z;
float f3 = p_187418_1_.x * p_187418_1_.w;
float f4 = p_187418_1_.y * p_187418_1_.y;
float f5 = p_187418_1_.y * p_187418_1_.z;
float f6 = p_187418_1_.y * p_187418_1_.w;
float f7 = p_187418_1_.z * p_187418_1_.z;
float f8 = p_187418_1_.z * p_187418_1_.w;
p_187418_0_.put(1.0F - 2.0F * (f4 + f7));
p_187418_0_.put(2.0F * (f1 + f8));
p_187418_0_.put(2.0F * (f2 - f6));
p_187418_0_.put(0.0F);
p_187418_0_.put(2.0F * (f1 - f8));
p_187418_0_.put(1.0F - 2.0F * (f + f7));
p_187418_0_.put(2.0F * (f5 + f3));
p_187418_0_.put(0.0F);
p_187418_0_.put(2.0F * (f2 + f6));
p_187418_0_.put(2.0F * (f5 - f3));
p_187418_0_.put(1.0F - 2.0F * (f + f4));
p_187418_0_.put(0.0F);
p_187418_0_.put(0.0F);
p_187418_0_.put(0.0F);
p_187418_0_.put(0.0F);
p_187418_0_.put(1.0F);
p_187418_0_.rewind();
return p_187418_0_;
}
public static final void rotate(Quaternion quaternion) {
multMatrix(quatToGlMatrix(BUF_FLOAT_16, quaternion));
}
public static final void rotate(float angle, float x, float y, float z) {
paramVector.x = x;
paramVector.y = y;
@ -966,6 +1005,31 @@ public class GlStateManager {
private static final Matrix4f paramMatrix = new Matrix4f();
public static final void multMatrix(FloatBuffer matrix) {
Matrix4f modeMatrix;
switch (stateMatrixMode) {
case GL_MODELVIEW:
default:
modeMatrix = modelMatrixStack[modelMatrixStackPointer];
modelMatrixStackAccessSerial[modelMatrixStackPointer] = ++modelMatrixAccessSerial;
break;
case GL_PROJECTION:
modeMatrix = projectionMatrixStack[projectionMatrixStackPointer];
projectionMatrixStackAccessSerial[projectionMatrixStackPointer] = ++projectionMatrixAccessSerial;
break;
case GL_TEXTURE:
int ptr = textureMatrixStackPointer[activeTexture];
modeMatrix = textureMatrixStack[activeTexture][ptr];
textureMatrixStackAccessSerial[activeTexture][textureMatrixStackPointer[activeTexture]] = ++textureMatrixAccessSerial[activeTexture];
break;
}
paramMatrix.load(matrix);
Matrix4f.mul(modeMatrix, paramMatrix, modeMatrix);
}
public static final void multMatrix(float[] matrix) {
Matrix4f modeMatrix;

View File

@ -27,14 +27,21 @@ import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -55,12 +62,12 @@ public class RenderHighPoly extends RenderPlayer {
double nameY = d1;
HighPolySkin highPolySkin = abstractclientplayer.getEaglerSkinModel().highPoly;
if(highPolySkin == null) {
if (highPolySkin == null) {
super.doRender(abstractclientplayer, d0, d1, d2, f, f1);
return;
}else if(highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
} else if (highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
nameY += 0.1;
}else if(highPolySkin == HighPolySkin.BABY_WINSTON) {
} else if (highPolySkin == HighPolySkin.BABY_WINSTON) {
nameY -= 1.0;
}
@ -69,14 +76,17 @@ public class RenderHighPoly extends RenderPlayer {
try {
Minecraft mc = Minecraft.getMinecraft();
float f2 = this.interpolateRotation(abstractclientplayer.prevRenderYawOffset, abstractclientplayer.renderYawOffset,
float f2 = this.interpolateRotation(abstractclientplayer.prevRenderYawOffset,
abstractclientplayer.renderYawOffset,
f1);
float f3 = this.interpolateRotation(abstractclientplayer.prevRotationYawHead, abstractclientplayer.rotationYawHead,
float f3 = this.interpolateRotation(abstractclientplayer.prevRotationYawHead,
abstractclientplayer.rotationYawHead,
f1);
float f4 = f3 - f2;
if (abstractclientplayer.isRiding() && abstractclientplayer.ridingEntity instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase1 = (EntityLivingBase) abstractclientplayer.ridingEntity;
f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset,
f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset,
entitylivingbase1.renderYawOffset,
f1);
f4 = f3 - f2;
float f5 = MathHelper.wrapAngleTo180_float(f4);
@ -100,42 +110,44 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.enableRescaleNormal();
this.preRenderCallback(abstractclientplayer, f1);
float f6 = 0.0625F;
GlStateManager.scale(HighPolySkin.highPolyScale, HighPolySkin.highPolyScale, HighPolySkin.highPolyScale);
GlStateManager.scale(HighPolySkin.highPolyScale, HighPolySkin.highPolyScale,
HighPolySkin.highPolyScale);
mc.getTextureManager().bindTexture(highPolySkin.texture);
if(abstractclientplayer.isPlayerSleeping()) {
if(highPolySkin == HighPolySkin.LAXATIVE_DUDE || highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
if (abstractclientplayer.isPlayerSleeping()) {
if (highPolySkin == HighPolySkin.LAXATIVE_DUDE || highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
GlStateManager.translate(0.0f, -3.7f, 0.0f);
}else if(highPolySkin == HighPolySkin.BABY_WINSTON) {
} else if (highPolySkin == HighPolySkin.BABY_WINSTON) {
GlStateManager.translate(0.0f, -2.4f, 0.0f);
}else {
} else {
GlStateManager.translate(0.0f, -3.0f, 0.0f);
}
}
float var15 = abstractclientplayer.prevLimbSwingAmount + (abstractclientplayer.limbSwingAmount - abstractclientplayer.prevLimbSwingAmount) * f1;
float var15 = abstractclientplayer.prevLimbSwingAmount
+ (abstractclientplayer.limbSwingAmount - abstractclientplayer.prevLimbSwingAmount) * f1;
float var16 = abstractclientplayer.limbSwing - abstractclientplayer.limbSwingAmount * (1.0F - f1);
if(highPolySkin == HighPolySkin.LONG_ARMS) {
if (highPolySkin == HighPolySkin.LONG_ARMS) {
GlStateManager.rotate(MathHelper.sin(var16) * 20f * var15, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(MathHelper.cos(var16) * 7f * var15, 0.0f, 0.0f, 1.0f);
}else if(highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
} else if (highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
GlStateManager.rotate(MathHelper.sin(var16) * 7f * var15, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(MathHelper.cos(var16) * 3f * var15, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(-f3, 0.0f, 1.0f, 0.0f);
float xd = (float)(abstractclientplayer.posX - abstractclientplayer.prevPosX);
float xd = (float) (abstractclientplayer.posX - abstractclientplayer.prevPosX);
GlStateManager.rotate(xd * 70.0f * var15, 0.0f, 0.0f, 1.0f);
float zd = (float)(abstractclientplayer.posZ - abstractclientplayer.prevPosZ);
float zd = (float) (abstractclientplayer.posZ - abstractclientplayer.prevPosZ);
GlStateManager.rotate(zd * 70.0f * var15, 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(f3, 0.0f, 1.0f, 0.0f);
}else if(highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
} else if (highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
GlStateManager.rotate(-f3, 0.0f, 1.0f, 0.0f);
float xd = (float)(abstractclientplayer.posX - abstractclientplayer.prevPosX);
float xd = (float) (abstractclientplayer.posX - abstractclientplayer.prevPosX);
GlStateManager.rotate(-xd * 40.0f * var15, 0.0f, 0.0f, 1.0f);
float zd = (float)(abstractclientplayer.posZ - abstractclientplayer.prevPosZ);
float zd = (float) (abstractclientplayer.posZ - abstractclientplayer.prevPosZ);
GlStateManager.rotate(-zd * 40.0f * var15, 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(f3, 0.0f, 1.0f, 0.0f);
}else if(highPolySkin == HighPolySkin.BABY_WINSTON) {
} else if (highPolySkin == HighPolySkin.BABY_WINSTON) {
GlStateManager.translate(0.0f, (MathHelper.cos(f10 % 100000.0f) + 1.0f) * var15 * 0.2f, 0.0f);
GlStateManager.rotate(MathHelper.sin(var16) * 5f * var15, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(MathHelper.cos(var16) * 5f * var15, 0.0f, 0.0f, 1.0f);
@ -145,134 +157,148 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.color(1.2f, 0.8F, 0.8F, 1.0F);
}
if(DeferredStateManager.isInDeferredPass()) {
if (DeferredStateManager.isInDeferredPass()) {
DeferredStateManager.setDefaultMaterialConstants();
DeferredStateManager.setRoughnessConstant(0.5f);
DeferredStateManager.setMetalnessConstant(0.05f);
}
if(highPolySkin.bodyModel != null) {
if (highPolySkin.bodyModel != null) {
EaglercraftGPU.drawHighPoly(EaglerMeshLoader.getEaglerMesh(highPolySkin.bodyModel));
}
float jumpFactor = 0.0f;
if(highPolySkin.headModel != null) {
if(highPolySkin == HighPolySkin.BABY_CHARLES) {
if (highPolySkin.headModel != null) {
if (highPolySkin == HighPolySkin.BABY_CHARLES) {
long millis = System.currentTimeMillis();
float partialTicks = (float) ((millis - abstractclientplayer.eaglerHighPolyAnimationTick) * 0.02);
//long l50 = millis / 50l * 50l;
//boolean runTick = par1EntityPlayer.eaglerHighPolyAnimationTick < l50 && millis >= l50;
float partialTicks = (float) ((millis - abstractclientplayer.eaglerHighPolyAnimationTick)
* 0.02);
// long l50 = millis / 50l * 50l;
// boolean runTick = par1EntityPlayer.eaglerHighPolyAnimationTick < l50 &&
// millis >= l50;
abstractclientplayer.eaglerHighPolyAnimationTick = millis;
if(partialTicks < 0.0f) {
if (partialTicks < 0.0f) {
partialTicks = 0.0f;
}
if(partialTicks > 1.0f) {
if (partialTicks > 1.0f) {
partialTicks = 1.0f;
}
float jumpFac = (float)(abstractclientplayer.posY - abstractclientplayer.prevPosY);
if(jumpFac < 0.0f && !abstractclientplayer.isCollidedVertically) {
float jumpFac = (float) (abstractclientplayer.posY - abstractclientplayer.prevPosY);
if (jumpFac < 0.0f && !abstractclientplayer.isCollidedVertically) {
jumpFac = -jumpFac;
jumpFac *= 0.1f;
}
jumpFac -= 0.05f;
if(jumpFac > 0.1f && !abstractclientplayer.isCollidedVertically) {
if (jumpFac > 0.1f && !abstractclientplayer.isCollidedVertically) {
jumpFac = 0.1f;
}else if(jumpFac < 0.0f) {
} else if (jumpFac < 0.0f) {
jumpFac = 0.0f;
}else if(jumpFac > 0.1f && abstractclientplayer.isCollidedVertically) {
} else if (jumpFac > 0.1f && abstractclientplayer.isCollidedVertically) {
jumpFac = 0.1f;
}else if(jumpFac > 0.4f) {
} else if (jumpFac > 0.4f) {
jumpFac = 0.4f;
}
jumpFac *= 10.0f;
abstractclientplayer.eaglerHighPolyAnimationFloat3 += (jumpFac / (jumpFac + 1.0f)) * 6.0f * partialTicks;
abstractclientplayer.eaglerHighPolyAnimationFloat3 += (jumpFac / (jumpFac + 1.0f)) * 6.0f
* partialTicks;
if(Float.isInfinite(abstractclientplayer.eaglerHighPolyAnimationFloat3)) {
if (Float.isInfinite(abstractclientplayer.eaglerHighPolyAnimationFloat3)) {
abstractclientplayer.eaglerHighPolyAnimationFloat3 = 1.0f;
}else if(abstractclientplayer.eaglerHighPolyAnimationFloat3 > 1.0f) {
} else if (abstractclientplayer.eaglerHighPolyAnimationFloat3 > 1.0f) {
abstractclientplayer.eaglerHighPolyAnimationFloat3 = 1.0f;
}else if(abstractclientplayer.eaglerHighPolyAnimationFloat3 < -1.0f) {
} else if (abstractclientplayer.eaglerHighPolyAnimationFloat3 < -1.0f) {
abstractclientplayer.eaglerHighPolyAnimationFloat3 = -1.0f;
}
abstractclientplayer.eaglerHighPolyAnimationFloat2 += abstractclientplayer.eaglerHighPolyAnimationFloat3 * partialTicks;
abstractclientplayer.eaglerHighPolyAnimationFloat2 += abstractclientplayer.eaglerHighPolyAnimationFloat3
* partialTicks;
abstractclientplayer.eaglerHighPolyAnimationFloat5 += partialTicks;
while(abstractclientplayer.eaglerHighPolyAnimationFloat5 > 0.05f) {
while (abstractclientplayer.eaglerHighPolyAnimationFloat5 > 0.05f) {
abstractclientplayer.eaglerHighPolyAnimationFloat5 -= 0.05f;
abstractclientplayer.eaglerHighPolyAnimationFloat3 *= 0.99f;
abstractclientplayer.eaglerHighPolyAnimationFloat2 *= 0.9f;
}
jumpFactor = abstractclientplayer.eaglerHighPolyAnimationFloat2; //(abstractclientplayer.eaglerHighPolyAnimationFloat1 - abstractclientplayer.eaglerHighPolyAnimationFloat2) * partialTicks + abstractclientplayer.eaglerHighPolyAnimationFloat2;
jumpFactor = abstractclientplayer.eaglerHighPolyAnimationFloat2; // (abstractclientplayer.eaglerHighPolyAnimationFloat1
// -
// abstractclientplayer.eaglerHighPolyAnimationFloat2)
// * partialTicks +
// abstractclientplayer.eaglerHighPolyAnimationFloat2;
jumpFactor -= 0.12f;
if(jumpFactor < 0.0f) {
if (jumpFactor < 0.0f) {
jumpFactor = 0.0f;
}
jumpFactor = jumpFactor / (jumpFactor + 2.0f);
if(jumpFactor > 1.0f) {
if (jumpFactor > 1.0f) {
jumpFactor = 1.0f;
}
}
if(jumpFactor > 0.0f) {
if (jumpFactor > 0.0f) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0f, jumpFactor * 3.0f, 0.0f);
}
EaglercraftGPU.drawHighPoly(EaglerMeshLoader.getEaglerMesh(highPolySkin.headModel));
if(jumpFactor > 0.0f) {
if (jumpFactor > 0.0f) {
GlStateManager.popMatrix();
}
}
if(highPolySkin.limbsModel != null && highPolySkin.limbsModel.length > 0) {
for(int i = 0; i < highPolySkin.limbsModel.length; ++i) {
if (highPolySkin.limbsModel != null && highPolySkin.limbsModel.length > 0) {
for (int i = 0; i < highPolySkin.limbsModel.length; ++i) {
DeferredStateManager.setRoughnessConstant(0.023f);
DeferredStateManager.setMetalnessConstant(0.902f);
float offset = 0.0f;
if(highPolySkin.limbsOffset != null) {
if(highPolySkin.limbsOffset.length == 1) {
if (highPolySkin.limbsOffset != null) {
if (highPolySkin.limbsOffset.length == 1) {
offset = highPolySkin.limbsOffset[0];
}else {
} else {
offset = highPolySkin.limbsOffset[i];
}
}
GlStateManager.pushMatrix();
if(offset != 0.0f || highPolySkin.limbsInitialRotation != 0.0f) {
if(offset != 0.0f) {
if (offset != 0.0f || highPolySkin.limbsInitialRotation != 0.0f) {
if (offset != 0.0f) {
GlStateManager.translate(0.0f, offset, 0.0f);
}
if(highPolySkin.limbsInitialRotation != 0.0f) {
if (highPolySkin.limbsInitialRotation != 0.0f) {
GlStateManager.rotate(highPolySkin.limbsInitialRotation, 1.0f, 0.0f, 0.0f);
}
}
if(highPolySkin == HighPolySkin.LONG_ARMS) {
if(abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
if (highPolySkin == HighPolySkin.LONG_ARMS) {
if (abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper
.cos(-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 *= var17;
GlStateManager.rotate(-var17 * 20.0f, 1.0f, 0.0f, 0.0f);
}
}else if(highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
if(abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
} else if (highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
if (abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper
.cos(-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 *= var17;
GlStateManager.rotate(var17 * 60.0f, 1.0f, 0.0f, 0.0f);
}
GlStateManager.rotate(40.0f * var15, 1.0f, 0.0f, 0.0f);
}else if(highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
} else if (highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
float fff = (i == 0) ? 1.0f : -1.0f;
float swing = (MathHelper.cos(f10 % 100000.0f) * fff + 0.2f) * var15;
float swing2 = (MathHelper.cos(f10 % 100000.0f) * fff * 0.5f + 0.0f) * var15;
GlStateManager.rotate(swing * 25.0f, 1.0f, 0.0f, 0.0f);
if(abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
if (abstractclientplayer.isSwingInProgress) {
float var17 = MathHelper
.cos(-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 *= var17;
GlStateManager.rotate(-var17 * 25.0f, 1.0f, 0.0f, 0.0f);
}
@ -284,76 +310,81 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.multMatrix(tmpMatrix);
}
if(i != 0) {
if (i != 0) {
mc.getTextureManager().bindTexture(highPolySkin.texture);
if (abstractclientplayer.hurtTime > 0 || abstractclientplayer.deathTime > 0) {
GlStateManager.color(1.2f, 0.8F, 0.8F, 1.0F);
}else {
} else {
GlStateManager.color(1.0f, 1.0F, 1.0F, 1.0F);
}
}
EaglercraftGPU.drawHighPoly(EaglerMeshLoader.getEaglerMesh(highPolySkin.limbsModel[i]));
if(i == 0) {
if (i == 0) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.287f, 0.05f, 0.0f);
if(highPolySkin == HighPolySkin.LONG_ARMS) {
if (highPolySkin == HighPolySkin.LONG_ARMS) {
GlStateManager.translate(1.72f, 2.05f, -0.24f);
ItemStack stk = abstractclientplayer.getHeldItem();
if(stk != null) {
if (stk != null) {
Item itm = stk.getItem();
if(itm != null) {
if(itm == Items.bow) {
if (itm != null) {
if (itm == Items.bow) {
GlStateManager.translate(-0.22f, 0.8f, 0.6f);
GlStateManager.rotate(-90.0f, 1.0f, 0.0f, 0.0f);
}else if(itm instanceof ItemBlock && !((ItemBlock)itm).getBlock().isNormalCube()) {
} else if (itm instanceof ItemBlock
&& !((ItemBlock) itm).getBlock().isNormalCube()) {
GlStateManager.translate(0.0f, -0.1f, 0.13f);
}else if(!itm.isFull3D()) {
} else if (!itm.isFull3D()) {
GlStateManager.translate(-0.08f, -0.1f, 0.16f);
}
}
}
}else if(highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
} else if (highPolySkin == HighPolySkin.WEIRD_CLIMBER_DUDE) {
GlStateManager.translate(-0.029f, 1.2f, -3f);
GlStateManager.rotate(-5.0f, 0.0f, 1.0f, 0.0f);
float var17 = -1.2f * var15;
if(abstractclientplayer.isSwingInProgress) {
float vvar17 = MathHelper.cos(-abstractclientplayer.getSwingProgress(f1) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
if (abstractclientplayer.isSwingInProgress) {
float vvar17 = MathHelper.cos(
-abstractclientplayer.getSwingProgress(f1) * (float) Math.PI * 2.0f - 1.2f)
- 0.362f;
var17 = vvar17 < var17 ? vvar17 : var17;
}
GlStateManager.translate(-0.02f * var17, 0.42f * var17, var17 * 0.35f);
GlStateManager.rotate(var17 * 30.0f, 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(110.0f, 1.0f, 0.0f, 0.0f);
ItemStack stk = abstractclientplayer.getHeldItem();
if(stk != null) {
if (stk != null) {
Item itm = stk.getItem();
if(itm != null) {
if(itm == Items.bow) {
if (itm != null) {
if (itm == Items.bow) {
GlStateManager.translate(-0.18f, 1.0f, 0.4f);
GlStateManager.rotate(-95.0f, 1.0f, 0.0f, 0.0f);
}else if(itm instanceof ItemBlock && !((ItemBlock)itm).getBlock().isNormalCube()) {
} else if (itm instanceof ItemBlock
&& !((ItemBlock) itm).getBlock().isNormalCube()) {
GlStateManager.translate(0.0f, -0.1f, 0.13f);
}else if(!itm.isFull3D()) {
} else if (!itm.isFull3D()) {
GlStateManager.translate(-0.08f, -0.1f, 0.16f);
}
}
}
}else if(highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
} else if (highPolySkin == HighPolySkin.LAXATIVE_DUDE) {
GlStateManager.translate(1.291f, 2.44f, -2.18f);
GlStateManager.rotate(95.0f, 1.0f, 0.0f, 0.0f);
ItemStack stk = abstractclientplayer.getHeldItem();
if(stk != null) {
if (stk != null) {
Item itm = stk.getItem();
if(itm != null) {
if(itm == Items.bow) {
if (itm != null) {
if (itm == Items.bow) {
GlStateManager.translate(-0.65f, 1.3f, -0.1f);
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(20.0f, 1.0f, 0.0f, 0.0f);
}else if(itm instanceof ItemBlock && !((ItemBlock)itm).getBlock().isNormalCube()) {
} else if (itm instanceof ItemBlock
&& !((ItemBlock) itm).getBlock().isNormalCube()) {
GlStateManager.translate(0.0f, -0.35f, 0.4f);
}else if(!itm.isFull3D()) {
} else if (!itm.isFull3D()) {
GlStateManager.translate(-0.1f, -0.1f, 0.16f);
}
}
@ -369,32 +400,36 @@ public class RenderHighPoly extends RenderPlayer {
}
}
if(highPolySkin.eyesModel != null && !DeferredStateManager.isEnableShadowRender()) {
if (highPolySkin.eyesModel != null && !DeferredStateManager.isEnableShadowRender()) {
float ff = 0.00416f;
int brightness = abstractclientplayer.getBrightnessForRender(0.0f);
float blockLight = (brightness % 65536) * ff;
float skyLight = (brightness / 65536) * ff;
float sunCurve = (float)((abstractclientplayer.worldObj.getWorldTime() + 4000l) % 24000) / 24000.0f;
sunCurve = MathHelper.clamp_float(9.8f - MathHelper.abs(sunCurve * 5.0f + sunCurve * sunCurve * 45.0f - 14.3f) * 0.7f, 0.0f, 1.0f);
float sunCurve = (float) ((abstractclientplayer.worldObj.getWorldTime() + 4000l) % 24000)
/ 24000.0f;
sunCurve = MathHelper.clamp_float(
9.8f - MathHelper.abs(sunCurve * 5.0f + sunCurve * sunCurve * 45.0f - 14.3f) * 0.7f, 0.0f,
1.0f);
skyLight = skyLight * (sunCurve * 0.85f + 0.15f);
blockLight = blockLight * (sunCurve * 0.3f + 0.7f);
float eyeBrightness = blockLight;
if(skyLight > eyeBrightness) {
if (skyLight > eyeBrightness) {
eyeBrightness = skyLight;
}
eyeBrightness += blockLight * 0.2f;
eyeBrightness = 1.0f - eyeBrightness;
eyeBrightness = MathHelper.clamp_float(eyeBrightness * 1.9f - 1.0f, 0.0f, 1.0f);
if(eyeBrightness > 0.1f) {
if(DeferredStateManager.isInDeferredPass()) {
if (eyeBrightness > 0.1f) {
if (DeferredStateManager.isInDeferredPass()) {
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
DeferredStateManager.setDefaultMaterialConstants();
DeferredStateManager.setEmissionConstant(eyeBrightness);
}else {
} else {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_ONE, GL_ONE);
GlStateManager.color(eyeBrightness * 7.0f, eyeBrightness * 7.0f, eyeBrightness * 7.0f, 1.0f);
if(jumpFactor > 0.0f) {
GlStateManager.color(eyeBrightness * 7.0f, eyeBrightness * 7.0f, eyeBrightness * 7.0f,
1.0f);
if (jumpFactor > 0.0f) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0f, jumpFactor * 3.0f, 0.0f);
}
@ -408,16 +443,16 @@ public class RenderHighPoly extends RenderPlayer {
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.disableCull();
if(jumpFactor > 0.0f) {
if (jumpFactor > 0.0f) {
GlStateManager.popMatrix();
}
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
if(!DeferredStateManager.isInDeferredPass()) {
if (!DeferredStateManager.isInDeferredPass()) {
GlStateManager.disableBlend();
}
}
}
}catch(Throwable t) {
} catch (Throwable t) {
logger.error("Couldn\'t render entity");
logger.error(t);
}
@ -464,7 +499,7 @@ public class RenderHighPoly extends RenderPlayer {
}
minecraft.getItemRenderer().renderItem(clientPlayer, itemstack,
ItemCameraTransforms.TransformType.THIRD_PERSON);
ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND);
GlStateManager.popMatrix();
}
}

View File

@ -0,0 +1,138 @@
package net.minecraft.block;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockEndRod extends Block {
public static final PropertyDirection FACING = PropertyDirection.create("facing");
protected static final AxisAlignedBB END_ROD_VERTICAL_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D,
0.625D);
protected static final AxisAlignedBB END_ROD_NS_AABB = new AxisAlignedBB(0.375D, 0.375D, 0.0D, 0.625D, 0.625D,
1.0D);
protected static final AxisAlignedBB END_ROD_EW_AABB = new AxisAlignedBB(0.0D, 0.375D, 0.375D, 1.0D, 0.625D,
0.625D);
protected BlockEndRod() {
super(Material.circuits);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP));
this.setCreativeTab(CreativeTabs.tabDecorations);
}
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockpos, IBlockState iblockstate) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getCollisionBoundingBox(world, blockpos, iblockstate);
}
public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos blockpos) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getSelectedBoundingBox(world, blockpos);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, BlockPos blockpos) {
IBlockState iblockstate = iblockaccess.getBlockState(blockpos);
EnumFacing enumfacing = (EnumFacing) iblockstate.getValue(FACING);
switch (enumfacing.getAxis()) {
case X:
default:
this.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
break;
case Z:
this.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F,
1.0F);
break;
case Y:
this.setBlockBounds(0.0F, 0.375F, 0.375F, 1.0F, 0.625F,
0.625F);
}
}
public boolean isOpaqueCube() {
return false;
}
public boolean isFullCube() {
return false;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return true;
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ,
int meta, EntityLivingBase placer) {
IBlockState iblockstate = worldIn.getBlockState(pos.offset(facing.getOpposite()));
if (iblockstate.getBlock() == EaglerItems.getEaglerBlock("end_rod")) {
EnumFacing enumfacing = (EnumFacing) iblockstate.getValue(FACING);
if (enumfacing == facing) {
return this.getDefaultState().withProperty(FACING, facing.getOpposite());
}
}
return this.getDefaultState().withProperty(FACING, facing);
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
}
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, EaglercraftRandom rand) {
EnumFacing enumfacing = (EnumFacing) stateIn.getValue(FACING);
double d0 = (double) pos.getX() + 0.55D - (double) (rand.nextFloat() * 0.1F);
double d1 = (double) pos.getY() + 0.55D - (double) (rand.nextFloat() * 0.1F);
double d2 = (double) pos.getZ() + 0.55D - (double) (rand.nextFloat() * 0.1F);
double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);
if (rand.nextInt(5) == 0) {
worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double) enumfacing.getFrontOffsetX() * d3,
d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double) enumfacing.getFrontOffsetZ() * d3,
rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
new int[0]);
}
}
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState();
iblockstate = iblockstate.withProperty(FACING, EnumFacing.getFront(meta));
return iblockstate;
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(FACING)).getIndex();
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}
public int getMobilityFlag(IBlockState state) {
return 0;
}
}

View File

@ -167,6 +167,7 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumHand;
import net.minecraft.util.FrameTimer;
import net.minecraft.util.IThreadListener;
import net.minecraft.util.MathHelper;
@ -1240,7 +1241,8 @@ public class Minecraft implements IThreadListener {
if (itemstack.stackSize == 0) {
this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null;
} else if (itemstack.stackSize != i || this.playerController.isInCreativeMode()) {
this.entityRenderer.itemRenderer.resetEquippedProgress();
// TODO: implement offhand
this.entityRenderer.itemRenderer.resetEquippedProgress(EnumHand.MAIN_HAND);
}
}
}
@ -1250,7 +1252,8 @@ public class Minecraft implements IThreadListener {
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
if (itemstack1 != null
&& this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) {
this.entityRenderer.itemRenderer.resetEquippedProgress2();
// TODO: implement offhand
this.entityRenderer.itemRenderer.resetEquippedProgress(EnumHand.MAIN_HAND);
}
}

View File

@ -137,7 +137,7 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
sounds.getSoundCategory());
this.sndRegistry.registerSound(soundeventaccessorcomposite);
}
int currentSoundList = 0;
for (final SoundList.SoundEntry soundlist$soundentry : sounds.getSoundList()) {
String s = soundlist$soundentry.getSoundEntryName();
ResourceLocation resourcelocation = new ResourceLocation(s);
@ -152,8 +152,10 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
try {
inputstream = this.mcResourceManager.getResource(resourcelocation1).getInputStream();
} catch (FileNotFoundException var18) {
if (currentSoundList == 1) {
logger.warn("File {} does not exist, cannot add it to event {}",
new Object[] { resourcelocation1, location });
}
continue;
} catch (IOException ioexception) {
logger.warn(
@ -194,6 +196,7 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
}
soundeventaccessorcomposite.addSoundToEventPool((ISoundEventAccessor<SoundPoolEntry>) object);
++currentSoundList;
}
}

View File

@ -148,6 +148,8 @@ public class EntityOtherPlayerMP extends AbstractClientPlayer {
public void setCurrentItemOrArmor(int slotIn, ItemStack stack) {
if (slotIn == 0) {
this.inventory.mainInventory[this.inventory.currentItem] = stack;
} else if (slotIn == 5) {
this.inventory.offHandInventory[0] = stack;
} else {
this.inventory.armorInventory[slotIn - 1] = stack;
}

View File

@ -26,6 +26,7 @@ import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.passive.EntityHorse;
@ -113,6 +114,8 @@ public class EntityPlayerSP extends AbstractClientPlayer {
public float prevTimeInPortal;
private StatFileWriter statWriter;
private boolean rowingBoat;
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatFileWriter statWriter) {
super(worldIn, netHandler.getGameProfile());
this.sendQueue = netHandler;
@ -149,6 +152,31 @@ public class EntityPlayerSP extends AbstractClientPlayer {
}
public void dismountEntity(Entity parEntity) {
super.dismountEntity(parEntity);
this.rowingBoat = false;
}
public void updateRidden() {
super.updateRidden();
this.rowingBoat = false;
if (this.ridingEntity instanceof EntityBoat) {
EntityBoat entityboat = (EntityBoat) this.ridingEntity;
// TODO: fix boats
// entityboat.updateInputs(this.movementInput.leftKeyDown,
// this.movementInput.rightKeyDown,
// this.movementInput.forwardKeyDown, this.movementInput.backKeyDown);
// this.rowingBoat |= this.movementInput.leftKeyDown ||
// this.movementInput.rightKeyDown
// || this.movementInput.forwardKeyDown || this.movementInput.backKeyDown;
}
}
public boolean isRowingBoat() {
return this.rowingBoat;
}
/**
* +
* Called to update the entity's position/logic.

View File

@ -4,6 +4,8 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import java.util.ArrayList;
import java.util.Collection;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
@ -148,6 +150,12 @@ public class GuiIngame extends Gui {
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.enableDepth();
GlStateManager.disableLighting();
if (Config.developmentBuild) {
// draw a yellow transparent rectangle on the top of the screen
drawRect(0, 0, i, 10, 0x80FFFF00);
// draw text in the middle of the rectangle
drawCenteredString(this.mc.fontRendererObj, "Development Build. Issues WILL arise.", i / 2, 1, 0xFFFFFF);
}
ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3);
if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null

View File

@ -12,6 +12,7 @@ import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglerXBungeeVersion;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
@ -104,6 +105,13 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback {
* mouseY, renderPartialTicks
*/
public void drawScreen(int i, int j, float var3) {
if (Config.developmentBuild) {
// draw a yellow transparent rectangle on the top of the screen
drawRect(0, 0, width, 10, 0x80FFFF00);
// draw text in the middle of the rectangle
drawCenteredString(fontRendererObj, "Development Build. Issues WILL arise.", width / 2, 1, 0xFFFFFF);
}
for (int k = 0, l = this.buttonList.size(); k < l; ++k) {
((GuiButton) this.buttonList.get(k)).drawButton(this.mc, i, j);
}

View File

@ -116,32 +116,32 @@ public abstract class GuiContainer extends GuiScreen {
* Draws the screen and all the components in it. Args : mouseX,
* mouseY, renderPartialTicks
*/
public void drawScreen(int i, int j, float f) {
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
int k = this.guiLeft;
int l = this.guiTop;
this.drawGuiContainerBackgroundLayer(f, i, j);
int i = this.guiLeft;
int j = this.guiTop;
this.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
super.drawScreen(i, j, f);
super.drawScreen(mouseX, mouseY, partialTicks);
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.pushMatrix();
GlStateManager.translate((float) k, (float) l, 0.0F);
GlStateManager.translate((float) i, (float) j, 0.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableRescaleNormal();
this.theSlot = null;
short short1 = 240;
short short2 = 240;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) short1 / 1.0F,
(float) short2 / 1.0F);
int k = 240;
int l = 240;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) k, (float) l);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i1);
this.drawSlot(slot);
if (this.isMouseOverSlot(slot, i, j) && slot.canBeHovered()) {
if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.canBeHovered()) {
this.theSlot = slot;
GlStateManager.disableLighting();
GlStateManager.disableDepth();
@ -153,50 +153,54 @@ public abstract class GuiContainer extends GuiScreen {
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
GlStateManager.enableAlpha();
}
RenderHelper.disableStandardItemLighting();
this.drawGuiContainerForegroundLayer(i, j);
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
RenderHelper.enableGUIStandardItemLighting();
InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
if (itemstack != null) {
byte b0 = 8;
int j2 = this.draggedStack == null ? 8 : 16;
int j2 = 8;
int k2 = this.draggedStack == null ? 8 : 16;
String s = null;
if (this.draggedStack != null && this.isRightMouseClick) {
itemstack = itemstack.copy();
itemstack.stackSize = MathHelper.ceiling_float_int((float) itemstack.stackSize / 2.0F);
} else if (this.dragSplitting && this.dragSplittingSlots.size() > 1) {
itemstack = itemstack.copy();
itemstack.stackSize = this.dragSplittingRemnant;
if (itemstack.stackSize == 0) {
s = "" + EnumChatFormatting.YELLOW + "0";
}
}
this.drawItemStack(itemstack, i - k - b0, j - l - j2, s);
this.drawItemStack(itemstack, mouseX - i - j2, mouseY - j - k2, s);
}
if (this.returningStack != null) {
float f1 = (float) (Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
if (f1 >= 1.0F) {
f1 = 1.0F;
float f = (float) (Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
if (f >= 1.0F) {
f = 1.0F;
this.returningStack = null;
}
int k2 = this.returningStackDestSlot.xDisplayPosition - this.touchUpX;
int l2 = this.returningStackDestSlot.yDisplayPosition - this.touchUpY;
int l1 = this.touchUpX + (int) ((float) k2 * f1);
int i2 = this.touchUpY + (int) ((float) l2 * f1);
int l2 = this.returningStackDestSlot.xDisplayPosition - this.touchUpX;
int i3 = this.returningStackDestSlot.yDisplayPosition - this.touchUpY;
int l1 = this.touchUpX + (int) ((float) l2 * f);
int i2 = this.touchUpY + (int) ((float) i3 * f);
this.drawItemStack(this.returningStack, l1, i2, (String) null);
}
GlStateManager.popMatrix();
if (inventoryplayer.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack()) {
ItemStack itemstack1 = this.theSlot.getStack();
this.renderToolTip(itemstack1, i, j);
this.renderToolTip(itemstack1, mouseX, mouseY);
}
GlStateManager.enableLighting();
@ -237,6 +241,7 @@ public abstract class GuiContainer extends GuiScreen {
boolean flag1 = slotIn == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
String s = null;
if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null) {
itemstack = itemstack.copy();
itemstack.stackSize /= 2;
@ -250,6 +255,7 @@ public abstract class GuiContainer extends GuiScreen {
flag = true;
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack,
slotIn.getStack() == null ? 0 : slotIn.getStack().stackSize);
if (itemstack.stackSize > itemstack.getMaxStackSize()) {
s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
itemstack.stackSize = itemstack.getMaxStackSize();
@ -267,8 +273,10 @@ public abstract class GuiContainer extends GuiScreen {
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
if (itemstack == null) {
if (itemstack == null && slotIn.canBeHovered()) {
String s1 = slotIn.getSlotTexture();
if (s1 != null) {
EaglerTextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1);
GlStateManager.disableLighting();

View File

@ -260,7 +260,6 @@ public class GuiContainerCreative extends InventoryEffectRenderer {
} else {
this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer));
}
}
/**
@ -434,34 +433,39 @@ public class GuiContainerCreative extends InventoryEffectRenderer {
parCreativeTabs.displayAllReleventItems(guicontainercreative$containercreative.itemList);
if (parCreativeTabs == CreativeTabs.tabInventory) {
Container container = this.mc.thePlayer.inventoryContainer;
if (this.field_147063_B == null) {
this.field_147063_B = guicontainercreative$containercreative.inventorySlots;
}
guicontainercreative$containercreative.inventorySlots = Lists.newArrayList();
guicontainercreative$containercreative.inventorySlots = Lists.<Slot>newArrayList();
for (int j = 0; j < container.inventorySlots.size(); ++j) {
GuiContainerCreative.CreativeSlot guicontainercreative$creativeslot = new GuiContainerCreative.CreativeSlot(
(Slot) container.inventorySlots.get(j), j);
guicontainercreative$containercreative.inventorySlots.add(guicontainercreative$creativeslot);
Slot slot = new GuiContainerCreative.CreativeSlot((Slot) container.inventorySlots.get(j), j);
guicontainercreative$containercreative.inventorySlots.add(slot);
if (j >= 5 && j < 9) {
int j1 = j - 5;
int k1 = j1 / 2;
int l1 = j1 % 2;
guicontainercreative$creativeslot.xDisplayPosition = 9 + k1 * 54;
guicontainercreative$creativeslot.yDisplayPosition = 6 + l1 * 27;
slot.xDisplayPosition = 54 + k1 * 54;
slot.yDisplayPosition = 6 + l1 * 27;
} else if (j >= 0 && j < 5) {
guicontainercreative$creativeslot.yDisplayPosition = -2000;
guicontainercreative$creativeslot.xDisplayPosition = -2000;
slot.xDisplayPosition = -2000;
slot.yDisplayPosition = -2000;
} else if (j == 45) {
slot.xDisplayPosition = 35;
slot.yDisplayPosition = 20;
} else if (j < container.inventorySlots.size()) {
int k = j - 9;
int l = k % 9;
int i1 = k / 9;
guicontainercreative$creativeslot.xDisplayPosition = 9 + l * 18;
slot.xDisplayPosition = 9 + l * 18;
if (j >= 36) {
guicontainercreative$creativeslot.yDisplayPosition = 112;
slot.yDisplayPosition = 112;
} else {
guicontainercreative$creativeslot.yDisplayPosition = 54 + i1 * 18;
slot.yDisplayPosition = 54 + i1 * 18;
}
}
}
@ -635,8 +639,9 @@ public class GuiContainerCreative extends InventoryEffectRenderer {
this.func_147051_a(creativetabs);
if (creativetabs == CreativeTabs.tabInventory) {
GuiInventory.drawEntityOnScreen(this.guiLeft + 43, this.guiTop + 45, 20, (float) (this.guiLeft + 43 - i),
(float) (this.guiTop + 45 - 30 - j), this.mc.thePlayer);
GuiInventory.drawEntityOnScreen(this.guiLeft + 88, this.guiTop + 45, 20,
(float) (this.guiLeft + 88 - i), (float) (this.guiTop + 45 - 30 - j), this.mc.thePlayer);
}
}

View File

@ -85,7 +85,7 @@ public class GuiInventory extends InventoryEffectRenderer {
* front of the items). Args : mouseX, mouseY
*/
protected void drawGuiContainerForegroundLayer(int var1, int var2) {
this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 86, 16, 4210752);
this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 97, 8, 4210752);
}
/**

View File

@ -3,6 +3,7 @@ package net.minecraft.client.model;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.util.EnumHandSide;
/**
* +
@ -150,9 +151,10 @@ public class ModelArmorStand extends ModelArmorStandArmor {
}
public void postRenderArm(float scale) {
// TODO: implement offhand
boolean flag = this.bipedRightArm.showModel;
this.bipedRightArm.showModel = true;
super.postRenderArm(scale);
super.postRenderArm(scale, EnumHandSide.RIGHT);
this.bipedRightArm.showModel = flag;
}
}

View File

@ -3,50 +3,30 @@ package net.minecraft.client.model;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.MathHelper;
/**
* +
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
*
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights
* Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class ModelBiped extends ModelBase {
public ModelRenderer bipedHead;
/** The Biped's Headwear. Used for the outer layer of player skins. */
public ModelRenderer bipedHeadwear;
public ModelRenderer bipedBody;
/** The Biped's Right Arm */
public ModelRenderer bipedRightArm;
/** The Biped's Left Arm */
public ModelRenderer bipedLeftArm;
/** The Biped's Right Leg */
public ModelRenderer bipedRightLeg;
/** The Biped's Left Leg */
public ModelRenderer bipedLeftLeg;
public int heldItemLeft;
public int heldItemRight;
public ModelBiped.ArmPose leftArmPose;
public ModelBiped.ArmPose rightArmPose;
public boolean isSneak;
public boolean aimedBow;
public ModelBiped() {
this(0.0F);
@ -56,147 +36,184 @@ public class ModelBiped extends ModelBase {
this(modelSize, 0.0F, 64, 32);
}
public ModelBiped(float modelSize, float parFloat1, int textureWidthIn, int textureHeightIn) {
public ModelBiped(float modelSize, float p_i1149_2_, int textureWidthIn, int textureHeightIn) {
this.leftArmPose = ModelBiped.ArmPose.EMPTY;
this.rightArmPose = ModelBiped.ArmPose.EMPTY;
this.textureWidth = textureWidthIn;
this.textureHeight = textureHeightIn;
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize);
this.bipedHead.setRotationPoint(0.0F, 0.0F + parFloat1, 0.0F);
this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize + 0.5F);
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + parFloat1, 0.0F);
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
this.bipedBody = new ModelRenderer(this, 16, 16);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, modelSize);
this.bipedBody.setRotationPoint(0.0F, 0.0F + parFloat1, 0.0F);
this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, modelSize);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + parFloat1, 0.0F);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, modelSize);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + parFloat1, 0.0F);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize);
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + parFloat1, 0.0F);
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + p_i1149_2_, 0.0F);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize);
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + parFloat1, 0.0F);
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F);
}
/**
* +
* Sets the models various rotation angles then renders the
* model.
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
float headPitch, float scale) {
this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);
GlStateManager.pushMatrix();
if (this.isChild) {
float f6 = 2.0F;
GlStateManager.scale(1.5F / f6, 1.5F / f6, 1.5F / f6);
GlStateManager.translate(0.0F, 16.0F * f5, 0.0F);
this.bipedHead.render(f5);
float f = 2.0F;
GlStateManager.scale(1.5F / f, 1.5F / f, 1.5F / f);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
this.bipedHead.render(scale);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.scale(1.0F / f6, 1.0F / f6, 1.0F / f6);
GlStateManager.translate(0.0F, 24.0F * f5, 0.0F);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
this.bipedBody.render(scale);
this.bipedRightArm.render(scale);
this.bipedLeftArm.render(scale);
this.bipedRightLeg.render(scale);
this.bipedLeftLeg.render(scale);
this.bipedHeadwear.render(scale);
} else {
if (entity != null && entity.isSneaking()) {
if (entityIn != null) {
if (entityIn.isSneaking()) {
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
}
this.bipedHead.render(f5);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
this.bipedHead.render(scale);
this.bipedBody.render(scale);
this.bipedRightArm.render(scale);
this.bipedLeftArm.render(scale);
this.bipedRightLeg.render(scale);
this.bipedLeftLeg.render(scale);
this.bipedHeadwear.render(scale);
}
GlStateManager.popMatrix();
}
@SuppressWarnings("incomplete-switch")
/**
* +
* Sets the model's various rotation angles. For bipeds, par1
* and par2 are used for animating the movement of arms and
* legs, where par1 represents the time(so that arms and legs
* swing back and forth) and par2 represents how "far" arms and
* legs can swing at most.
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used
* for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and
* forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float var6, Entity var7) {
boolean flag = var7 instanceof EntityLivingBase && ((EntityLivingBase) var7).getTicksElytraFlying() > 4;
this.bipedHead.rotateAngleY = f3 / 57.295776F;
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
float headPitch, float scaleFactor, Entity entityIn) {
boolean flag = entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).getTicksElytraFlying() > 4;
this.bipedHead.rotateAngleY = netHeadYaw * 0.017453292F;
if (flag) {
this.bipedHead.rotateAngleX = -((float) Math.PI / 4F);
} else {
this.bipedHead.rotateAngleX = f4 * 0.017453292F;
this.bipedHead.rotateAngleX = headPitch * 0.017453292F;
}
float d = 1.0F;
this.bipedBody.rotateAngleY = 0.0F;
this.bipedRightArm.rotationPointZ = 0.0F;
this.bipedRightArm.rotationPointX = -5.0F;
this.bipedLeftArm.rotationPointZ = 0.0F;
this.bipedLeftArm.rotationPointX = 5.0F;
float f = 1.0F;
if (flag) {
d = (float) (var7.motionX * var7.motionX + var7.motionY * var7.motionY
+ var7.motionZ * var7.motionZ);
d = d / 0.2F;
d = d * d * d;
f = (float) (entityIn.motionX * entityIn.motionX + entityIn.motionY * entityIn.motionY
+ entityIn.motionZ * entityIn.motionZ);
f = f / 0.2F;
f = f * f * f;
}
if (d < 1.0F) {
d = 1.0F;
if (f < 1.0F) {
f = 1.0F;
}
this.bipedRightArm.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.1415927F) * 2.0F * f1 * 0.5F / d;
this.bipedLeftArm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F / d;
this.bipedRightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbSwingAmount
* 0.5F / f;
this.bipedLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F / f;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightLeg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1 / d;
this.bipedLeftLeg.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.1415927F) * 1.4F * f1 / d;
this.bipedRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount / f;
this.bipedLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount
/ f;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
if (this.isRiding) {
this.bipedRightArm.rotateAngleX += -0.62831855F;
this.bipedLeftArm.rotateAngleX += -0.62831855F;
this.bipedRightLeg.rotateAngleX = -1.2566371F;
this.bipedLeftLeg.rotateAngleX = -1.2566371F;
this.bipedRightLeg.rotateAngleY = 0.31415927F;
this.bipedLeftLeg.rotateAngleY = -0.31415927F;
}
this.bipedRightLeg.rotateAngleZ = 0.0F;
this.bipedLeftLeg.rotateAngleZ = 0.0F;
if (this.heldItemLeft != 0) {
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F
- 0.31415927F * (float) this.heldItemLeft;
if (this.isRiding) {
this.bipedRightArm.rotateAngleX += -((float) Math.PI / 5F);
this.bipedLeftArm.rotateAngleX += -((float) Math.PI / 5F);
this.bipedRightLeg.rotateAngleX = -1.4137167F;
this.bipedRightLeg.rotateAngleY = ((float) Math.PI / 10F);
this.bipedRightLeg.rotateAngleZ = 0.07853982F;
this.bipedLeftLeg.rotateAngleX = -1.4137167F;
this.bipedLeftLeg.rotateAngleY = -((float) Math.PI / 10F);
this.bipedLeftLeg.rotateAngleZ = -0.07853982F;
}
this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedRightArm.rotateAngleZ = 0.0F;
switch (this.heldItemRight) {
case 0:
case 2:
default:
switch (this.leftArmPose) {
case EMPTY:
this.bipedLeftArm.rotateAngleY = 0.0F;
break;
case 1:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F
- 0.31415927F * (float) this.heldItemRight;
case BLOCK:
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
this.bipedLeftArm.rotateAngleY = 0.5235988F;
break;
case 3:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F
- 0.31415927F * (float) this.heldItemRight;
this.bipedRightArm.rotateAngleY = -0.5235988F;
case ITEM:
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
this.bipedLeftArm.rotateAngleY = 0.0F;
}
switch (this.rightArmPose) {
case EMPTY:
this.bipedRightArm.rotateAngleY = 0.0F;
break;
case BLOCK:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
this.bipedRightArm.rotateAngleY = -0.5235988F;
break;
case ITEM:
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
this.bipedRightArm.rotateAngleY = 0.0F;
}
if (this.swingProgress > 0.0F) {
EnumHandSide enumhandside = this.getMainHand(entityIn);
ModelRenderer modelrenderer = this.getArmForSide(enumhandside);
this.getArmForSide(enumhandside.opposite());
float f1 = this.swingProgress;
this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f1) * ((float) Math.PI * 2F)) * 0.2F;
if (enumhandside == EnumHandSide.LEFT) {
this.bipedBody.rotateAngleY *= -1.0F;
}
this.bipedLeftArm.rotateAngleY = 0.0F;
if (this.swingProgress > -9990.0F) {
float f5 = this.swingProgress;
this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f5) * 3.1415927F * 2.0F) * 0.2F;
this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
@ -204,16 +221,17 @@ public class ModelBiped extends ModelBase {
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
f5 = 1.0F - this.swingProgress;
f5 = f5 * f5;
f5 = f5 * f5;
f5 = 1.0F - f5;
float f6 = MathHelper.sin(f5 * 3.1415927F);
float f7 = MathHelper.sin(this.swingProgress * 3.1415927F) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
this.bipedRightArm.rotateAngleX = (float) ((double) this.bipedRightArm.rotateAngleX
- ((double) f6 * 1.2D + (double) f7));
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.bipedRightArm.rotateAngleZ += MathHelper.sin(this.swingProgress * 3.1415927F) * -0.4F;
f1 = 1.0F - this.swingProgress;
f1 = f1 * f1;
f1 = f1 * f1;
f1 = 1.0F - f1;
float f2 = MathHelper.sin(f1 * (float) Math.PI);
float f3 = MathHelper.sin(this.swingProgress * (float) Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F)
* 0.75F;
modelrenderer.rotateAngleX = (float) ((double) modelrenderer.rotateAngleX
- ((double) f2 * 1.2D + (double) f3));
modelrenderer.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
modelrenderer.rotateAngleZ += MathHelper.sin(this.swingProgress * (float) Math.PI) * -0.4F;
}
if (this.isSneak) {
@ -234,25 +252,21 @@ public class ModelBiped extends ModelBase {
this.bipedHead.rotationPointY = 0.0F;
}
this.bipedRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F;
if (this.aimedBow) {
float f8 = 0.0F;
float f9 = 0.0F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f8 * 0.6F) + this.bipedHead.rotateAngleY;
this.bipedLeftArm.rotateAngleY = 0.1F - f8 * 0.6F + this.bipedHead.rotateAngleY + 0.4F;
this.bipedRightArm.rotateAngleX = -1.5707964F + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -1.5707964F + this.bipedHead.rotateAngleX;
this.bipedRightArm.rotateAngleX -= f8 * 1.2F - f9 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f8 * 1.2F - f9 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
if (this.rightArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY;
this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY + 0.4F;
this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
} else if (this.leftArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) {
this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY - 0.4F;
this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY;
this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX;
}
copyModelAngles(this.bipedHead, this.bipedHeadwear);
@ -260,14 +274,13 @@ public class ModelBiped extends ModelBase {
public void setModelAttributes(ModelBase model) {
super.setModelAttributes(model);
if (model instanceof ModelBiped) {
ModelBiped modelbiped = (ModelBiped) model;
this.heldItemLeft = modelbiped.heldItemLeft;
this.heldItemRight = modelbiped.heldItemRight;
this.leftArmPose = modelbiped.leftArmPose;
this.rightArmPose = modelbiped.rightArmPose;
this.isSneak = modelbiped.isSneak;
this.aimedBow = modelbiped.aimedBow;
}
}
public void setInvisible(boolean invisible) {
@ -280,7 +293,23 @@ public class ModelBiped extends ModelBase {
this.bipedLeftLeg.showModel = invisible;
}
public void postRenderArm(float f) {
this.bipedRightArm.postRender(f);
public void postRenderArm(float scale, EnumHandSide side) {
this.getArmForSide(side).postRender(scale);
}
protected ModelRenderer getArmForSide(EnumHandSide side) {
return side == EnumHandSide.LEFT ? this.bipedLeftArm : this.bipedRightArm;
}
protected EnumHandSide getMainHand(Entity entityIn) {
return entityIn instanceof EntityLivingBase ? ((EntityLivingBase) entityIn).getPrimaryHand()
: EnumHandSide.RIGHT;
}
public static enum ArmPose {
EMPTY,
ITEM,
BLOCK,
BOW_AND_ARROW;
}
}

View File

@ -4,6 +4,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumHandSide;
/**
* +
@ -179,6 +180,7 @@ public class ModelPlayer extends ModelBiped {
this.bipedDeadmau5Head.showModel = flag;
}
@Deprecated
public void postRenderArm(float f) {
if (this.smallArms) {
++this.bipedRightArm.rotationPointX;
@ -189,4 +191,18 @@ public class ModelPlayer extends ModelBiped {
}
}
public void postRenderArm(float scale, EnumHandSide side) {
ModelRenderer modelrenderer = this.getArmForSide(side);
if (this.smallArms) {
float f = 0.5F * (float) (side == EnumHandSide.RIGHT ? 1 : -1);
modelrenderer.rotationPointX += f;
modelrenderer.postRender(scale);
modelrenderer.rotationPointX -= f;
} else {
modelrenderer.postRender(scale);
}
}
}

View File

@ -3,6 +3,10 @@ package net.minecraft.client.model;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
/**
* +
@ -65,9 +69,22 @@ public class ModelSkeleton extends ModelZombie {
* second and third float params here are the same second and
* third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase entitylivingbase, float f, float f1, float f2) {
this.aimedBow = ((EntitySkeleton) entitylivingbase).getSkeletonType() == 1;
super.setLivingAnimations(entitylivingbase, f, f1, f2);
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_,
float partialTickTime) {
this.rightArmPose = ModelBiped.ArmPose.EMPTY;
this.leftArmPose = ModelBiped.ArmPose.EMPTY;
ItemStack itemstack = entitylivingbaseIn.getHeldItem();
if (itemstack != null && itemstack.getItem() == Items.bow
&& ((EntitySkeleton) entitylivingbaseIn).isSwingingArms()) {
if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT) {
this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
} else {
this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
}
/**

View File

@ -211,6 +211,7 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;
@ -1564,7 +1565,10 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
} else if ("MC|Brand".equals(packetIn.getChannelName())) {
this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
} else if ("MC|BOpen".equals(packetIn.getChannelName())) {
ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();
EnumHand enumhand = (EnumHand) packetIn.getBufferData().readEnumValue(EnumHand.class);
ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.thePlayer.getHeldItemOffhand()
: this.gameController.thePlayer.getHeldItem();
if (itemstack != null && itemstack.getItem() == Items.written_book) {
this.gameController
.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));

View File

@ -149,6 +149,11 @@ public class EffectRenderer {
this.registerParticle(EnumParticleTypes.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory());
this.registerParticle(EnumParticleTypes.FIREWORKS_SPARK.getParticleID(), new EntityFirework.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) {

View File

@ -108,6 +108,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 MagicFactory implements IParticleFactory {
public EntityFX getEntityFX(int var1, World world, double d0, double d1, double d2, double d3, double d4,
double d5, int... var15) {

View File

@ -6,6 +6,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -56,6 +57,18 @@ public class EntityFX extends Entity {
public static double interpPosY;
public static double interpPosZ;
/** 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;
protected EntityFX(World worldIn, double posXIn, double posYIn, double posZIn) {
super(worldIn);
this.particleAlpha = 1.0F;
@ -135,6 +148,17 @@ public class EntityFX extends Entity {
return this.particleAlpha;
}
public void setMaxAge(int age) {
this.particleMaxAge = age;
}
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;
}
/**
* +
* returns if this entity triggers Block.onEntityWalking on the
@ -160,6 +184,17 @@ public class EntityFX extends Entity {
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.motionY -= 0.04D * (double) this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
@ -234,6 +269,13 @@ public class EntityFX extends Entity {
}
}
protected void resetPositionToBB() {
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
this.posX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D;
this.posY = axisalignedbb.minY;
this.posZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D;
}
public int getFXLayer() {
return 0;
}

View File

@ -0,0 +1,79 @@
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,28 @@
package net.minecraft.client.particle;
import net.minecraft.world.World;
public class ParticleEndRod extends EntityFX {
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,100 @@
package net.minecraft.client.particle;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
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;
}
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,12 +1,10 @@
package net.minecraft.client.renderer;
import com.google.common.base.Objects;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -18,63 +16,40 @@ import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.world.storage.MapData;
/**
* +
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
*
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
public class ItemRenderer {
private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png");
private static final ResourceLocation RES_UNDERWATER_OVERLAY = new ResourceLocation("textures/misc/underwater.png");
/** A reference to the Minecraft object. */
private final Minecraft mc;
private ItemStack itemToRender;
private float equippedProgress;
private float prevEquippedProgress;
private ItemStack itemStackMainHand;
private ItemStack itemStackOffHand;
private float equippedProgressMainHand;
private float prevEquippedProgressMainHand;
private float equippedProgressOffHand;
private float prevEquippedProgressOffHand;
private final RenderManager renderManager;
private final RenderItem itemRenderer;
/**
* +
* The index of the currently held item (0-8, or -1 if not yet
* updated)
*/
private int equippedItemSlot = -1;
public ItemRenderer(Minecraft mcIn) {
this.mc = mcIn;
@ -84,320 +59,398 @@ public class ItemRenderer {
public void renderItem(EntityLivingBase entityIn, ItemStack heldStack,
ItemCameraTransforms.TransformType transform) {
this.renderItemSide(entityIn, heldStack, transform, false);
}
public void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack,
ItemCameraTransforms.TransformType transform, boolean p_187462_4_) {
if (heldStack != null) {
Item item = heldStack.getItem();
Block block = Block.getBlockFromItem(item);
GlStateManager.pushMatrix();
if (this.itemRenderer.shouldRenderItemIn3D(heldStack)) {
GlStateManager.scale(2.0F, 2.0F, 2.0F);
// if (this.isBlockTranslucent(block)) { //TODO: figure out why this code
// exists, it breaks slime blocks
// GlStateManager.depthMask(false);
// }
boolean flag = this.itemRenderer.shouldRenderItemIn3D(heldStack) && this.isBlockTranslucent(block);
if (flag) {
GlStateManager.depthMask(false);
}
this.itemRenderer.renderItemModelForEntity(heldStack, entityIn, transform);
// if (this.isBlockTranslucent(block)) {
// GlStateManager.depthMask(true);
// }
this.itemRenderer.renderItem(heldStack, entitylivingbaseIn, transform, p_187462_4_);
if (flag) {
GlStateManager.depthMask(true);
}
GlStateManager.popMatrix();
}
}
/**
* +
* Returns true if given block is translucent
*/
private boolean isBlockTranslucent(Block blockIn) {
private boolean isBlockTranslucent(@Nullable Block blockIn) {
return blockIn != null && blockIn.getBlockLayer() == EnumWorldBlockLayer.TRANSLUCENT;
}
private void func_178101_a(float angle, float parFloat2) {
/**
* Rotate the render around X and Y
*/
private void rotateArroundXAndY(float angle, float angleY) {
GlStateManager.pushMatrix();
GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(parFloat2, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(angleY, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}
private void func_178109_a(AbstractClientPlayer clientPlayer) {
int i = this.mc.theWorld.getCombinedLight(new BlockPos(clientPlayer.posX,
clientPlayer.posY + (double) clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
float f = (float) (i & '\uffff');
private void setLightmap() {
AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
int i = this.mc.theWorld.getCombinedLight(new BlockPos(abstractclientplayer.posX,
abstractclientplayer.posY + (double) abstractclientplayer.getEyeHeight(), abstractclientplayer.posZ),
0);
float f = (float) (i & 65535);
float f1 = (float) (i >> 16);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
}
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
float f = entityplayerspIn.prevRenderArmPitch
+ (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
float f1 = entityplayerspIn.prevRenderArmYaw
+ (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks;
GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
private void rotateArm(float p_187458_1_) {
EntityPlayerSP entityplayersp = this.mc.thePlayer;
float f = entityplayersp.prevRenderArmPitch
+ (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * p_187458_1_;
float f1 = entityplayersp.prevRenderArmYaw
+ (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * p_187458_1_;
GlStateManager.rotate((entityplayersp.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate((entityplayersp.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
}
private float func_178100_c(float parFloat1) {
float f = 1.0F - parFloat1 / 45.0F + 0.1F;
/**
* Return the angle to render the Map
*/
private float getMapAngleFromPitch(float pitch) {
float f = 1.0F - pitch / 45.0F + 0.1F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
f = -MathHelper.cos(f * 3.1415927F) * 0.5F + 0.5F;
f = -MathHelper.cos(f * (float) Math.PI) * 0.5F + 0.5F;
return f;
}
private void renderRightArm(RenderPlayer renderPlayerIn) {
GlStateManager.pushMatrix();
GlStateManager.rotate(54.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(64.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-62.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.25F, -0.85F, 0.75F);
renderPlayerIn.renderRightArm(this.mc.thePlayer);
GlStateManager.popMatrix();
}
private void renderLeftArm(RenderPlayer renderPlayerIn) {
GlStateManager.pushMatrix();
GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(41.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(-0.3F, -1.1F, 0.45F);
renderPlayerIn.renderLeftArm(this.mc.thePlayer);
GlStateManager.popMatrix();
}
private void renderPlayerArms(AbstractClientPlayer clientPlayer) {
this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin());
Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer);
RenderPlayer renderplayer = (RenderPlayer) render;
if (!clientPlayer.isInvisible()) {
private void renderArms() {
if (!this.mc.thePlayer.isInvisible()) {
GlStateManager.disableCull();
this.renderRightArm(renderplayer);
this.renderLeftArm(renderplayer);
GlStateManager.pushMatrix();
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
this.renderArm(EnumHandSide.RIGHT);
this.renderArm(EnumHandSide.LEFT);
GlStateManager.popMatrix();
GlStateManager.enableCull();
}
}
private void renderItemMap(AbstractClientPlayer clientPlayer, float parFloat1, float parFloat2, float parFloat3) {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(parFloat3) * 3.1415927F);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(parFloat3) * 3.1415927F * 2.0F);
float f2 = -0.2F * MathHelper.sin(parFloat3 * 3.1415927F);
GlStateManager.translate(f, f1, f2);
float f3 = this.func_178100_c(parFloat1);
GlStateManager.translate(0.0F, 0.04F, -0.72F);
GlStateManager.translate(0.0F, parFloat2 * -1.2F, 0.0F);
GlStateManager.translate(0.0F, f3 * -0.5F, 0.0F);
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f3 * -85.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F);
this.renderPlayerArms(clientPlayer);
float f4 = MathHelper.sin(parFloat3 * parFloat3 * 3.1415927F);
float f5 = MathHelper.sin(MathHelper.sqrt_float(parFloat3) * 3.1415927F);
GlStateManager.rotate(f4 * -20.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f5 * -20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(f5 * -80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(0.38F, 0.38F, 0.38F);
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
private void renderArm(EnumHandSide p_187455_1_) {
this.mc.getTextureManager().bindTexture(this.mc.thePlayer.getLocationSkin());
Render<AbstractClientPlayer> render = this.renderManager
.<AbstractClientPlayer>getEntityRenderObject(this.mc.thePlayer);
RenderPlayer renderplayer = (RenderPlayer) render;
GlStateManager.pushMatrix();
float f = p_187455_1_ == EnumHandSide.RIGHT ? 1.0F : -1.0F;
GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(f * -41.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(f * 0.3F, -1.1F, 0.45F);
if (p_187455_1_ == EnumHandSide.RIGHT) {
renderplayer.renderRightArm(this.mc.thePlayer);
} else {
renderplayer.renderLeftArm(this.mc.thePlayer);
}
GlStateManager.popMatrix();
}
private void renderMapFirstPersonSide(float p_187465_1_, EnumHandSide p_187465_2_, float p_187465_3_,
ItemStack p_187465_4_) {
float f = p_187465_2_ == EnumHandSide.RIGHT ? 1.0F : -1.0F;
GlStateManager.translate(f * 0.125F, -0.125F, 0.0F);
if (!this.mc.thePlayer.isInvisible()) {
GlStateManager.pushMatrix();
GlStateManager.rotate(f * 10.0F, 0.0F, 0.0F, 1.0F);
this.renderArmFirstPerson(p_187465_1_, p_187465_3_, p_187465_2_);
GlStateManager.popMatrix();
}
GlStateManager.pushMatrix();
GlStateManager.translate(f * 0.51F, -0.08F + p_187465_1_ * -1.2F, -0.75F);
float f1 = MathHelper.sqrt_float(p_187465_3_);
float f2 = MathHelper.sin(f1 * (float) Math.PI);
float f3 = -0.5F * f2;
float f4 = 0.4F * MathHelper.sin(f1 * ((float) Math.PI * 2F));
float f5 = -0.3F * MathHelper.sin(p_187465_3_ * (float) Math.PI);
GlStateManager.translate(f * f3, f4 - 0.3F * f2, f5);
GlStateManager.rotate(f2 * -45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(f * f2 * -30.0F, 0.0F, 1.0F, 0.0F);
this.renderMapFirstPerson(p_187465_4_);
GlStateManager.popMatrix();
}
private void renderMapFirstPerson(float p_187463_1_, float p_187463_2_, float p_187463_3_) {
float f = MathHelper.sqrt_float(p_187463_3_);
float f1 = -0.2F * MathHelper.sin(p_187463_3_ * (float) Math.PI);
float f2 = -0.4F * MathHelper.sin(f * (float) Math.PI);
GlStateManager.translate(0.0F, -f1 / 2.0F, f2);
float f3 = this.getMapAngleFromPitch(p_187463_1_);
GlStateManager.translate(0.0F, 0.04F + p_187463_2_ * -1.2F + f3 * -0.5F, -0.72F);
GlStateManager.rotate(f3 * -85.0F, 1.0F, 0.0F, 0.0F);
this.renderArms();
float f4 = MathHelper.sin(f * (float) Math.PI);
GlStateManager.rotate(f4 * 20.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(2.0F, 2.0F, 2.0F);
this.renderMapFirstPerson(this.itemStackMainHand);
}
private void renderMapFirstPerson(ItemStack stack) {
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(-1.0F, -1.0F, 0.0F);
GlStateManager.scale(0.015625F, 0.015625F, 0.015625F);
GlStateManager.scale(0.38F, 0.38F, 0.38F);
GlStateManager.disableLighting();
this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
EaglercraftGPU.glNormal3f(0.0F, 0.0F, -1.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
worldrenderer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
worldrenderer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
GlStateManager.translate(-0.5F, -0.5F, 0.0F);
GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F);
worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldRenderer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
worldRenderer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
worldRenderer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
worldRenderer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
tessellator.draw();
MapData mapdata = Items.filled_map.getMapData(this.itemToRender, this.mc.theWorld);
MapData mapdata = Items.filled_map.getMapData(stack, this.mc.theWorld);
if (mapdata != null) {
this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false);
}
GlStateManager.enableLighting();
}
private void func_178095_a(AbstractClientPlayer clientPlayer, float parFloat1, float parFloat2) {
float f = -0.3F * MathHelper.sin(MathHelper.sqrt_float(parFloat2) * 3.1415927F);
float f1 = 0.4F * MathHelper.sin(MathHelper.sqrt_float(parFloat2) * 3.1415927F * 2.0F);
float f2 = -0.4F * MathHelper.sin(parFloat2 * 3.1415927F);
GlStateManager.translate(f, f1, f2);
GlStateManager.translate(0.64000005F, -0.6F, -0.71999997F);
GlStateManager.translate(0.0F, parFloat1 * -0.6F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
float f3 = MathHelper.sin(parFloat2 * parFloat2 * 3.1415927F);
float f4 = MathHelper.sin(MathHelper.sqrt_float(parFloat2) * 3.1415927F);
GlStateManager.rotate(f4 * 70.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f3 * -20.0F, 0.0F, 0.0F, 1.0F);
this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin());
GlStateManager.translate(-1.0F, 3.6F, 3.5F);
GlStateManager.rotate(120.0F, 0.0F, 0.0F, 1.0F);
private void renderArmFirstPerson(float p_187456_1_, float p_187456_2_, EnumHandSide p_187456_3_) {
boolean flag = p_187456_3_ != EnumHandSide.LEFT;
float f = flag ? 1.0F : -1.0F;
float f1 = MathHelper.sqrt_float(p_187456_2_);
float f2 = -0.3F * MathHelper.sin(f1 * (float) Math.PI);
float f3 = 0.4F * MathHelper.sin(f1 * ((float) Math.PI * 2F));
float f4 = -0.4F * MathHelper.sin(p_187456_2_ * (float) Math.PI);
GlStateManager.translate(f * (f2 + 0.64000005F), f3 + -0.6F + p_187456_1_ * -0.6F, f4 + -0.71999997F);
GlStateManager.rotate(f * 45.0F, 0.0F, 1.0F, 0.0F);
float f5 = MathHelper.sin(p_187456_2_ * p_187456_2_ * (float) Math.PI);
float f6 = MathHelper.sin(f1 * (float) Math.PI);
GlStateManager.rotate(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
this.mc.getTextureManager().bindTexture(abstractclientplayer.getLocationSkin());
GlStateManager.translate(f * -1.0F, 3.6F, 3.5F);
GlStateManager.rotate(f * 120.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(1.0F, 1.0F, 1.0F);
GlStateManager.translate(5.6F, 0.0F, 0.0F);
Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer);
GlStateManager.rotate(f * -135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(f * 5.6F, 0.0F, 0.0F);
RenderPlayer renderplayer = (RenderPlayer) this.renderManager.getEntityRenderObject(abstractclientplayer);
GlStateManager.disableCull();
RenderPlayer renderplayer = (RenderPlayer) render;
renderplayer.renderRightArm(this.mc.thePlayer);
if (flag) {
renderplayer.renderRightArm(abstractclientplayer);
} else {
renderplayer.renderLeftArm(abstractclientplayer);
}
GlStateManager.enableCull();
}
private void func_178105_d(float parFloat1) {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(parFloat1) * 3.1415927F);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(parFloat1) * 3.1415927F * 2.0F);
float f2 = -0.2F * MathHelper.sin(parFloat1 * 3.1415927F);
GlStateManager.translate(f, f1, f2);
}
private void func_178104_a(AbstractClientPlayer clientPlayer, float parFloat1) {
float f = (float) clientPlayer.getItemInUseCount() - parFloat1 + 1.0F;
float f1 = f / (float) this.itemToRender.getMaxItemUseDuration();
float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * 3.1415927F) * 0.1F);
if (f1 >= 0.8F) {
f2 = 0.0F;
}
private void transformEatFirstPerson(float p_187454_1_, EnumHandSide p_187454_2_, ItemStack p_187454_3_) {
float f = (float) this.mc.thePlayer.getItemInUseCount() - p_187454_1_ + 1.0F;
float f1 = f / (float) p_187454_3_.getMaxItemUseDuration();
if (f1 < 0.8F) {
float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * (float) Math.PI) * 0.1F);
GlStateManager.translate(0.0F, f2, 0.0F);
}
float f3 = 1.0F - (float) Math.pow((double) f1, 27.0D);
GlStateManager.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F);
GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F);
int i = p_187454_2_ == EnumHandSide.RIGHT ? 1 : -1;
GlStateManager.translate(f3 * 0.6F * (float) i, f3 * -0.5F, f3 * 0.0F);
GlStateManager.rotate((float) i * f3 * 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(f3 * 30.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate((float) i * f3 * 30.0F, 0.0F, 0.0F, 1.0F);
}
/**
* +
* Performs transformations prior to the rendering of a held
* item in first person.
*/
private void transformFirstPersonItem(float equipProgress, float swingProgress) {
GlStateManager.translate(0.56F, -0.52F, -0.71999997F);
GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
float f = MathHelper.sin(swingProgress * swingProgress * 3.1415927F);
float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * 3.1415927F);
GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F);
private void transformFirstPerson(EnumHandSide p_187453_1_, float p_187453_2_) {
int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1;
float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float) Math.PI);
GlStateManager.rotate((float) i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
float f1 = MathHelper.sin(MathHelper.sqrt_float(p_187453_2_) * (float) Math.PI);
GlStateManager.rotate((float) i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.rotate((float) i * -45.0F, 0.0F, 1.0F, 0.0F);
}
private void func_178098_a(float clientPlayer, AbstractClientPlayer parAbstractClientPlayer) {
GlStateManager.rotate(-18.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(-12.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-8.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(-0.9F, 0.2F, 0.0F);
float f = (float) this.itemToRender.getMaxItemUseDuration()
- ((float) parAbstractClientPlayer.getItemInUseCount() - clientPlayer + 1.0F);
float f1 = f / 20.0F;
f1 = (f1 * f1 + f1 * 2.0F) / 3.0F;
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (f1 > 0.1F) {
float f2 = MathHelper.sin((f - 0.1F) * 1.3F);
float f3 = f1 - 0.1F;
float f4 = f2 * f3;
GlStateManager.translate(f4 * 0.0F, f4 * 0.01F, f4 * 0.0F);
}
GlStateManager.translate(f1 * 0.0F, f1 * 0.0F, f1 * 0.1F);
GlStateManager.scale(1.0F, 1.0F, 1.0F + f1 * 0.2F);
}
private void func_178103_d() {
GlStateManager.translate(-0.5F, 0.2F, 0.0F);
GlStateManager.rotate(30.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(60.0F, 0.0F, 1.0F, 0.0F);
private void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_) {
int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1;
GlStateManager.translate((float) i * 0.56F, -0.52F + p_187459_2_ * -0.6F, -0.72F);
}
/**
* +
* Renders the active item in the player's hand when in first
* person mode. Args: partialTickTime
* Renders the active item in the player's hand when in first person mode.
*/
public void renderItemInFirstPerson(float partialTicks) {
float f = 1.0F
- (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks);
EntityPlayerSP entityplayersp = this.mc.thePlayer;
float f1 = entityplayersp.getSwingProgress(partialTicks);
float f2 = entityplayersp.prevRotationPitch
+ (entityplayersp.rotationPitch - entityplayersp.prevRotationPitch) * partialTicks;
float f3 = entityplayersp.prevRotationYaw
+ (entityplayersp.rotationYaw - entityplayersp.prevRotationYaw) * partialTicks;
this.func_178101_a(f2, f3);
this.func_178109_a(entityplayersp);
this.func_178110_a((EntityPlayerSP) entityplayersp, partialTicks);
AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
float f = abstractclientplayer.getSwingProgress(partialTicks);
EnumHand enumhand = (EnumHand) Objects.firstNonNull(abstractclientplayer.swingingHand, EnumHand.MAIN_HAND);
float f1 = abstractclientplayer.prevRotationPitch
+ (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks;
float f2 = abstractclientplayer.prevRotationYaw
+ (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks;
boolean flag = true;
boolean flag1 = true;
if (abstractclientplayer.isHandActive()) {
ItemStack itemstack = abstractclientplayer.getActiveItemStack();
if (itemstack.getItem() == Items.bow) {
EnumHand enumhand1 = abstractclientplayer.getActiveHand();
flag = enumhand1 == EnumHand.MAIN_HAND;
flag1 = !flag;
}
}
this.rotateArroundXAndY(f1, f2);
this.setLightmap();
this.rotateArm(partialTicks);
GlStateManager.enableRescaleNormal();
GlStateManager.pushMatrix();
if (this.itemToRender != null) {
if (this.itemToRender.getItem() == Items.filled_map) {
this.renderItemMap(entityplayersp, f2, f, f1);
} else if (entityplayersp.getItemInUseCount() > 0) {
EnumAction enumaction = this.itemToRender.getItemUseAction();
switch (enumaction) {
case NONE:
this.transformFirstPersonItem(f, 0.0F);
break;
case EAT:
case DRINK:
this.func_178104_a(entityplayersp, partialTicks);
this.transformFirstPersonItem(f, 0.0F);
break;
case BLOCK:
this.transformFirstPersonItem(f, 0.0F);
this.func_178103_d();
break;
case BOW:
this.transformFirstPersonItem(f, 0.0F);
this.func_178098_a(partialTicks, entityplayersp);
}
} else {
this.func_178105_d(f1);
this.transformFirstPersonItem(f, f1);
if (flag) {
float f3 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F;
float f5 = 1.0F - (this.prevEquippedProgressMainHand
+ (this.equippedProgressMainHand - this.prevEquippedProgressMainHand) * partialTicks);
this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.MAIN_HAND, f3,
this.itemStackMainHand, f5);
}
this.renderItem(entityplayersp, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON);
} else if (!entityplayersp.isInvisible()) {
this.func_178095_a(entityplayersp, f, f1);
if (flag1) {
float f4 = enumhand == EnumHand.OFF_HAND ? f : 0.0F;
float f6 = 1.0F - (this.prevEquippedProgressOffHand
+ (this.equippedProgressOffHand - this.prevEquippedProgressOffHand) * partialTicks);
this.renderItemInFirstPerson(abstractclientplayer, partialTicks, f1, EnumHand.OFF_HAND, f4,
this.itemStackOffHand, f6);
}
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
}
public void renderItemInFirstPerson(AbstractClientPlayer p_187457_1_, float p_187457_2_, float p_187457_3_,
EnumHand p_187457_4_, float p_187457_5_, @Nullable ItemStack p_187457_6_, float p_187457_7_) {
boolean flag = p_187457_4_ == EnumHand.MAIN_HAND;
EnumHandSide enumhandside = flag ? p_187457_1_.getPrimaryHand() : p_187457_1_.getPrimaryHand().opposite();
GlStateManager.pushMatrix();
if (p_187457_6_ == null) {
if (flag && !p_187457_1_.isInvisible()) {
this.renderArmFirstPerson(p_187457_7_, p_187457_5_, enumhandside);
}
} else if (p_187457_6_.getItem() == Items.filled_map) {
if (flag && this.itemStackOffHand == null) {
this.renderMapFirstPerson(p_187457_3_, p_187457_7_, p_187457_5_);
} else {
this.renderMapFirstPersonSide(p_187457_7_, enumhandside, p_187457_5_, p_187457_6_);
}
} else {
boolean flag1 = enumhandside == EnumHandSide.RIGHT;
if (p_187457_1_.isHandActive() && p_187457_1_.getItemInUseCount() > 0
&& p_187457_1_.getActiveHand() == p_187457_4_) {
int j = flag1 ? 1 : -1;
switch (p_187457_6_.getItemUseAction()) {
case NONE:
this.transformSideFirstPerson(enumhandside, p_187457_7_);
break;
case EAT:
case DRINK:
this.transformEatFirstPerson(p_187457_2_, enumhandside, p_187457_6_);
this.transformSideFirstPerson(enumhandside, p_187457_7_);
break;
case BLOCK:
this.transformSideFirstPerson(enumhandside, p_187457_7_);
break;
case BOW:
this.transformSideFirstPerson(enumhandside, p_187457_7_);
GlStateManager.translate((float) j * -0.2785682F, 0.18344387F, 0.15731531F);
GlStateManager.rotate(-13.935F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate((float) j * 35.3F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((float) j * -9.785F, 0.0F, 0.0F, 1.0F);
float f5 = (float) p_187457_6_.getMaxItemUseDuration()
- ((float) this.mc.thePlayer.getItemInUseCount() - p_187457_2_ + 1.0F);
float f6 = f5 / 20.0F;
f6 = (f6 * f6 + f6 * 2.0F) / 3.0F;
if (f6 > 1.0F) {
f6 = 1.0F;
}
if (f6 > 0.1F) {
float f7 = MathHelper.sin((f5 - 0.1F) * 1.3F);
float f3 = f6 - 0.1F;
float f4 = f7 * f3;
GlStateManager.translate(f4 * 0.0F, f4 * 0.004F, f4 * 0.0F);
}
GlStateManager.translate(f6 * 0.0F, f6 * 0.0F, f6 * 0.04F);
GlStateManager.scale(1.0F, 1.0F, 1.0F + f6 * 0.2F);
GlStateManager.rotate((float) j * 45.0F, 0.0F, -1.0F, 0.0F);
}
} else {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_187457_5_) * (float) Math.PI);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_187457_5_) * ((float) Math.PI * 2F));
float f2 = -0.2F * MathHelper.sin(p_187457_5_ * (float) Math.PI);
int i = flag1 ? 1 : -1;
GlStateManager.translate((float) i * f, f1, f2);
this.transformSideFirstPerson(enumhandside, p_187457_7_);
this.transformFirstPerson(enumhandside, p_187457_5_);
}
this.renderItemSide(p_187457_1_, p_187457_6_,
flag1 ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
: ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND,
!flag1);
}
GlStateManager.popMatrix();
}
/**
* +
* Renders all the overlays that are in first person mode. Args:
* partialTickTime
* Renders the overlays.
*/
public void renderOverlays(float partialTicks) {
GlStateManager.disableAlpha();
if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) {
IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer));
EntityPlayerSP entityplayersp = this.mc.thePlayer;
EntityPlayer entityplayer = this.mc.thePlayer;
for (int i = 0; i < 8; ++i) {
double d0 = entityplayersp.posX
+ (double) (((float) ((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F);
double d1 = entityplayersp.posY + (double) (((float) ((i >> 1) % 2) - 0.5F) * 0.1F);
double d2 = entityplayersp.posZ
+ (double) (((float) ((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F);
BlockPos blockpos = new BlockPos(d0, d1 + (double) entityplayersp.getEyeHeight(), d2);
double d0 = entityplayer.posX + (double) (((float) ((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F);
double d1 = entityplayer.posY + (double) (((float) ((i >> 1) % 2) - 0.5F) * 0.1F);
double d2 = entityplayer.posZ + (double) (((float) ((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F);
BlockPos blockpos = new BlockPos(d0, d1 + (double) entityplayer.getEyeHeight(), d2);
IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos);
if (iblockstate1.getBlock().isVisuallyOpaque()) {
iblockstate = iblockstate1;
}
}
if (iblockstate.getBlock().getRenderType() != -1) {
this.func_178108_a(partialTicks,
this.renderBlockInHand(partialTicks,
this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate));
}
}
@ -415,10 +468,13 @@ public class ItemRenderer {
GlStateManager.enableAlpha();
}
private void func_178108_a(float parFloat1, EaglerTextureAtlasSprite parTextureAtlasSprite) {
/**
* Render the block in the player's hand
*/
private void renderBlockInHand(float partialTicks, EaglerTextureAtlasSprite atlas) {
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
float f = 0.1F;
GlStateManager.color(0.1F, 0.1F, 0.1F, 0.5F);
GlStateManager.pushMatrix();
@ -427,34 +483,34 @@ public class ItemRenderer {
float f3 = -1.0F;
float f4 = 1.0F;
float f5 = -0.5F;
float f6 = parTextureAtlasSprite.getMinU();
float f7 = parTextureAtlasSprite.getMaxU();
float f8 = parTextureAtlasSprite.getMinV();
float f9 = parTextureAtlasSprite.getMaxV();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double) f7, (double) f9).endVertex();
worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double) f6, (double) f9).endVertex();
worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double) f6, (double) f8).endVertex();
worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double) f7, (double) f8).endVertex();
float f6 = atlas.getMinU();
float f7 = atlas.getMaxU();
float f8 = atlas.getMinV();
float f9 = atlas.getMaxV();
worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldRenderer.pos(-1.0D, -1.0D, -0.5D).tex((double) f7, (double) f9).endVertex();
worldRenderer.pos(1.0D, -1.0D, -0.5D).tex((double) f6, (double) f9).endVertex();
worldRenderer.pos(1.0D, 1.0D, -0.5D).tex((double) f6, (double) f8).endVertex();
worldRenderer.pos(-1.0D, 1.0D, -0.5D).tex((double) f7, (double) f8).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/**
* +
* Renders a texture that warps around based on the direction
* the player is looking. Texture needs to be bound before being
* called. Used for the water overlay. Args: parialTickTime
* Renders a texture that warps around based on the direction the player is
* looking. Texture needs to be bound
* before being called. Used for the water overlay.
*/
private void renderWaterOverlayTexture(float parFloat1) {
private void renderWaterOverlayTexture(float partialTicks) {
this.mc.getTextureManager().bindTexture(RES_UNDERWATER_OVERLAY);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
float f = this.mc.thePlayer.getBrightness(parFloat1);
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
float f = this.mc.thePlayer.getBrightness(partialTicks);
GlStateManager.color(f, f, f, 0.5F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
GlStateManager.pushMatrix();
float f1 = 4.0F;
float f2 = -1.0F;
@ -464,11 +520,11 @@ public class ItemRenderer {
float f6 = -0.5F;
float f7 = -this.mc.thePlayer.rotationYaw / 64.0F;
float f8 = this.mc.thePlayer.rotationPitch / 64.0F;
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double) (4.0F + f7), (double) (4.0F + f8)).endVertex();
worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double) (0.0F + f7), (double) (4.0F + f8)).endVertex();
worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double) (0.0F + f7), (double) (0.0F + f8)).endVertex();
worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double) (4.0F + f7), (double) (0.0F + f8)).endVertex();
worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldRenderer.pos(-1.0D, -1.0D, -0.5D).tex((double) (4.0F + f7), (double) (4.0F + f8)).endVertex();
worldRenderer.pos(1.0D, -1.0D, -0.5D).tex((double) (0.0F + f7), (double) (4.0F + f8)).endVertex();
worldRenderer.pos(1.0D, 1.0D, -0.5D).tex((double) (0.0F + f7), (double) (0.0F + f8)).endVertex();
worldRenderer.pos(-1.0D, 1.0D, -0.5D).tex((double) (4.0F + f7), (double) (0.0F + f8)).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
@ -476,18 +532,18 @@ public class ItemRenderer {
}
/**
* +
* Renders the fire on the screen for first person mode. Arg:
* partialTickTime
* Renders the fire on the screen for first person mode. Arg: partialTickTime
*/
private void renderFireInFirstPerson(float parFloat1) {
private void renderFireInFirstPerson(float partialTicks) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F);
GlStateManager.depthFunc(GL_ALWAYS);
GlStateManager.depthFunc(519);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, GL_ONE,
GL_ZERO);
float f = 1.0F;
for (int i = 0; i < 2; ++i) {
@ -499,18 +555,18 @@ public class ItemRenderer {
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMinV();
float f4 = textureatlassprite.getMaxV();
float f5 = (0.0F - f) / 2.0F;
float f6 = f5 + f;
float f7 = 0.0F - f / 2.0F;
float f8 = f7 + f;
float f5 = -0.5F;
float f6 = 0.5F;
float f7 = -0.5F;
float f8 = 0.5F;
float f9 = -0.5F;
GlStateManager.translate((float) (-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F);
GlStateManager.rotate((float) (i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double) f5, (double) f7, (double) f9).tex((double) f2, (double) f4).endVertex();
worldrenderer.pos((double) f6, (double) f7, (double) f9).tex((double) f1, (double) f4).endVertex();
worldrenderer.pos((double) f6, (double) f8, (double) f9).tex((double) f1, (double) f3).endVertex();
worldrenderer.pos((double) f5, (double) f8, (double) f9).tex((double) f2, (double) f3).endVertex();
worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldRenderer.pos(-0.5D, -0.5D, -0.5D).tex((double) f2, (double) f4).endVertex();
worldRenderer.pos(0.5D, -0.5D, -0.5D).tex((double) f1, (double) f4).endVertex();
worldRenderer.pos(0.5D, 0.5D, -0.5D).tex((double) f1, (double) f3).endVertex();
worldRenderer.pos(-0.5D, 0.5D, -0.5D).tex((double) f2, (double) f3).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
@ -518,48 +574,45 @@ public class ItemRenderer {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.depthFunc(GL_LEQUAL);
GlStateManager.depthFunc(515);
}
public void updateEquippedItem() {
this.prevEquippedProgress = this.equippedProgress;
this.prevEquippedProgressMainHand = this.equippedProgressMainHand;
this.prevEquippedProgressOffHand = this.equippedProgressOffHand;
EntityPlayerSP entityplayersp = this.mc.thePlayer;
ItemStack itemstack = entityplayersp.inventory.getCurrentItem();
boolean flag = false;
if (this.itemToRender != null && itemstack != null) {
if (!this.itemToRender.getIsItemStackEqual(itemstack)) {
flag = true;
}
} else if (this.itemToRender == null && itemstack == null) {
flag = false;
ItemStack itemstack = entityplayersp.getHeldItem();
ItemStack itemstack1 = entityplayersp.getHeldItemOffhand();
if (entityplayersp.isRowingBoat()) {
this.equippedProgressMainHand = MathHelper.clamp_float(this.equippedProgressMainHand - 0.4F, 0.0F, 1.0F);
this.equippedProgressOffHand = MathHelper.clamp_float(this.equippedProgressOffHand - 0.4F, 0.0F, 1.0F);
} else {
flag = true;
// TODO: implement attack cooldown (new combat system)
float f = 0.0F;
// float f = entityplayersp.getCooledAttackStrength(1.0F);
this.equippedProgressMainHand += MathHelper
.clamp_float((Objects.equal(this.itemStackMainHand, itemstack) ? f * f * f : 0.0F)
- this.equippedProgressMainHand, -0.4F, 0.4F);
this.equippedProgressOffHand += MathHelper.clamp_float(
(float) (Objects.equal(this.itemStackOffHand, itemstack1) ? 1 : 0) - this.equippedProgressOffHand,
-0.4F, 0.4F);
}
float f = 0.4F;
float f1 = flag ? 0.0F : 1.0F;
float f2 = MathHelper.clamp_float(f1 - this.equippedProgress, -f, f);
this.equippedProgress += f2;
if (this.equippedProgress < 0.1F) {
this.itemToRender = itemstack;
this.equippedItemSlot = entityplayersp.inventory.currentItem;
if (this.equippedProgressMainHand < 0.1F) {
this.itemStackMainHand = itemstack;
}
if (this.equippedProgressOffHand < 0.1F) {
this.itemStackOffHand = itemstack1;
}
}
/**
* +
* Resets equippedProgress
*/
public void resetEquippedProgress() {
this.equippedProgress = 0.0F;
public void resetEquippedProgress(EnumHand hand) {
if (hand == EnumHand.MAIN_HAND) {
this.equippedProgressMainHand = 0.0F;
} else {
this.equippedProgressOffHand = 0.0F;
}
/**
* +
* Resets equippedProgress
*/
public void resetEquippedProgress2() {
this.equippedProgress = 0.0F;
}
}

View File

@ -6,6 +6,8 @@ import org.json.JSONObject;
import net.lax1dude.eaglercraft.v1_8.json.JSONTypeDeserializer;
import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.vector.Quaternion;
import net.minecraft.util.MathHelper;
/**
* +
@ -38,17 +40,19 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
*/
public class ItemCameraTransforms {
public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms();
public static float field_181690_b = 0.0F;
public static float field_181691_c = 0.0F;
public static float field_181692_d = 0.0F;
public static float field_181693_e = 0.0F;
public static float field_181694_f = 0.0F;
public static float field_181695_g = 0.0F;
public static float field_181696_h = 0.0F;
public static float field_181697_i = 0.0F;
public static float field_181698_j = 0.0F;
public final ItemTransformVec3f thirdPerson;
public final ItemTransformVec3f firstPerson;
public static float offsetTranslateX = 0.0F;
public static float offsetTranslateY = 0.0F;
public static float offsetTranslateZ = 0.0F;
public static float offsetRotationX = 0.0F;
public static float offsetRotationY = 0.0F;
public static float offsetRotationZ = 0.0F;
public static float offsetScaleX = 0.0F;
public static float offsetScaleY = 0.0F;
public static float offsetScaleZ = 0.0F;
public final ItemTransformVec3f thirdperson_left;
public final ItemTransformVec3f thirdperson_right;
public final ItemTransformVec3f firstperson_left;
public final ItemTransformVec3f firstperson_right;
public final ItemTransformVec3f head;
public final ItemTransformVec3f gui;
public final ItemTransformVec3f ground;
@ -56,87 +60,152 @@ public class ItemCameraTransforms {
private ItemCameraTransforms() {
this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT,
ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT);
ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT,
ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT);
}
public ItemCameraTransforms(ItemCameraTransforms parItemCameraTransforms) {
this.thirdPerson = parItemCameraTransforms.thirdPerson;
this.firstPerson = parItemCameraTransforms.firstPerson;
this.head = parItemCameraTransforms.head;
this.gui = parItemCameraTransforms.gui;
this.ground = parItemCameraTransforms.ground;
this.fixed = parItemCameraTransforms.fixed;
public ItemCameraTransforms(ItemCameraTransforms transforms) {
this.thirdperson_left = transforms.thirdperson_left;
this.thirdperson_right = transforms.thirdperson_right;
this.firstperson_left = transforms.firstperson_left;
this.firstperson_right = transforms.firstperson_right;
this.head = transforms.head;
this.gui = transforms.gui;
this.ground = transforms.ground;
this.fixed = transforms.fixed;
}
public ItemCameraTransforms(ItemTransformVec3f parItemTransformVec3f, ItemTransformVec3f parItemTransformVec3f_2,
ItemTransformVec3f parItemTransformVec3f_3, ItemTransformVec3f parItemTransformVec3f_4,
ItemTransformVec3f parItemTransformVec3f_5, ItemTransformVec3f parItemTransformVec3f_6) {
this.thirdPerson = parItemTransformVec3f;
this.firstPerson = parItemTransformVec3f_2;
this.head = parItemTransformVec3f_3;
this.gui = parItemTransformVec3f_4;
this.ground = parItemTransformVec3f_5;
this.fixed = parItemTransformVec3f_6;
public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_,
ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_,
ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) {
this.thirdperson_left = p_i46569_1_;
this.thirdperson_right = p_i46569_2_;
this.firstperson_left = p_i46569_3_;
this.firstperson_right = p_i46569_4_;
this.head = p_i46569_5_;
this.gui = p_i46569_6_;
this.ground = p_i46569_7_;
this.fixed = p_i46569_8_;
}
public void applyTransform(ItemCameraTransforms.TransformType parTransformType) {
ItemTransformVec3f itemtransformvec3f = this.getTransform(parTransformType);
if (itemtransformvec3f != ItemTransformVec3f.DEFAULT) {
GlStateManager.translate(itemtransformvec3f.translation.x + field_181690_b,
itemtransformvec3f.translation.y + field_181691_c,
itemtransformvec3f.translation.z + field_181692_d);
GlStateManager.rotate(itemtransformvec3f.rotation.y + field_181694_f, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(itemtransformvec3f.rotation.x + field_181693_e, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(itemtransformvec3f.rotation.z + field_181695_g, 0.0F, 0.0F, 1.0F);
GlStateManager.scale(itemtransformvec3f.scale.x + field_181696_h,
itemtransformvec3f.scale.y + field_181697_i, itemtransformvec3f.scale.z + field_181698_j);
public void applyTransform(ItemCameraTransforms.TransformType type) {
applyTransformSide(this.getTransform(type), false);
}
public static void applyTransformSide(ItemTransformVec3f vec, boolean leftHand) {
if (vec != ItemTransformVec3f.DEFAULT) {
int i = leftHand ? -1 : 1;
GlStateManager.translate((float) i * (offsetTranslateX + vec.translation.x),
offsetTranslateY + vec.translation.y, offsetTranslateZ + vec.translation.z);
float f = offsetRotationX + vec.rotation.x;
float f1 = offsetRotationY + vec.rotation.y;
float f2 = offsetRotationZ + vec.rotation.z;
if (leftHand) {
f1 = -f1;
f2 = -f2;
}
public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType parTransformType) {
switch (parTransformType) {
case THIRD_PERSON:
return this.thirdPerson;
case FIRST_PERSON:
return this.firstPerson;
GlStateManager.rotate(makeQuaternion(f, f1, f2));
GlStateManager.scale(offsetScaleX + vec.scale.x, offsetScaleY + vec.scale.y, offsetScaleZ + vec.scale.z);
}
}
private static Quaternion makeQuaternion(float p_188035_0_, float p_188035_1_, float p_188035_2_) {
float f = p_188035_0_ * 0.017453292F;
float f1 = p_188035_1_ * 0.017453292F;
float f2 = p_188035_2_ * 0.017453292F;
float f3 = MathHelper.sin(0.5F * f);
float f4 = MathHelper.cos(0.5F * f);
float f5 = MathHelper.sin(0.5F * f1);
float f6 = MathHelper.cos(0.5F * f1);
float f7 = MathHelper.sin(0.5F * f2);
float f8 = MathHelper.cos(0.5F * f2);
return new Quaternion(f3 * f6 * f8 + f4 * f5 * f7, f4 * f5 * f8 - f3 * f6 * f7, f3 * f5 * f8 + f4 * f6 * f7,
f4 * f6 * f8 - f3 * f5 * f7);
}
public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType type) {
switch (type) {
case THIRD_PERSON_LEFT_HAND:
return this.thirdperson_left;
case THIRD_PERSON_RIGHT_HAND:
return this.thirdperson_right;
case FIRST_PERSON_LEFT_HAND:
return this.firstperson_left;
case FIRST_PERSON_RIGHT_HAND:
return this.firstperson_right;
case HEAD:
return this.head;
case GUI:
return this.gui;
case GROUND:
return this.ground;
case FIXED:
return this.fixed;
default:
return ItemTransformVec3f.DEFAULT;
}
}
public boolean func_181687_c(ItemCameraTransforms.TransformType parTransformType) {
return !this.getTransform(parTransformType).equals(ItemTransformVec3f.DEFAULT);
public boolean hasCustomTransform(ItemCameraTransforms.TransformType type) {
return this.getTransform(type) != ItemTransformVec3f.DEFAULT;
}
public static class Deserializer implements JSONTypeDeserializer<JSONObject, ItemCameraTransforms> {
public ItemCameraTransforms deserialize(JSONObject jsonobject) throws JSONException {
ItemTransformVec3f itemtransformvec3f = this.func_181683_a(jsonobject, "thirdperson");
ItemTransformVec3f itemtransformvec3f1 = this.func_181683_a(jsonobject, "firstperson");
ItemTransformVec3f itemtransformvec3f2 = this.func_181683_a(jsonobject, "head");
ItemTransformVec3f itemtransformvec3f3 = this.func_181683_a(jsonobject, "gui");
ItemTransformVec3f itemtransformvec3f4 = this.func_181683_a(jsonobject, "ground");
ItemTransformVec3f itemtransformvec3f5 = this.func_181683_a(jsonobject, "fixed");
return new ItemCameraTransforms(itemtransformvec3f, itemtransformvec3f1, itemtransformvec3f2,
itemtransformvec3f3, itemtransformvec3f4, itemtransformvec3f5);
ItemTransformVec3f itemtransformvec3f = this.getTransform(jsonobject,
"thirdperson_righthand");
ItemTransformVec3f itemtransformvec3f1 = this.getTransform(jsonobject,
"thirdperson_lefthand");
if (itemtransformvec3f1 == ItemTransformVec3f.DEFAULT) {
itemtransformvec3f1 = itemtransformvec3f;
}
private ItemTransformVec3f func_181683_a(JSONObject parJsonObject, String parString1) {
return parJsonObject.has(parString1)
? JSONTypeProvider.deserialize(parJsonObject.get(parString1), ItemTransformVec3f.class)
ItemTransformVec3f itemtransformvec3f2 = this.getTransform(jsonobject,
"firstperson_righthand");
ItemTransformVec3f itemtransformvec3f3 = this.getTransform(jsonobject,
"firstperson_lefthand");
if (itemtransformvec3f3 == ItemTransformVec3f.DEFAULT) {
itemtransformvec3f3 = itemtransformvec3f2;
}
ItemTransformVec3f itemtransformvec3f4 = this.getTransform(jsonobject, "head");
ItemTransformVec3f itemtransformvec3f5 = this.getTransform(jsonobject, "gui");
ItemTransformVec3f itemtransformvec3f6 = this.getTransform(jsonobject, "ground");
ItemTransformVec3f itemtransformvec3f7 = this.getTransform(jsonobject, "fixed");
return new ItemCameraTransforms(itemtransformvec3f1, itemtransformvec3f, itemtransformvec3f3,
itemtransformvec3f2, itemtransformvec3f4, itemtransformvec3f5, itemtransformvec3f6,
itemtransformvec3f7);
}
private ItemTransformVec3f getTransform(JSONObject p_181683_2_,
String p_181683_3_) {
return p_181683_2_.has(p_181683_3_)
? JSONTypeProvider.deserialize(p_181683_2_.get(p_181683_3_), ItemTransformVec3f.class)
: ItemTransformVec3f.DEFAULT;
}
}
public static enum TransformType {
NONE, THIRD_PERSON, FIRST_PERSON, HEAD, GUI, GROUND, FIXED;
NONE,
THIRD_PERSON_LEFT_HAND,
THIRD_PERSON_RIGHT_HAND,
FIRST_PERSON_LEFT_HAND,
FIRST_PERSON_RIGHT_HAND,
HEAD,
GUI,
GROUND,
FIXED;
}
}

View File

@ -159,20 +159,28 @@ public class ModelBlock {
}
public ItemCameraTransforms func_181682_g() {
ItemTransformVec3f itemtransformvec3f = this.func_181681_a(ItemCameraTransforms.TransformType.THIRD_PERSON);
ItemTransformVec3f itemtransformvec3f1 = this.func_181681_a(ItemCameraTransforms.TransformType.FIRST_PERSON);
ItemTransformVec3f itemtransformvec3f2 = this.func_181681_a(ItemCameraTransforms.TransformType.HEAD);
ItemTransformVec3f itemtransformvec3f3 = this.func_181681_a(ItemCameraTransforms.TransformType.GUI);
ItemTransformVec3f itemtransformvec3f4 = this.func_181681_a(ItemCameraTransforms.TransformType.GROUND);
ItemTransformVec3f itemtransformvec3f5 = this.func_181681_a(ItemCameraTransforms.TransformType.FIXED);
ItemTransformVec3f itemtransformvec3f = this
.func_181681_a(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND);
ItemTransformVec3f itemtransformvec3f1 = this
.func_181681_a(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND);
ItemTransformVec3f itemtransformvec3f2 = this
.func_181681_a(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND);
ItemTransformVec3f itemtransformvec3f3 = this
.func_181681_a(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND);
ItemTransformVec3f itemtransformvec3f4 = this.func_181681_a(ItemCameraTransforms.TransformType.HEAD);
ItemTransformVec3f itemtransformvec3f5 = this.func_181681_a(ItemCameraTransforms.TransformType.GUI);
ItemTransformVec3f itemtransformvec3f6 = this.func_181681_a(ItemCameraTransforms.TransformType.GROUND);
ItemTransformVec3f itemtransformvec3f7 = this.func_181681_a(ItemCameraTransforms.TransformType.FIXED);
return new ItemCameraTransforms(itemtransformvec3f, itemtransformvec3f1, itemtransformvec3f2,
itemtransformvec3f3, itemtransformvec3f4, itemtransformvec3f5);
itemtransformvec3f3, itemtransformvec3f4, itemtransformvec3f5, itemtransformvec3f6,
itemtransformvec3f7);
}
private ItemTransformVec3f func_181681_a(ItemCameraTransforms.TransformType parTransformType) {
return this.parent != null && !this.cameraTransforms.func_181687_c(parTransformType)
? this.parent.func_181681_a(parTransformType)
: this.cameraTransforms.getTransform(parTransformType);
private ItemTransformVec3f func_181681_a(ItemCameraTransforms.TransformType type) {
return this.parent != null && !this.cameraTransforms.hasCustomTransform(type) ? this.parent.func_181681_a(type)
: this.cameraTransforms.getTransform(type);
}
public static void checkModelHierarchy(Map<ResourceLocation, ModelBlock> parMap) {

View File

@ -6,6 +6,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerCustomBlock;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
@ -70,6 +72,7 @@ import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3i;
import net.minecraft.world.World;
/**
* +
@ -255,6 +258,51 @@ public class RenderItem implements IResourceManagerReloadListener {
}
}
public void renderItem(ItemStack stack, EntityLivingBase entitylivingbaseIn,
ItemCameraTransforms.TransformType transform, boolean leftHanded) {
if (stack != null && entitylivingbaseIn != null && stack.getItem() != null) {
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
this.renderItemModel(stack, ibakedmodel, transform, leftHanded);
}
}
protected void renderItemModel(ItemStack stack, IBakedModel bakedmodel,
ItemCameraTransforms.TransformType transform, boolean leftHanded) {
if (stack.getItem() != null) {
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
this.textureManager.getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(516, 0.1F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, GL_ONE,
GL_ZERO);
GlStateManager.pushMatrix();
ItemCameraTransforms itemcameratransforms = bakedmodel.getItemCameraTransforms();
ItemCameraTransforms.applyTransformSide(itemcameratransforms.getTransform(transform), leftHanded);
if (this.isThereOneNegativeScale(itemcameratransforms.getTransform(transform))) {
GlStateManager.cullFace(GL_FRONT);
}
this.renderItem(stack, bakedmodel);
GlStateManager.cullFace(GL_BACK);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap();
}
}
/**
* Return true if only one scale is negative
*/
private boolean isThereOneNegativeScale(ItemTransformVec3f itemTranformVec) {
return itemTranformVec.scale.x < 0.0F ^ itemTranformVec.scale.y < 0.0F ^ itemTranformVec.scale.z < 0.0F;
}
private static boolean isTransparentItem(ItemStack stack) {
Item itm = stack.getItem();
return itm instanceof ItemBlock

View File

@ -6,6 +6,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.entity.layers.LayerArrow;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
@ -20,6 +21,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
@ -79,8 +81,8 @@ public class RenderPlayer extends RendererLivingEntity<AbstractClientPlayer> {
super(renderManager, modelBase, size);
}
public ModelBiped getMainModel() {
return (ModelBiped) super.getMainModel();
public ModelPlayer getMainModel() {
return (ModelPlayer) super.getMainModel();
}
/**
@ -107,41 +109,60 @@ public class RenderPlayer extends RendererLivingEntity<AbstractClientPlayer> {
}
private void setModelVisibilities(AbstractClientPlayer clientPlayer) {
ModelBiped modelplayer = this.getMainModel();
ModelPlayer modelplayer = this.getMainModel();
if (clientPlayer.isSpectator()) {
modelplayer.setInvisible(false);
modelplayer.bipedHead.showModel = true;
modelplayer.bipedHeadwear.showModel = true;
} else {
ItemStack itemstack = clientPlayer.inventory.getCurrentItem();
ItemStack itemstack = clientPlayer.getHeldItem();
ItemStack itemstack1 = clientPlayer.getHeldItemOffhand();
modelplayer.setInvisible(true);
modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT);
if (!zombieModel) {
ModelPlayer modelplayer_ = (ModelPlayer) modelplayer;
modelplayer_.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET);
modelplayer_.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
modelplayer_.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
modelplayer_.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
modelplayer_.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
}
modelplayer.heldItemLeft = 0;
modelplayer.aimedBow = false;
modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET);
modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
modelplayer.isSneak = clientPlayer.isSneaking();
if (itemstack == null) {
modelplayer.heldItemRight = 0;
} else {
modelplayer.heldItemRight = 1;
ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY;
ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY;
if (itemstack != null) {
modelbiped$armpose = ModelBiped.ArmPose.ITEM;
if (clientPlayer.getItemInUseCount() > 0) {
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.BLOCK) {
modelplayer.heldItemRight = 3;
modelbiped$armpose = ModelBiped.ArmPose.BLOCK;
} else if (enumaction == EnumAction.BOW) {
modelplayer.aimedBow = true;
}
modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
}
if (itemstack1 != null) {
modelbiped$armpose1 = ModelBiped.ArmPose.ITEM;
if (clientPlayer.getItemInUseCount() > 0) {
EnumAction enumaction1 = itemstack1.getItemUseAction();
if (enumaction1 == EnumAction.BLOCK) {
modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK;
}
}
}
if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) {
modelplayer.rightArmPose = modelbiped$armpose;
modelplayer.leftArmPose = modelbiped$armpose1;
} else {
modelplayer.rightArmPose = modelbiped$armpose1;
modelplayer.leftArmPose = modelbiped$armpose;
}
}
}
/**
@ -185,29 +206,37 @@ public class RenderPlayer extends RendererLivingEntity<AbstractClientPlayer> {
}
public void renderRightArm(AbstractClientPlayer clientPlayer) {
if (!zombieModel) {
float f = 1.0F;
GlStateManager.color(f, f, f);
ModelBiped modelplayer = this.getMainModel();
float f1 = 0.0625F;
ModelPlayer modelplayer = this.getMainModel();
this.setModelVisibilities(clientPlayer);
GlStateManager.enableBlend();
modelplayer.swingProgress = 0.0F;
modelplayer.isSneak = false;
modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, clientPlayer);
((ModelPlayer) modelplayer).renderRightArm();
}
modelplayer.bipedRightArm.rotateAngleX = 0.0F;
modelplayer.bipedRightArm.render(0.0625F);
modelplayer.bipedRightArmwear.rotateAngleX = 0.0F;
modelplayer.bipedRightArmwear.render(0.0625F);
GlStateManager.disableBlend();
}
public void renderLeftArm(AbstractClientPlayer clientPlayer) {
if (!zombieModel) {
float f = 1.0F;
GlStateManager.color(f, f, f);
ModelBiped modelplayer = this.getMainModel();
float f1 = 0.0625F;
ModelPlayer modelplayer = this.getMainModel();
this.setModelVisibilities(clientPlayer);
GlStateManager.enableBlend();
modelplayer.isSneak = false;
modelplayer.swingProgress = 0.0F;
modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, clientPlayer);
((ModelPlayer) modelplayer).renderLeftArm();
}
modelplayer.bipedLeftArm.rotateAngleX = 0.0F;
modelplayer.bipedLeftArm.render(0.0625F);
modelplayer.bipedLeftArmwear.rotateAngleX = 0.0F;
modelplayer.bipedLeftArmwear.render(0.0625F);
GlStateManager.disableBlend();
}
/**

View File

@ -12,6 +12,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHandSide;
/**
* +
@ -49,11 +50,16 @@ public class LayerHeldItem implements LayerRenderer<EntityLivingBase> {
this.livingEntityRenderer = livingEntityRendererIn;
}
public void doRenderLayer(EntityLivingBase entitylivingbase, float var2, float var3, float var4, float var5,
float var6, float var7, float var8) {
ItemStack itemstack = entitylivingbase.getHeldItem();
if (itemstack != null) {
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount,
float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT;
ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItem();
ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItem()
: entitylivingbaseIn.getHeldItemOffhand();
if (itemstack != null || itemstack1 != null) {
GlStateManager.pushMatrix();
if (this.livingEntityRenderer.getMainModel().isChild) {
float f = 0.5F;
GlStateManager.translate(0.0F, 0.625F, 0.0F);
@ -61,28 +67,29 @@ public class LayerHeldItem implements LayerRenderer<EntityLivingBase> {
GlStateManager.scale(f, f, f);
}
((ModelBiped) this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F);
GlStateManager.translate(-0.0625F, 0.4375F, 0.0625F);
if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer) entitylivingbase).fishEntity != null) {
itemstack = new ItemStack(Items.fishing_rod, 0);
this.renderHeldItem(entitylivingbaseIn, itemstack1,
ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT);
this.renderHeldItem(entitylivingbaseIn, itemstack,
ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT);
GlStateManager.popMatrix();
}
}
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) {
GlStateManager.translate(0.0F, 0.1875F, -0.3125F);
GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
float f1 = 0.375F;
GlStateManager.scale(-f1, -f1, f1);
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_,
ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) {
if (p_188358_2_ != null) {
GlStateManager.pushMatrix();
((ModelBiped) this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide);
if (p_188358_1_.isSneaking()) {
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
if (entitylivingbase.isSneaking()) {
GlStateManager.translate(0.0F, 0.203125F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbase, itemstack,
ItemCameraTransforms.TransformType.THIRD_PERSON);
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
boolean flag = handSide == EnumHandSide.LEFT;
GlStateManager.translate(flag ? -0.0625F : 0.0625F, 0.125F, -0.625F);
Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag);
GlStateManager.popMatrix();
}
}

View File

@ -102,8 +102,9 @@ public class LayerHeldItemWitch implements LayerRenderer<EntityWitch> {
GlStateManager.rotate(-15.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(40.0F, 0.0F, 0.0F, 1.0F);
// TODO: implement offhand
minecraft.getItemRenderer().renderItem(entitywitch, itemstack,
ItemCameraTransforms.TransformType.THIRD_PERSON);
ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND);
GlStateManager.popMatrix();
}
}

View File

@ -95,7 +95,8 @@ public class ModelBakery {
new ResourceLocation("items/empty_armor_slot_helmet"),
new ResourceLocation("items/empty_armor_slot_chestplate"),
new ResourceLocation("items/empty_armor_slot_leggings"),
new ResourceLocation("items/empty_armor_slot_boots") });
new ResourceLocation("items/empty_armor_slot_boots"),
new ResourceLocation("items/empty_armor_slot_shield") });
private static final Logger LOGGER = LogManager.getLogger();
protected static final ModelResourceLocation MODEL_MISSING = new ModelResourceLocation("builtin/missing",
"missing");

View File

@ -2,6 +2,8 @@ package net.minecraft.entity;
import java.util.List;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.ai.EntityAITasks;
@ -33,6 +35,7 @@ import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.stats.AchievementList;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.DifficultyInstance;
@ -86,7 +89,7 @@ public abstract class EntityLiving extends EntityLivingBase {
* +
* Equipment (armor and held item) for this entity.
*/
private ItemStack[] equipment = new ItemStack[5];
private ItemStack[] equipment = new ItemStack[6];
/**
* +
* Chances for each equipment piece from dropping when this
@ -750,6 +753,7 @@ public abstract class EntityLiving extends EntityLivingBase {
* +
* Returns the item that this EntityLiving is holding, if any.
*/
@Nullable
public ItemStack getHeldItem() {
return this.equipment[0];
}
@ -772,6 +776,7 @@ public abstract class EntityLiving extends EntityLivingBase {
* Slot 1-4 is armor. Params: Item, slot
*/
public void setCurrentItemOrArmor(int i, ItemStack itemstack) {
// TODO: implement offhand
this.equipment[i] = itemstack;
}
@ -1201,6 +1206,10 @@ public abstract class EntityLiving extends EntityLivingBase {
return (this.dataWatcher.getWatchableObjectByte(10) & 2) != 0;
}
public EnumHandSide getPrimaryHand() {
return this.isLeftHanded() ? EnumHandSide.LEFT : EnumHandSide.RIGHT;
}
public static enum SpawnPlacementType {
ON_GROUND, IN_AIR, IN_WATER;
}

View File

@ -3,13 +3,14 @@ package net.minecraft.entity;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Maps;
import com.logisticscraft.occlusionculling.util.Vec3d;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
@ -31,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemElytra;
@ -51,10 +53,13 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.CombatTracker;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@ -167,6 +172,11 @@ public abstract class EntityLivingBase extends Entity {
private int jumpTicks;
private float absorptionAmount;
public EnumHand swingingHand;
protected ItemStack itemInUse;
protected int itemInUseCount;
/**
* +
* Called by the /kill command.
@ -758,43 +768,67 @@ public abstract class EntityLivingBase extends Entity {
* +
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource damagesource, float f) {
if (this.isEntityInvulnerable(damagesource)) {
public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.isEntityInvulnerable(source)) {
return false;
} else if (this.worldObj.isRemote) {
return false;
} else {
this.entityAge = 0;
if (this.getHealth() <= 0.0F) {
return false;
} else if (damagesource.isFireDamage() && this.isPotionActive(Potion.fireResistance)) {
} else if (source.isFireDamage() && this.isPotionActive(Potion.fireResistance)) {
return false;
} else {
if ((damagesource == DamageSource.anvil || damagesource == DamageSource.fallingBlock)
if ((source == DamageSource.anvil || source == DamageSource.fallingBlock)
&& this.getEquipmentInSlot(4) != null) {
this.getEquipmentInSlot(4).damageItem((int) (f * 4.0F + this.rand.nextFloat() * f * 2.0F), this);
f *= 0.75F;
this.getEquipmentInSlot(4)
.damageItem((int) (amount * 4.0F + this.rand.nextFloat() * amount * 2.0F), this);
amount *= 0.75F;
}
boolean flag = false;
if (amount > 0.0F && this.canBlockDamageSource(source)) {
this.damageShield(amount);
if (source.isProjectile()) {
amount = 0.0F;
} else {
amount *= 0.33F;
if (source.getSourceOfDamage() instanceof EntityLivingBase) {
((EntityLivingBase) source.getSourceOfDamage()).knockBack(this, 0.5F,
this.posX - source.getSourceOfDamage().posX,
this.posZ - source.getSourceOfDamage().posZ);
}
}
flag = true;
}
this.limbSwingAmount = 1.5F;
boolean flag = true;
boolean flag1 = true;
if ((float) this.hurtResistantTime > (float) this.maxHurtResistantTime / 2.0F) {
if (f <= this.lastDamage) {
if (amount <= this.lastDamage) {
return false;
}
this.damageEntity(damagesource, f - this.lastDamage);
this.lastDamage = f;
flag = false;
this.damageEntity(source, amount - this.lastDamage);
this.lastDamage = amount;
flag1 = false;
} else {
this.lastDamage = f;
this.lastDamage = amount;
this.hurtResistantTime = this.maxHurtResistantTime;
this.damageEntity(damagesource, f);
this.damageEntity(source, amount);
this.hurtTime = this.maxHurtTime = 10;
}
this.attackedAtYaw = 0.0F;
Entity entity = damagesource.getEntity();
Entity entity = source.getEntity();
if (entity != null) {
if (entity instanceof EntityLivingBase) {
this.setRevengeTarget((EntityLivingBase) entity);
@ -805,6 +839,7 @@ public abstract class EntityLivingBase extends Entity {
this.attackingPlayer = (EntityPlayer) entity;
} else if (entity instanceof EntityWolf) {
EntityWolf entitywolf = (EntityWolf) entity;
if (entitywolf.isTamed()) {
this.recentlyHit = 100;
this.attackingPlayer = null;
@ -812,48 +847,85 @@ public abstract class EntityLivingBase extends Entity {
}
}
if (flag1) {
if (flag) {
this.worldObj.setEntityState(this, (byte) 29);
} else if (source instanceof EntityDamageSource
&& ((EntityDamageSource) source).getIsThornsDamage()) {
this.worldObj.setEntityState(this, (byte) 33);
} else {
this.worldObj.setEntityState(this, (byte) 2);
if (damagesource != DamageSource.drown) {
}
if (source != DamageSource.drown && (!flag || amount > 0.0F)) {
this.setBeenAttacked();
}
if (entity != null) {
double d1 = entity.posX - this.posX;
double d0;
for (d0 = entity.posZ - this.posZ; d1 * d1
+ d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) {
d1 = (Math.random() - Math.random()) * 0.01D;
}
this.attackedAtYaw = (float) (MathHelper.func_181159_b(d0, d1) * 180.0D / 3.1415927410125732D
this.attackedAtYaw = (float) (MathHelper.atan2(d0, d1) * (180D / Math.PI)
- (double) this.rotationYaw);
this.knockBack(entity, f, d1, d0);
this.knockBack(entity, 0.4F, d1, d0);
} else {
this.attackedAtYaw = (float) ((int) (Math.random() * 2.0D) * 180);
}
}
if (this.getHealth() <= 0.0F) {
String s = this.getDeathSound();
if (flag && s != null) {
this.playSound(s, this.getSoundVolume(), this.getSoundPitch());
String soundevent = this.getDeathSound();
if (flag1 && soundevent != null) {
this.playSound(soundevent, this.getSoundVolume(), this.getSoundPitch());
}
this.onDeath(damagesource);
} else {
this.onDeath(source);
} else if (flag1) {
String s1 = this.getHurtSound();
if (flag && s1 != null) {
if (s1 != null) {
this.playSound(s1, this.getSoundVolume(), this.getSoundPitch());
}
}
return !flag || amount > 0.0F;
}
}
}
public boolean isActiveItemStackBlocking() {
if (this.isHandActive() && this.getActiveItemStack() != null) {
Item item = this.getActiveItemStack().getItem();
return item.getItemUseAction(this.getActiveItemStack()) != EnumAction.BLOCK ? false
: item.getMaxItemUseDuration(this.getActiveItemStack()) - this.itemInUseCount >= 5;
} else {
return false;
}
}
private boolean canBlockDamageSource(DamageSource damageSourceIn) {
if (!damageSourceIn.isUnblockable() && this.isActiveItemStackBlocking()) {
Vec3 vec3d = damageSourceIn.getDamageLocation();
if (vec3d != null) {
Vec3 vec3d1 = this.getLook(1.0F);
Vec3 vec3d2 = vec3d.subtractReverse(new Vec3(this.posX, this.posY, this.posZ)).normalize();
vec3d2 = new Vec3(vec3d2.xCoord, 0.0D, vec3d2.zCoord);
if (vec3d2.dotProduct(vec3d1) < 0.0D) {
return true;
}
}
}
return false;
}
/**
* +
* Renders broken item particles using the given ItemStack
@ -1048,6 +1120,9 @@ public abstract class EntityLivingBase extends Entity {
protected void damageArmor(float parFloat1) {
}
protected void damageShield(float damage) {
}
/**
* +
* Reduces damage, depending on armor
@ -1150,6 +1225,11 @@ public abstract class EntityLivingBase extends Entity {
public final void setArrowCountInEntity(int count) {
this.dataWatcher.updateObject(9, Integer.valueOf(count));
}
public boolean isHandActive() {
return this.itemInUse != null;
}
// TODO: implement hand states
// public boolean isHandActive() {
// return (((Byte) this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
@ -1161,6 +1241,91 @@ public abstract class EntityLivingBase extends Entity {
// : EnumHand.MAIN_HAND;
// }
public EnumHand getActiveHand() {
return EnumHand.MAIN_HAND;
}
/**
* Plays sounds and makes particles for item in use state
*/
protected void updateItemUse(@Nullable ItemStack stack, int eatingParticleCount) {
if (stack != null && this.isHandActive()) {
if (stack.getItemUseAction() == EnumAction.DRINK) {
this.playSound("entity.generic.drink", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (stack.getItemUseAction() == EnumAction.EAT) {
for (int i = 0; i < eatingParticleCount; ++i) {
Vec3 vec3d = new Vec3(((double) this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D,
0.0D);
vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
double d0 = (double) (-this.rand.nextFloat()) * 0.6D - 0.3D;
Vec3 vec3d1 = new Vec3(((double) this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
vec3d1 = vec3d1.addVector(this.posX, this.posY + (double) this.getEyeHeight(), this.posZ);
if (stack.getHasSubtypes()) {
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord,
vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord,
new int[] { Item.getIdFromItem(stack.getItem()), stack.getMetadata() });
} else {
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord,
vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord,
new int[] { Item.getIdFromItem(stack.getItem()) });
}
}
this.playSound("entity.generic.eat", 0.5F + 0.5F * (float) this.rand.nextInt(2),
(this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
}
}
}
protected void onItemUseFinish() {
// TODO: implement offhand
if (this.itemInUse != null && this.isHandActive()) {
this.updateItemUse(this.itemInUse, 16);
ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this);
if (itemstack != null && itemstack.stackSize == 0) {
itemstack = null;
}
// this.setHeldItem(this.getActiveHand(), itemstack);
this.setCurrentItemOrArmor(0, itemstack);
// this.resetActiveHand();
this.clearItemInUse();
}
}
public void setHeldItem(EnumHand hand, @Nullable ItemStack stack) {
if (hand == EnumHand.MAIN_HAND) {
this.setCurrentItemOrArmor(0, stack);
} else {
if (hand != EnumHand.OFF_HAND) {
throw new IllegalArgumentException("Invalid hand " + hand);
}
this.setCurrentItemOrArmor(5, stack);
}
}
public void clearItemInUse() {
this.itemInUse = null;
this.itemInUseCount = 0;
if (!this.worldObj.isRemote) {
this.setEating(false);
}
}
@Nullable
public ItemStack getActiveItemStack() {
return this.itemInUse;
}
/**
* +
* Returns an integer indicating the end point of the swing
@ -1185,6 +1350,8 @@ public abstract class EntityLivingBase extends Entity {
|| this.swingProgressInt < 0) {
this.swingProgressInt = -1;
this.isSwingInProgress = true;
// TODO: implement offhand
this.swingingHand = EnumHand.MAIN_HAND;
if (this.worldObj instanceof WorldServer) {
((WorldServer) this.worldObj).getEntityTracker().sendToAllTrackingEntity(this,
new S0BPacketAnimation(this, 0));
@ -1194,6 +1361,7 @@ public abstract class EntityLivingBase extends Entity {
}
public void handleStatusUpdate(byte b0) {
// TODO: play shield sound
if (b0 == 2) {
this.limbSwingAmount = 1.5F;
this.hurtResistantTime = this.maxHurtResistantTime;
@ -1289,6 +1457,10 @@ public abstract class EntityLivingBase extends Entity {
public abstract ItemStack getHeldItem();
public ItemStack getHeldItemOffhand() {
return this.getEquipmentInSlot(5);
}
public abstract ItemStack getEquipmentInSlot(int var1);
public abstract ItemStack getCurrentArmor(int var1);
@ -2119,6 +2291,8 @@ public abstract class EntityLivingBase extends Entity {
this.potionsNeedUpdate = true;
}
public abstract EnumHandSide getPrimaryHand();
protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
super.renderDynamicLightsEaglerAt(entityX, entityY, entityZ, renderX, renderY, renderZ, partialTicks,

View File

@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Rotations;
import net.minecraft.util.Vec3;
@ -823,4 +824,8 @@ public class EntityArmorStand extends EntityLivingBase {
public boolean canBeCollidedWith() {
return super.canBeCollidedWith() && !this.func_181026_s();
}
public EnumHandSide getPrimaryHand() {
return EnumHandSide.RIGHT;
}
}

View File

@ -1,10 +1,14 @@
package net.minecraft.entity.monster;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
@ -118,31 +122,53 @@ public abstract class EntityMob extends EntityCreature implements IMob {
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();
int i = 0;
if (entity instanceof EntityLivingBase) {
if (entityIn instanceof EntityLivingBase) {
f += EnchantmentHelper.func_152377_a(this.getHeldItem(),
((EntityLivingBase) entity).getCreatureAttribute());
((EntityLivingBase) entityIn).getCreatureAttribute());
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) {
entity.addVelocity(
(double) (-MathHelper.sin(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D,
(double) (MathHelper.cos(this.rotationYaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
if (i > 0 && entityIn instanceof EntityLivingBase) {
((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.motionZ *= 0.6D;
}
int j = EnchantmentHelper.getFireAspectModifier(this);
if (j > 0) {
entity.setFire(j * 4);
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() == EaglerItems.getEaglerItem("shield")) {
// float f1 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) *
// 0.05F;
// if (this.rand.nextFloat() < f1) {
// // TODO: implement cooldown
// // entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
// this.worldObj.setEntityState(entityplayer, (byte) 30);
// }
// }
}
this.applyEnchantments(this, entityIn);
}
return flag;

View File

@ -52,7 +52,7 @@ public class EntityBat extends EntityAmbientCreature {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(11, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -116,15 +116,15 @@ public class EntityBat extends EntityAmbientCreature {
}
public boolean getIsBatHanging() {
return (this.dataWatcher.getWatchableObjectByte(10) & 1) != 0;
return (this.dataWatcher.getWatchableObjectByte(11) & 1) != 0;
}
public void setIsBatHanging(boolean isHanging) {
byte b0 = this.dataWatcher.getWatchableObjectByte(10);
byte b0 = this.dataWatcher.getWatchableObjectByte(11);
if (isHanging) {
this.dataWatcher.updateObject(10, Byte.valueOf((byte) (b0 | 1)));
this.dataWatcher.updateObject(11, Byte.valueOf((byte) (b0 | 1)));
} else {
this.dataWatcher.updateObject(10, Byte.valueOf((byte) (b0 & -2)));
this.dataWatcher.updateObject(11, Byte.valueOf((byte) (b0 & -2)));
}
}
@ -242,7 +242,7 @@ public class EntityBat extends EntityAmbientCreature {
*/
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);
this.dataWatcher.updateObject(10, Byte.valueOf(nbttagcompound.getByte("BatFlags")));
this.dataWatcher.updateObject(11, Byte.valueOf(nbttagcompound.getByte("BatFlags")));
}
/**
@ -252,7 +252,7 @@ public class EntityBat extends EntityAmbientCreature {
*/
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
super.writeEntityToNBT(nbttagcompound);
nbttagcompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(10));
nbttagcompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(11));
}
/**

View File

@ -1239,11 +1239,13 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
nbttagcompound.setInteger("Variant", this.getHorseVariant());
nbttagcompound.setInteger("Temper", this.getTemper());
nbttagcompound.setBoolean("Tame", this.isTame());
if (this.getOwnerId() != null) {
if (worldObj.isRemote && !SingleplayerServerController.isClientInEaglerSingleplayerOrLAN()) {
nbttagcompound.setString("OwnerUUID", this.getOwnerId().toString());
} else {
nbttagcompound.setString("Owner", this.getOwnerId().toString());
}
}
if (this.isChested()) {
NBTTagList nbttaglist = new NBTTagList();

View File

@ -133,7 +133,7 @@ public class EntityWolf extends EntityTameable {
}
protected void updateAITasks() {
this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
this.dataWatcher.updateObject(14, Float.valueOf(this.getHealth()));
}
protected void entityInit() {
@ -510,7 +510,7 @@ public class EntityWolf extends EntityTameable {
}
public void setCollarColor(EnumDyeColor collarcolor) {
this.dataWatcher.updateObject(20, Byte.valueOf((byte) (collarcolor.getDyeDamage() & 15)));
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (collarcolor.getDyeDamage() & 15)));
}
public EntityWolf createChild(EntityAgeable var1) {

View File

@ -9,6 +9,7 @@ import java.util.List;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBed;
@ -47,9 +48,11 @@ import net.minecraft.inventory.InventoryEnderChest;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemElytra;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.play.server.S12PacketEntityVelocity;
@ -70,6 +73,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.FoodStats;
@ -80,6 +84,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.LockCode;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.entity.DataWatcher;
@ -155,8 +160,6 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
public int experienceTotal;
public float experience;
private int xpSeed;
private ItemStack itemInUse;
private int itemInUseCount;
protected float speedOnGround = 0.1F;
protected float speedInAir = 0.02F;
private int lastXPSound;
@ -466,11 +469,6 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
}
public boolean isHandActive() {
// TODO: implement offhand
return this.itemInUse != null;
}
/**
* +
* Used for when item use count runs out, ie: eating completed
@ -1021,6 +1019,41 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.inventory.damageArmor(f);
}
protected void damageShield(float damage) {
// if (damage >= 3.0F && this.getActiveItemStack() != null
// && this.getActiveItemStack().getItem() ==
// EaglerItems.getEaglerItem("shield")) {
// int i = 1 + MathHelper.floor_float(damage);
// this.getActiveItemStack().damageItem(i, this);
// if (this.getActiveItemStack().stackSize <= 0) {
// EnumHand enumhand = this.getActiveHand();
// if (enumhand == EnumHand.MAIN_HAND) {
// this.setItemStackToSlot(0, (ItemStack) null);
// } else {
// this.setItemStackToSlot(5, (ItemStack) null);
// }
// this.getActiveItemStack().stackSize = 0;
// // TODO: Implement sound
// // this.playSound(SoundEvents.ITEM_SHIELD_BREAK, 0.8F, 0.8F +
// // this.worldObj.rand.nextFloat() * 0.4F);
// }
// }
}
public void setItemStackToSlot(int slotIn, @Nullable ItemStack stack) {
// TODO: Implement sound
if (slotIn == 0) {
this.inventory.mainInventory[this.inventory.currentItem] = stack;
} else if (slotIn == 5) {
this.inventory.offHandInventory[0] = stack;
} else if (slotIn > 0 && slotIn < 5) {
this.inventory.armorInventory[slotIn] = stack;
}
}
/**
* +
* Returns the current armor value as determined by a call to
@ -1189,118 +1222,235 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
return -0.35D;
}
/**
* +
* Attacks for the player the targeted entity with the currently
* equipped item. The equipped item has hitEntity called on it.
* Args: targetEntity
*/
public void attackTargetEntityWithCurrentItem(Entity entity) {
if (entity.canAttackWithItem()) {
if (!entity.hitByEntity(this)) {
public void attackTargetEntityWithCurrentItem(Entity targetEntity) {
if (targetEntity.canAttackWithItem()) {
if (!targetEntity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
int i = 0;
float f1 = 0.0F;
if (entity instanceof EntityLivingBase) {
if (targetEntity instanceof EntityLivingBase) {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
((EntityLivingBase) entity).getCreatureAttribute());
((EntityLivingBase) targetEntity).getCreatureAttribute());
} else {
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), EnumCreatureAttribute.UNDEFINED);
f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(),
EnumCreatureAttribute.UNDEFINED);
}
i = i + EnchantmentHelper.getKnockbackModifier(this);
if (this.isSprinting()) {
++i;
}
// float f2 = this.getCooledAttackStrength(0.5F);
// f = f * (0.2F + f2 * f2 * 0.8F);
// f1 = f1 * f2;
// this.resetCooldown();
f1 = f;
if (f > 0.0F || f1 > 0.0F) {
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater()
&& !this.isPotionActive(Potion.blindness) && this.ridingEntity == null
&& entity instanceof EntityLivingBase;
if (flag && f > 0.0F) {
// boolean flag = f2 > 0.9F;
boolean flag = false;
boolean flag1 = false;
boolean flag2 = false;
boolean flag3 = false;
int i = 0;
i = i + EnchantmentHelper.getKnockbackModifier(this);
if (this.isSprinting() && flag) {
// TODO: implement sound
// 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;
}
flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder()
&& !this.isInWater() && !this.isPotionActive(Potion.blindness) && !this.isRiding()
&& targetEntity instanceof EntityLivingBase;
flag2 = flag2 && !this.isSprinting();
if (flag2) {
f *= 1.5F;
}
f = f + f1;
boolean flag1 = false;
int j = EnchantmentHelper.getFireAspectModifier(this);
if (entity instanceof EntityLivingBase && j > 0 && !entity.isBurning()) {
flag1 = true;
entity.setFire(1);
double d0 = (double) (this.distanceWalkedModified - this.prevDistanceWalkedModified);
if (flag && !flag2 && !flag1 && this.onGround && d0 < (double) this.getAIMoveSpeed()) {
// ItemStack itemstack = this.getHeldItem(EnumHand.MAIN_HAND);
ItemStack itemstack = this.getHeldItem();
if (itemstack != null && itemstack.getItem() instanceof ItemSword) {
flag3 = true;
}
}
double d0 = entity.motionX;
double d1 = entity.motionY;
double d2 = entity.motionZ;
boolean flag2 = entity.attackEntityFrom(DamageSource.causePlayerDamage(this), f);
if (flag2) {
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) {
entity.addVelocity(
(double) (-MathHelper.sin(this.rotationYaw * 3.1415927F / 180.0F) * (float) i
* 0.5F),
0.1D, (double) (MathHelper.cos(this.rotationYaw * 3.1415927F / 180.0F) * (float) i
* 0.5F));
if (targetEntity instanceof EntityLivingBase) {
((EntityLivingBase) targetEntity).knockBack(this, (float) i * 0.5F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
} else {
targetEntity.addVelocity(
(double) (-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float) i * 0.5F),
0.1D,
(double) (MathHelper.cos(this.rotationYaw * 0.017453292F) * (float) i * 0.5F));
}
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
this.setSprinting(false);
}
if (entity instanceof EntityPlayerMP && entity.velocityChanged) {
((EntityPlayerMP) entity).playerNetServerHandler
.sendPacket(new S12PacketEntityVelocity(entity));
entity.velocityChanged = false;
entity.motionX = d0;
entity.motionY = d1;
entity.motionZ = d2;
if (flag3) {
for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(
EntityLivingBase.class,
targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) {
if (entitylivingbase != this && entitylivingbase != targetEntity
&& !this.isOnSameTeam(entitylivingbase)
&& this.getDistanceSqToEntity(entitylivingbase) < 9.0D) {
entitylivingbase.knockBack(this, 0.4F,
(double) MathHelper.sin(this.rotationYaw * 0.017453292F),
(double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F);
}
}
// TODO: Implement sound and particles
// 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) {
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) {
this.onEnchantmentCritical(entity);
this.onEnchantmentCritical(targetEntity);
}
if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) targetEntity;
ItemStack itemstack2 = this.getHeldItem();
ItemStack itemstack3 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack()
: null;
// if (itemstack2 != null && itemstack3 != null && itemstack2.getItem()
// instanceof ItemAxe
// && itemstack3.getItem() == EaglerItems.getEaglerItem("shield")) {
// float f3 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) *
// 0.05F;
// if (flag1) {
// f3 += 0.75F;
// }
// if (this.rand.nextFloat() < f3) {
// // TODO: Implement cooldown
// //
// entityplayer.getCooldownTracker().setCooldown(EaglerItems.getEaglerItem("shield"),
// // 100);
// this.worldObj.setEntityState(entityplayer, (byte) 30);
// }
// }
}
if (f >= 18.0F) {
this.triggerAchievement(AchievementList.overkill);
}
this.setLastAttacker(entity);
if (entity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) entity, this);
this.setLastAttacker(targetEntity);
if (targetEntity instanceof EntityLivingBase) {
EnchantmentHelper.applyThornEnchantments((EntityLivingBase) targetEntity, this);
}
EnchantmentHelper.applyArthropodEnchantments(this, entity);
ItemStack itemstack = this.getCurrentEquippedItem();
Object object = entity;
if (entity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) entity).entityDragonObj;
EnchantmentHelper.applyArthropodEnchantments(this, targetEntity);
ItemStack itemstack1 = this.getHeldItem();
Entity entity = targetEntity;
if (targetEntity instanceof EntityDragonPart) {
IEntityMultiPart ientitymultipart = ((EntityDragonPart) targetEntity).entityDragonObj;
if (ientitymultipart instanceof EntityLivingBase) {
object = (EntityLivingBase) ientitymultipart;
entity = (EntityLivingBase) ientitymultipart;
}
}
if (itemstack != null && object instanceof EntityLivingBase) {
itemstack.hitEntity((EntityLivingBase) object, this);
if (itemstack.stackSize <= 0) {
this.destroyCurrentEquippedItem();
if (itemstack1 != null && entity instanceof EntityLivingBase) {
itemstack1.hitEntity((EntityLivingBase) entity, this);
if (itemstack1.stackSize <= 0) {
this.setHeldItem(EnumHand.MAIN_HAND, (ItemStack) null);
}
}
if (entity instanceof EntityLivingBase) {
this.addStat(StatList.damageDealtStat, Math.round(f * 10.0F));
if (targetEntity instanceof EntityLivingBase) {
float f5 = f4 - ((EntityLivingBase) targetEntity).getHealth();
this.addStat(StatList.damageDealtStat, Math.round(f5 * 10.0F));
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);
// TODO: Implement particles
// ((WorldServer)
// this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR,
// targetEntity.posX, targetEntity.posY + (double) (targetEntity.height * 0.5F),
// targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]);
}
}
this.addExhaustion(0.3F);
} else if (flag1) {
entity.extinguish();
}
}
} else {
// 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();
}
}
}
}
}
}
@ -2010,6 +2160,10 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
* 0: Tool in Hand; 1-4: Armor
*/
public ItemStack getEquipmentInSlot(int i) {
// ! offhand might break this
if (i == 5) {
return this.inventory.offHandInventory[0];
}
return i == 0 ? this.inventory.getCurrentItem() : this.inventory.armorInventory[i - 1];
}
@ -2021,6 +2175,11 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
return this.inventory.getCurrentItem();
}
@Nullable
public ItemStack getHeldItemOffhand() {
return this.inventory.offHandInventory[0];
}
/**
* +
* Sets the held item, or an armor slot. Slot 0 is held item.

View File

@ -8,6 +8,7 @@ import net.minecraft.block.Block;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@ -333,9 +334,13 @@ public class InventoryPlayer implements IInventory {
* receiving a block.
*/
public void decrementAnimations() {
for (int i = 0; i < this.mainInventory.length; ++i) {
if (this.mainInventory[i] != null) {
this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i);
for (int i = 0; i < this.allInventories.length; ++i) {
ItemStack[] aitemstack = this.allInventories[i];
for (int j = 0; j < aitemstack.length; ++j) {
if (aitemstack[j] != null) {
aitemstack[j].updateAnimation(this.player.worldObj, this.player, j, this.currentItem == j);
}
}
}
@ -429,45 +434,41 @@ public class InventoryPlayer implements IInventory {
* Removes up to a specified number of items from an inventory
* slot and returns them in a new stack.
*/
public ItemStack decrStackSize(int i, int j) {
ItemStack[] aitemstack = this.mainInventory;
if (i >= this.mainInventory.length) {
aitemstack = this.armorInventory;
i -= this.mainInventory.length;
public ItemStack decrStackSize(int index, int count) {
ItemStack[] aitemstack = null;
for (ItemStack[] aitemstack1 : this.allInventories) {
if (index < aitemstack1.length) {
aitemstack = aitemstack1;
break;
}
if (aitemstack[i] != null) {
if (aitemstack[i].stackSize <= j) {
ItemStack itemstack1 = aitemstack[i];
aitemstack[i] = null;
return itemstack1;
} else {
ItemStack itemstack = aitemstack[i].splitStack(j);
if (aitemstack[i].stackSize == 0) {
aitemstack[i] = null;
index -= aitemstack1.length;
}
return itemstack;
}
} else {
return null;
}
return aitemstack != null && aitemstack[index] != null ? ItemStackHelper.getAndSplit(aitemstack, index, count)
: null;
}
/**
* +
* Removes a stack from the given slot and returns it.
*/
public ItemStack removeStackFromSlot(int i) {
ItemStack[] aitemstack = this.mainInventory;
if (i >= this.mainInventory.length) {
aitemstack = this.armorInventory;
i -= this.mainInventory.length;
public ItemStack removeStackFromSlot(int index) {
ItemStack[] aitemstack = null;
for (ItemStack[] aitemstack1 : this.allInventories) {
if (index < aitemstack1.length) {
aitemstack = aitemstack1;
break;
}
if (aitemstack[i] != null) {
ItemStack itemstack = aitemstack[i];
aitemstack[i] = null;
index -= aitemstack1.length;
}
if (aitemstack != null && aitemstack[index] != null) {
ItemStack itemstack = aitemstack[index];
aitemstack[index] = null;
return itemstack;
} else {
return null;
@ -479,14 +480,21 @@ public class InventoryPlayer implements IInventory {
* Sets the given item stack to the specified slot in the
* inventory (can be crafting or armor sections).
*/
public void setInventorySlotContents(int i, ItemStack itemstack) {
ItemStack[] aitemstack = this.mainInventory;
if (i >= aitemstack.length) {
i -= aitemstack.length;
aitemstack = this.armorInventory;
public void setInventorySlotContents(int index, @Nullable ItemStack stack) {
ItemStack[] aitemstack = null;
for (ItemStack[] aitemstack1 : this.allInventories) {
if (index < aitemstack1.length) {
aitemstack = aitemstack1;
break;
}
aitemstack[i] = itemstack;
index -= aitemstack1.length;
}
if (aitemstack != null) {
aitemstack[index] = stack;
}
}
public float getStrVsBlock(Block blockIn) {
@ -574,14 +582,19 @@ public class InventoryPlayer implements IInventory {
* +
* Returns the stack in the given slot.
*/
public ItemStack getStackInSlot(int i) {
ItemStack[] aitemstack = this.mainInventory;
if (i >= aitemstack.length) {
i -= aitemstack.length;
aitemstack = this.armorInventory;
public ItemStack getStackInSlot(int index) {
ItemStack[] aitemstack = null;
for (ItemStack[] aitemstack1 : this.allInventories) {
if (index < aitemstack1.length) {
aitemstack = aitemstack1;
break;
}
return aitemstack[i];
index -= aitemstack1.length;
}
return aitemstack == null ? null : aitemstack[index];
}
/**
@ -682,22 +695,16 @@ public class InventoryPlayer implements IInventory {
* Drop all armor and main inventory items.
*/
public void dropAllItems() {
for (int i = 0; i < this.mainInventory.length; ++i) {
if (this.mainInventory[i] != null) {
this.player.dropItem(this.mainInventory[i], true, false);
this.mainInventory[i] = null;
for (ItemStack[] aitemstack : this.allInventories) {
for (int i = 0; i < aitemstack.length; ++i) {
if (aitemstack[i] != null) {
this.player.dropItem(aitemstack[i], true, false);
aitemstack[i] = null;
}
}
for (int j = 0; j < this.armorInventory.length; ++j) {
if (this.armorInventory[j] != null) {
this.player.dropItem(this.armorInventory[j], true, false);
this.armorInventory[j] = null;
}
}
}
/**
* +
* For tile entities, ensures the chunk containing the tile
@ -739,16 +746,12 @@ public class InventoryPlayer implements IInventory {
* inventory.
*/
public boolean hasItemStack(ItemStack itemStackIn) {
for (int i = 0; i < this.armorInventory.length; ++i) {
if (this.armorInventory[i] != null && this.armorInventory[i].isItemEqual(itemStackIn)) {
for (ItemStack[] aitemstack : this.allInventories) {
for (int i = 0; i < aitemstack.length; ++i) {
if (aitemstack[i] != null && aitemstack[i].isItemEqual(itemStackIn)) {
return true;
}
}
for (int j = 0; j < this.mainInventory.length; ++j) {
if (this.mainInventory[j] != null && this.mainInventory[j].isItemEqual(itemStackIn)) {
return true;
}
}
return false;
@ -798,13 +801,10 @@ public class InventoryPlayer implements IInventory {
}
public void clear() {
for (int i = 0; i < this.mainInventory.length; ++i) {
this.mainInventory[i] = null;
for (ItemStack[] aitemstack : this.allInventories) {
for (int i = 0; i < aitemstack.length; ++i) {
aitemstack[i] = null;
}
for (int j = 0; j < this.armorInventory.length; ++j) {
this.armorInventory[j] = null;
}
}
}

View File

@ -1,5 +1,7 @@
package net.minecraft.inventory;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
@ -54,18 +56,18 @@ public class ContainerPlayer extends Container {
this.isLocalWorld = localWorld;
this.thePlayer = player;
this.addSlotToContainer(
new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 144, 36));
new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 154, 28));
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 88 + j * 18, 26 + i * 18));
this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 98 + j * 18, 18 + i * 18));
}
}
for (int k = 0; k < 4; ++k) {
final int k2 = k;
this.addSlotToContainer(
new Slot(playerInventory, playerInventory.getSizeInventory() - 1 - k, 8, 8 + k * 18) {
new Slot(playerInventory, 36 + (3 - k), 8, 8 + k * 18) {
public int getSlotStackLimit() {
return 1;
}
@ -97,6 +99,17 @@ public class ContainerPlayer extends Container {
this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 142));
}
this.addSlotToContainer(new Slot(playerInventory, 40, 77, 62) {
public boolean isItemValid(@Nullable ItemStack stack) {
return super.isItemValid(stack);
}
@Nullable
public String getSlotTexture() {
return "minecraft:items/empty_armor_slot_shield";
}
});
this.onCraftMatrixChanged(this.craftMatrix);
}
@ -183,6 +196,16 @@ public class ContainerPlayer extends Container {
return null;
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
slot.onPickupFromSlot(entityplayer, itemstack1);
}

View File

@ -0,0 +1,32 @@
package net.minecraft.inventory;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
public class ItemStackHelper {
@Nullable
public static ItemStack getAndSplit(ItemStack[] stacks, int index, int amount) {
if (index >= 0 && index < stacks.length && stacks[index] != null && amount > 0) {
ItemStack itemstack = stacks[index].splitStack(amount);
if (stacks[index].stackSize == 0) {
stacks[index] = null;
}
return itemstack;
} else {
return null;
}
}
@Nullable
public static ItemStack getAndRemove(ItemStack[] stacks, int index) {
if (index >= 0 && index < stacks.length) {
ItemStack itemstack = stacks[index];
stacks[index] = null;
return itemstack;
} else {
return null;
}
}
}

View File

@ -170,6 +170,10 @@ public class Item {
return itemstack;
}
public ItemStack onItemRightClick(ItemStack itemstack, World var2, EntityLivingBase var3) {
return this.onItemRightClick(itemstack, var2, var3 instanceof EntityPlayer ? (EntityPlayer) var3 : null);
}
/**
* +
* Called when the player finishes using this Item (E.g.
@ -180,6 +184,10 @@ public class Item {
return itemstack;
}
public ItemStack onItemUseFinish(ItemStack itemstack, World var2, EntityLivingBase var3) {
return this.onItemUseFinish(itemstack, var2, var3 instanceof EntityPlayer ? (EntityPlayer) var3 : null);
}
/**
* +
* Returns the maximum size of the stack for a specific item.

View File

@ -182,6 +182,11 @@ public final class ItemStack {
return this.getItem().onItemRightClick(this, worldIn, playerIn);
}
public ItemStack useItemRightClick(World worldIn, EntityLivingBase entityIn) {
return this.getItem().onItemRightClick(this, worldIn,
entityIn instanceof EntityPlayer ? (EntityPlayer) entityIn : null);
}
/**
* +
* Called when the item in use count reach 0, e.g. item food
@ -191,6 +196,11 @@ public final class ItemStack {
return this.getItem().onItemUseFinish(this, worldIn, playerIn);
}
public ItemStack onItemUseFinish(World worldIn, EntityLivingBase entityLiving) {
return this.getItem().onItemUseFinish(this, worldIn,
entityLiving instanceof EntityPlayer ? (EntityPlayer) entityLiving : null);
}
/**
* +
* Write the stack fields to a NBT object. Return the new NBT

View File

@ -62,8 +62,6 @@ public class S30PacketWindowItems implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.windowId = parPacketBuffer.readUnsignedByte();
short short1 = parPacketBuffer.readShort();
if (short1 == 45)
short1 = 44; // TODO: implement offhand
this.itemStacks = new ItemStack[short1];
for (int i = 0; i < short1; ++i) {

View File

@ -286,4 +286,11 @@ public class DamageSource {
Entity entity = this.getEntity();
return entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode;
}
/**
* Gets the location from which the damage originates.
*/
public Vec3 getDamageLocation() {
return null;
}
}

View File

@ -92,4 +92,11 @@ public class EntityDamageSource extends DamageSource {
return this.damageSourceEntity != null && this.damageSourceEntity instanceof EntityLivingBase
&& !(this.damageSourceEntity instanceof EntityPlayer);
}
/**
* Gets the location from which the damage originates.
*/
public Vec3 getDamageLocation() {
return new Vec3(this.damageSourceEntity.posX, this.damageSourceEntity.posY, this.damageSourceEntity.posZ);
}
}

View File

@ -50,7 +50,10 @@ public enum EnumParticleTypes {
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),
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();

View File

@ -45,9 +45,9 @@ public class MathHelper {
*/
private static final float[] SIN_TABLE = new float[4096];
private static final int[] multiplyDeBruijnBitPosition;
private static final double field_181163_d;
private static final double[] field_181164_e;
private static final double[] field_181165_f;
private static final double FRAC_BIAS;
private static final double[] ASINE_TAB;
private static final double[] COS_TAB;
/**
* +
@ -84,6 +84,15 @@ public class MathHelper {
return y;
}
public static double fastInvSqrt(double p_181161_0_) {
double d0 = 0.5D * p_181161_0_;
long i = Double.doubleToRawLongBits(p_181161_0_);
i = 6910469410427058090L - (i >> 1);
p_181161_0_ = Double.longBitsToDouble(i);
p_181161_0_ = p_181161_0_ * (1.5D - d0 * p_181161_0_ * p_181161_0_);
return p_181161_0_;
}
public static int getHash(int p_188208_0_) {
p_188208_0_ = p_188208_0_ ^ p_188208_0_ >>> 16;
p_188208_0_ = p_188208_0_ * -2048144789;
@ -389,6 +398,60 @@ public class MathHelper {
return calculateLogBaseTwoDeBruijn(value) - (isPowerOfTwo(value) ? 0 : 1);
}
public static double atan2(double p_181159_0_, double p_181159_2_) {
double d0 = p_181159_2_ * p_181159_2_ + p_181159_0_ * p_181159_0_;
if (Double.isNaN(d0)) {
return Double.NaN;
} else {
boolean flag = p_181159_0_ < 0.0D;
if (flag) {
p_181159_0_ = -p_181159_0_;
}
boolean flag1 = p_181159_2_ < 0.0D;
if (flag1) {
p_181159_2_ = -p_181159_2_;
}
boolean flag2 = p_181159_0_ > p_181159_2_;
if (flag2) {
double d1 = p_181159_2_;
p_181159_2_ = p_181159_0_;
p_181159_0_ = d1;
}
double d9 = fastInvSqrt(d0);
p_181159_2_ = p_181159_2_ * d9;
p_181159_0_ = p_181159_0_ * d9;
double d2 = FRAC_BIAS + p_181159_0_;
int i = (int) Double.doubleToRawLongBits(d2);
double d3 = ASINE_TAB[i];
double d4 = COS_TAB[i];
double d5 = d2 - FRAC_BIAS;
double d6 = p_181159_0_ * d4 - p_181159_2_ * d5;
double d7 = (6.0D + d6 * d6) * d6 * 0.16666666666666666D;
double d8 = d3 + d7;
if (flag2) {
d8 = (Math.PI / 2D) - d8;
}
if (flag1) {
d8 = Math.PI - d8;
}
if (flag) {
d8 = -d8;
}
return d8;
}
}
public static int func_154354_b(int parInt1, int parInt2) {
if (parInt2 == 0) {
return 0;
@ -477,11 +540,11 @@ public class MathHelper {
double d9 = func_181161_i(d0);
parDouble2 = parDouble2 * d9;
parDouble1 = parDouble1 * d9;
double d2 = field_181163_d + parDouble1;
double d2 = FRAC_BIAS + parDouble1;
int i = (int) Double.doubleToRawLongBits(d2);
double d3 = field_181164_e[i];
double d4 = field_181165_f[i];
double d5 = d2 - field_181163_d;
double d3 = ASINE_TAB[i];
double d4 = COS_TAB[i];
double d5 = d2 - FRAC_BIAS;
double d6 = parDouble1 * d4 - parDouble2 * d5;
double d7 = (6.0D + d6 * d6) * d6 * 0.16666666666666666D;
double d8 = d3 + d7;
@ -573,15 +636,15 @@ public class MathHelper {
multiplyDeBruijnBitPosition = new int[] { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13,
23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
field_181163_d = Double.longBitsToDouble(4805340802404319232L);
field_181164_e = new double[257];
field_181165_f = new double[257];
FRAC_BIAS = Double.longBitsToDouble(4805340802404319232L);
ASINE_TAB = new double[257];
COS_TAB = new double[257];
for (int j = 0; j < 257; ++j) {
double d0 = (double) j / 256.0D;
double d1 = Math.asin(d0);
field_181165_f[j] = Math.cos(d1);
field_181164_e[j] = d1;
COS_TAB[j] = Math.cos(d1);
ASINE_TAB[j] = d1;
}
}
}

View File

@ -1,6 +1,8 @@
package net.minecraft.world.gen.structure;
import java.util.List;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
@ -362,7 +364,7 @@ public abstract class StructureComponent {
}
} else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof BlockDirectional)) {
if (blockIn == Blocks.piston || blockIn == Blocks.sticky_piston || blockIn == Blocks.lever
|| blockIn == Blocks.dispenser) {
|| blockIn == Blocks.dispenser || blockIn == EaglerItems.getEaglerBlock("end_rod")) {
if (this.coordBaseMode == EnumFacing.SOUTH) {
if (meta == EnumFacing.NORTH.getIndex() || meta == EnumFacing.SOUTH.getIndex()) {
return EnumFacing.getFront(meta).getOpposite().getIndex();