diff --git a/src/main/java/taintedmagic/client/ClientProxy.java b/src/main/java/taintedmagic/client/ClientProxy.java index 9bfafac..13e8ae5 100644 --- a/src/main/java/taintedmagic/client/ClientProxy.java +++ b/src/main/java/taintedmagic/client/ClientProxy.java @@ -1,6 +1,9 @@ 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; @@ -18,6 +21,7 @@ import thaumcraft.client.fx.ParticleEngine; import thaumcraft.client.fx.particles.FXWisp; import thaumcraft.client.renderers.entity.RenderEldritchOrb; import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.ReflectionHelper; public class ClientProxy extends CommonProxy { @@ -80,24 +84,36 @@ public class ClientProxy extends CommonProxy public void spawnWindParticles (World w) { EntityPlayer p = getClientPlayer(); + Random r = new Random(); - for (int i = 1; i < 150; i++) + for (int i = 1; i < 200; 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 xp = (-Math.random() * 2.0F) + (Math.random() * 2.0F); + double zp = (-Math.random() * 2.0F) + (Math.random() * 2.0F); + double yp = (-Math.random() * 2.0F) + (Math.random() * 2.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); + FXWisp ef = new FXWisp(w, p.posX + xp + off, p.posY + yp + off, p.posZ + zp + off, 0.5F + ((float) Math.random() * 0.25F), red, green, blue); ef.setGravity(0.0F); ef.shrink = true; ef.noClip = true; + + int age = 30 + r.nextInt(50); + + try + { + ReflectionHelper.setPrivateValue(EntityFX.class, ef, age, "particleMaxAge"); + } + catch (Exception e) + { + e.printStackTrace(); + } Vector3 movement = TaintedMagicHelper.getDistanceBetween(ef, p); - ef.addVelocity(movement.x * 0.5, 0, movement.z * 0.5); + ef.addVelocity(movement.x * 0.5, movement.y * 0.5, movement.z * 0.5); ParticleEngine.instance.addEffect(w, ef); } diff --git a/src/main/java/taintedmagic/client/handler/HUDHandler.java b/src/main/java/taintedmagic/client/handler/HUDHandler.java index cefae17..a2d73e4 100644 --- a/src/main/java/taintedmagic/client/handler/HUDHandler.java +++ b/src/main/java/taintedmagic/client/handler/HUDHandler.java @@ -6,6 +6,7 @@ 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 taintedmagic.common.items.tools.ItemThaumicDisassembler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class HUDHandler @@ -23,6 +24,7 @@ public class HUDHandler if (mc.currentScreen == null) { ItemKatana.renderHUD(r, p, pt); + ItemThaumicDisassembler.renderHUD(r, p, pt); } } } diff --git a/src/main/java/taintedmagic/client/helper/TaintedMagicClientHelper.java b/src/main/java/taintedmagic/client/helper/TaintedMagicClientHelper.java deleted file mode 100644 index 051616b..0000000 --- a/src/main/java/taintedmagic/client/helper/TaintedMagicClientHelper.java +++ /dev/null @@ -1,44 +0,0 @@ -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(); - } -} diff --git a/src/main/java/taintedmagic/client/renderer/RenderItemKatana.java b/src/main/java/taintedmagic/client/renderer/RenderItemKatana.java index 30be09c..37fabca 100644 --- a/src/main/java/taintedmagic/client/renderer/RenderItemKatana.java +++ b/src/main/java/taintedmagic/client/renderer/RenderItemKatana.java @@ -9,10 +9,7 @@ import net.minecraft.util.MathHelper; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; -import org.lwjgl.opengl.GL21; -import taintedmagic.client.helper.TaintedMagicClientHelper; import taintedmagic.common.TaintedMagic; import taintedmagic.common.items.tools.ItemKatana; import thaumcraft.client.lib.UtilsFX; @@ -45,7 +42,7 @@ public class RenderItemKatana implements IItemRenderer GL11.glScalef(1.4F, 1.4F, 1.4F); - if (p.getHeldItem() == null || ! (p.getHeldItem() == s)) + if ( (p.getHeldItem() == null || p.getHeldItem() != s) && t != ItemRenderType.EQUIPPED) { GL11.glPushMatrix(); @@ -129,13 +126,13 @@ public class RenderItemKatana implements IItemRenderer for (int a = 0; a < 14; a++) { int rune = (a * 3) % 16; - TaintedMagicClientHelper.drawRune(-1.65D + a * 0.14D, 0D, -0.03D, rune, p); + 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); + drawRune(-1.65D + a * 0.14D, 0D, -0.03D, rune, p); } GL11.glBlendFunc(770, 771); GL11.glDisable(GL11.GL_BLEND); @@ -150,4 +147,36 @@ public class RenderItemKatana implements IItemRenderer GL11.glPopMatrix(); } -} + + /** + * 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(); + } +} \ No newline at end of file diff --git a/src/main/java/taintedmagic/common/items/tools/ItemKatana.java b/src/main/java/taintedmagic/common/items/tools/ItemKatana.java index c8b6bca..5c5dfe4 100644 --- a/src/main/java/taintedmagic/common/items/tools/ItemKatana.java +++ b/src/main/java/taintedmagic/common/items/tools/ItemKatana.java @@ -44,6 +44,7 @@ import taintedmagic.common.network.PacketHandler; import thaumcraft.api.IRepairable; import thaumcraft.api.IWarpingGear; import thaumcraft.api.wands.FocusUpgradeType; +import thaumcraft.common.Thaumcraft; import thaumcraft.common.config.Config; import thaumcraft.common.entities.projectile.EntityEmber; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -61,6 +62,9 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable public static final ModelKatana katana = new ModelKatana(); public static final ModelSaya saya = new ModelSaya(); + public static boolean equipped = false; + public static float ticksEquipped = 0F; + public ItemKatana () { this.setCreativeTab(TaintedMagic.tabTaintedMagic); @@ -217,8 +221,11 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable public void onUsingTick (ItemStack s, EntityPlayer p, int i) { super.onUsingTick(s, p, i); - float j = 1.0F + (Math.min(1.0F * (float) p.getItemInUseDuration() / 30, 1.0F) + ((float) Math.random() * 0.25F)); - if (p.ticksExisted % 5 == 0) p.worldObj.playSoundAtEntity(p, "thaumcraft:wind", j * 0.1F, j); + if (!p.worldObj.isRemote) + { + float j = 1.0F + ((float) Math.random() * 0.25F); + if (p.ticksExisted % 5 == 0) p.worldObj.playSoundAtEntity(p, "thaumcraft:wind", j * 0.1F, j); + } } @Override @@ -289,6 +296,7 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable } } p.swingItem(); + w.playSoundAtEntity(p, "taintedmagic:shockwave", 5.0F, 1.0F * (float) Math.random()); TaintedMagic.proxy.spawnWindParticles(w); break; } @@ -329,7 +337,20 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if (p.getHeldItem() == null || p.getHeldItem().getItem() != this) + GL11.glPushMatrix(); + + GL11.glScalef(0.5F, 0.5F, 0.5F); + GL11.glRotatef(55, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); + + GL11.glTranslatef(-0.6F, 2.25F, 1.25F); + + Minecraft.getMinecraft().renderEngine.bindTexture(getTexture(s)); + saya.render(0.0625F); + + GL11.glPopMatrix(); + + if (p.getHeldItem() == null || p.getHeldItem() != s) { GL11.glPushMatrix(); @@ -345,19 +366,6 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable GL11.glPopMatrix(); } - GL11.glPushMatrix(); - - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glRotatef(55, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); - - GL11.glTranslatef(-0.6F, 2.25F, 1.25F); - - Minecraft.getMinecraft().renderEngine.bindTexture(getTexture(s)); - saya.render(0.0625F); - - GL11.glPopMatrix(); - GL11.glPopMatrix(); break; @@ -372,7 +380,20 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable ItemStack s = mc.thePlayer.getCurrentEquippedItem(); Tessellator t = Tessellator.instance; - if (s != null && s.getItem() instanceof ItemKatana) + boolean b = false; + + if (s != null && s.getItem() instanceof ItemKatana) b = true; + else b = false; + + float time = 30F; + if (b) ticksEquipped = Math.min(time, ticksEquipped + pt); + else ticksEquipped = Math.max(0F, ticksEquipped - pt); + + float defAlpha = 0F; + float fract = ticksEquipped / time; + float a = fract; + + if (b || ticksEquipped != 0) { float tickFract = Math.min((float) p.getItemInUseDuration() / 30.0F, 1.0F); @@ -406,7 +427,7 @@ public class ItemKatana extends Item implements IWarpingGear, IRepairable t.startDrawingQuads(); t.setBrightness(240); - t.setColorRGBA_F(red, green, 0.4F, alpha + 0.7F); + t.setColorRGBA_F(red, green, 0.4F, (alpha + 0.7F) * a); t.addVertexWithUV(x + (rune * 16) - alpha, y2 + alpha, 0, f, f3); t.addVertexWithUV(x2 + (rune * 16) + alpha, y2 + alpha, 0, f1, f3); t.addVertexWithUV(x2 + (rune * 16) + alpha, y - alpha, 0, f1, f2); diff --git a/src/main/java/taintedmagic/common/items/tools/ItemThaumicDisassembler.java b/src/main/java/taintedmagic/common/items/tools/ItemThaumicDisassembler.java index 4cd2e30..da6f8a7 100644 --- a/src/main/java/taintedmagic/common/items/tools/ItemThaumicDisassembler.java +++ b/src/main/java/taintedmagic/common/items/tools/ItemThaumicDisassembler.java @@ -3,6 +3,9 @@ package taintedmagic.common.items.tools; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -11,15 +14,19 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + import taintedmagic.common.TaintedMagic; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.items.wands.WandManager; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class ItemThaumicDisassembler extends Item { @@ -82,10 +89,7 @@ public class ItemThaumicDisassembler extends Item Block block = p.worldObj.getBlock(x, y, z); int meta = p.worldObj.getBlockMetadata(x, y, z); - if (block == Blocks.lit_redstone_ore) - { - block = Blocks.redstone_ore; - } + if (block == Blocks.lit_redstone_ore) block = Blocks.redstone_ore; ItemStack stack = new ItemStack(block, 1, meta); } @@ -112,7 +116,7 @@ public class ItemThaumicDisassembler extends Item return s; } - public int getEfficiency (ItemStack s) + public static int getEfficiency (ItemStack s) { switch (getMode(s)) { @@ -128,16 +132,13 @@ public class ItemThaumicDisassembler extends Item return 0; } - public int getMode (ItemStack s) + public static int getMode (ItemStack s) { - if (s.stackTagCompound == null) - { - return 0; - } + if (s.stackTagCompound == null) return 0; return s.stackTagCompound.getInteger(TAG_MODE); } - public String getModeName (ItemStack s) + public static String getModeName (ItemStack s) { int mode = getMode(s); @@ -158,7 +159,6 @@ public class ItemThaumicDisassembler extends Item public void toggleMode (ItemStack s) { if (s.stackTagCompound == null) s.setTagCompound(new NBTTagCompound()); - s.stackTagCompound.setInteger(TAG_MODE, getMode(s) < 3 ? getMode(s) + 1 : 0); } @@ -168,13 +168,38 @@ public class ItemThaumicDisassembler extends Item if (e instanceof EntityPlayer) { EntityPlayer p = (EntityPlayer) e; - if ( (!w.isRemote) && (s.isItemDamaged()) && (e.ticksExisted % 20 == 0)) + if (!w.isRemote && s.isItemDamaged() && e.ticksExisted % 20 == 0) { - if (WandManager.consumeVisFromInventory(p, new AspectList().add(Aspect.ENTROPY, 5))) - { - s.damageItem(-1, (EntityLivingBase) e); - } + if (WandManager.consumeVisFromInventory(p, new AspectList().add(Aspect.ENTROPY, 5))) s.damageItem(-1, (EntityLivingBase) e); } } } + + @SideOnly (Side.CLIENT) + public static void renderHUD (ScaledResolution resolution, EntityPlayer player, float partialTicks) + { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer p = TaintedMagic.proxy.getClientPlayer(); + ItemStack s = mc.thePlayer.getCurrentEquippedItem(); + FontRenderer f = mc.fontRenderer; + + if (s != null && s.getItem() instanceof ItemThaumicDisassembler) + { + String str = "\u00A78" + StatCollector.translateToLocal("text.mode") + ": " + getModeName(s) + (getMode(s) == 3 ? "\u00A7c" : "\u00A7a") + " (" + getEfficiency(s) + ")"; + + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glTranslated(0, -15, 0); + + GL11.glScalef(0.8F, 0.8F, 0.8F); + + f.drawStringWithShadow(str, resolution.getScaledWidth() / 2 + 100, resolution.getScaledHeight() / 2 + 212, 0xFFFFFF); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + } } diff --git a/src/main/java/taintedmagic/common/lib/LibKeyBindings.java b/src/main/java/taintedmagic/common/lib/LibKeyBindings.java deleted file mode 100644 index 61426e9..0000000 --- a/src/main/java/taintedmagic/common/lib/LibKeyBindings.java +++ /dev/null @@ -1,15 +0,0 @@ -package taintedmagic.common.lib; - -import net.minecraft.client.settings.KeyBinding; - -import org.lwjgl.input.Keyboard; - -import cpw.mods.fml.client.registry.ClientRegistry; - -public class LibKeyBindings -{ - public LibKeyBindings () - { - // this is legacy and will probably never be used again - } -} diff --git a/src/main/java/taintedmagic/common/lib/LibRecipes.java b/src/main/java/taintedmagic/common/lib/LibRecipes.java index a97dbba..b5ed06d 100644 --- a/src/main/java/taintedmagic/common/lib/LibRecipes.java +++ b/src/main/java/taintedmagic/common/lib/LibRecipes.java @@ -614,7 +614,7 @@ public class LibRecipes ResearchRegistry.recipes.put("ItemMagicFunguar", ThaumcraftApi.addShapelessArcaneCraftingRecipe("MAGICFUNGUAR", new ItemStack(ItemRegistry.ItemMagicFunguar), new AspectList().add(Aspect.ORDER, 1).add(Aspect.WATER, 1).add(Aspect.EARTH, 1).add(Aspect.AIR, 1).add(Aspect.FIRE, 1).add(Aspect.ENTROPY, 1), new Object[]{ new ItemStack(ConfigBlocks.blockCustomPlant, 1, 5), - new ItemStack(ConfigItems.itemShard, 32767), + new ItemStack(ConfigItems.itemShard, 1, 32767), new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom), new ItemStack(Items.blaze_powder) })); diff --git a/src/main/java/taintedmagic/common/network/PacketAttackEntityFromClient.java b/src/main/java/taintedmagic/common/network/PacketAttackEntityFromClient.java index aa7ed7b..5a86765 100644 --- a/src/main/java/taintedmagic/common/network/PacketAttackEntityFromClient.java +++ b/src/main/java/taintedmagic/common/network/PacketAttackEntityFromClient.java @@ -39,10 +39,7 @@ public class PacketAttackEntityFromClient implements IMessage, IMessageHandler

Shadow-Imbued Cloth is has similar properties to Enchanted Fabric though it is quite dark in colour, and has some interesting magical properties... It is soft, thin, light, and incredibly strong. You are certain that it will be of many uses. +tm.text.SHADOWCLOTH.1=When you discovered Shadowmetal, you ran a few experiments using it. Shadow-Imbued Cloth was one of many results.
Shadow-Imbued Cloth has similar properties to Enchanted Fabric though it is quite dark in colour, and has some interesting magical properties... It is soft, thin, light, and incredibly strong. You are certain that it will be of many uses. #VOIDWALKERBOOTS