port gamer bow to 1.18.2

This commit is contained in:
RyanTLG
2022-04-30 14:40:45 +02:00
parent 95cf937175
commit b00f4a96fa
15 changed files with 197 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import net.arcmods.ryantlg.items.armour.jeremiumArmour;
import net.arcmods.ryantlg.items.armour.notArmour;
import net.arcmods.ryantlg.items.armour.omniumArmour;
import net.arcmods.ryantlg.items.armour.oriumArmour;
import net.arcmods.ryantlg.items.bows.gamerBow;
import net.arcmods.ryantlg.items.itemsByCrop.weemItems;
import net.arcmods.ryantlg.items.metalItems.jeremiumMetals;
import net.arcmods.ryantlg.items.metalItems.omniumMetals;
@@ -97,6 +98,7 @@ public class gamermod implements ModInitializer {
JeremiumOreGen.register();
notArmour.register();
gamerBow.register();
}
//fight me

View File

@@ -1,6 +1,7 @@
package net.arcmods.ryantlg;
import net.arcmods.ryantlg.blocks.CropBlocks;
import net.arcmods.ryantlg.utils.bowModelPredicateProvider;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@@ -14,6 +15,8 @@ public class gamermodClient implements ClientModInitializer{
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), CropBlocks.WEEM_CROP_BLOCK);
bowModelPredicateProvider.registerBowModels();
gamermod.LOGGER.info("Client only objects loaded");
}

View File

@@ -0,0 +1,19 @@
package net.arcmods.ryantlg.items.bows;
import net.arcmods.ryantlg.gamermod;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.BowItem;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class gamerBow {
public static final Item GAMER_BOW = new BowItem(new FabricItemSettings().group(gamermod.CHING).maxCount(1).fireproof().maxDamage(458));
public static void register(){
Registry.register(Registry.ITEM, new Identifier("gamermod", "gamer_bow"), GAMER_BOW);
}
}

View File

@@ -0,0 +1,31 @@
package net.arcmods.ryantlg.utils;
import net.arcmods.ryantlg.items.bows.gamerBow;
import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
public class bowModelPredicateProvider {
public static void registerBowModels() {
registerBow(gamerBow.GAMER_BOW);
}
private static void registerBow(Item bow) {
ModelPredicateProviderRegistry.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;
});
ModelPredicateProviderRegistry.register(bow, new Identifier("pulling"),
(stack, world, entity, seed) -> entity != null && entity.isUsingItem()
&& entity.getActiveItem() == stack ? 1.0f : 0.0f);
}
}