Bugfixes, improvements, and Katana upgrades.

This commit is contained in:
John Yorke committed 2016-10-30 00:20:56 -03:00
1 parent 015167ae96
commit bc8cc766f0
25 files changed
+667 -139

No files matched your search

@@ -1,7 +1,6 @@
package taintedmagic.client;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
@@ -10,11 +9,10 @@ import taintedmagic.client.handler.HUDHandler;
import taintedmagic.client.renderer.RenderItemKatana;
import taintedmagic.client.renderer.RenderTaintBubble;
import taintedmagic.common.CommonProxy;
import taintedmagic.common.TaintedMagic;
import taintedmagic.common.entities.EntityEldritchOrbAttack;
import taintedmagic.common.entities.EntityTaintBubble;
import taintedmagic.common.helper.TaintedMagicHelper;
import taintedmagic.common.helper.Vector3;
import taintedmagic.common.items.tools.ItemKatana;
import taintedmagic.common.registry.ItemRegistry;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.fx.particles.FXWisp;
@@ -70,7 +68,7 @@ public class ClientProxy extends CommonProxy
ef.setGravity(0.0F);
ef.shrink = true;
ef.noClip = true;
Vector3 movement = getDistanceVectorBetween(ef, p);
Vector3 movement = TaintedMagicHelper.getDistanceBetween(ef, p);
ef.addVelocity(movement.x * 2.5, 0, movement.z * 2.5);
ParticleEngine.instance.addEffect(w, ef);
@@ -78,12 +76,30 @@ public class ClientProxy extends CommonProxy
}
}
public static Vector3 getDistanceVectorBetween (Entity e, Entity target)
@Override
public void spawnWindParticles (World w)
{
Vector3 fromPosition = new Vector3(e.posX, e.posY, e.posZ);
Vector3 toPosition = new Vector3(target.posX, target.posY, target.posZ);
Vector3 dist = fromPosition.sub(toPosition);
dist.normalize();
return dist;
EntityPlayer p = getClientPlayer();
for (int i = 1; i < 150; i++)
{
double xp = (-Math.random() * 5.0F) + (Math.random() * 5.0F);
double zp = (-Math.random() * 5.0F) + (Math.random() * 5.0F);
double yp = (-Math.random() * 5.0F) + (Math.random() * 5.0F);
double off = Math.random() * 0.1;
float red = (0.8F + p.worldObj.rand.nextFloat() * 0.5F);
float green = (0.8F + p.worldObj.rand.nextFloat() * 0.5F);
float blue = (0.6F + p.worldObj.rand.nextFloat() * 0.5F);
FXWisp ef = new FXWisp(w, p.posX + xp + off, p.posY + yp + off, p.posZ + zp + off, 0.25F + ((float) Math.random() * 0.25F), red, green, blue);
ef.setGravity(0.0F);
ef.shrink = true;
ef.noClip = true;
Vector3 movement = TaintedMagicHelper.getDistanceBetween(ef, p);
ef.addVelocity(movement.x * 0.5, 0, movement.z * 0.5);
ParticleEngine.instance.addEffect(w, ef);
}
}
}
@@ -1,9 +1,11 @@
package taintedmagic.client.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import taintedmagic.common.items.tools.ItemKatana;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class HUDHandler
@@ -14,7 +16,14 @@ public class HUDHandler
if (event.type == ElementType.ALL)
{
Minecraft mc = Minecraft.getMinecraft();
ItemStack equippedStack = mc.thePlayer.getCurrentEquippedItem();
EntityPlayer p = mc.thePlayer;
ScaledResolution r = event.resolution;
float pt = event.partialTicks;
if (mc.currentScreen == null)
{
ItemKatana.renderHUD(r, p, pt);
}
}
}
}
@@ -0,0 +1,44 @@
package taintedmagic.client.helper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import thaumcraft.client.lib.UtilsFX;
public class TaintedMagicClientHelper
{
/**
* TC method to draw runes on runed staves
*/
public static void drawRune (double x, double y, double z, int rune, EntityPlayer player)
{
GL11.glPushMatrix();
UtilsFX.bindTexture("textures/misc/script.png");
float r = MathHelper.sin( (player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F;
float g = MathHelper.sin( (player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F;
float alpha = MathHelper.sin( (player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
GL11.glColor4f(r, g, 0.2F, alpha + 0.6F);
GL11.glRotated(90.0D, 0.0D, 0.0D, 1.0D);
GL11.glTranslated(x, y, z);
Tessellator tessellator = Tessellator.instance;
float f = 0.0625F * rune;
float f1 = f + 0.0625F;
float f2 = 0.0F;
float f3 = 1.0F;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(r, g, 0.2F, alpha + 0.6F);
tessellator.addVertexWithUV(-0.06D - alpha / 40.0F, 0.06D + alpha / 40.0F, 0.0D, f1, f3);
tessellator.addVertexWithUV(0.06D + alpha / 40.0F, 0.06D + alpha / 40.0F, 0.0D, f1, f2);
tessellator.addVertexWithUV(0.06D + alpha / 40.0F, -0.06D - alpha / 40.0F, 0.0D, f, f2);
tessellator.addVertexWithUV(-0.06D - alpha / 40.0F, -0.06D - alpha / 40.0F, 0.0D, f, f3);
tessellator.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
}
@@ -10,9 +10,9 @@ import net.minecraft.client.model.ModelRenderer;
*/
public class ModelKatana extends ModelBase
{
ModelRenderer blade;
ModelRenderer grip1;
ModelRenderer grip2;
public ModelRenderer blade;
public ModelRenderer grip1;
public ModelRenderer grip2;
public ModelKatana ()
{
@@ -2,19 +2,20 @@ package taintedmagic.client.renderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GL21;
import taintedmagic.client.model.ModelKatana;
import taintedmagic.client.model.ModelSaya;
import taintedmagic.client.helper.TaintedMagicClientHelper;
import taintedmagic.common.TaintedMagic;
import taintedmagic.common.items.tools.ItemKatana;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.client.lib.UtilsFX;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -44,41 +45,6 @@ public class RenderItemKatana implements IItemRenderer
GL11.glScalef(1.4F, 1.4F, 1.4F);
GL11.glPushMatrix();
if (t == ItemRenderType.ENTITY)
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0F, 0.5F, 0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
}
else if (t == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glScalef(2F, 2F, 2F);
GL11.glTranslatef(2.25F, 1.75F, -0.2F);
GL11.glRotatef(-10F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F);
}
else if (t == ItemRenderType.INVENTORY)
{
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glRotatef(-65, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-50, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(1F, 1F, 0.0F);
}
else
{
GL11.glRotatef(60, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-40, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(70, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 2F, 0.65F);
}
Minecraft.getMinecraft().renderEngine.bindTexture(ItemKatana.getTexture(s));
ItemKatana.katana.render(0.0625F);
GL11.glPopMatrix();
if (p.getHeldItem() == null || ! (p.getHeldItem() == s))
{
GL11.glPushMatrix();
@@ -104,8 +70,82 @@ public class RenderItemKatana implements IItemRenderer
ItemKatana.saya.render(0.0625F);
GL11.glPopMatrix();
}
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glPushMatrix();
if (t == ItemRenderType.ENTITY)
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0F, 0.5F, 0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
}
else if (t == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
if (p.isUsingItem())
{
GL11.glTranslatef(5.0F, 1.0F, -0.2F);
GL11.glRotatef(155.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-20.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
}
GL11.glScalef(1.5F, 1.5F, 1.5F);
GL11.glTranslatef(2.0F, 1.85F, -0.25F);
GL11.glRotatef(-10F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F);
}
else if (t == ItemRenderType.INVENTORY)
{
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glRotatef(-65, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-50, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(1F, 1F, 0.0F);
}
else
{
GL11.glRotatef(60, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-40, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(70, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 2F, 0.65F);
}
Minecraft.getMinecraft().renderEngine.bindTexture(ItemKatana.getTexture(s));
ItemKatana.katana.render(0.0625F);
// Runes
if (ItemKatana.hasAnyInscription(s))
{
GL11.glPushMatrix();
int j = 200;
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 1);
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
for (int a = 0; a < 14; a++)
{
int rune = (a * 3) % 16;
TaintedMagicClientHelper.drawRune(-1.65D + a * 0.14D, 0D, -0.03D, rune, p);
}
GL11.glRotated(180.0D, 0.0D, 1.0D, 0.0D);
for (int a = 0; a < 14; a++)
{
int rune = (a + 1 * 3) % 16;
TaintedMagicClientHelper.drawRune(-1.65D + a * 0.14D, 0D, -0.03D, rune, p);
}
GL11.glBlendFunc(770, 771);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
@@ -33,22 +33,21 @@ public class RenderTaintBubble extends Render
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(true);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
int p = (int) (8.0F * (bubble.ticksExisted / bubble.duration));
int p = (int) (7.0F * ((float) bubble.ticksExisted / (float) bubble.duration));
float f2 = 0;
float f3 = 1;
float f4 = (6 + p) / 16F;
float f5 = f4 + 0.125F;
float f4 = p / 8.0F;
float f5 = (p + 1) / 8.0F;
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
float fc = bubble.ticksExisted / bubble.duration;
float s = 0.25F + fc;
float s = 0.5F;
GL11.glScalef(s, s, s);
@@ -56,9 +55,9 @@ public class RenderTaintBubble extends Render
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
t.startDrawingQuads();
t.setBrightness(220);
t.setBrightness(240);
t.setNormal(0.0F, 1.0F, 0.0F);
t.setColorRGBA_F(0.3F, 0.0F, 0.3F, 1F);
t.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.9F);
t.addVertexWithUV(-f7, -f8, 0.0D, f2, f5);
t.addVertexWithUV(f6 - f7, -f8, 0.0D, f3, f5);
@@ -68,7 +67,7 @@ public class RenderTaintBubble extends Render
t.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(32826);
GL11.glPopMatrix();
}