tunnel arrow
This commit is contained in:
parent
cc21d6b935
commit
339c466c88
@ -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
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"enhancedexplosives:particle_tunnel_arrow"
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 206 B |
Binary file not shown.
After Width: | Height: | Size: 132 B |
@ -2,6 +2,7 @@
|
||||
"values": [
|
||||
"enhancedexplosives:arrow_tnt",
|
||||
"enhancedexplosives:arrow_concussive",
|
||||
"enhancedexplosives:arrow_carpet"
|
||||
"enhancedexplosives:arrow_carpet",
|
||||
"enhancedexplosives:arrow_tunnel"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user