Skip to content

Commit

Permalink
Fix #266
Browse files Browse the repository at this point in the history
  • Loading branch information
Noaaan committed Sep 29, 2024
1 parent 9e35eb2 commit 0410aec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<StarPlatinumArrowEntity> type, World world) {
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/nourl/mythicmetals/item/StarPlatinumArrowItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
3 changes: 0 additions & 3 deletions src/main/java/nourl/mythicmetals/item/tools/CarmotStaff.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0410aec

Please sign in to comment.