arrow particle rewrite
This commit is contained in:
		
							parent
							
								
									89a7ea18db
								
							
						
					
					
						commit
						39786b4612
					
				@ -38,7 +38,7 @@ mod_name=Enhanced Explosives
 | 
			
		||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
 | 
			
		||||
mod_license=All Rights Reserved
 | 
			
		||||
# The mod version. See https://semver.org/
 | 
			
		||||
mod_version=0.13.1
 | 
			
		||||
mod_version=0.13.2
 | 
			
		||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
 | 
			
		||||
# This should match the base package used for the mod sources.
 | 
			
		||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@ import net.minecraft.world.entity.projectile.AbstractArrow;
 | 
			
		||||
import net.minecraft.world.item.ItemStack;
 | 
			
		||||
import net.minecraft.world.item.Items;
 | 
			
		||||
import net.minecraft.world.level.Level;
 | 
			
		||||
import net.minecraft.world.phys.Vec3;
 | 
			
		||||
import org.jetbrains.annotations.NotNull;
 | 
			
		||||
 | 
			
		||||
public class baseArrow extends AbstractArrow {
 | 
			
		||||
@ -39,8 +40,16 @@ public class baseArrow extends AbstractArrow {
 | 
			
		||||
        return new ItemStack(Items.ARROW);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void spawnParticles(float partialTicks) {
 | 
			
		||||
    protected Vec3 particlePos(double dist) {
 | 
			
		||||
        Double speed = getDeltaMovement().length();
 | 
			
		||||
        return new Vec3(
 | 
			
		||||
                level().getRandom().nextIntBetweenInclusive(-100, 100),
 | 
			
		||||
                level().getRandom().nextIntBetweenInclusive(-100, 100),
 | 
			
		||||
                level().getRandom().nextIntBetweenInclusive(-100, 100)
 | 
			
		||||
        ).normalize().scale(dist + ((double) level().getRandom().nextIntBetweenInclusive(0, 100) / 100)).add(position());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void spawnParticles(float partialTicks) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getTick() {
 | 
			
		||||
 | 
			
		||||
@ -54,14 +54,10 @@ public class carpetArrow extends baseArrow {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void spawnParticles(float partialTicks) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(3); i++) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
 | 
			
		||||
            double m = (double) level().getRandom().nextIntBetweenInclusive(-100, 100) / 100;
 | 
			
		||||
            Vec3 DeltaMovement = getDeltaMovement();
 | 
			
		||||
            Vec3 pos = new Vec3(
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10,
 | 
			
		||||
                    0,
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10
 | 
			
		||||
            ).normalize().multiply(m, 0, m).add(getPosition(partialTicks));
 | 
			
		||||
            Vec3 pos = particlePos(0.5);
 | 
			
		||||
            level().addParticle(particles.CARPET_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,9 @@
 | 
			
		||||
package com.jenny.enhancedexplosives.entities.arrows;
 | 
			
		||||
 | 
			
		||||
import com.jenny.enhancedexplosives.config.ConfigClient;
 | 
			
		||||
import com.jenny.enhancedexplosives.entities.entities;
 | 
			
		||||
import com.jenny.enhancedexplosives.items.items;
 | 
			
		||||
import com.jenny.enhancedexplosives.config.ConfigClient;
 | 
			
		||||
import com.jenny.enhancedexplosives.particles.particles;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.world.entity.EntityType;
 | 
			
		||||
import net.minecraft.world.entity.LivingEntity;
 | 
			
		||||
import net.minecraft.world.item.ItemStack;
 | 
			
		||||
@ -43,15 +42,10 @@ public class concussiveArrow extends baseArrow{
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void spawnParticles(float partialTicks) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(3); i++) {
 | 
			
		||||
            double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
 | 
			
		||||
            Vec3 DeltaMovement = getDeltaMovement();
 | 
			
		||||
            Vec3 pos = new Vec3(
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10,
 | 
			
		||||
                    0,
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10
 | 
			
		||||
            ).normalize().multiply(m, m, m).add(getPosition(partialTicks));
 | 
			
		||||
            level().addParticle(particles.CONCUSSIVE_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
 | 
			
		||||
            Vec3 delta = getDeltaMovement();
 | 
			
		||||
            Vec3 pos = particlePos(0.5);
 | 
			
		||||
            level().addParticle(particles.CONCUSSIVE_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, delta.x, delta.y, delta.z);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,8 @@
 | 
			
		||||
package com.jenny.enhancedexplosives.entities.arrows;
 | 
			
		||||
 | 
			
		||||
import com.jenny.enhancedexplosives.config.ConfigClient;
 | 
			
		||||
import com.jenny.enhancedexplosives.items.items;
 | 
			
		||||
import com.jenny.enhancedexplosives.entities.entities;
 | 
			
		||||
 | 
			
		||||
import com.jenny.enhancedexplosives.items.items;
 | 
			
		||||
import com.jenny.enhancedexplosives.particles.particles;
 | 
			
		||||
import net.minecraft.world.entity.EntityType;
 | 
			
		||||
import net.minecraft.world.entity.LivingEntity;
 | 
			
		||||
@ -43,14 +42,10 @@ public class tntArrow extends baseArrow {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void spawnParticles(float partialTicks) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(3); i++) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
 | 
			
		||||
            double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
 | 
			
		||||
            Vec3 DeltaMovement = getDeltaMovement();
 | 
			
		||||
            Vec3 pos = new Vec3(
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10,
 | 
			
		||||
                    0,
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10
 | 
			
		||||
            ).normalize().multiply(m, m, m).add(getPosition(partialTicks));
 | 
			
		||||
            Vec3 pos = particlePos(0.5);
 | 
			
		||||
            level().addParticle(particles.TNT_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -60,14 +60,10 @@ public class tunnelArrow extends baseArrow{
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void spawnParticles(float partialTicks) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(3); i++) {
 | 
			
		||||
        for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
 | 
			
		||||
            double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
 | 
			
		||||
            Vec3 DeltaMovement = getDeltaMovement();
 | 
			
		||||
            Vec3 pos = new Vec3(
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10,
 | 
			
		||||
                    0,
 | 
			
		||||
                    (double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10
 | 
			
		||||
            ).normalize().multiply(m, m, m).add(getPosition(partialTicks));
 | 
			
		||||
            Vec3 pos = particlePos(0.5);
 | 
			
		||||
            level().addParticle(particles.TUNNEL_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user