-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raiders and guards now properly look at their target while fighting Raiders do now also properly display item use animations, spear/bow etc Archer raiders now also draw their bow in preparation of shooting Raiders no longer scale in attackspeed, as they already scale in damage with difficulty
- Loading branch information
1 parent
e7a4af7
commit 9b7eed5
Showing
14 changed files
with
263 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/main/java/com/minecolonies/core/client/render/RenderUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.minecolonies.core.client.render; | ||
|
||
import net.minecraft.client.model.HumanoidModel; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.entity.Mob; | ||
import net.minecraft.world.item.CrossbowItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.UseAnim; | ||
|
||
public class RenderUtils | ||
{ | ||
/** | ||
* Arm pose helper, take from PlayerRenderer#getArmPose | ||
* | ||
* @param entity | ||
* @param hand | ||
* @return | ||
*/ | ||
public static HumanoidModel.ArmPose getArmPose(Mob entity, InteractionHand hand) | ||
{ | ||
if (entity.isLeftHanded()) | ||
{ | ||
hand = hand == InteractionHand.MAIN_HAND ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND; | ||
} | ||
|
||
ItemStack itemstack = entity.getItemInHand(hand); | ||
if (itemstack.isEmpty()) | ||
{ | ||
return HumanoidModel.ArmPose.EMPTY; | ||
} | ||
else | ||
{ | ||
if (entity.getUsedItemHand() == hand && entity.getUseItemRemainingTicks() > 0) | ||
{ | ||
UseAnim useanim = itemstack.getUseAnimation(); | ||
if (useanim == UseAnim.BLOCK) | ||
{ | ||
return HumanoidModel.ArmPose.BLOCK; | ||
} | ||
|
||
if (useanim == UseAnim.BOW) | ||
{ | ||
return HumanoidModel.ArmPose.BOW_AND_ARROW; | ||
} | ||
|
||
if (useanim == UseAnim.SPEAR) | ||
{ | ||
return HumanoidModel.ArmPose.THROW_SPEAR; | ||
} | ||
|
||
if (useanim == UseAnim.CROSSBOW && hand == entity.getUsedItemHand()) | ||
{ | ||
return HumanoidModel.ArmPose.CROSSBOW_CHARGE; | ||
} | ||
|
||
if (useanim == UseAnim.SPYGLASS) | ||
{ | ||
return HumanoidModel.ArmPose.SPYGLASS; | ||
} | ||
|
||
if (useanim == UseAnim.TOOT_HORN) | ||
{ | ||
return HumanoidModel.ArmPose.TOOT_HORN; | ||
} | ||
|
||
if (useanim == UseAnim.BRUSH) | ||
{ | ||
return HumanoidModel.ArmPose.BRUSH; | ||
} | ||
} | ||
else if (!entity.swinging && itemstack.getItem() instanceof CrossbowItem && CrossbowItem.isCharged(itemstack)) | ||
{ | ||
return HumanoidModel.ArmPose.CROSSBOW_HOLD; | ||
} | ||
|
||
HumanoidModel.ArmPose forgeArmPose = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(itemstack).getArmPose(entity, hand, itemstack); | ||
if (forgeArmPose != null) | ||
{ | ||
return forgeArmPose; | ||
} | ||
|
||
return HumanoidModel.ArmPose.ITEM; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.