dispenser action

This commit is contained in:
Jenny 2025-02-10 13:49:12 +01:00
parent a9271ab33e
commit c400a3da3d
Signed by: Jenny
GPG Key ID: 2072A14E40940632
28 changed files with 259 additions and 64 deletions

View File

@ -5,7 +5,7 @@ minecraft_version=1.20.1
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.1,1.20.2)
minecraft_version_range=[1.20.1,1.20.2]
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=47.3.0
# The Forge version range can use any version of Forge as bounds or match the loader version range
@ -38,7 +38,7 @@ mod_name=Advanced Arrows
# 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.0.3
mod_version=0.0.4
# 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

@ -1,9 +1,10 @@
package com.jenny.advancedarrows;
import com.jenny.advancedarrows.config.*;
import com.jenny.advancedarrows.config.ConfigClient;
import com.jenny.advancedarrows.config.ConfigCommon;
import com.jenny.advancedarrows.entities.entities;
import com.jenny.advancedarrows.items.items;
import com.jenny.advancedarrows.particles.particles;
import com.mojang.logging.LogUtils;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
@ -30,18 +31,23 @@ public class advancedArrows {
modEventBus.addListener(this::commonSetup);
entities.register(modEventBus);
items.register(modEventBus);
creativeTab.register(modEventBus);
entities.register(modEventBus);
particles.register(modEventBus);
MinecraftForge.EVENT_BUS.register(this);
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigClient.SPEC);
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigClient.SPEC, "AdvancedArrows-client.toml");
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ConfigCommon.SPEC, "AdvancedArrows-common.toml");
}
private void commonSetup(final FMLCommonSetupEvent event) {}
private void commonSetup(final FMLCommonSetupEvent event) {
items.registerDispenser();
}
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {}
public void onServerStarting(ServerStartingEvent event) {
}
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public static class ClientModEvents {

View File

@ -1,31 +1,26 @@
package com.jenny.advancedarrows.config;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.config.ModConfigEvent;
import static com.jenny.advancedarrows.advancedArrows.MODID;
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ConfigClient {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static final ForgeConfigSpec SPEC;
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.ConfigValue<Double> C_PARTICLE_PERCENT;
public static final ForgeConfigSpec SPEC = BUILDER.build();
static {
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 float particlePercent;
@SubscribeEvent
static void onLoad(final ModConfigEvent event)
{
particlePercent = C_PARTICLE_PERCENT.get().floatValue();
SPEC = BUILDER.build();
}
public static int calcPCount(int pCount) {
return Math.round(pCount * particlePercent);
return (int) Math.round(pCount * C_PARTICLE_PERCENT.get());
}
}

View File

@ -0,0 +1,22 @@
package com.jenny.advancedarrows.config;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.common.Mod;
import static com.jenny.advancedarrows.advancedArrows.MODID;
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ConfigCommon {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static final ForgeConfigSpec SPEC;
public static final ForgeConfigSpec.ConfigValue<Boolean> C_AIMBOT_PLAYER;
static {
C_AIMBOT_PLAYER =
BUILDER.comment("allow the homing arrow to target players")
.define("homingAtPlayer", false);
SPEC = BUILDER.build();
}
}

View File

@ -1,7 +1,6 @@
package com.jenny.advancedarrows;
import com.jenny.advancedarrows.items.items;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
@ -18,9 +17,7 @@ import static com.jenny.advancedarrows.advancedArrows.MODID;
public class creativeTab {
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
public static final RegistryObject<CreativeModeTab> CREATIVE_TAB = CREATIVE_MODE_TABS.register("advanced_arrows", () -> CreativeModeTab.builder().withTabsBefore(CreativeModeTabs.COMBAT).icon(() -> items.ARROW_INCENDIARY.get().getDefaultInstance()).displayItems((parameters, output) -> {
output.acceptAll(Arrays.stream(getItems()).toList());
}).title(Component.literal("Advanced Arrows")).build());
public static final RegistryObject<CreativeModeTab> CREATIVE_TAB = CREATIVE_MODE_TABS.register("advanced_arrows", () -> CreativeModeTab.builder().withTabsBefore(CreativeModeTabs.SPAWN_EGGS).icon(() -> items.ARROW_INCENDIARY.get().getDefaultInstance()).displayItems((parameters, output) -> output.acceptAll(Arrays.stream(getItems()).toList())).title(Component.literal("Advanced Arrows")).build());
public static void register(IEventBus bus) {
CREATIVE_MODE_TABS.register(bus);

View File

@ -13,7 +13,6 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Arrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.Potion;
@ -29,7 +28,7 @@ import java.util.Set;
public class baseArrow extends AbstractArrow {
private static final int EXPOSED_POTION_DECAY_TIME = 600;
private static final int NO_EFFECT_COLOR = -1;
private static final EntityDataAccessor<Integer> ID_EFFECT_COLOR = SynchedEntityData.defineId(Arrow.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Integer> ID_EFFECT_COLOR = SynchedEntityData.defineId(baseArrow.class, EntityDataSerializers.INT);
private static final byte EVENT_POTION_PUFF = 0;
private Potion potion = Potions.EMPTY;
private final Set<MobEffectInstance> effects = Sets.newHashSet();

View File

@ -2,8 +2,7 @@ package com.jenny.advancedarrows.entities;
import com.jenny.advancedarrows.config.ConfigClient;
import com.jenny.advancedarrows.items.items;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.damagesource.DamageSource;
import com.jenny.advancedarrows.particles.particles;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
@ -19,6 +18,8 @@ import java.util.ArrayList;
import java.util.List;
public class breachingArrow extends baseArrow{
static final int range = 4;
public breachingArrow(EntityType<breachingArrow> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}
@ -27,6 +28,14 @@ public class breachingArrow extends baseArrow{
super(pLevel, pShooter, entities.ARROW_BREACHING.get());
}
@Override
public void tick() {
super.tick();
if (level().isClientSide && inGround && inGroundTime == 1) {
spawnBreachParticles();
}
}
@Override
protected void onHit(@NotNull HitResult pResult) {
for (Entity entity : getEntities()) {
@ -37,17 +46,34 @@ public class breachingArrow extends baseArrow{
protected List<Entity> getEntities() {
List<Entity> ret_list = new ArrayList<>();
Vec3 corner1 = position().subtract(4, 4, 4);
Vec3 corner2 = position().add(4, 4, 4);
Vec3 corner1 = position().subtract(range, range, range);
Vec3 corner2 = position().add(range, range, range);
AABB boundingBox = new AABB(corner1, corner2);
for (Entity entity : level().getEntitiesOfClass(LivingEntity.class, boundingBox)) {
if (entity.getBoundingBox().intersects(position(), position().add(getDeltaMovement().normalize().scale(10)))) {
if (entity.getBoundingBox().intersects(position(), position().add(getDeltaMovement().normalize().scale(range)))) {
ret_list.add(entity);
}
}
return ret_list;
}
protected void spawnBreachParticles() {
int max = ConfigClient.calcPCount(20);
Vec3 delta = getDeltaMovement().normalize().scale(range);
for (int i = 0; i < max; i++) {
Vec3 pos = position().add(delta.scale((float) i / (max - 1)));
level().addParticle(particles.PARTICLE_BREACHING_ARROW.get(), pos.x, pos.y, pos.z, 0, 0, 0);
}
}
@Override
public void spawnParticles() {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
Vec3 pos = createParticlePos(1f);
level().addParticle(particles.PARTICLE_BREACHING_ARROW.get(), pos.x, pos.y, pos.z, 0, 0, 0);
}
}
@NotNull
protected ItemStack getPickupItem() {
return new ItemStack(items.ARROW_BREACHING.get());

View File

@ -47,7 +47,7 @@ public class enderArrow extends baseArrow {
public void spawnParticles() {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
Vec3 pos = createParticlePos(1f);
level().addParticle(ParticleTypes.ELECTRIC_SPARK, pos.x, pos.y, pos.z, 0, 0, 0);
level().addParticle(ParticleTypes.GLOW, pos.x, pos.y, pos.z, 0, 0, 0);
}
}
}

View File

@ -12,7 +12,7 @@ import net.minecraftforge.registries.RegistryObject;
import static com.jenny.advancedarrows.advancedArrows.MODID;
public class entities {
private static final int tr = 16;
private static final int tr = 32;
private static final float w = 0.5f;
private static final float h = 0.5f;

View File

@ -1,6 +1,7 @@
package com.jenny.advancedarrows.entities;
import com.jenny.advancedarrows.config.ConfigClient;
import com.jenny.advancedarrows.config.ConfigCommon;
import com.jenny.advancedarrows.items.items;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EntityType;
@ -78,8 +79,10 @@ public class homingArrow extends baseArrow {
AABB boundingBox = new AABB(corner1, corner2);
for (LivingEntity entity : level().getEntitiesOfClass(LivingEntity.class, boundingBox)) {
if (entity.getUUID() != getOwner().getUUID()) {
ret_list.add(entity);
if (entity.getUUID() != getOwner().getUUID()) { // prevents targeting itself
if (level().getPlayerByUUID(entity.getUUID()) == null || ConfigCommon.C_AIMBOT_PLAYER.get()) { // prevent aiming at player if config says so
ret_list.add(entity);
}
}
}
return ret_list;

View File

@ -2,7 +2,6 @@ package com.jenny.advancedarrows.entities;
import com.jenny.advancedarrows.config.ConfigClient;
import com.jenny.advancedarrows.items.items;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
@ -20,6 +19,11 @@ public class incendiaryArrow extends baseArrow{
super(pLevel, pShooter, entities.ARROW_INCENDIARY.get());
}
public incendiaryArrow(Level pLevel, double x, double y, double z) {
super(entities.ARROW_INCENDIARY.get(), pLevel);
setPos(x, y, z);
}
@Override
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
pTarget.setSecondsOnFire(5);
@ -34,9 +38,8 @@ public class incendiaryArrow extends baseArrow{
public void spawnParticles() {
for (int i = 1; i <= ConfigClient.calcPCount(5); i++) {
double m = (double) level().getRandom().nextIntBetweenInclusive(- 100, 100) / 100;
Vec3 DeltaMovement = getDeltaMovement();
Vec3 pos = createParticlePos(1f);
level().addParticle(ParticleTypes.FLAME, pos.x, pos.y, pos.z, DeltaMovement.x, DeltaMovement.y, DeltaMovement.z);
level().addParticle(ParticleTypes.FLAME, pos.x, pos.y, pos.z, 0, 0, 0);
}
}
}

View File

@ -2,18 +2,13 @@ package com.jenny.advancedarrows.entities;
import com.jenny.advancedarrows.config.ConfigClient;
import com.jenny.advancedarrows.items.items;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.Entity;
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.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,11 @@
package com.jenny.advancedarrows.entities;
import com.jenny.advancedarrows.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 net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
public class ricochetArrow extends baseArrow{

View File

@ -2,19 +2,13 @@ package com.jenny.advancedarrows.entities;
import com.jenny.advancedarrows.config.ConfigClient;
import com.jenny.advancedarrows.items.items;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
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.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
@ -27,6 +21,11 @@ public class switchArrow extends baseArrow{
super(pLevel, pShooter, entities.ARROW_SWITCH.get());
}
public switchArrow(Level pLevel, double x, double y, double z) {
super(entities.ARROW_SWITCH.get(), pLevel);
setPos(x, y, z);
}
@Override
protected void onHitEntity(@NotNull EntityHitResult pTarget) {
super.onHitEntity(pTarget);

View File

@ -0,0 +1,19 @@
package com.jenny.advancedarrows;
import com.jenny.advancedarrows.particles.ArrowParticle;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import static com.jenny.advancedarrows.advancedArrows.MODID;
import static com.jenny.advancedarrows.particles.particles.PARTICLE_BREACHING_ARROW;
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class eventBusEvents {
@SubscribeEvent
public static void registerParticleFactories(final RegisterParticleProvidersEvent event) {
//particles.registerClient(Minecraft.getInstance().particleEngine);
Minecraft.getInstance().particleEngine.register(PARTICLE_BREACHING_ARROW.get(), ArrowParticle.Provider::new);
}
}

View File

@ -1,7 +1,6 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.breachingArrow;
import com.jenny.advancedarrows.entities.switchArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;

View File

@ -1,7 +1,6 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.incendiaryArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;

View File

@ -1,6 +1,5 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.incendiaryArrow;
import com.jenny.advancedarrows.entities.kineticArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;

View File

@ -1,6 +1,5 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.incendiaryArrow;
import com.jenny.advancedarrows.entities.ricochetArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;

View File

@ -1,6 +1,5 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.ricochetArrow;
import com.jenny.advancedarrows.entities.sharpenedArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;

View File

@ -1,6 +1,5 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.sharpenedArrow;
import com.jenny.advancedarrows.entities.switchArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;

View File

@ -1,10 +1,21 @@
package com.jenny.advancedarrows.items;
import com.jenny.advancedarrows.entities.baseArrow;
import com.jenny.advancedarrows.entities.entities;
import net.minecraft.core.Position;
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.NotNull;
import static com.jenny.advancedarrows.advancedArrows.MODID;
@ -20,8 +31,36 @@ public class items {
public static final RegistryObject<Item> ARROW_HOMING = ITEMS.register("arrow_homing", () -> new ArrowHoming(new Item.Properties()));
public static final RegistryObject<Item> ARROW_ENDER = ITEMS.register("arrow_ender", () -> new ArrowEnder(new Item.Properties()));
public static void register(IEventBus bus) {
ITEMS.register(bus);
}
public static void registerDispenser() {
class ArrowDispenseBehaviour extends AbstractProjectileDispenseBehavior {
private final EntityType<? extends baseArrow> arrowType;
public ArrowDispenseBehaviour(EntityType<? extends baseArrow> arrow) {
this.arrowType = arrow;
}
@Override
protected @NotNull Projectile getProjectile(@NotNull Level pLevel, @NotNull Position pPosition, @NotNull ItemStack pStack) {
baseArrow arrow = arrowType.create(pLevel);
assert arrow != null;
arrow.setPos(pPosition.x(), pPosition.y(), pPosition.z());
arrow.pickup = AbstractArrow.Pickup.ALLOWED;
return arrow;
}
}
DispenserBlock.registerBehavior(ARROW_INCENDIARY.get(), new ArrowDispenseBehaviour(entities.ARROW_INCENDIARY.get()));
DispenserBlock.registerBehavior(ARROW_RICOCHET.get(), new ArrowDispenseBehaviour(entities.ARROW_RICOCHET.get()));
DispenserBlock.registerBehavior(ARROW_KINETIC.get(), new ArrowDispenseBehaviour(entities.ARROW_KINETIC.get()));
DispenserBlock.registerBehavior(ARROW_SHARPENED.get(), new ArrowDispenseBehaviour(entities.ARROW_SHARPENED.get()));
DispenserBlock.registerBehavior(ARROW_SWITCH.get(), new ArrowDispenseBehaviour(entities.ARROW_SWITCH.get()));
DispenserBlock.registerBehavior(ARROW_BREACHING.get(), new ArrowDispenseBehaviour(entities.ARROW_BREACHING.get()));
DispenserBlock.registerBehavior(ARROW_HOMING.get(), new ArrowDispenseBehaviour(entities.ARROW_HOMING.get()));
DispenserBlock.registerBehavior(ARROW_ENDER.get(), new ArrowDispenseBehaviour(entities.ARROW_ENDER.get()));
}
}

View File

@ -0,0 +1,60 @@
package com.jenny.advancedarrows.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 = 40;
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);
}
}
}

View File

@ -0,0 +1,27 @@
package com.jenny.advancedarrows.particles;
import net.minecraft.client.particle.ParticleEngine;
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 org.jetbrains.annotations.NotNull;
import static com.jenny.advancedarrows.advancedArrows.MODID;
public class particles {
public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, MODID);
public static final RegistryObject<SimpleParticleType> PARTICLE_BREACHING_ARROW =
PARTICLES.register("particle_breaching_arrow", () -> new SimpleParticleType(true));
public static void register(IEventBus bus) {
PARTICLES.register(bus);
}
public static void registerClient(@NotNull ParticleEngine pEngine) {
pEngine.register(PARTICLE_BREACHING_ARROW.get(), ArrowParticle.Provider::new);
}
}

View File

@ -0,0 +1,5 @@
{
"textures": [
"advancedarrows:particle_breaching_arrow"
]
}

View File

@ -1,10 +1,6 @@
{
"animation": {
"frametime": 15,
"interpolate": false,
"frames": [
0,
1
]
"interpolate": false
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

View File

@ -0,0 +1,12 @@
{
"values": [
"advancedarrows:arrow_incendiary",
"advancedarrows:arrow_ricochet",
"advancedarrows:arrow_kinetic",
"advancedarrows:arrow_sharpened",
"advancedarrows:arrow_switch",
"advancedarrows:arrow_breaching",
"advancedarrows:arrow_homing",
"advancedarrows:arrow_ender"
]
}