arrow particle rewrite
This commit is contained in:
parent
89a7ea18db
commit
d3f9181cfa
@ -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.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=All Rights Reserved
|
mod_license=All Rights Reserved
|
||||||
# The mod version. See https://semver.org/
|
# 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.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
@ -12,11 +12,9 @@ public class ConfigClient {
|
|||||||
|
|
||||||
public static final ForgeConfigSpec.ConfigValue<Boolean> arrowParticles;
|
public static final ForgeConfigSpec.ConfigValue<Boolean> arrowParticles;
|
||||||
public static final ForgeConfigSpec.ConfigValue<Boolean> tntParticles;
|
public static final ForgeConfigSpec.ConfigValue<Boolean> tntParticles;
|
||||||
private static final ForgeConfigSpec.ConfigValue<Double> particlePercent;
|
public static final ForgeConfigSpec.ConfigValue<Double> particlePercent;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
|
||||||
arrowParticles =
|
arrowParticles =
|
||||||
BUILDER.comment("particles from arrows arrows")
|
BUILDER.comment("particles from arrows arrows")
|
||||||
.define("arrow_particles", true);
|
.define("arrow_particles", true);
|
||||||
|
@ -14,14 +14,16 @@ public class ConfigServer {
|
|||||||
public static final ForgeConfigSpec.ConfigValue<Boolean> homingAtPlayers;
|
public static final ForgeConfigSpec.ConfigValue<Boolean> homingAtPlayers;
|
||||||
public static final ForgeConfigSpec.ConfigValue<Boolean> carpetCompactDetonation;
|
public static final ForgeConfigSpec.ConfigValue<Boolean> carpetCompactDetonation;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
claymoreInstantDespawn = BUILDER.comment("Claymore arrows despawn instantly upon hitting a surface")
|
claymoreInstantDespawn =
|
||||||
.define("claymore_instant_arrow_despawn", false);
|
BUILDER.comment("Claymore arrows despawn instantly upon hitting a surface")
|
||||||
homingAtPlayers = BUILDER.comment("Homing TNTs are allowed to follow players")
|
.define("claymore_instant_arrow_despawn", false);
|
||||||
.define("homing_tnt_target_players", true);
|
homingAtPlayers =
|
||||||
carpetCompactDetonation = BUILDER.comment("Carpet Arrow TNTs explode upon explosion damage; This reduces spread")
|
BUILDER.comment("Homing TNTs are allowed to follow players")
|
||||||
.define("carpet_arrow_compact_detonation", true);
|
.define("homing_tnt_target_players", true);
|
||||||
|
carpetCompactDetonation =
|
||||||
|
BUILDER.comment("Carpet Arrow TNTs explode upon explosion damage; This reduces spread")
|
||||||
|
.define("carpet_arrow_compact_detonation", true);
|
||||||
|
|
||||||
SPEC = BUILDER.build();
|
SPEC = BUILDER.build();
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.minecraft.world.entity.projectile.AbstractArrow;
|
|||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class baseArrow extends AbstractArrow {
|
public class baseArrow extends AbstractArrow {
|
||||||
@ -39,8 +40,16 @@ public class baseArrow extends AbstractArrow {
|
|||||||
return new ItemStack(Items.ARROW);
|
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() {
|
public int getTick() {
|
||||||
|
@ -54,14 +54,10 @@ public class carpetArrow extends baseArrow {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void spawnParticles(float partialTicks) {
|
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;
|
double m = (double) level().getRandom().nextIntBetweenInclusive(-100, 100) / 100;
|
||||||
Vec3 DeltaMovement = getDeltaMovement();
|
Vec3 DeltaMovement = getDeltaMovement();
|
||||||
Vec3 pos = new Vec3(
|
Vec3 pos = particlePos(0.5);
|
||||||
(double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10,
|
|
||||||
0,
|
|
||||||
(double) level().getRandom().nextIntBetweenInclusive(-5, 5) / 10
|
|
||||||
).normalize().multiply(m, 0, m).add(getPosition(partialTicks));
|
|
||||||
level().addParticle(particles.CARPET_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
|
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;
|
package com.jenny.enhancedexplosives.entities.arrows;
|
||||||
|
|
||||||
|
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||||
import com.jenny.enhancedexplosives.entities.entities;
|
import com.jenny.enhancedexplosives.entities.entities;
|
||||||
import com.jenny.enhancedexplosives.items.items;
|
import com.jenny.enhancedexplosives.items.items;
|
||||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
|
||||||
import com.jenny.enhancedexplosives.particles.particles;
|
import com.jenny.enhancedexplosives.particles.particles;
|
||||||
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
@ -43,15 +42,10 @@ public class concussiveArrow extends baseArrow{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void spawnParticles(float partialTicks) {
|
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 delta = getDeltaMovement();
|
||||||
Vec3 DeltaMovement = getDeltaMovement();
|
Vec3 pos = particlePos(0.5);
|
||||||
Vec3 pos = new Vec3(
|
level().addParticle(particles.CONCUSSIVE_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, delta.x, delta.y, delta.z);
|
||||||
(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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package com.jenny.enhancedexplosives.entities.arrows;
|
package com.jenny.enhancedexplosives.entities.arrows;
|
||||||
|
|
||||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||||
import com.jenny.enhancedexplosives.items.items;
|
|
||||||
import com.jenny.enhancedexplosives.entities.entities;
|
import com.jenny.enhancedexplosives.entities.entities;
|
||||||
|
import com.jenny.enhancedexplosives.items.items;
|
||||||
import com.jenny.enhancedexplosives.particles.particles;
|
import com.jenny.enhancedexplosives.particles.particles;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
@ -43,14 +42,10 @@ public class tntArrow extends baseArrow {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void spawnParticles(float partialTicks) {
|
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;
|
double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
|
||||||
Vec3 DeltaMovement = getDeltaMovement();
|
Vec3 DeltaMovement = getDeltaMovement();
|
||||||
Vec3 pos = new Vec3(
|
Vec3 pos = particlePos(0.5);
|
||||||
(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.TNT_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
|
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
|
@Override
|
||||||
public void spawnParticles(float partialTicks) {
|
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;
|
double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
|
||||||
Vec3 DeltaMovement = getDeltaMovement();
|
Vec3 DeltaMovement = getDeltaMovement();
|
||||||
Vec3 pos = new Vec3(
|
Vec3 pos = particlePos(0.5);
|
||||||
(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.TUNNEL_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
|
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