-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76149f0
commit b6aaac2
Showing
3 changed files
with
38 additions
and
24 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
35 changes: 35 additions & 0 deletions
35
src/main/java/net/balancedrecall/BalancedRecallClient.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,35 @@ | ||
package net.balancedrecall; | ||
|
||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; | ||
import net.minecraft.client.world.ClientWorld; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class BalancedRecallClient implements ClientModInitializer{ | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
// Model Predicates | ||
FabricModelPredicateProviderRegistry.register(BalancedRecall.MAGIC_MIRROR, new Identifier("recalling"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> { | ||
if (livingEntity == null || livingEntity.getActiveItem() != itemStack) { | ||
return 0.0F; | ||
} | ||
return (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 20.0F; | ||
}); | ||
FabricModelPredicateProviderRegistry.register(BalancedRecall.DIMENSIONAL_MIRROR, new Identifier("recalling"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> { | ||
if (livingEntity == null || livingEntity.getActiveItem() != itemStack) { | ||
return 0.0F; | ||
} | ||
return (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 20.0F; | ||
}); | ||
FabricModelPredicateProviderRegistry.register(BalancedRecall.MAGIC_MIRROR, new Identifier("broken"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> { | ||
return (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) ? 1F : 0F; | ||
}); | ||
FabricModelPredicateProviderRegistry.register(BalancedRecall.DIMENSIONAL_MIRROR, new Identifier("broken"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> { | ||
return (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) ? 1F : 0F; | ||
}); | ||
} | ||
|
||
} |
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