added concussive arrow & more particles for arrows

This commit is contained in:
Jenny 2025-01-24 02:25:53 +01:00
parent 509895e32c
commit e02551f4fb
Signed by: Jenny
GPG Key ID: 4A98012FB1C39311
13 changed files with 108 additions and 8 deletions

View File

@ -38,7 +38,7 @@ mod_name=Compressed TNT
# 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.4.0
mod_version=0.5.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

@ -28,6 +28,7 @@ public class creativeTab {
output.accept(blocks.TNT_BLACK_HOLE.get());
output.accept(blocks.TNT_CLAYMORE.get());
output.accept(items.TNT_ARROW.get());
output.accept(items.CONCUSSIVE_ARROW.get());
}).title(Component.literal("Compressed TNT")).build());
public static void register(IEventBus bus) {

View File

@ -20,6 +20,7 @@ public class ModItemModelProvider extends ItemModelProvider {
@Override
protected void registerModels() {
simpleItem(items.TNT_ARROW);
simpleItem(items.CONCUSSIVE_ARROW);
}
private ItemModelBuilder simpleItem(RegistryObject<Item> item) {

View File

@ -0,0 +1,48 @@
package com.jenny.compressedtnt.entities.arrows;
import com.jenny.compressedtnt.entities.entities;
import com.jenny.compressedtnt.items.items;
import net.minecraft.client.particle.Particle;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType;
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 org.jetbrains.annotations.NotNull;
public class concussiveArrow extends baseArrow{
public concussiveArrow(EntityType<concussiveArrow> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}
public concussiveArrow(Level pLevel, LivingEntity pShooter) {
super(pLevel, pShooter, entities.ARROW_CONCUSSIVE.get());
}
@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();
}
}
@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();
}
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.CONCUSSIVE_ARROW.get());
}
}

View File

@ -3,6 +3,7 @@ package com.jenny.compressedtnt.entities.arrows;
import com.jenny.compressedtnt.items.items;
import com.jenny.compressedtnt.entities.entities;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
@ -21,6 +22,9 @@ public class tntArrow 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, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
this.discard();
@ -30,6 +34,7 @@ public class tntArrow extends baseArrow {
@Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
this.discard();
}
@NotNull

View File

@ -1,6 +1,6 @@
package com.jenny.compressedtnt.entities.client;
import com.jenny.compressedtnt.entities.arrows.tntArrow;
import com.jenny.compressedtnt.entities.arrows.baseArrow;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource;
@ -14,7 +14,7 @@ import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
public class TNTArrowRenderer extends EntityRenderer<tntArrow> {
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
private final BlockRenderDispatcher blockRenderer;
private float i = 0;
@ -24,7 +24,7 @@ public class TNTArrowRenderer extends EntityRenderer<tntArrow> {
this.blockRenderer = pContext.getBlockRenderDispatcher();
}
public void render(@NotNull tntArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight) {
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);
@ -38,7 +38,7 @@ public class TNTArrowRenderer extends EntityRenderer<tntArrow> {
}
@NotNull
public ResourceLocation getTextureLocation(@NotNull tntArrow pEntity) {
public ResourceLocation getTextureLocation(@NotNull baseArrow pEntity) {
return TextureAtlas.LOCATION_BLOCKS;
}
}

View File

@ -1,6 +1,6 @@
package com.jenny.compressedtnt.entities;
import com.jenny.compressedtnt.entities.arrows.tntArrow;
import com.jenny.compressedtnt.entities.arrows.*;
import com.jenny.compressedtnt.entities.client.BaseTNTRenderer;
import com.jenny.compressedtnt.entities.client.TNTArrowRenderer;
import com.jenny.compressedtnt.entities.client.clusterTNTRenderer;
@ -44,6 +44,10 @@ public class entities {
ENTITY_TYPES.register("arrow_tnt", () -> EntityType.Builder.<tntArrow>of(tntArrow::new, MobCategory.MISC)
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_tnt"));
public static final RegistryObject<EntityType<concussiveArrow>> ARROW_CONCUSSIVE =
ENTITY_TYPES.register("arrow_concussive", () -> EntityType.Builder.<concussiveArrow>of(concussiveArrow::new, MobCategory.MISC)
.sized(0.48F, 0.48F).clientTrackingRange(64).build("arrow_concussive"));
public static void register(IEventBus eventBus) {
ENTITY_TYPES.register(eventBus);
}
@ -56,5 +60,6 @@ public class entities {
EntityRenderers.register(TNT_CLUSTER.get(), clusterTNTRenderer::new);
EntityRenderers.register(ARROW_TNT.get(), TNTArrowRenderer::new);
EntityRenderers.register(ARROW_CONCUSSIVE.get(), TNTArrowRenderer::new);
}
}

View File

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

View File

@ -12,6 +12,7 @@ public class items {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<Item> TNT_ARROW = ITEMS.register("arrow_tnt", () -> new ArrowTNT(new Item.Properties()));
public static final RegistryObject<Item> CONCUSSIVE_ARROW = ITEMS.register("arrow_concussive", () -> new ArrowConcussive(new Item.Properties()));
public static void register(IEventBus bus) {
ITEMS.register(bus);

View File

@ -11,5 +11,6 @@
"block.compressedtnt.tnt_black_hole": "Black Hole TNT",
"block.compressedtnt.tnt_claymore": "Claymore TNT",
"item.compressedtnt.arrow_tnt": "TNT Arrow"
"item.compressedtnt.arrow_tnt": "TNT Arrow",
"item.compressedtnt.arrow_concussive": "Concussive Arrow"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View File

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "redstone",
"ingredients":[
{
"item": "compressedtnt:arrow_tnt"
},
{
"item": "minecraft:water_bucket"
}
],
"result": {
"item": "compressedtnt:arrow_tnt"
}
}

View File

@ -1,5 +1,6 @@
{
"values": [
"compressedtnt:arrow_tnt"
"compressedtnt:arrow_tnt",
"compressedtnt:arrow_concussive"
]
}