Everything posted by Himself12794
-
[1.8] [SOLVED] Spawning Particle Trail Along a Vector
Ah yes, I apologize. I was able to tighten the spread by doing what you did. I was also able to spawn along the line and achieve my desired effect using this code: for(float j = 0.0F; j < 1.0F; j += 0.05F) { for (int i = 0; i < 10; ++i) { world.spawnParticle(EnumParticleTypes.FLAME, spell.prevPosX + (spell.motionX * j) - world.rand.nextFloat() * 0.5F, spell.prevPosY + (spell.motionY * j) - world.rand.nextFloat() * 0.5F, spell.prevPosZ + (spell.motionZ * j) - world.rand.nextFloat() * 0.5F, 0, 0, 0); } }
-
[1.8] [SOLVED] Spawning Particle Trail Along a Vector
That does work similar to what I'm looking for, however I'd like the spread to be much tighter, and just a little less random. It doesn't seem to be generating a trail, just a bunch of particles where the EntitySpell is at that moment. That formula will be useful though once I figure out the best way to use it on about every 0.2 blocks. Perhaps I get a vector from the caster to the Spell, and maybe I can do something with that?
-
[1.8] [SOLVED] Spawning Particle Trail Along a Vector
I already have the vector, that is taken from the EntitySpell. That's similar to what I want to do, I'm just unsure how exactly to implement it. Trigonometry was not my strong suit.
-
[1.8] [SOLVED] Spawning Particle Trail Along a Vector
I'm making a flamethrower spell, of sorts, and want it to generate a line of flames. What I've done is create a projectile that leaves a trail of flames behind it. This works just as I'd like to. I have the entity set to die after a certain distance traveled. My problem is that when the projectile is thrown, it is able to generate just a few particles before disappearing. If I drop the velocity, I get the fire trail I desire, but the fire is not traveling at the speed expected of a flamethrower. I've tried to get the previous position, the current position, and take the velocity into account to spawn particles in the space between these two vectors, but it's just not working like I want it to, and they are spawning in a line, but not where I want them to. Here's my flawed code: public void onUpdate(EntitySpell spell) { World world = spell.worldObj; float distTraveled = getSpellVelocity() * spell.getTicksInAir(); for (float i = 0.0F; i < getSpellSpeed(); i += getSpellSpeed() * 0.1) world.spawnParticle(EnumParticleTypes.FLAME, spell.posX - spell.motionX + i, spell.posY - spell.motionY + i, spell.posZ - spell.motionZ + i, 0.0D, 0.0D, 0.0D, new int[0]); //world.spawnParticle(EnumParticleTypes.FLAME, spell.posX, spell.posY, spell.posZ, 0.0D, 0.0D, 0.0D, new int[0]); if (distTraveled > 3) spell.setDead(); if (spell.getTicksInGround() > 0) spell.setDead(); } If you need more context, the whole of my code can be found here: https://github.com/Himself12794/usefulthings/blob/master/src/main/java/com/himself12794/usefulthings/spell/Flames.java This is the first time I've really messed with vector locations and movement, so I'm a bit new.
-
[1.8] [SOLVED] Cancel Animation for Modifying Item Stack While In Use
I was afraid of that. I was looking through the code and couldn't even figure out what was causing it. I'm about to move onto to using mana to gauge magic use anyway, so in the meantime I'll just accumulate the damage that should be caused, and use getDurabilityForDisplay() to force the correct display while the item is in use.
-
[1.8] [SOLVED] Cancel Animation for Modifying Item Stack While In Use
I'm making a mod that adds magic spells to the game. I have it set that a spell is tied to each specific item stack. If the spell has a cast time of 0, then the spell should be cast as long as it is in use. This part works fine. However, after the spell is successful, the item stack must be damaged. The only thing, is that when I damage the item stack while it is still in use, the player does a little bobbing animation. Is there a way to stop that animation? here's my onUsingTick() code: public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { Spell spell = SpellRegistry.lookupSpell(stack); if (spell != null) { String spellName = spell.getName(); String spellSound = spell.getCastSound(); int castTime = spell.getCastTime(); if (castTime <= 0 && count % 4 == 0 ) { if (spell.cast(player.worldObj, player, stack, 1)) { if (spellSound != null) player.playSound(spellSound, 1, 1); stack.damageItem(spell.getStackDamage(), player); } } else if (count == getMaxItemUseDuration(stack) - castTime && spellSound != null) player.playSound(spellSound, 1, 1); } } Perhaps there is a way to prevent this using events? I'm not sure, I never was very good at rendering. I don't suppose that this is too terribly important, but either way, I'd like it to not do that. If it's needed, the rest of my code is on GitHub: https://github.com/Himself12794/usefulthings
-
[1.8] [SOLVED] Explosion Particles not Appearing
Ahah! Right you are. Sending a packet to the client fixed that nicely. Now it's just a matter of dialing in how exactly I want it to look. Thanks! Here's what I ended up with: @SubscribeEvent public void avoidDamage(LivingAttackEvent event) { EntityLivingBase dodger = event.entityLiving; if (UsefulMethods.hasEquipped(dodger, ModItems.assassinRobes) && dodger instanceof EntityPlayerMP) { System.out.println(event.source.getDamageType()); System.out.println(event.entityLiving.worldObj.isRemote); event.entityLiving.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, dodger.posX, dodger.posY /*+ (double)(event.entityLiving.height / 2.0F)*/, dodger.posZ, 0.0D, 0.0D, 0.0D, new int[0]); NBTTagCompound data = new NBTTagCompound(); data.setBoolean("doSmoke", true); UsefulThings.proxy.network.sendTo(new MessageClient(data), (EntityPlayerMP) dodger); //int noDamageChance = event.entityLiving.worldObj.rand.nextInt(4); int noDamageChance = 1; if (noDamageChance == 1) { event.setCanceled(true); } } } Thanks for your help!
-
[1.8] [SOLVED] Explosion Particles not Appearing
I'm trying to create an armor that gives the player a chance to dodge an attack. I've got the dodging part down, but when I try to add a smoke cloud to accommodate this, it does not show. I tried mimicking the affect that happens when you shear a mooshroom, but unfortunately it does not seem to work. I've tried limiting it to server side, client side, and not limiting it at all, but whatever I do, no explosion cloud appears. Here's what I have: @SubscribeEvent public void avoidDamage(LivingAttackEvent event) { EntityLivingBase dodger = event.entityLiving; if (UsefulMethods.hasEquipped(dodger, ModItems.assassinRobes)) { //System.out.println(event.source.getDamageType()); event.entityLiving.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, dodger.posX, dodger.posY /*+ (double)(event.entityLiving.height / 2.0F)*/, dodger.posZ, 0.0D, 0.0D, 0.0D, new int[0]); //int noDamageChance = event.entityLiving.worldObj.rand.nextInt(4); int noDamageChance = 1; if (noDamageChance == 1) { event.setCanceled(true); } } } Any help I can get is appreciated.
IPS spam blocked by CleanTalk.