From 0410aeca00513af80eb49474b50d755b147431d5 Mon Sep 17 00:00:00 2001 From: Noaaan Date: Sun, 29 Sep 2024 18:20:58 +0200 Subject: [PATCH] Fix #266 --- .../mythicmetals/entity/StarPlatinumArrowEntity.java | 8 ++++++-- .../mythicmetals/item/StarPlatinumArrowItem.java | 12 +++++++++++- .../nourl/mythicmetals/item/tools/CarmotStaff.java | 3 --- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/nourl/mythicmetals/entity/StarPlatinumArrowEntity.java b/src/main/java/nourl/mythicmetals/entity/StarPlatinumArrowEntity.java index feb2b332..8e18a8ab 100644 --- a/src/main/java/nourl/mythicmetals/entity/StarPlatinumArrowEntity.java +++ b/src/main/java/nourl/mythicmetals/entity/StarPlatinumArrowEntity.java @@ -19,8 +19,12 @@ public class StarPlatinumArrowEntity extends PersistentProjectileEntity { public static final ItemStack STAR_PLAT_STACK = new ItemStack(MythicTools.STAR_PLATINUM_ARROW); - public StarPlatinumArrowEntity(LivingEntity owner, World world, @Nullable ItemStack shotFrom) { - super(MythicEntities.STAR_PLATINUM_ARROW_ENTITY_TYPE, owner, world, STAR_PLAT_STACK, shotFrom); + public StarPlatinumArrowEntity(LivingEntity owner, World world, ItemStack stack, @Nullable ItemStack weapon) { + super(MythicEntities.STAR_PLATINUM_ARROW_ENTITY_TYPE, owner, world, stack, weapon); + } + + public StarPlatinumArrowEntity(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { + super(MythicEntities.STAR_PLATINUM_ARROW_ENTITY_TYPE, x, y, z, world, stack, shotFrom); } public StarPlatinumArrowEntity(EntityType type, World world) { diff --git a/src/main/java/nourl/mythicmetals/item/StarPlatinumArrowItem.java b/src/main/java/nourl/mythicmetals/item/StarPlatinumArrowItem.java index 478c3258..536fecd3 100644 --- a/src/main/java/nourl/mythicmetals/item/StarPlatinumArrowItem.java +++ b/src/main/java/nourl/mythicmetals/item/StarPlatinumArrowItem.java @@ -2,7 +2,10 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.projectile.PersistentProjectileEntity; +import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.item.*; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Position; import net.minecraft.world.World; import nourl.mythicmetals.entity.StarPlatinumArrowEntity; import org.jetbrains.annotations.Nullable; @@ -15,6 +18,13 @@ public StarPlatinumArrowItem(Item.Settings settings) { @Override public PersistentProjectileEntity createArrow(World world, ItemStack stack, LivingEntity shooter, @Nullable ItemStack shotFrom) { - return new StarPlatinumArrowEntity(shooter, world, shotFrom); + return new StarPlatinumArrowEntity(shooter, world, stack, shotFrom); + } + + @Override + public ProjectileEntity createEntity(World world, Position pos, ItemStack stack, Direction direction) { + var entity = new StarPlatinumArrowEntity(world, pos.getX(), pos.getY(), pos.getZ(), stack.copyWithCount(1), null); + entity.pickupType = PersistentProjectileEntity.PickupPermission.ALLOWED; + return entity; } } diff --git a/src/main/java/nourl/mythicmetals/item/tools/CarmotStaff.java b/src/main/java/nourl/mythicmetals/item/tools/CarmotStaff.java index 57bf4c81..032f11ec 100644 --- a/src/main/java/nourl/mythicmetals/item/tools/CarmotStaff.java +++ b/src/main/java/nourl/mythicmetals/item/tools/CarmotStaff.java @@ -512,9 +512,6 @@ public void usageTick(World world, LivingEntity user, ItemStack stack, int remai if (entity instanceof ExplosiveProjectileEntity projectile) { var bounceVec = projectile.getVelocity().multiply(-0.25, -0.25, -0.25); projectile.setVelocity(bounceVec.x, bounceVec.y, bounceVec.z, 1.05F, 0.5F); -// projectile.powerX = -projectile.powerX; -// projectile.powerY = -projectile.powerY; -// projectile.powerZ = -projectile.powerZ; projectile.setOwner(user); projectile.addCommandTag(PROJECTILE_MODIFIED.toString()); stack.damage(2, user, EquipmentSlot.MAINHAND);