Compare commits
No commits in common. "f7bf08407066ee52ca9941539099c997cebbdf6a" and "ab77a7246a85b3832cc4e8a4449da6e89a50f487" have entirely different histories.
f7bf084070
...
ab77a7246a
@ -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.8.9
|
||||
mod_version=0.8.0
|
||||
# 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
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.jenny.enhancedexplosives;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.particles.particles;
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import com.jenny.enhancedexplosives.items.items;
|
||||
@ -31,7 +30,6 @@ public class EnhancedExplosives {
|
||||
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
|
||||
particles.register(modEventBus);
|
||||
blocks.register(modEventBus);
|
||||
items.register(modEventBus);
|
||||
creativeTab.register(modEventBus);
|
||||
|
@ -1,11 +1,8 @@
|
||||
package com.jenny.enhancedexplosives.blocks;
|
||||
|
||||
import com.jenny.enhancedexplosives.entities.tnt.enderPrimedTNT;
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -15,7 +12,6 @@ import net.minecraft.world.level.block.TntBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -51,9 +47,6 @@ public class enderTNTBlock extends TntBlock {
|
||||
level.gameEvent(entity, GameEvent.PRIME_FUSE, blockPos);
|
||||
}
|
||||
}
|
||||
else {
|
||||
spawnParticles(level, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
private static BlockPos getSpawnPos(Level level, BlockPos blockPos) {
|
||||
@ -89,19 +82,5 @@ public class enderTNTBlock extends TntBlock {
|
||||
level.addFreshEntity(primedtnt);
|
||||
}
|
||||
}
|
||||
else {
|
||||
spawnParticles(level, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnParticles(Level level, BlockPos blockPos) {
|
||||
if (ConfigClient.tntParticles) {
|
||||
for (int i = 1; i <= ConfigClient.calcPCount(30); i++) {
|
||||
float x = blockPos.getX() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F;
|
||||
float y = blockPos.getY() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10;
|
||||
float z = blockPos.getZ() + (float) level.getRandom().nextIntBetweenInclusive(-10, 10) / 10 + 0.5F;
|
||||
level.addParticle(ParticleTypes.GLOW, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,31 +12,16 @@ public class ConfigClient {
|
||||
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
||||
|
||||
private static final ForgeConfigSpec.ConfigValue<Boolean> C_ARROW_PARTICLES =
|
||||
BUILDER.comment("whether to spawn client-side particles for arrows")
|
||||
BUILDER.comment("weather to spawn client-side particles for arrows")
|
||||
.define("arrowParticles", true);
|
||||
|
||||
private static final ForgeConfigSpec.ConfigValue<Boolean> C_TNT_PARTICLES =
|
||||
BUILDER.comment("weather to spawn client-side particles for tnt")
|
||||
.define("tntParticles", true);
|
||||
|
||||
private static final ForgeConfigSpec.ConfigValue<Double> C_PARTICLE_PERCENT =
|
||||
BUILDER.comment("amount of particles to spawn (0.0 = None, 1.0 = normal, values higher are valid too)")
|
||||
.define("arrowParticleCount", 1.0D);
|
||||
|
||||
public static final ForgeConfigSpec SPEC = BUILDER.build();
|
||||
|
||||
public static boolean arrowParticles, tntParticles;
|
||||
public static float particlePercent;
|
||||
public static boolean ARROW_PARTICLES;
|
||||
|
||||
@SubscribeEvent
|
||||
static void onLoad(final ModConfigEvent event)
|
||||
{
|
||||
arrowParticles = C_ARROW_PARTICLES.get();
|
||||
tntParticles = C_TNT_PARTICLES.get();
|
||||
particlePercent = C_PARTICLE_PERCENT.get().floatValue();
|
||||
}
|
||||
|
||||
public static int calcPCount(int pCount) {
|
||||
return Math.round(pCount * particlePercent);
|
||||
ARROW_PARTICLES = C_ARROW_PARTICLES.get();
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,6 @@ public class ModBlockStateProvider extends BlockStateProvider {
|
||||
sideTopBottom(blocks.TNT_64.get());
|
||||
sideTopBottom(blocks.TNT_128.get());
|
||||
sideTopBottom(blocks.TNT_ENDER.get());
|
||||
sideTopBottom(blocks.TNT_CLAYMORE.get());
|
||||
blockWithItem(blocks.TNT_BLACK_HOLE);
|
||||
}
|
||||
|
||||
private void blockWithItem(RegistryObject<Block> blockRegistryObject) {
|
||||
|
@ -33,7 +33,6 @@ public class baseArrow extends AbstractArrow {
|
||||
private Potion potion = Potions.EMPTY;
|
||||
private final Set<MobEffectInstance> effects = Sets.newHashSet();
|
||||
private boolean fixedColor;
|
||||
private int tick = 0;
|
||||
|
||||
public baseArrow(EntityType<? extends baseArrow> pEntityType, Level pLevel) {
|
||||
super(pEntityType, pLevel);
|
||||
@ -106,13 +105,13 @@ public class baseArrow extends AbstractArrow {
|
||||
} else {
|
||||
this.makeParticle(2);
|
||||
}
|
||||
this.tick++;
|
||||
} else if (this.inGround && this.inGroundTime != 0 && !this.effects.isEmpty() && this.inGroundTime >= 600) {
|
||||
this.level().broadcastEntityEvent(this, (byte)0);
|
||||
this.potion = Potions.EMPTY;
|
||||
this.effects.clear();
|
||||
this.entityData.set(ID_EFFECT_COLOR, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void makeParticle(int pParticleAmount) {
|
||||
@ -230,11 +229,7 @@ public class baseArrow extends AbstractArrow {
|
||||
|
||||
}
|
||||
|
||||
public void spawnParticles(float partialTicks) {
|
||||
public void spawnParticles() {
|
||||
|
||||
}
|
||||
|
||||
public int getTick() {
|
||||
return this.tick;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
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.particles.particles;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@ -13,6 +12,8 @@ import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class carpetArrow extends baseArrow {
|
||||
private int tick = 0;
|
||||
private Vec3 pos = position();
|
||||
public final int childCount = 32;
|
||||
|
||||
public carpetArrow(EntityType<carpetArrow> pEntityType, Level pLevel) {
|
||||
@ -25,24 +26,26 @@ public class carpetArrow extends baseArrow {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
pos = position();
|
||||
super.tick();
|
||||
if (getDeltaMovement().y < 0) {
|
||||
if (level().isClientSide()) {
|
||||
level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
tick++;
|
||||
if (pos.y > position().y) {
|
||||
spawnChildren(childCount);
|
||||
discard();
|
||||
}
|
||||
}
|
||||
|
||||
protected void spawnChildren(int count) {
|
||||
Vec3 delta = getDeltaMovement();
|
||||
RandomSource rng = level().getRandom();
|
||||
for (int i = 0; i < count; i++) {
|
||||
carpetArrowPart arrow = new carpetArrowPart(entities.ARROW_CARPT_PART.get(), level());
|
||||
double r = (double) rng.nextIntBetweenInclusive(-100, 100) / 200;
|
||||
Vec3 move = new Vec3(
|
||||
(double) rng.nextIntBetweenInclusive(-100, 100) / 100,
|
||||
0,
|
||||
(double) rng.nextIntBetweenInclusive(-100, 100) / 100).normalize().multiply(r, 0, r);
|
||||
concussiveArrow arrow = new concussiveArrow(entities.ARROW_CONCUSSIVE.get(), level());
|
||||
Vec3 move = delta.add((float) rng.nextInt(-10, 11) / 10, 0, (float) rng.nextInt(-10, 11) / 10);
|
||||
arrow.setPos(position());
|
||||
arrow.setDeltaMovement(move.add(getDeltaMovement()));
|
||||
arrow.setDeltaMovement(delta.add(move.multiply(0.2, 0, 0.2)));
|
||||
level().addFreshEntity(arrow);
|
||||
}
|
||||
}
|
||||
@ -51,18 +54,4 @@ public class carpetArrow extends baseArrow {
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.CARPET_ARROW.get());
|
||||
}
|
||||
|
||||
@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, 0, m).add(getPosition(partialTicks));
|
||||
level().addParticle(particles.CARPET_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
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.particles.particles;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class carpetArrowPart extends baseArrow {
|
||||
public carpetArrowPart(EntityType<carpetArrowPart> pEntityType, Level pLevel) {
|
||||
super(pEntityType, pLevel);
|
||||
}
|
||||
|
||||
public carpetArrowPart(Level pLevel, LivingEntity pShooter) {
|
||||
super(pLevel, pShooter, entities.ARROW_CARPT_PART.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.inGround) {
|
||||
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.CONCUSSIVE_ARROW.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticles(float partialTicks) {
|
||||
for (int i = 1; i <= ConfigClient.calcPCount(1); 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.jenny.enhancedexplosives.entities.arrows;
|
||||
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import com.jenny.enhancedexplosives.items.items;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class claymoreArrow extends baseArrow{
|
||||
public claymoreArrow(EntityType<claymoreArrow> pEntityType, Level pLevel) {
|
||||
super(pEntityType, pLevel);
|
||||
}
|
||||
|
||||
public claymoreArrow(@NotNull Level pLevel, @NotNull LivingEntity pShooter) {
|
||||
super(pLevel, pShooter, entities.ARROW_CLAYMORE.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
pTarget.hurt(damageSources().mobProjectile(this, (LivingEntity) getOwner()), 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.CONCUSSIVE_ARROW.get(), 0);
|
||||
}
|
||||
}
|
@ -2,14 +2,11 @@ package com.jenny.enhancedexplosives.entities.arrows;
|
||||
|
||||
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.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class concussiveArrow extends baseArrow{
|
||||
@ -24,8 +21,12 @@ public class concussiveArrow extends baseArrow{
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (level().isClientSide()) {
|
||||
level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if (this.inGround) {
|
||||
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
|
||||
//this.level().explode(this, null, new NilExplosionCalculator(), this.getX(), this.getY(), this.getZ(), 8, false, Level.ExplosionInteraction.NONE);
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
@ -33,6 +34,7 @@ public class concussiveArrow extends baseArrow{
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, getX(), getY(), getZ(), 8.0f, Level.ExplosionInteraction.NONE);
|
||||
//this.level().explode(this, null, new NilExplosionCalculator(), this.getX(), this.getY(), this.getZ(), 8, false, Level.ExplosionInteraction.NONE);
|
||||
this.discard();
|
||||
}
|
||||
|
||||
@ -42,16 +44,12 @@ 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);
|
||||
public void spawnParticles() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,13 @@
|
||||
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.particles.particles;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class tntArrow extends baseArrow {
|
||||
@ -24,12 +22,25 @@ public class tntArrow extends baseArrow {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (level().isClientSide()) {
|
||||
//spawnParticles();
|
||||
}
|
||||
if (this.inGround) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticles() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
@ -40,18 +51,4 @@ public class tntArrow extends baseArrow {
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.TNT_ARROW.get());
|
||||
}
|
||||
|
||||
@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.TNT_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.jenny.enhancedexplosives.entities.client;
|
||||
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.entities.tnt.basePrimedTNT;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
@ -12,9 +12,11 @@ import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BaseTNTRenderer<T extends basePrimedTNT> extends EntityRenderer<T> {
|
||||
public class BaseTNTRenderer extends EntityRenderer<basePrimedTNT> {
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
|
||||
public BaseTNTRenderer(EntityRendererProvider.Context pContext) {
|
||||
@ -23,7 +25,7 @@ public class BaseTNTRenderer<T extends basePrimedTNT> extends EntityRenderer<T>
|
||||
this.blockRenderer = pContext.getBlockRenderDispatcher();
|
||||
}
|
||||
|
||||
public void render(T pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
|
||||
public void render(basePrimedTNT pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
|
||||
pPoseStack.pushPose();
|
||||
pPoseStack.translate(0.0F, 0.5F, 0.0F);
|
||||
int i = pEntity.getFuse();
|
||||
@ -35,20 +37,31 @@ public class BaseTNTRenderer<T extends basePrimedTNT> extends EntityRenderer<T>
|
||||
float f1 = 1.0F + f * 0.3F;
|
||||
pPoseStack.scale(f1, f1, f1);
|
||||
}
|
||||
if (ConfigClient.tntParticles) {
|
||||
pEntity.spawnParticles(pPartialTicks);
|
||||
String renderID = pEntity.getRenderID();
|
||||
if (renderID == null) {
|
||||
renderID = "";
|
||||
}
|
||||
pEntity.spawnParticles(pPartialTicks);
|
||||
Block block = switch (renderID) {
|
||||
case "stronger_8" -> blocks.TNT_8.get();
|
||||
case "stronger_16" -> blocks.TNT_16.get();
|
||||
case "stronger_32" -> blocks.TNT_32.get();
|
||||
case "stronger_64" -> blocks.TNT_64.get();
|
||||
case "stronger_128" -> blocks.TNT_128.get();
|
||||
case "homing" -> blocks.TNT_HOMING.get();
|
||||
case "ender" -> blocks.TNT_ENDER.get();
|
||||
default -> Blocks.NETHER_PORTAL; // placeholder for debugging
|
||||
};
|
||||
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, block.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
|
||||
pPoseStack.popPose();
|
||||
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ResourceLocation getTextureLocation(@NotNull T pEntity) {
|
||||
public ResourceLocation getTextureLocation(@NotNull basePrimedTNT pEntity) {
|
||||
return TextureAtlas.LOCATION_BLOCKS;
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,9 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
|
||||
private final boolean renderParticles = ConfigClient.arrowParticles;
|
||||
private final boolean renderParticles = ConfigClient.ARROW_PARTICLES;
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
private float i = 0;
|
||||
|
||||
public TNTArrowRenderer(EntityRendererProvider.Context pContext) {
|
||||
super(pContext);
|
||||
@ -30,14 +31,14 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
|
||||
pPoseStack.pushPose();
|
||||
pPoseStack.translate(0.0F, 0.5F, 0.0F);
|
||||
pPoseStack.scale(0.5f, 0.5f, 0.5f);
|
||||
int i = pEntity.getTick();
|
||||
i += 0.1f;
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
if (renderParticles) {
|
||||
pEntity.spawnParticles(pPartialTicks);
|
||||
pEntity.spawnParticles();
|
||||
}
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, Math.round(Math.sin(i)) == 0);
|
||||
pPoseStack.popPose();
|
||||
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package com.jenny.enhancedexplosives.entities.client;
|
||||
|
||||
import net.minecraft.client.renderer.entity.ArrowRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.minecraft.client.renderer.entity.TippableArrowRenderer.NORMAL_ARROW_LOCATION;
|
||||
|
||||
public class baseArrowRenderer extends ArrowRenderer<AbstractArrow> {
|
||||
public baseArrowRenderer(EntityRendererProvider.Context pContext) {
|
||||
super(pContext);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ResourceLocation getTextureLocation(@NotNull AbstractArrow pEntity) {
|
||||
return NORMAL_ARROW_LOCATION;
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class clusterTNTRenderer extends EntityRenderer<basePrimedTNT> {
|
||||
@ -39,9 +40,9 @@ public class clusterTNTRenderer extends EntityRenderer<basePrimedTNT> {
|
||||
}
|
||||
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||
pPoseStack.translate(-0.5F, -1.0F, 0.5F);
|
||||
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, pEntity.renderBlock().defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
|
||||
pPoseStack.popPose();
|
||||
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.jenny.enhancedexplosives.entities;
|
||||
|
||||
import com.jenny.enhancedexplosives.entities.arrows.*;
|
||||
import com.jenny.enhancedexplosives.entities.client.*;
|
||||
import com.jenny.enhancedexplosives.entities.client.BaseTNTRenderer;
|
||||
import com.jenny.enhancedexplosives.entities.client.TNTArrowRenderer;
|
||||
import com.jenny.enhancedexplosives.entities.client.clusterTNTRenderer;
|
||||
import com.jenny.enhancedexplosives.entities.throwable.dynamite;
|
||||
import com.jenny.enhancedexplosives.entities.tnt.*;
|
||||
|
||||
@ -59,14 +61,6 @@ public class entities {
|
||||
ENTITY_TYPES.register("arrow_carpet", () -> EntityType.Builder.<carpetArrow>of(carpetArrow::new, MobCategory.MISC)
|
||||
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_carpet"));
|
||||
|
||||
public static final RegistryObject<EntityType<claymoreArrow>> ARROW_CLAYMORE =
|
||||
ENTITY_TYPES.register("arrow_claymore", () -> EntityType.Builder.<claymoreArrow>of(claymoreArrow::new, MobCategory.MISC)
|
||||
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_claymore"));
|
||||
|
||||
public static final RegistryObject<EntityType<carpetArrowPart>> ARROW_CARPT_PART =
|
||||
ENTITY_TYPES.register("arrow_carpet_part", () -> EntityType.Builder.<carpetArrowPart>of(carpetArrowPart::new, MobCategory.MISC)
|
||||
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_carpet_part"));
|
||||
|
||||
public static final RegistryObject<EntityType<dynamite>> DYNAMITE =
|
||||
ENTITY_TYPES.register("dynamite", () -> EntityType.Builder.<dynamite>of(dynamite::new, MobCategory.MISC)
|
||||
.sized(0.48F, 0.48F).clientTrackingRange(64).build("dynamite"));
|
||||
@ -89,7 +83,5 @@ public class entities {
|
||||
EntityRenderers.register(ARROW_TNT.get(), TNTArrowRenderer::new);
|
||||
EntityRenderers.register(ARROW_CONCUSSIVE.get(), TNTArrowRenderer::new);
|
||||
EntityRenderers.register(ARROW_CARPET.get(), TNTArrowRenderer::new);
|
||||
EntityRenderers.register(ARROW_CARPT_PART.get(), TNTArrowRenderer::new);
|
||||
EntityRenderers.register(ARROW_CLAYMORE.get(), baseArrowRenderer::new);
|
||||
}
|
||||
}
|
@ -9,19 +9,18 @@ import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class dynamite extends basePrimedTNT {
|
||||
public dynamite (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
|
||||
super(entities.DYNAMITE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.DYNAMITE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "dynamite");
|
||||
}
|
||||
|
||||
public dynamite(EntityType<dynamite> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
this.setRenderID("dynamite");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,8 +59,4 @@ public class dynamite extends basePrimedTNT {
|
||||
Vec3 vec3 = pShooter.getDeltaMovement();
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(vec3.x, pShooter.onGround() ? 0.0D : vec3.y, vec3.z));
|
||||
}
|
||||
|
||||
public Block renderBlock() {
|
||||
return Blocks.TNT;
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,12 @@ import javax.annotation.Nullable;
|
||||
public class ClusterPrimedTNT extends basePrimedTNT {
|
||||
|
||||
public ClusterPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, Vec3 move) {
|
||||
super(entities.TNT_CLUSTER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_CLUSTER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "cluster");
|
||||
this.addDeltaMovement(move);
|
||||
}
|
||||
|
||||
public ClusterPrimedTNT(EntityType<ClusterPrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
this.setRenderID("cluster");
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,33 @@
|
||||
package com.jenny.enhancedexplosives.entities.tnt;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class StrongerPrimedTNT extends basePrimedTNT {
|
||||
public StrongerPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
|
||||
super(entities.TNT_STRONGER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_STRONGER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "default");
|
||||
this.setRenderID(evalRenderID());
|
||||
}
|
||||
|
||||
public StrongerPrimedTNT(EntityType<StrongerPrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
this.setRenderID(evalRenderID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block renderBlock() {
|
||||
public String evalRenderID() {
|
||||
int a = (int) this.getPower();
|
||||
return switch ((int) this.getPower()) {
|
||||
case 8 -> blocks.TNT_8.get();
|
||||
case 16 -> blocks.TNT_16.get();
|
||||
case 32 -> blocks.TNT_32.get();
|
||||
case 64 -> blocks.TNT_64.get();
|
||||
case 128 -> blocks.TNT_128.get();
|
||||
default -> Blocks.END_GATEWAY;
|
||||
case 8 -> "stronger_8";
|
||||
case 16 -> "stronger_16";
|
||||
case 32 -> "stronger_32";
|
||||
case 64 -> "stronger_64";
|
||||
case 128 -> "stronger_128";
|
||||
default -> "default";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -17,15 +15,16 @@ import javax.annotation.Nullable;
|
||||
public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.INT);
|
||||
private static final EntityDataAccessor<Float> DATA_POWER_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.FLOAT);
|
||||
private static final EntityDataAccessor<String> DATA_RENDER_ID = SynchedEntityData.defineId(basePrimedTNT.class, EntityDataSerializers.STRING);
|
||||
|
||||
@Nullable
|
||||
private LivingEntity owner;
|
||||
private int fuse = 0;
|
||||
|
||||
private String renderID = "default";
|
||||
|
||||
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, Level pLevel, @Nullable LivingEntity owner) {
|
||||
super(pEntityType, pLevel);
|
||||
commonInit(pLevel, owner);
|
||||
this.fuse = getFuse();
|
||||
}
|
||||
|
||||
private void commonInit(Level pLevel, @Nullable LivingEntity owner) {
|
||||
@ -35,13 +34,13 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power) {
|
||||
public basePrimedTNT(EntityType<? extends basePrimedTNT> pEntityType, Level pLevel, @Nullable LivingEntity owner, Vec3 pos, int fuse, float power, String renderID) {
|
||||
super(pEntityType, pLevel);
|
||||
commonInit(pLevel, owner);
|
||||
setPos(pos);
|
||||
setFuse(fuse);
|
||||
setPower(power);
|
||||
this.fuse = getFuse();
|
||||
setRenderID(renderID);
|
||||
}
|
||||
|
||||
protected void explode() {
|
||||
@ -94,24 +93,26 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected MovementEmission getMovementEmission() {
|
||||
return MovementEmission.NONE;
|
||||
protected Entity.@NotNull MovementEmission getMovementEmission() {
|
||||
return Entity.MovementEmission.NONE;
|
||||
}
|
||||
|
||||
protected void defineSynchedData() {
|
||||
this.entityData.define(DATA_FUSE_ID, 80);
|
||||
this.entityData.define(DATA_POWER_ID, 4.0f);
|
||||
this.entityData.define(DATA_RENDER_ID, "default");
|
||||
}
|
||||
|
||||
protected void addAdditionalSaveData(CompoundTag pCompound) {
|
||||
pCompound.putShort("Fuse", (short)this.getFuse());
|
||||
pCompound.putFloat("Power", (short)this.getPower());
|
||||
pCompound.putString("RenderID", getRenderID());
|
||||
}
|
||||
|
||||
protected void readAdditionalSaveData(CompoundTag pCompound) {
|
||||
this.setFuse(pCompound.getShort("Fuse"));
|
||||
this.setPower(pCompound.getFloat("Power"));
|
||||
this.setRenderID(pCompound.getString("RenderID"));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -123,17 +124,15 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public void setRenderID(String renderID) {
|
||||
this.entityData.set(DATA_RENDER_ID, renderID);
|
||||
}
|
||||
|
||||
public String getRenderID() {
|
||||
return this.entityData.get(DATA_RENDER_ID);
|
||||
}
|
||||
|
||||
protected float getEyeHeight(@NotNull Pose pPose, @NotNull EntityDimensions pSize) {
|
||||
return 0.15F;
|
||||
}
|
||||
|
||||
public Block renderBlock() {
|
||||
return Blocks.GLASS;
|
||||
}
|
||||
|
||||
public int defaultFuse() {
|
||||
return this.fuse;
|
||||
}
|
||||
|
||||
public void spawnParticles(float partialTicks) {}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.jenny.enhancedexplosives.entities.tnt;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
@ -8,7 +7,6 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@ -19,12 +17,13 @@ public class blackHolePrimedTNT extends basePrimedTNT {
|
||||
private static final EntityDataAccessor<Float> DATA_SPEED_ID = SynchedEntityData.defineId(blackHolePrimedTNT.class, EntityDataSerializers.FLOAT);
|
||||
|
||||
public blackHolePrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, float speed) {
|
||||
super(entities.TNT_BLACK_HOLE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_BLACK_HOLE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "black_hole");
|
||||
this.setSpeed(speed);
|
||||
}
|
||||
|
||||
public blackHolePrimedTNT(EntityType<blackHolePrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
this.setRenderID("black_hole");
|
||||
this.setSpeed(this.getSpeed());
|
||||
}
|
||||
|
||||
@ -87,9 +86,4 @@ public class blackHolePrimedTNT extends basePrimedTNT {
|
||||
this.entityData.define(DATA_SPEED_ID, 4.0f);
|
||||
super.defineSynchedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block renderBlock() {
|
||||
return blocks.TNT_BLACK_HOLE.get();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.jenny.enhancedexplosives.entities.tnt;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.entities.arrows.claymoreArrow;
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
@ -10,9 +8,9 @@ import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -21,31 +19,31 @@ public class claymorePrimedTNT extends basePrimedTNT {
|
||||
private static final EntityDataAccessor<Integer> DATA_PCOUNT_ID = SynchedEntityData.defineId(claymorePrimedTNT.class, EntityDataSerializers.INT);
|
||||
|
||||
public claymorePrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, int projectileCount) {
|
||||
super(entities.TNT_CLAYMORE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_CLAYMORE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "tnt_claymore");
|
||||
setPCount(projectileCount);
|
||||
}
|
||||
|
||||
public claymorePrimedTNT(EntityType<claymorePrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
setRenderID("tnt_claymore");
|
||||
}
|
||||
|
||||
public Vec3 targetVector(RandomSource rng) {
|
||||
return new Vec3(
|
||||
getX() + rng.nextIntBetweenInclusive(-15, 15),
|
||||
getY() + (float) rng.nextIntBetweenInclusive(-10, 10) / 10,
|
||||
getZ() + rng.nextIntBetweenInclusive(-15, 15)
|
||||
).subtract(position().add(0, 0.5, 0)).normalize().multiply(1.3, 1.3, 1.3);
|
||||
(double) rng.nextInt(-10, 11) / 10,
|
||||
(double) rng.nextInt( 11) / 10,
|
||||
(double) rng.nextInt(-10, 11) / 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explode() {
|
||||
super.explode();
|
||||
RandomSource rng = level().getRandom();
|
||||
for (int i = 0; i < getPCount(); i++) {
|
||||
Vec3 target = targetVector(rng);
|
||||
assert this.getOwner() != null;
|
||||
Projectile e = new claymoreArrow(level(), this.getOwner());
|
||||
e.setPos(position().add(0, 0.5, 0));
|
||||
e.setDeltaMovement(target);
|
||||
Vec3 pos = position().add(target);
|
||||
Projectile e = new Arrow(level(),pos.x, pos.y + 1, pos.z);
|
||||
e.setDeltaMovement(target.multiply(5, 0.1, 5));
|
||||
level().addFreshEntity(e);
|
||||
}
|
||||
|
||||
@ -76,9 +74,4 @@ public class claymorePrimedTNT extends basePrimedTNT {
|
||||
this.entityData.define(DATA_PCOUNT_ID, 16);
|
||||
super.defineSynchedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block renderBlock() {
|
||||
return blocks.TNT_CLAYMORE.get();
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
package com.jenny.enhancedexplosives.entities.tnt;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -13,14 +18,12 @@ import javax.annotation.Nullable;
|
||||
public class enderPrimedTNT extends basePrimedTNT {
|
||||
|
||||
public enderPrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
|
||||
super(entities.TNT_ENDER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_ENDER.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "ender");
|
||||
}
|
||||
|
||||
public enderPrimedTNT(EntityType<enderPrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
setRenderID("ender");
|
||||
}
|
||||
|
||||
public Block renderBlock() {
|
||||
return blocks.TNT_ENDER.get();
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.jenny.enhancedexplosives.entities.tnt;
|
||||
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
@ -21,7 +18,7 @@ public class homingPrimedTNT extends basePrimedTNT {
|
||||
Entity target;
|
||||
|
||||
public homingPrimedTNT (Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse, float speed) {
|
||||
super(entities.TNT_HOMING.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_HOMING.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "homing");
|
||||
this.target = null;
|
||||
this.setSpeed(speed);
|
||||
}
|
||||
@ -91,11 +88,4 @@ public class homingPrimedTNT extends basePrimedTNT {
|
||||
this.entityData.define(DATA_SPEED_ID, 4.0f);
|
||||
super.defineSynchedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticles(float partialTicks) {
|
||||
for (int i = 1; i <= ConfigClient.calcPCount(30); i++) {
|
||||
level().addParticle(ParticleTypes.FALLING_OBSIDIAN_TEAR, getX(), getY(), getZ(), this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,6 @@ import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -30,11 +28,12 @@ public class selectivePrimedTNT extends basePrimedTNT {
|
||||
}
|
||||
|
||||
public selectivePrimedTNT(Level pLevel, double pX, double pY, double pZ, @Nullable LivingEntity pOwner, float power, int fuse) {
|
||||
super(entities.TNT_SELECTIVE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power);
|
||||
super(entities.TNT_SELECTIVE.get(), pLevel, pOwner, new Vec3(pX, pY, pZ), fuse, power, "tnt_selective");
|
||||
}
|
||||
|
||||
public selectivePrimedTNT(EntityType<selectivePrimedTNT> entityType, Level level) {
|
||||
super(entityType, level, null);
|
||||
this.setRenderID("tnt_selective");
|
||||
}
|
||||
@Override
|
||||
protected void explode() {
|
||||
|
@ -1,30 +0,0 @@
|
||||
package com.jenny.enhancedexplosives;
|
||||
|
||||
import com.jenny.enhancedexplosives.particles.ArrowParticle;
|
||||
import com.jenny.enhancedexplosives.particles.particles;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.TextureSheetParticle;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class eventBusEvents {
|
||||
@SubscribeEvent
|
||||
public static void registerParticleFactories(final RegisterParticleProvidersEvent event) {
|
||||
Minecraft.getInstance().particleEngine.register(particles.CONCUSSIVE_ARROW_PARTICLE.get(),
|
||||
ArrowParticle.Provider::new);
|
||||
Minecraft.getInstance().particleEngine.register(particles.TNT_ARROW_PARTICLE.get(),
|
||||
ArrowParticle.Provider::new);
|
||||
Minecraft.getInstance().particleEngine.register(particles.CARPET_ARROW_PARTICLE.get(),
|
||||
ArrowParticle.Provider::new);
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.jenny.enhancedexplosives.particles;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ArrowParticle extends TextureSheetParticle {
|
||||
private final float quadSizeStart;
|
||||
|
||||
protected ArrowParticle(ClientLevel level, double xCoord, double yCoord, double zCoord,
|
||||
SpriteSet spriteSet, double xd, double yd, double zd) {
|
||||
super(level, xCoord, yCoord, zCoord, xd, yd, zd);
|
||||
|
||||
this.friction = 0.8F;
|
||||
this.xd = xd;
|
||||
this.yd = yd;
|
||||
this.zd = zd;
|
||||
this.quadSizeStart = this.quadSize;
|
||||
this.lifetime = 20;
|
||||
this.setSpriteFromAge(spriteSet);
|
||||
|
||||
this.rCol = 1f;
|
||||
this.gCol = 1f;
|
||||
this.bCol = 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
fadeOut();
|
||||
}
|
||||
|
||||
private void fadeOut() {
|
||||
this.alpha = (-(1/(float)lifetime) * age + 1);
|
||||
this.quadSize = this.quadSizeStart * ((float) age / lifetime);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Provider implements ParticleProvider<SimpleParticleType> {
|
||||
private final SpriteSet sprites;
|
||||
|
||||
public Provider(SpriteSet spriteSet) {
|
||||
this.sprites = spriteSet;
|
||||
}
|
||||
|
||||
public Particle createParticle(@NotNull SimpleParticleType particleType, @NotNull ClientLevel level,
|
||||
double x, double y, double z,
|
||||
double dx, double dy, double dz) {
|
||||
return new ArrowParticle(level, x, y, z, this.sprites, dx, dy, dz);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.jenny.enhancedexplosives.particles;
|
||||
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
|
||||
|
||||
public class particles {
|
||||
public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, MODID);
|
||||
|
||||
public static final RegistryObject<SimpleParticleType> CONCUSSIVE_ARROW_PARTICLE =
|
||||
PARTICLES.register("particle_concussive_arrow", () -> new SimpleParticleType(true));
|
||||
public static final RegistryObject<SimpleParticleType> TNT_ARROW_PARTICLE =
|
||||
PARTICLES.register("particle_tnt_arrow", () -> new SimpleParticleType(true));
|
||||
public static final RegistryObject<SimpleParticleType> CARPET_ARROW_PARTICLE =
|
||||
PARTICLES.register("particle_carpet_arrow", () -> new SimpleParticleType(true));
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
PARTICLES.register(bus);
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"textures": [
|
||||
"enhancedexplosives:particle_carpet_arrow"
|
||||
]
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"textures": [
|
||||
"enhancedexplosives:particle_concussive_arrow"
|
||||
]
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"textures": [
|
||||
"enhancedexplosives:particle_tnt_arrow"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 28 KiB |
@ -1,7 +0,0 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 1,
|
||||
"interpolate": true,
|
||||
"frames": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 353 B |
Before Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 132 B |