Add bowModelPredicateProvider
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
# Changes:
|
# Changes:
|
||||||
## 1.18.1-1.0.1-unstable
|
## 1.18.1-1.0.1-unstable
|
||||||
- first test and register to Strong bow (name not decided yet)
|
- first test and register to Strong bow (name not decided yet)
|
||||||
- praying to god i did nothing wrong
|
- praying to god i did nothing wrong
|
||||||
|
|
||||||
|
## 1.18.1-1.0.2-unstable
|
||||||
|
- added model predicate provider
|
||||||
|
- changed bow maxDamage to 458 from 19 (found ot it wasnt attack damage)
|
||||||
|
- registered model predicate provider in client initializer
|
||||||
|
- figuring out new stuff is painful
|
||||||
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx6G
|
|||||||
loader_version=0.12.12
|
loader_version=0.12.12
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.18.1-1.0.1-unstable
|
mod_version = 1.18.1-1.0.2-unstable
|
||||||
maven_group = ryantlg.GamerMod.mod
|
maven_group = ryantlg.GamerMod.mod
|
||||||
archives_base_name = GamerMod
|
archives_base_name = GamerMod
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.arcmods.ryantlg;
|
package net.arcmods.ryantlg;
|
||||||
|
|
||||||
import net.arcmods.ryantlg.blocks.CropBlocks;
|
import net.arcmods.ryantlg.blocks.CropBlocks;
|
||||||
|
import net.arcmods.ryantlg.utils.bowModelPredicateProvider;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
@@ -14,6 +15,8 @@ public class gamermodClient implements ClientModInitializer{
|
|||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), CropBlocks.WEEM_CROP_BLOCK);
|
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), CropBlocks.WEEM_CROP_BLOCK);
|
||||||
|
|
||||||
|
bowModelPredicateProvider.registerBowModels();
|
||||||
|
|
||||||
gamermod.LOGGER.info("Client only objects loaded");
|
gamermod.LOGGER.info("Client only objects loaded");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import net.minecraft.util.registry.Registry;
|
|||||||
|
|
||||||
public class strongBow {
|
public class strongBow {
|
||||||
|
|
||||||
public static final Item STRONG_BOW = new BowItem(new FabricItemSettings().group(gamermod.CHING).maxCount(1).fireproof().maxDamage(19));
|
public static final Item STRONG_BOW = new BowItem(new FabricItemSettings().group(gamermod.CHING).maxCount(1).fireproof().maxDamage(458));
|
||||||
|
|
||||||
public static void register(){
|
public static void register(){
|
||||||
Registry.register(Registry.ITEM, new Identifier("gamermod", "strong_bow"), STRONG_BOW);
|
Registry.register(Registry.ITEM, new Identifier("gamermod", "strong_bow"), STRONG_BOW);
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package net.arcmods.ryantlg.utils;
|
||||||
|
|
||||||
|
import net.arcmods.ryantlg.items.bows.strongBow;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class bowModelPredicateProvider {
|
||||||
|
|
||||||
|
public static void registerBowModels() {
|
||||||
|
registerBow(strongBow.STRONG_BOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerBow(Item bow) {
|
||||||
|
FabricModelPredicateProviderRegistry.register(bow, new Identifier("pull"),
|
||||||
|
(stack, world, entity, seed) -> {
|
||||||
|
if (entity == null) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
if (entity.getActiveItem() != stack) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return (float)(stack.getMaxUseTime() - entity.getItemUseTimeLeft()) / 20.0f;
|
||||||
|
});
|
||||||
|
|
||||||
|
FabricModelPredicateProviderRegistry.register(bow, new Identifier("pulling"),
|
||||||
|
(stack, world, entity, seed) -> entity != null && entity.isUsingItem()
|
||||||
|
&& entity.getActiveItem() == stack ? 1.0f : 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user