fixed item physics (kinda) and made the code kinda readable
This commit is contained in:
parent
94b14a7a73
commit
4718aad6e9
Binary file not shown.
45059
javascript/classes.js
45059
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -13,8 +13,10 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
|
||||||
public class RenderItemPhysics {
|
public class RenderItemPhysics {
|
||||||
|
|
||||||
|
|
||||||
public static int func_177077_a(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_, int func_177078_a) {
|
public static int func_177077_a(EntityItem itemIn, double x, double y, double z, float partialTicks, IBakedModel bakedModel, int itemStackNum) {
|
||||||
|
|
||||||
ItemStack itemstack = itemIn.getEntityItem();
|
ItemStack itemstack = itemIn.getEntityItem();
|
||||||
Item item = itemstack.getItem();
|
Item item = itemstack.getItem();
|
||||||
Block block = Block.getBlockFromItem(item);
|
Block block = Block.getBlockFromItem(item);
|
||||||
|
@ -22,26 +24,26 @@ public class RenderItemPhysics {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
boolean flag = p_177077_9_.isGui3d();
|
boolean flag = bakedModel.isGui3d();
|
||||||
int i = func_177078_a;
|
int i = itemStackNum;
|
||||||
|
|
||||||
if (ModManager.itemPhysics.isEnabled()) {
|
if (ModManager.itemPhysics.isEnabled()) {
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
GlStateManager.translate((float) p_177077_2_, (float) p_177077_4_ + 0.15F, (float) p_177077_6_);
|
GlStateManager.translate((float) x, (float) y + 0.15F, (float) z);
|
||||||
} else {
|
} else {
|
||||||
GlStateManager.translate((float) p_177077_2_, (float) p_177077_4_ + 0.02F, (float) p_177077_6_);
|
GlStateManager.translate((float) x, (float) y + 0.02F, (float) z);
|
||||||
GlStateManager.rotate(-90F, 1F, 0F, 0F);
|
GlStateManager.rotate(-90F, 1F, 0F, 0F);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float f1 = MathHelper.sin(((float) itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
|
float f1 = MathHelper.sin(((float) itemIn.getAge() + partialTicks) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
|
||||||
float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
|
float f2 = bakedModel.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
|
||||||
|
|
||||||
GlStateManager.translate((float) p_177077_2_, (float) p_177077_4_ + f1 + 0.25F * f2, (float) p_177077_6_);
|
GlStateManager.translate((float) x, (float) y + f1 + 0.25F * f2, (float) z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ModManager.itemPhysics.isEnabled()) {
|
if (!ModManager.itemPhysics.isEnabled()) {
|
||||||
if (flag || Minecraft.getMinecraft().getRenderManager().options != null) {
|
if (flag || Minecraft.getMinecraft().getRenderManager().options != null) {
|
||||||
float f3 = (((float) itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float) Math.PI);
|
float f3 = (((float) itemIn.getAge() + partialTicks) / 20.0F + itemIn.hoverStart) * (180F / (float) Math.PI);
|
||||||
GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
|
GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +57,7 @@ public class RenderItemPhysics {
|
||||||
|
|
||||||
if (ModManager.itemPhysics.isEnabled() && !itemIn.onGround) {
|
if (ModManager.itemPhysics.isEnabled() && !itemIn.onGround) {
|
||||||
float angle = System.currentTimeMillis() % (360 * 20) / (float) (4.5 - ItemPhysics.speed.getValue() / 2);
|
float angle = System.currentTimeMillis() % (360 * 20) / (float) (4.5 - ItemPhysics.speed.getValue() / 2);
|
||||||
GlStateManager.rotate(angle, 1F, 1F, 1F);
|
GlStateManager.rotate(angle, 1f, 0f, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user