Bug fixes and additions. Closes #39, #40, #41, #43 and #44
This commit is contained in:
John Yorke committed 2017-07-21 01:00:33 -03:00
1 parent 6b2ceddd86
commit cc77874e71
74 files changed
+1696 -1296

No files matched your search

@@ -1,19 +1,20 @@
package taintedmagic.client;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
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.RenderEntityDiffusion;
import taintedmagic.client.renderer.RenderEntityGlowpet;
import taintedmagic.client.renderer.RenderEntityHomingShard;
import taintedmagic.client.renderer.RenderEntityTaintBubble;
import taintedmagic.client.renderer.RenderItemKatana;
import taintedmagic.common.CommonProxy;
import taintedmagic.common.entities.EntityEldritchOrbAttack;
import taintedmagic.common.entities.EntityDarkMatter;
import taintedmagic.common.entities.EntityDiffusion;
import taintedmagic.common.entities.EntityGlowpet;
import taintedmagic.common.entities.EntityHomingShard;
import taintedmagic.common.entities.EntityTaintBubble;
import taintedmagic.common.helper.TaintedMagicHelper;
@@ -23,7 +24,7 @@ import thaumcraft.client.fx.particles.FXWisp;
import thaumcraft.client.renderers.entity.RenderEldritchOrb;
import thaumcraft.codechicken.lib.vec.Vector3;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.common.FMLCommonHandler;
public class ClientProxy extends CommonProxy
{
@@ -32,8 +33,10 @@ public class ClientProxy extends CommonProxy
{
// Entities
RenderingRegistry.registerEntityRenderingHandler(EntityTaintBubble.class, new RenderEntityTaintBubble());
RenderingRegistry.registerEntityRenderingHandler(EntityEldritchOrbAttack.class, new RenderEldritchOrb());
RenderingRegistry.registerEntityRenderingHandler(EntityDarkMatter.class, new RenderEldritchOrb());
RenderingRegistry.registerEntityRenderingHandler(EntityHomingShard.class, new RenderEntityHomingShard());
RenderingRegistry.registerEntityRenderingHandler(EntityGlowpet.class, new RenderEntityGlowpet());
RenderingRegistry.registerEntityRenderingHandler(EntityDiffusion.class, new RenderEntityDiffusion());
// Items
MinecraftForgeClient.registerItemRenderer(ItemRegistry.ItemKatana, new RenderItemKatana());
@@ -49,6 +52,7 @@ public class ClientProxy extends CommonProxy
public void registerClientHandlers ()
{
MinecraftForge.EVENT_BUS.register(new HUDHandler());
FMLCommonHandler.instance().bus().register(new HUDHandler());
}
@Override
@@ -1,14 +1,29 @@
package taintedmagic.client.handler;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.client.util.JsonException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import taintedmagic.common.items.equipment.ItemWarpedGoggles;
import taintedmagic.common.items.tools.ItemKatana;
import taintedmagic.common.items.tools.ItemThaumicDisassembler;
import thaumcraft.client.lib.ClientTickEventsFML;
import thaumcraft.client.lib.RenderEventHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly (Side.CLIENT)
public class HUDHandler
{
@SubscribeEvent
@@ -0,0 +1,76 @@
package taintedmagic.client.renderer;
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.EntityDiffusion;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.lib.UtilsFX;
public class RenderEntityDiffusion extends Render
{
public void render (EntityDiffusion e, double x, double y, double z, float f, float pT)
{
Tessellator t = Tessellator.instance;
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
float c = 0.1F;
float a = ( (20.0F - (float) e.ticksExisted) / 40.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
UtilsFX.bindTexture(ParticleEngine.particleTexture);
float f2 = e.ticksExisted % 13 / 16.0F;
float f3 = f2 + 0.0624375F;
float f4 = 0.1875F;
float f5 = f4 + 0.0624375F;
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GL11.glColor4f(c, c, c, a);
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
float s = 0.5F;
GL11.glScalef(s, s, s);
t.startDrawingQuads();
t.setNormal(0.0F, 1.0F, 0.0F);
t.setColorRGBA_F(c, c, c, a);
t.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
t.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
t.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
t.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
t.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@Override
public void doRender (Entity e, double x, double y, double z, float f, float pT)
{
render((EntityDiffusion) e, x, y, z, f, pT);
}
@Override
protected ResourceLocation getEntityTexture (Entity e)
{
return null;
}
}
@@ -0,0 +1,83 @@
package taintedmagic.client.renderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import taintedmagic.common.entities.EntityGlowpet;
import thaumcraft.client.fx.ParticleEngine;
public class RenderEntityGlowpet extends Render
{
public RenderEntityGlowpet ()
{
super();
this.shadowSize = 0.0F;
}
public void renderEntityAt (EntityGlowpet e, double x, double y, double z, float f, float pT)
{
Tessellator t = Tessellator.instance;
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
bindTexture(ParticleEngine.particleTexture);
float f2 = (8 + e.ticksExisted % 8) / 16.0F;
float f3 = f2 + 0.0625F;
float f4 = 0.25F;
float f5 = f4 + 0.0625F;
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GL11.glColor4f(1.0F, 0.75F, 0.45F, 1.0F);
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(0.4F, 0.4F, 0.4F);
t.startDrawingQuads();
t.setColorRGBA_F(1.0F, 0.75F, 0.45F, 1.0F);
t.setNormal(0.0F, 1.0F, 0.0F);
t.setBrightness(240);
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.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glBlendFunc(770, 771);
GL11.glDisable(3042);
GL11.glDisable(32826);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
public void doRender (Entity e, double x, double y, double z, float f, float pT)
{
renderEntityAt((EntityGlowpet) e, x, y, z, f, pT);
}
protected ResourceLocation getEntityTexture (Entity e)
{
return TextureMap.locationBlocksTexture;
}
}
@@ -25,7 +25,7 @@ public class RenderEntityHomingShard extends Render
this.shadowSize = 0.0F;
}
public void renderEntityAt (EntityHomingShard e, double x, double y, double z, float fq, float pt)
public void renderEntityAt (EntityHomingShard e, double x, double y, double z, float f, float pT)
{
Tessellator t = Tessellator.instance;
@@ -77,9 +77,9 @@ public class RenderEntityHomingShard extends Render
GL11.glPopMatrix();
}
public void doRender (Entity e, double x, double y, double z, float f, float pt)
public void doRender (Entity e, double x, double y, double z, float f, float pT)
{
renderEntityAt((EntityHomingShard) e, x, y, z, f, pt);
renderEntityAt((EntityHomingShard) e, x, y, z, f, pT);
}
protected ResourceLocation getEntityTexture (Entity e)
@@ -14,8 +14,7 @@ import taintedmagic.common.entities.EntityTaintBubble;
public class RenderEntityTaintBubble extends Render
{
private static final ResourceLocation texture = new ResourceLocation("taintedmagic:textures/entities/EntityTaintBubble.png");
private Random random = new Random();
private static final ResourceLocation texture = new ResourceLocation("thaumcraft:textures/misc/particles.png");
public RenderEntityTaintBubble ()
{
@@ -28,26 +27,32 @@ public class RenderEntityTaintBubble extends Render
Tessellator t = Tessellator.instance;
EntityTaintBubble bubble = (EntityTaintBubble) e;
float r = 0.8F + e.worldObj.rand.nextFloat() * 0.2F;
float g = e.worldObj.rand.nextFloat() * 0.4F;
float b = 1.0F - e.worldObj.rand.nextFloat() * 0.2F;
float a = (50.0F - (float) e.ticksExisted) / 50.0F;
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
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);
GL11.glDepthMask(false);
GL11.glColor4f(r, g, b, a);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
int p = (int) (7.0F * ((float) bubble.ticksExisted / (float) bubble.duration));
float f2 = 0;
float f3 = 1;
float f4 = p / 8.0F;
float f5 = (p + 1) / 8.0F;
int p = 7 + bubble.ticksExisted % 8;
float f2 = p / 16.0F;
float f3 = f2 + 0.0624375F;
float f4 = 0.25F;
float f5 = f4 + 0.0624375F;
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
float s = 0.25F;
float s = 0.3F;
GL11.glScalef(s, s, s);
@@ -55,9 +60,10 @@ public class RenderEntityTaintBubble extends Render
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
t.startDrawingQuads();
t.setBrightness(240);
t.setNormal(0.0F, 1.0F, 0.0F);
t.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.9F);
t.setColorRGBA_F(r, g, b, a);
t.addVertexWithUV(-f7, -f8, 0.0D, f2, f5);
t.addVertexWithUV(f6 - f7, -f8, 0.0D, f3, f5);
@@ -66,8 +72,8 @@ public class RenderEntityTaintBubble extends Render
t.draw();
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(32826);
GL11.glPopMatrix();
}