Skip to content

Commit

Permalink
Stop entity motion on general whip usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jan 1, 2024
1 parent d4ef4cd commit 5f3b18a
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/main/java/drzhark/mocreatures/item/MoCItemWhip.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public boolean isFull3D() {
return true;
}

public ItemStack onItemRightClick2(ItemStack itemstack, World world, EntityPlayer entityplayer) {
return itemstack;
}

@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
final ItemStack stack = player.getHeldItem(hand);
Expand All @@ -65,15 +61,22 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p
MoCEntityBigCat entitybigcat = (MoCEntityBigCat) entity;
if (entitybigcat.getIsTamed()) {
entitybigcat.setSitting(!entitybigcat.getIsSitting());
entitybigcat.setIsJumping(false);
entitybigcat.getNavigator().clearPath();
entitybigcat.setAttackTarget(null);
} else if ((worldIn.getDifficulty().getId() > 0) && entitybigcat.getIsAdult()) {
entitybigcat.setAttackTarget(player);
}
}

if (entity instanceof MoCEntityHorse) {
MoCEntityHorse entityhorse = (MoCEntityHorse) entity;
if (entityhorse.getIsTamed()) {
if (entityhorse.getRidingEntity() == null) {
entityhorse.setSitting(!entityhorse.getIsSitting());
entityhorse.setIsJumping(false);
entityhorse.getNavigator().clearPath();
entityhorse.setAttackTarget(null);
} else if (entityhorse.isNightmare()) {
entityhorse.setNightmareInt(100);
} else if (entityhorse.sprintCounter == 0) {
Expand All @@ -86,20 +89,29 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p
MoCEntityKitty entitykitty = (MoCEntityKitty) entity;
if ((entitykitty.getKittyState() > 2) && entitykitty.whipable()) {
entitykitty.setSitting(!entitykitty.getIsSitting());
entitykitty.setIsJumping(false);
entitykitty.getNavigator().clearPath();
entitykitty.setAttackTarget(null);
}
}

if ((entity instanceof MoCEntityWyvern)) {
MoCEntityWyvern entitywyvern = (MoCEntityWyvern) entity;
if (entitywyvern.getIsTamed() && entitywyvern.getRidingEntity() == null && !entitywyvern.isOnAir()) {
entitywyvern.setSitting(!entitywyvern.getIsSitting());
entitywyvern.setIsJumping(false);
entitywyvern.getNavigator().clearPath();
entitywyvern.setAttackTarget(null);
}
}

if ((entity instanceof MoCEntityPetScorpion)) {
MoCEntityPetScorpion petscorpion = (MoCEntityPetScorpion) entity;
if (petscorpion.getIsTamed() && petscorpion.getRidingEntity() == null) {
petscorpion.setSitting(!petscorpion.getIsSitting());
petscorpion.setIsJumping(false);
petscorpion.getNavigator().clearPath();
petscorpion.setAttackTarget(null);
}
}

Expand All @@ -114,8 +126,12 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p
//toggles hiding of tamed ostriches
if (entityostrich.getIsTamed() && entityostrich.getRidingEntity() == null) {
entityostrich.setHiding(!entityostrich.getHiding());
entityostrich.setIsJumping(false);
entityostrich.getNavigator().clearPath();
entityostrich.setAttackTarget(null);
}
}

if (entity instanceof MoCEntityElephant) {
MoCEntityElephant entityelephant = (MoCEntityElephant) entity;

Expand Down

0 comments on commit 5f3b18a

Please sign in to comment.