优化头盔实现方式
This commit is contained in:
parent
038833ba3d
commit
f59588877b
13 changed files with 152 additions and 118 deletions
|
@ -1,4 +1,4 @@
|
|||
// 1.20.1 2024-09-25T01:00:24.9322237 Item Models: superbwarfare
|
||||
// 1.20.1 2024-09-25T02:21:34.5694533 Item Models: superbwarfare
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_47_blueprint.json
|
||||
c993bddc0db9453ffbefa59f9ac9a74dba909038 assets/superbwarfare/models/item/ancient_cpu.json
|
||||
|
@ -70,7 +70,7 @@ ce0f0949b0545d8ef08aeaa52dd423dbe592f704 assets/superbwarfare/models/item/raw_ce
|
|||
5b8f7d5922e49e06bcd4d4d2a2a3dc934548570b assets/superbwarfare/models/item/reforging_table.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/rpg_blueprint.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/rpk_blueprint.json
|
||||
0385b632f86e2ecfbc28433ca209aa9a1da9ec72 assets/superbwarfare/models/item/ru_6b47.json
|
||||
66a2586547a7cc44a80f950036a1795af580518a assets/superbwarfare/models/item/ru_helmet_6b47.json
|
||||
ce2232fbc6a9186371c6ae6745ec3be2a0a33546 assets/superbwarfare/models/item/scheelite.json
|
||||
c010baff106b3307ec585df4757f7c3d756e9794 assets/superbwarfare/models/item/seeker.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/sentinel_blueprint.json
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/ru_6b47"
|
||||
"layer0": "superbwarfare:item/ru_helmet_6b47"
|
||||
}
|
||||
}
|
|
@ -1,23 +1,23 @@
|
|||
package net.mcreator.superbwarfare.client.model.armor;
|
||||
|
||||
import net.mcreator.superbwarfare.ModUtils;
|
||||
import net.mcreator.superbwarfare.item.armor.Ru6b47;
|
||||
import net.mcreator.superbwarfare.item.armor.RuHelmet6b47;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Ru6b47Model extends GeoModel<Ru6b47> {
|
||||
public class Ru6b47Model extends GeoModel<RuHelmet6b47> {
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Ru6b47 object) {
|
||||
public ResourceLocation getAnimationResource(RuHelmet6b47 object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Ru6b47 object) {
|
||||
public ResourceLocation getModelResource(RuHelmet6b47 object) {
|
||||
return new ResourceLocation(ModUtils.MODID, "geo/ru_6b47.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Ru6b47 object) {
|
||||
return new ResourceLocation(ModUtils.MODID, "textures/armor/ru_6b47.png");
|
||||
public ResourceLocation getTextureResource(RuHelmet6b47 object) {
|
||||
return new ResourceLocation(ModUtils.MODID, "textures/armor/ru_helmet_6b47.png");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
package net.mcreator.superbwarfare.client.renderer.armor;
|
||||
|
||||
import net.mcreator.superbwarfare.client.model.armor.Ru6b47Model;
|
||||
import net.mcreator.superbwarfare.item.armor.Ru6b47;
|
||||
import net.mcreator.superbwarfare.item.armor.RuHelmet6b47;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
||||
|
||||
public class Ru6b47ArmorRenderer extends GeoArmorRenderer<Ru6b47> {
|
||||
public class Ru6b47ArmorRenderer extends GeoArmorRenderer<RuHelmet6b47> {
|
||||
public Ru6b47ArmorRenderer() {
|
||||
super(new Ru6b47Model());
|
||||
this.head = new GeoBone(null, "", false, (double) 0, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Ru6b47 animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
public RenderType getRenderType(RuHelmet6b47 animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ModItemModelProvider extends ItemModelProvider {
|
|||
|
||||
// armor
|
||||
|
||||
simpleItem(ModItems.RU_6B47);
|
||||
simpleItem(ModItems.RU_HELMET_6B47);
|
||||
|
||||
// blueprints
|
||||
blueprintItem(ModItems.TRACHELIUM_BLUEPRINT);
|
||||
|
|
|
@ -2,7 +2,7 @@ package net.mcreator.superbwarfare.init;
|
|||
|
||||
import net.mcreator.superbwarfare.ModUtils;
|
||||
import net.mcreator.superbwarfare.item.*;
|
||||
import net.mcreator.superbwarfare.item.armor.Ru6b47;
|
||||
import net.mcreator.superbwarfare.item.armor.RuHelmet6b47;
|
||||
import net.mcreator.superbwarfare.item.common.BlueprintItem;
|
||||
import net.mcreator.superbwarfare.item.common.MaterialPack;
|
||||
import net.mcreator.superbwarfare.item.common.ammo.*;
|
||||
|
@ -123,7 +123,7 @@ public class ModItems {
|
|||
public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", Knife::new);
|
||||
public static final RegistryObject<Item> HAMMER = ITEMS.register("hammer", Hammer::new);
|
||||
public static final RegistryObject<Item> CROWBAR = ITEMS.register("crowbar", Crowbar::new);
|
||||
public static final RegistryObject<Item> RU_6B47 = ITEMS.register("ru_6b47", () -> new Ru6b47(ArmorItem.Type.HELMET, new Item.Properties()));
|
||||
public static final RegistryObject<Item> RU_HELMET_6B47 = ITEMS.register("ru_helmet_6b47", RuHelmet6b47::new);
|
||||
public static final RegistryObject<Item> MORTAR_DEPLOYER = ITEMS.register("mortar_deployer", MortarDeployer::new);
|
||||
public static final RegistryObject<Item> MORTAR_BARREL = ITEMS.register("mortar_barrel", () -> new Item(new Item.Properties()));
|
||||
public static final RegistryObject<Item> MORTAR_BASE_PLATE = ITEMS.register("mortar_base_plate", () -> new Item(new Item.Properties()));
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
|
||||
package net.mcreator.superbwarfare.item.armor;
|
||||
|
||||
import net.mcreator.superbwarfare.client.renderer.armor.Ru6b47ArmorRenderer;
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
import software.bernie.geckolib.animatable.GeoItem;
|
||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Ru6b47 extends ArmorItem implements GeoItem {
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
public String animationprocedure = "empty";
|
||||
|
||||
public Ru6b47(ArmorItem.Type type, Item.Properties properties) {
|
||||
super(new ArmorMaterial() {
|
||||
@Override
|
||||
public int getDurabilityForType(ArmorItem.Type type) {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefenseForType(ArmorItem.Type type) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentValue() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getEquipSound() {
|
||||
return SoundEvents.ARMOR_EQUIP_IRON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ingredient getRepairIngredient() {
|
||||
return Ingredient.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ru_6b47";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getToughness() {
|
||||
return 4f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getKnockbackResistance() {
|
||||
return 0f;
|
||||
}
|
||||
}, type, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
|
||||
consumer.accept(new IClientItemExtensions() {
|
||||
private GeoArmorRenderer<?> renderer;
|
||||
|
||||
@Override
|
||||
public HumanoidModel<?> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) {
|
||||
if (this.renderer == null)
|
||||
this.renderer = new Ru6b47ArmorRenderer();
|
||||
this.renderer.prepForRender(livingEntity, itemStack, equipmentSlot, original);
|
||||
return this.renderer;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
||||
super.appendHoverText(itemstack, world, list, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.cache;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package net.mcreator.superbwarfare.item.armor;
|
||||
|
||||
import net.mcreator.superbwarfare.client.renderer.armor.Ru6b47ArmorRenderer;
|
||||
import net.mcreator.superbwarfare.tiers.ModArmorMaterial;
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
import software.bernie.geckolib.animatable.GeoItem;
|
||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class RuHelmet6b47 extends ArmorItem implements GeoItem {
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
public String animationprocedure = "empty";
|
||||
|
||||
public RuHelmet6b47() {
|
||||
super(ModArmorMaterial.CEMENTED_CARBIDE, Type.HELMET, new Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
|
||||
consumer.accept(new IClientItemExtensions() {
|
||||
private GeoArmorRenderer<?> renderer;
|
||||
|
||||
@Override
|
||||
public HumanoidModel<?> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) {
|
||||
if (this.renderer == null)
|
||||
this.renderer = new Ru6b47ArmorRenderer();
|
||||
this.renderer.prepForRender(livingEntity, itemStack, equipmentSlot, original);
|
||||
return this.renderer;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.cache;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package net.mcreator.superbwarfare.tiers;
|
||||
|
||||
import net.mcreator.superbwarfare.init.ModItems;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.util.LazyLoadedValue;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ModArmorMaterial implements ArmorMaterial {
|
||||
CEMENTED_CARBIDE("cemented_carbide", 50, Util.make(new EnumMap<>(ArmorItem.Type.class), p -> {
|
||||
p.put(ArmorItem.Type.BOOTS, 3);
|
||||
p.put(ArmorItem.Type.LEGGINGS, 6);
|
||||
p.put(ArmorItem.Type.CHESTPLATE, 8);
|
||||
p.put(ArmorItem.Type.HELMET, 3);
|
||||
}), 10, SoundEvents.ARMOR_EQUIP_IRON, 4.0F, 0.0F, () -> Ingredient.of(ModItems.CEMENTED_CARBIDE_INGOT.get()));
|
||||
|
||||
private static final EnumMap<ArmorItem.Type, Integer> HEALTH_FUNCTION_FOR_TYPE = Util.make(new EnumMap<>(ArmorItem.Type.class), (p_266653_) -> {
|
||||
p_266653_.put(ArmorItem.Type.BOOTS, 13);
|
||||
p_266653_.put(ArmorItem.Type.LEGGINGS, 15);
|
||||
p_266653_.put(ArmorItem.Type.CHESTPLATE, 16);
|
||||
p_266653_.put(ArmorItem.Type.HELMET, 11);
|
||||
});
|
||||
private final String name;
|
||||
private final int durabilityMultiplier;
|
||||
private final EnumMap<ArmorItem.Type, Integer> protectionFunctionForType;
|
||||
private final int enchantmentValue;
|
||||
private final SoundEvent sound;
|
||||
private final float toughness;
|
||||
private final float knockbackResistance;
|
||||
private final LazyLoadedValue<Ingredient> repairIngredient;
|
||||
|
||||
ModArmorMaterial(String pName, int pDurabilityMultiplier, EnumMap<ArmorItem.Type, Integer> pProtectionFunctionForType, int pEnchantmentValue, SoundEvent pSound, float pToughness, float pKnockbackResistance, Supplier<Ingredient> pRepairIngredient) {
|
||||
this.name = pName;
|
||||
this.durabilityMultiplier = pDurabilityMultiplier;
|
||||
this.protectionFunctionForType = pProtectionFunctionForType;
|
||||
this.enchantmentValue = pEnchantmentValue;
|
||||
this.sound = pSound;
|
||||
this.toughness = pToughness;
|
||||
this.knockbackResistance = pKnockbackResistance;
|
||||
this.repairIngredient = new LazyLoadedValue<>(pRepairIngredient);
|
||||
}
|
||||
|
||||
public int getDurabilityForType(ArmorItem.Type pType) {
|
||||
return HEALTH_FUNCTION_FOR_TYPE.get(pType) * this.durabilityMultiplier;
|
||||
}
|
||||
|
||||
public int getDefenseForType(ArmorItem.Type pType) {
|
||||
return this.protectionFunctionForType.get(pType);
|
||||
}
|
||||
|
||||
public int getEnchantmentValue() {
|
||||
return this.enchantmentValue;
|
||||
}
|
||||
|
||||
public SoundEvent getEquipSound() {
|
||||
return this.sound;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
return this.repairIngredient.get();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public float getToughness() {
|
||||
return this.toughness;
|
||||
}
|
||||
|
||||
public float getKnockbackResistance() {
|
||||
return this.knockbackResistance;
|
||||
}
|
||||
|
||||
public String getSerializedName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
|
@ -204,7 +204,7 @@
|
|||
"item.superbwarfare.scheelite": "Raw Galena",
|
||||
"item.superbwarfare.raw_silver": "Raw Silver",
|
||||
|
||||
"item.superbwarfare.ru_6b47": "Russia 6b47 Helmet",
|
||||
"item.superbwarfare.ru_helmet_6b47": "Russia 6b47 Helmet",
|
||||
|
||||
"item.superbwarfare.ap_bullet": "Ap Bullet",
|
||||
"des.superbwarfare.ap_bullet": "Increased the armor-piercing ratio of bullets",
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
"item.superbwarfare.scheelite": "白钨矿",
|
||||
"item.superbwarfare.raw_silver": "粗银",
|
||||
|
||||
"item.superbwarfare.ru_6b47": "俄罗斯6B47头盔",
|
||||
"item.superbwarfare.ru_helmet_6b47": "俄罗斯6B47头盔",
|
||||
|
||||
"item.superbwarfare.ap_bullet": "穿甲弹",
|
||||
"des.superbwarfare.ap_bullet": "增加子弹的穿甲比例",
|
||||
|
|
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 478 B |
|
@ -14,7 +14,7 @@
|
|||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "superbwarfare:ru_6b47",
|
||||
"item": "superbwarfare:ru_helmet_6b47",
|
||||
"count": 1
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue