mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-25 14:24:27 +00:00
commit source
This commit is contained in:
commit
1381f5b9b4
171 files changed
+7742
No files matched your search
@@ -0,0 +1,88 @@
|
||||
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;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
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.Vector3;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
import thaumcraft.client.renderers.entity.RenderEldritchOrb;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@Override
|
||||
public void initRenders ()
|
||||
{
|
||||
// Entities
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityTaintBubble.class, new RenderTaintBubble());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEldritchOrbAttack.class, new RenderEldritchOrb());
|
||||
|
||||
// Items
|
||||
MinecraftForgeClient.registerItemRenderer(ItemRegistry.ItemKatana, new RenderItemKatana());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getClientPlayer ()
|
||||
{
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerClientHandlers ()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new HUDHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnShockwaveParticles (World w)
|
||||
{
|
||||
EntityPlayer p = getClientPlayer();
|
||||
|
||||
double xp = 0;
|
||||
double zp = 0;
|
||||
|
||||
for (int i = 1; i < 360; i++)
|
||||
{
|
||||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
xp = (Math.cos(i * Math.PI / 180F)) * 1;
|
||||
zp = (Math.sin(i * Math.PI / 180F)) * 1;
|
||||
|
||||
float red = (0.05F + p.worldObj.rand.nextFloat() * 0.1F);
|
||||
float blue = (0.1F + p.worldObj.rand.nextFloat() * 0.1F);
|
||||
|
||||
double off = Math.random() * 0.1;
|
||||
|
||||
FXWisp ef = new FXWisp(w, p.posX + xp + off, p.posY - 1, p.posZ + zp + off, 2.0F * (float) Math.random(), red, 0.0F, blue);
|
||||
ef.setGravity(0.0F);
|
||||
ef.shrink = true;
|
||||
ef.noClip = true;
|
||||
Vector3 movement = getDistanceBetween(ef, p);
|
||||
ef.addVelocity(movement.x * 2.5, 0, movement.z * 2.5);
|
||||
|
||||
ParticleEngine.instance.addEffect(w, ef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 getDistanceBetween (Entity e, Entity target)
|
||||
{
|
||||
Vector3 fromPosition = new Vector3(e.posX, e.posY, e.posZ);
|
||||
Vector3 toPosition = new Vector3(target.posX, target.posY, target.posZ);
|
||||
Vector3 var3 = fromPosition.sub(toPosition);
|
||||
var3.normalize();
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package taintedmagic.client.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class HUDHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onDrawScreen (RenderGameOverlayEvent.Post event)
|
||||
{
|
||||
if (event.type == ElementType.ALL)
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ItemStack equippedStack = mc.thePlayer.getCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package taintedmagic.client.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
/**
|
||||
* katana - wiiv Created using Tabula 4.1.1
|
||||
*/
|
||||
public class ModelKatana extends ModelBase
|
||||
{
|
||||
ModelRenderer blade;
|
||||
ModelRenderer grip1;
|
||||
ModelRenderer grip2;
|
||||
|
||||
public ModelKatana ()
|
||||
{
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 64;
|
||||
this.grip2 = new ModelRenderer(this, 22, 0);
|
||||
this.grip2.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
this.grip2.addBox(-1.0F, -12.0F, -1.5F, 2, 12, 3, 0.0F);
|
||||
this.blade = new ModelRenderer(this, 0, 0);
|
||||
this.blade.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
this.blade.addBox(-0.5F, 0.0F, -2.0F, 1, 48, 4, -0.75F);
|
||||
this.grip1 = new ModelRenderer(this, 0, 52);
|
||||
this.grip1.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
this.grip1.addBox(-2.5F, 0.0F, -3.5F, 5, 1, 7, 0.0F);
|
||||
this.grip1.addChild(this.grip2);
|
||||
}
|
||||
|
||||
public void render (float size)
|
||||
{
|
||||
this.blade.render(size);
|
||||
this.grip1.render(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
private void setRotation (ModelRenderer m, float x, float y, float z)
|
||||
{
|
||||
m.rotateAngleX = x;
|
||||
m.rotateAngleY = y;
|
||||
m.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package taintedmagic.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
/**
|
||||
* katana - wiiv Created using Tabula 4.1.1
|
||||
*/
|
||||
public class ModelSaya extends ModelBase
|
||||
{
|
||||
public ModelRenderer saya;
|
||||
|
||||
public ModelSaya ()
|
||||
{
|
||||
this.textureWidth = 32;
|
||||
this.textureHeight = 64;
|
||||
this.saya = new ModelRenderer(this, 10, 0);
|
||||
this.saya.setRotationPoint(0.0F, -40.0F, 0.0F);
|
||||
this.saya.addBox(-1.0F, 0.5F, -2.0F, 2, 48, 4, 0.0F);
|
||||
}
|
||||
|
||||
public void render (float size)
|
||||
{
|
||||
this.saya.render(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a helper function from Tabula to set the rotation of model parts
|
||||
*/
|
||||
public void setRotation (ModelRenderer m, float x, float y, float z)
|
||||
{
|
||||
m.rotateAngleX = x;
|
||||
m.rotateAngleY = y;
|
||||
m.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package taintedmagic.client.renderer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import taintedmagic.client.model.ModelKatana;
|
||||
import taintedmagic.client.model.ModelSaya;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import taintedmagic.common.items.tools.ItemKatana;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public class RenderItemKatana implements IItemRenderer
|
||||
{
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack s, ItemRenderType t)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType t, ItemStack s, ItemRendererHelper h)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType t, ItemStack s, Object... data)
|
||||
{
|
||||
EntityPlayer p = TaintedMagic.proxy.getClientPlayer();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
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();
|
||||
|
||||
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.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.glTranslatef(0.0F, -0.7F, 0.0F);
|
||||
}
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ItemKatana.getTexture(s));
|
||||
ItemKatana.saya.render(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package taintedmagic.client.renderer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import taintedmagic.common.entities.EntityTaintBubble;
|
||||
|
||||
public class RenderTaintBubble extends Render
|
||||
{
|
||||
private static final ResourceLocation texture = new ResourceLocation("taintedmagic:textures/entities/EntityTaintBubble.png");
|
||||
private Random random = new Random();
|
||||
|
||||
public RenderTaintBubble ()
|
||||
{
|
||||
this.shadowSize = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender (Entity e, double x, double y, double z, float f, float pt)
|
||||
{
|
||||
Tessellator t = Tessellator.instance;
|
||||
EntityTaintBubble bubble = (EntityTaintBubble) e;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
int p = (int) (8.0F * (bubble.ticksExisted / bubble.duration));
|
||||
float f2 = 0;
|
||||
float f3 = 1;
|
||||
float f4 = (6 + p) / 16F;
|
||||
float f5 = f4 + 0.125F;
|
||||
|
||||
float f6 = 1.0F;
|
||||
float f7 = 0.5F;
|
||||
float f8 = 0.5F;
|
||||
|
||||
float fc = bubble.ticksExisted / bubble.duration;
|
||||
|
||||
float s = 0.25F + fc;
|
||||
|
||||
GL11.glScalef(s, s, s);
|
||||
|
||||
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
t.startDrawingQuads();
|
||||
t.setBrightness(220);
|
||||
t.setNormal(0.0F, 1.0F, 0.0F);
|
||||
t.setColorRGBA_F(0.3F, 0.0F, 0.3F, 1F);
|
||||
|
||||
t.addVertexWithUV(-f7, -f8, 0.0D, f2, f5);
|
||||
t.addVertexWithUV(f6 - f7, -f8, 0.0D, f3, f5);
|
||||
t.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
|
||||
t.addVertexWithUV(-f7, 1.0F - f8, 0.0D, f2, f4);
|
||||
|
||||
t.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user