Minecraft.java
private void rightClickMouse() {
if (!this.playerController.getIsHittingBlock()) {
this.rightClickDelayTimer = 4;
if (!this.player.isRowingBoat()) {
if (this.objectMouseOver == null) {
LOGGER.warn("Null returned as 'hitResult', this shouldn't happen!");
}
for (Hand hand : Hand.values()) {
ItemStack itemstack = this.player.getHeldItem(hand);
if (this.objectMouseOver != null) {
switch (this.objectMouseOver.getType()) {
case ENTITY -> {
FunctionRegistry functionRegistry = Expensive.getInstance().getFunctionRegistry();
KillAura killAura = functionRegistry.getKillAura();
EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) this.objectMouseOver;
Entity entity = entityRayTraceResult.getEntity();
ActionResultType actionResult = this.playerController.interactWithEntity(this.player, entity, entityRayTraceResult, hand);
boolean killAuraActive = killAura.isState() && killAura.getTarget() != null;
if (!killAuraActive) {
if (!actionResult.isSuccessOrConsume()) {
actionResult = this.playerController.interactWithEntity(this.player, entity, hand);
}
if (actionResult.isSuccessOrConsume()) {
if (actionResult.isSuccess()) {
this.player.swingArm(hand);
}
return;
}
}
}
case BLOCK -> {
BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) this.objectMouseOver;
int i = itemstack.getCount();
ActionResultType result = this.playerController.processRightClickBlock(this.player, this.world, hand, blockRayTraceResult);
if (result.isSuccessOrConsume()) {
if (result.isSuccess()) {
this.player.swingArm(hand);
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.playerController.isInCreativeMode())) {
this.gameRenderer.itemRenderer.resetEquippedProgress(hand);
}
}
return;
}
if (result == ActionResultType.FAIL) {
return;
}
}
}
}
FunctionRegistry functionRegistry = Expensive.getInstance().getFunctionRegistry();
ItemCooldown itemCooldown = functionRegistry.getItemCooldown();
ItemCooldown.ItemEnum itemEnum = ItemCooldown.ItemEnum.getItemEnum(itemstack.getItem());
if (!itemstack.isEmpty()) {
ActionResultType result;
if (itemCooldown.isState() && itemEnum != null && itemCooldown.isCurrentItem(itemEnum) && player.getCooldownTracker().hasCooldown(itemEnum.getItem())) {
result = ActionResultType.FAIL;
} else {
result = this.playerController.processRightClick(this.player, this.world, hand);
}
if (result.isSuccessOrConsume()) {
if (result.isSuccess()) {
this.player.swingArm(hand);
}
this.gameRenderer.itemRenderer.resetEquippedProgress(hand);
return;
}
}
}
}
}
}