-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # CHANGELOG.md # common/src/main/java/net/bettercombat/network/ServerNetwork.java # gradle.properties
- Loading branch information
Showing
25 changed files
with
290 additions
and
54 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
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
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
4 changes: 2 additions & 2 deletions
4
common/src/main/java/net/bettercombat/compatibility/FirstPersonModelHelper.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package net.bettercombat.compatibility; | ||
|
||
import dev.tr7zw.firstperson.FirstPersonModelCore; | ||
import dev.tr7zw.firstperson.api.FirstPersonAPI; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class FirstPersonModelHelper { | ||
public static Supplier<Boolean> isDisabled() { | ||
return (() -> { | ||
return !FirstPersonModelCore.enabled; | ||
return !FirstPersonAPI.isEnabled(); | ||
}); | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
common/src/main/java/net/bettercombat/mixin/RangedWeaponItemMixin.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,45 @@ | ||
package net.bettercombat.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.RangedWeaponItem; | ||
import net.minecraft.util.Hand; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(RangedWeaponItem.class) | ||
public class RangedWeaponItemMixin { | ||
|
||
/** | ||
* FEATURE: Two-handed wielding | ||
* | ||
* Two-handed weapons (such as Heavy Crossbow) disable offhand slot. | ||
* Disabled offhand slot returns `EMPTY` stack when queried using: | ||
* - getStackInHand(Hand.OFF_HAND) | ||
* - getOffHandStack() | ||
* | ||
* This causes two-handed ranged weapons to no longer prioritize offhand projectiles. | ||
* This mixin fixes that. | ||
*/ | ||
|
||
@WrapOperation( | ||
method = "getHeldProjectile", | ||
require = 0, // Make this optional, it is not worth crashing the game over | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;")) | ||
private static ItemStack getHeldProjectile_Wrapped_BetterCombat( | ||
// Mixin Parameters | ||
LivingEntity entity, Hand hand, Operation<ItemStack> original | ||
// Context Parameters (not needed) | ||
// LivingEntity entity, Predicate<ItemStack> predicate | ||
) { | ||
var originalResult = original.call(entity, hand); // Always call original first to allow others' side effects | ||
if (entity instanceof PlayerEntity player) { | ||
return player.getInventory().offHand.get(0); | ||
} else { | ||
return originalResult; | ||
} | ||
} | ||
} |
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.