mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
Work on making flamethrowers work nice. Still need to get first person neutral particles down.
This commit is contained in:
1 parent
6fbfd22583
commit
1a458834a8
3 files changed
+81
-3
No files matched your search
@@ -131,6 +131,22 @@ public class Pos3D
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pos3D rotatePitch(double pitch)
|
||||
{
|
||||
double pitchRadians = Math.toRadians(pitch);
|
||||
|
||||
double y = yPos;
|
||||
double z = zPos;
|
||||
|
||||
if(pitch != 0)
|
||||
{
|
||||
yPos = y * Math.cos(pitchRadians) - z * Math.sin(pitchRadians);
|
||||
zPos = z * Math.cos(pitchRadians) + y * Math.sin(pitchRadians);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scales this Pos3D by the defined x, y, an z values.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mekanism.client.render;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -8,6 +9,7 @@ import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Pos3D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.item.ItemFlamethrower;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
import mekanism.common.item.ItemScubaTank;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
@@ -163,6 +165,51 @@ public class RenderTickHandler
|
||||
spawnAndSetParticle("flame", world, v.xPos, v.yPos, v.zPos, mCenter.xPos, mCenter.yPos, mCenter.zPos);
|
||||
spawnAndSetParticle("smoke", world, v.xPos, v.yPos, v.zPos, mCenter.xPos, mCenter.yPos, mCenter.zPos);
|
||||
}
|
||||
|
||||
if(world.getWorldTime() % 4 == 0)
|
||||
{
|
||||
for(EntityPlayer p : (List<EntityPlayer>)world.playerEntities)
|
||||
{
|
||||
if(!p.isSwingInProgress && p.getCurrentEquippedItem() != null && p.getCurrentEquippedItem().getItem() instanceof ItemFlamethrower)
|
||||
{
|
||||
if(((ItemFlamethrower)p.getCurrentEquippedItem().getItem()).getGas(p.getCurrentEquippedItem()) != null)
|
||||
{
|
||||
Pos3D playerPos = new Pos3D(p);
|
||||
|
||||
Pos3D flameVec = new Pos3D();
|
||||
|
||||
if(p.isSneaking())
|
||||
{
|
||||
flameVec.yPos -= 0.35F;
|
||||
flameVec.zPos -= 0.15F;
|
||||
}
|
||||
|
||||
Pos3D flameMotion = new Pos3D(p.motionX, p.onGround ? 0 : p.motionY, p.motionZ);
|
||||
|
||||
if(player == p && mc.gameSettings.thirdPersonView == 0)
|
||||
{
|
||||
flameVec.xPos -= 0.25F;
|
||||
flameVec.yPos -= 0.5F;
|
||||
flameVec.zPos += 1.15F;
|
||||
|
||||
flameVec.rotateYaw(p.rotationYaw);
|
||||
flameVec.rotatePitch(p.rotationPitch);
|
||||
}
|
||||
else {
|
||||
flameVec.xPos -= 0.45F;
|
||||
flameVec.yPos -= 0.5F;
|
||||
flameVec.zPos += 1.05F;
|
||||
|
||||
flameVec.rotateYaw(p.renderYawOffset);
|
||||
}
|
||||
|
||||
Pos3D mergedVec = playerPos.clone().translate(flameVec);
|
||||
|
||||
spawnAndSetParticle("flame", world, mergedVec.xPos, mergedVec.yPos, mergedVec.zPos, flameMotion.xPos, flameMotion.yPos, flameMotion.zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,14 +441,29 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||
else if(item.getItem() instanceof ItemFlamethrower)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(180, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(160, 0.0F, 0.0F, 1.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Flamethrower.png"));
|
||||
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glRotatef(135, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-20, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
if(type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
GL11.glRotatef(55, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glScalef(2.5F, 2.5F, 2.5F);
|
||||
GL11.glTranslatef(0.0F, -1.0F, -0.5F);
|
||||
}
|
||||
else if(type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
GL11.glRotatef(45F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
flamethrower.render(0.0625F);
|
||||
|
||||
Reference in new issue
Block a user