Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ItemRegister class:
- public static final RegistryObject<Item> ARMOR = ITEMS.register("armor", () -> new ArmorModel(ArmorMaterial.DIAMOND, EquipmentSlotType.HEAD, (new Item.Properties())));
- ArmorItem class:
- public class ArmorModel extends ArmorItem{
- public ArmorModel(IArmorMaterial p_i48534_1_, EquipmentSlotType p_i48534_2_, Properties p_i48534_3_) {
- super(p_i48534_1_, p_i48534_2_, p_i48534_3_);
- }
- public BipedModel getArmorModel(LivingEntity entity, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
- custom_model model = new custom_model(1.0F);
- return model;
- }
- public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
- return "mymod:textures/entity/magic_hat.png";
- }
- }
- custom_model class:
- public class custom_model extends BipedModel{
- private ModelRenderer bb_main;
- public custom_model(float size) {
- super(size, 0, 64, 64);
- texWidth = 64;
- texHeight = 64;
- bb_main = new ModelRenderer(this);
- bb_main.setPos(0.0F, 0.0F, 0.0F);
- bb_main.texOffs(0, 0).addBox(1F, 1.0F, 1.0F, 4.0F, 9.0F, 3.0F, 0.0F);
- this.head.addChild(bb_main);
- }
- public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
- //previously the render function, render code was moved to a method below
- }
- public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
- super.renderToBuffer(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
- }
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.xRot = x;
- modelRenderer.yRot = y;
- modelRenderer.zRot = z;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement