Compare commits

..

2 Commits

24 changed files with 142 additions and 27 deletions

View File

@ -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.11
mod_version=0.9.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

View File

@ -17,7 +17,7 @@ public class blocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<strongerTNTBlock> TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE), 8.0f, 80));
public static final RegistryObject<Block> TNT_8 = BLOCKS.register("tnt_8", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE), 8.0f, 80));
public static final RegistryObject<Item> TNT_8_ITEM = ITEMS.register("tnt_8", () -> new BlockItemTooltip(TNT_8.get(), new Item.Properties()));
public static final RegistryObject<Block> TNT_16 = BLOCKS.register("tnt_16", () -> new strongerTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 16.0f, 80));

View File

@ -32,6 +32,7 @@ public class creativeTab {
output.accept(items.TNT_ARROW.get());
output.accept(items.CONCUSSIVE_ARROW.get());
output.accept(items.CARPET_ARROW.get());
output.accept(items.TUNNEL_ARROW.get());
output.accept(items.DYNAMITE.get());
}).title(Component.literal("Enhanced Explosives")).build());

View File

@ -21,13 +21,14 @@ public class ModBlockStateProvider extends BlockStateProvider {
@Override
protected void registerStatesAndModels() {
sideTopBottom(blocks.TNT_8.get());
sideTopBottom(blocks.TNT_16.get());
sideTopBottom(blocks.TNT_32.get());
sideTopBottom(blocks.TNT_64.get());
sideTopBottom(blocks.TNT_128.get());
sideTopBottom(blocks.TNT_ENDER.get());
sideTopBottom(blocks.TNT_CLAYMORE.get());
sideTopBottom(blocks.TNT_8);
sideTopBottom(blocks.TNT_16);
sideTopBottom(blocks.TNT_32);
sideTopBottom(blocks.TNT_64);
sideTopBottom(blocks.TNT_128);
sideTopBottom(blocks.TNT_ENDER);
sideTopBottom(blocks.TNT_CLAYMORE);
sideTopBottom(blocks.TNT_HOMING);
blockWithItem(blocks.TNT_BLACK_HOLE);
}
@ -60,7 +61,8 @@ public class ModBlockStateProvider extends BlockStateProvider {
return new ResourceLocation(rl.getNamespace(), rl.getPath() + suffix);
}
public void sideTopBottom(Block block) {
public void sideTopBottom(RegistryObject<Block> blockRegistryObject) {
Block block = blockRegistryObject.get();
ModelFile model = models().cubeBottomTop(name(block), extend(blockTexture(block), "_side"), extend(blockTexture(block), "_bottom"), extend(blockTexture(block), "_top"));
this.getVariantBuilder(block).forAllStates(blockState -> ConfiguredModel.builder().modelFile(model).build());
simpleBlockItem(block, model);

View File

@ -22,6 +22,7 @@ public class ModItemModelProvider extends ItemModelProvider {
simpleItem(items.TNT_ARROW);
simpleItem(items.CONCUSSIVE_ARROW);
simpleItem(items.CARPET_ARROW);
simpleItem(items.TUNNEL_ARROW);
}
private ItemModelBuilder simpleItem(RegistryObject<Item> item) {

View File

@ -104,7 +104,7 @@ public class baseArrow extends AbstractArrow {
this.makeParticle(1);
}
} else {
this.makeParticle(2);
spawnParticles(0);
}
this.tick++;
} else if (this.inGround && this.inGroundTime != 0 && !this.effects.isEmpty() && this.inGroundTime >= 600) {

View File

@ -0,0 +1,68 @@
package com.jenny.enhancedexplosives.entities.arrows;
import com.jenny.enhancedexplosives.config.ConfigClient;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.particles.particles;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class tunnelArrow extends baseArrow{
public static int explosionCount = 16;
public static int spacing = 2;
public tunnelArrow(EntityType<tunnelArrow> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}
public tunnelArrow(Level pLevel, LivingEntity pShooter) {
super(pLevel, pShooter, entities.ARROW_TUNNEL.get());
}
@Override
public void tick() {
super.tick();
if (inGround) {
explode();
discard();
}
}
@Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
explode();
this.discard();
}
protected void explode() {
Vec3 rot = getTargetVec( - getXRot(), - getYRot(), 0);
for (int i = 0; i < explosionCount; i++) {
Vec3 pos = position().add(rot.multiply(i * spacing, i * spacing, i * spacing));
this.level().explode(this, pos.x, pos.y, pos.z, 8.0f, Level.ExplosionInteraction.TNT);
}
}
public static Vec3 getTargetVec(float xRot, float yRot, float zRot) {
float f = -Mth.sin((float) (yRot * (Math.PI / 180F))) * Mth.cos(xRot * ((float)Math.PI / 180F));
float f1 = -Mth.sin((xRot + zRot) * ((float)Math.PI / 180F));
float f2 = Mth.cos(yRot * ((float)Math.PI / 180F)) * Mth.cos(xRot * ((float)Math.PI / 180F));
return new Vec3(f, f1, f2);
}
@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.TUNNEL_ARROW_PARTICLE.get(), pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
}
}
}

View File

@ -35,10 +35,6 @@ 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);
}
pEntity.spawnParticles(pPartialTicks);
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));

View File

@ -17,7 +17,6 @@ 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 BlockRenderDispatcher blockRenderer;
public TNTArrowRenderer(EntityRendererProvider.Context pContext) {
@ -27,6 +26,7 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
}
public void render(@NotNull baseArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
pPoseStack.pushPose();
pPoseStack.translate(0.0F, 0.5F, 0.0F);
pPoseStack.scale(0.5f, 0.5f, 0.5f);
@ -34,9 +34,6 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
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);
}
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, i / 5 % 2 == 0);
pPoseStack.popPose();
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);

View File

@ -71,6 +71,10 @@ public class entities {
ENTITY_TYPES.register("dynamite", () -> EntityType.Builder.<dynamite>of(dynamite::new, MobCategory.MISC)
.sized(0.48F, 0.48F).clientTrackingRange(64).build("dynamite"));
public static final RegistryObject<EntityType<tunnelArrow>> ARROW_TUNNEL =
ENTITY_TYPES.register("arrow_tunnel", () -> EntityType.Builder.<tunnelArrow>of(tunnelArrow::new, MobCategory.MISC)
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_tunnel"));
public static void register(IEventBus eventBus) {
ENTITY_TYPES.register(eventBus);
}
@ -90,6 +94,7 @@ public class entities {
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_TUNNEL.get(), TNTArrowRenderer::new);
EntityRenderers.register(ARROW_CLAYMORE.get(), baseArrowRenderer::new);
}
}

View File

@ -65,6 +65,9 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
}
public void tick() {
if (level().isClientSide) {
spawnParticles(0);
}
if (!this.isNoGravity()) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
}

View File

@ -1,8 +1,10 @@
package com.jenny.enhancedexplosives.entities.tnt;
import com.jenny.enhancedexplosives.blocks.blocks;
import com.jenny.enhancedexplosives.entities.entities;
import com.jenny.enhancedexplosives.config.ConfigClient;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
@ -11,6 +13,7 @@ import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.*;
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;
@ -94,8 +97,14 @@ public class homingPrimedTNT extends basePrimedTNT {
@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);
Vec3 pos = getPosition(partialTicks);
for (int i = 1; i <= ConfigClient.calcPCount(1); i++) {
level().addParticle(ParticleTypes.FLAME, pos.x, pos.y, pos.z, 0, 0, 0);
}
}
@Override
public Block renderBlock() {
return blocks.TNT_HOMING.get();
}
}

View File

@ -26,5 +26,7 @@ public class eventBusEvents {
ArrowParticle.Provider::new);
Minecraft.getInstance().particleEngine.register(particles.CARPET_ARROW_PARTICLE.get(),
ArrowParticle.Provider::new);
Minecraft.getInstance().particleEngine.register(particles.TUNNEL_ARROW_PARTICLE.get(),
ArrowParticle.Provider::new);
}
}

