Skip to content

Commit f7c8072

Browse files
committed
- merge lang fixes
1 parent 6f92dff commit f7c8072

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

COMPAT.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ That being said, Better Combat also sadly has a bug with NBT based compatibility
1010

1111
## Other Mod Info
1212
- **[Better Paragliders](https://modrinth.com/mod/better-paragliders)** stamina system should work with MIAPI tools.
13+
- **[MineColonies](https://www.curseforge.com/minecraft/mc-mods/minecolonies)** NPCs should detect tools and armor correctly.
14+
- most other mods should just work as well. - if issues are found please report them
1315

1416
## Generated Material Info
1517
Truly Modular attempts to make any mods' tool materials compatible.

common/src/main/java/smartin/miapi/entity/ItemProjectileEntity.java

+5
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ protected boolean tryPickup(PlayerEntity player) {
320320
if (hasLoyalty && getOwner() != null && !isOwner(player)) {
321321
return false;
322322
}
323+
if (slotId == -2 && player.getOffHandStack().isEmpty()) {
324+
player.getInventory().offHand.set(0, this.asItemStack());
325+
player.getInventory().markDirty();
326+
return true;
327+
}
323328
if (slotId >= 0 && player.getInventory().getStack(slotId).isEmpty()) {
324329
return player.getInventory().insertStack(slotId, this.asItemStack());
325330
} else {

common/src/main/java/smartin/miapi/modules/abilities/BoomerangThrowingAbility.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ public void onStoppedUsingAfter(ItemStack stack, World world, LivingEntity user,
7979
boomerangEntity.setBowItem(ItemStack.EMPTY);
8080
boomerangEntity.setPierceLevel((byte) (int) AttributeProperty.getActualValue(stack, EquipmentSlot.MAINHAND, AttributeRegistry.PROJECTILE_PIERCING));
8181
boomerangEntity.setSpeedDamage(true);
82-
boomerangEntity.setPreferredSlot(playerEntity.getInventory().selectedSlot);
82+
if (user.getActiveHand() == Hand.OFF_HAND) {
83+
boomerangEntity.setPreferredSlot(-2);
84+
} else {
85+
boomerangEntity.setPreferredSlot(playerEntity.getInventory().selectedSlot);
86+
}
8387
boomerangEntity.thrownStack = stack;
8488
world.spawnEntity(boomerangEntity);
8589
world.playSoundFromEntity(null, user, SoundEvents.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0f, 1.0f);

common/src/main/java/smartin/miapi/modules/abilities/ThrowingAbility.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ public void onStoppedUsingAfter(ItemStack stack, World world, LivingEntity user,
9191
projectileEntity.setBowItem(ItemStack.EMPTY);
9292
projectileEntity.setPierceLevel((byte) (int) AttributeProperty.getActualValue(stack, EquipmentSlot.MAINHAND, AttributeRegistry.PROJECTILE_PIERCING));
9393
projectileEntity.setSpeedDamage(true);
94-
projectileEntity.setPreferredSlot(playerEntity.getInventory().selectedSlot);
94+
if (user.getActiveHand() == Hand.OFF_HAND) {
95+
projectileEntity.setPreferredSlot(-2);
96+
} else {
97+
projectileEntity.setPreferredSlot(playerEntity.getInventory().selectedSlot);
98+
}
9599
projectileEntity.thrownStack = stack;
96100
world.spawnEntity(projectileEntity);
97101
world.playSoundFromEntity(null, user, SoundEvents.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0f, 1.0f);

0 commit comments

Comments
 (0)