View File

@ -0,0 +1,20 @@
package com.jenny.enhancedexplosives.items;
import com.jenny.enhancedexplosives.entities.arrows.tunnelArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
public class ArrowTunnel extends ArrowAbstract {
public ArrowTunnel(Properties properties){
super(properties);
}
@Override
@NotNull
public AbstractArrow createArrow(@NotNull Level pLevel, @NotNull ItemStack pStack, @NotNull LivingEntity pShooter) {
return new tunnelArrow(pLevel, pShooter);
}
}

View File

@ -15,6 +15,7 @@ public class items {
public static final RegistryObject<Item> CONCUSSIVE_ARROW = ITEMS.register("arrow_concussive", () -> new ArrowConcussive(new Item.Properties()));
public static final RegistryObject<Item> CARPET_ARROW = ITEMS.register("arrow_carpet", () -> new ArrowCarpet(new Item.Properties()));
public static final RegistryObject<Item> DYNAMITE = ITEMS.register("dynamite", () -> new Dynamite(new Item.Properties()));
public static final RegistryObject<Item> TUNNEL_ARROW = ITEMS.register("arrow_tunnel", () -> new ArrowTunnel(new Item.Properties()));
public static void register(IEventBus bus) {
ITEMS.register(bus);

View File

@ -18,6 +18,8 @@ public class particles {
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 final RegistryObject<SimpleParticleType> TUNNEL_ARROW_PARTICLE =
PARTICLES.register("particle_tunnel_arrow", () -> new SimpleParticleType(true));
public static void register(IEventBus bus) {
PARTICLES.register(bus);

View File

@ -13,11 +13,6 @@
"block.enhancedexplosives.tnt_selective": "Selective TNT",
"block.enhancedexplosives.tnt_ender": "Ender TNT",
"item.enhancedexplosives.arrow_tnt": "TNT Arrow",
"item.enhancedexplosives.arrow_concussive": "Concussive Arrow",
"item.enhancedexplosives.arrow_carpet": "Carpet Bombing Arrow",
"item.enhancedexplosives.dynamite": "Dynamite",
"tooltip.enhancedexplosives.tnt_cluster_2": "splits into 2 small TNTs",
"tooltip.enhancedexplosives.tnt_cluster_4": "splits into 4 small TNTs",
"tooltip.enhancedexplosives.tnt_cluster_8": "splits into 8 small TNTs",
@ -27,8 +22,15 @@
"tooltip.enhancedexplosives.tnt_selective": "only destroys the type of block it explodes on",
"tooltip.enhancedexplosives.tnt_ender": "teleports in a 16 block radius upon priming",
"item.enhancedexplosives.arrow_tnt": "TNT Arrow",
"item.enhancedexplosives.arrow_concussive": "Concussive Arrow",
"item.enhancedexplosives.arrow_carpet": "Carpet Bombing Arrow",
"item.enhancedexplosives.arrow_tunnel": "Tunnel Arrow",
"item.enhancedexplosives.dynamite": "Dynamite",
"tooltip.enhancedexplosives.arrow_tnt": "explodes on impact",
"tooltip.enhancedexplosives.arrow_concussive": "explodes on impact without block damage",
"tooltip.enhancedexplosives.arrow_carpet": "splits into multiple TNT arrows when it starts falling",
"tooltip.enhancedexplosives.arrow_tunnel": "explodes along the direction it is looking at",
"tooltip.enhancedexplosives.dynamite": "TNT, but throwable"
}

View File

@ -0,0 +1,5 @@
{
"textures": [
"enhancedexplosives:particle_tunnel_arrow"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View File

@ -2,6 +2,7 @@
"values": [
"enhancedexplosives:arrow_tnt",
"enhancedexplosives:arrow_concussive",
"enhancedexplosives:arrow_carpet"
"enhancedexplosives:arrow_carpet",
"enhancedexplosives:arrow_tunnel"
]
}