Jump to content

[SOLVED][1.18.2]Implementation of custom armor animations


ocome

Recommended Posts

I created the armor and implemented it this way, but the SetupAnim does not work.

I think the problem is that it is not being called, but where and how can I call it?

Is it correct to describe it in the execution of each tick?

 

Model

public class Test_ArmorModel<T extends LivingEntity> extends HumanoidModel<T> {
    public static  ModelLayerLocation LAYER_LOCATION_TOP = new ModelLayerLocation(new ResourceLocation(TestWorldMod.MOD_ID, "Test_armor_top"), "main");
   public static  ModelLayerLocation LAYER_LOCATION_BOTTOM = new ModelLayerLocation(new ResourceLocation(TestWorldMod.MOD_ID, "Test_armor_bottom"), "main");

    public Test_ArmorModel(ModelPart root) {
        super(root);
    }

    public static LayerDefinition createBodyLayer(CubeDeformation size) {
        MeshDefinition meshdefinition = HumanoidModel.createMesh(size,0.0F);
        PartDefinition partdefinition = meshdefinition.getRoot();

        PartDefinition Head = partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.0F))
                .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.5F)), PartPose.offset(0.0F, 0.0F, 0.0F));

        PartDefinition moon2 = Head.addOrReplaceChild("moon2", CubeListBuilder.create().texOffs(4, 18).addBox(5.0F, -24.0F, -6.7F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(4, 18).addBox(4.0F, -24.5F, -6.7F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(4, 18).addBox(6.0F, -24.5F, -6.7F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 18).addBox(5.5F, -23.0F, -7.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 18).addBox(4.5F, -23.5F, -7.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 18).addBox(4.5F, -24.5F, -7.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 18).addBox(5.5F, -25.0F, -7.0F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-3.0F, 17.0F, 2.0F));

        PartDefinition Body = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
                .texOffs(28, 28).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(0.0F, 0.0F, 0.0F));

        PartDefinition RightArm = partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(56, 0).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
                .texOffs(52, 44).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(-5.0F, 2.0F, 0.0F));

        PartDefinition LeftArm = partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(52, 28).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
                .texOffs(0, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(5.0F, 2.0F, 0.0F));

        PartDefinition RightLeg = partdefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(36, 44).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
                .texOffs(20, 44).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(-1.9F, 12.0F, 0.0F));

        PartDefinition LeftLeg = partdefinition.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(44, 12).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
                .texOffs(32, 0).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), PartPose.offset(1.9F, 12.0F, 0.0F));

        PartDefinition RightFeather2 =Body.addOrReplaceChild("LeftFeather", CubeListBuilder.create().texOffs(4, 2).mirror().addBox(-7.5665F, -16.7195F, 0.0796F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(4, 2).mirror().addBox(-8.5665F, -17.7195F, 0.0796F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 0).mirror().addBox(-11.5665F, -15.7195F, 0.0796F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(24, 0).mirror().addBox(-17.5665F, -18.7195F, 0.0796F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 16).mirror().addBox(-15.5665F, -19.7195F, 0.0796F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 16).mirror().addBox(-15.5665F, -17.7195F, 0.0796F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 20).mirror().addBox(-6.5665F, -19.7195F, 0.0796F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(24, 16).mirror().addBox(-14.5665F, -20.7195F, 0.0796F, 8.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(16, 60).mirror().addBox(-18.5665F, -21.7195F, 0.0796F, 11.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(24, 18).mirror().addBox(-16.5665F, -22.7195F, 0.0796F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(32, 20).mirror().addBox(-13.5665F, -19.7195F, 0.0796F, 5.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 2).addBox(-6.5665F, -15.7195F, 0.0796F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.0F, 23.0F, 0.0F, 0.0F, 0.2618F, 0.0873F));

        PartDefinition RightFeather = Body.addOrReplaceChild("RightFeather", CubeListBuilder.create().texOffs(4, 2).addBox(0.793F, -17.2424F, 1.6266F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(4, 2).addBox(1.793F, -18.2424F, 1.6266F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 0).addBox(2.793F, -16.2424F, 1.6266F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(24, 0).addBox(7.793F, -19.2424F, 1.6266F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 16).addBox(7.793F, -20.2424F, 1.6266F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 16).addBox(7.793F, -18.2424F, 1.6266F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 20).addBox(-0.207F, -20.2424F, 1.6266F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(24, 16).addBox(0.793F, -21.2424F, 1.6266F, 8.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(16, 60).addBox(1.793F, -22.2424F, 1.6266F, 11.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(24, 18).addBox(3.793F, -23.2424F, 1.6266F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(32, 20).addBox(2.793F, -20.2424F, 1.6266F, 5.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 2).addBox(-0.207F, -16.2424F, 1.6266F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.0F, 23.0F, 0.0F, 0.0F, -0.2618F, -0.0873F));

        return LayerDefinition.create(meshdefinition, 128, 128);

    }

    @Override
    public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
        head.render(poseStack, buffer, packedLight, packedOverlay);
        body.render(poseStack, buffer, packedLight, packedOverlay);
        rightArm.render(poseStack, buffer, packedLight, packedOverlay);
        leftArm.render(poseStack, buffer, packedLight, packedOverlay);
        rightLeg.render(poseStack, buffer, packedLight, packedOverlay);
        leftLeg.render(poseStack, buffer, packedLight, packedOverlay);
    }

    @Override
    public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
        if (entity instanceof ArmorStand) {
            super.setupAnim(entity, 0, 0, 0, 0, 0);
        } else {
            float ff = ageInTicks * (float)Math.PI * -0.1F;
            rightArm.copyFrom(super.rightArm);
            leftArm.copyFrom(super.leftArm);
            head.copyFrom(super.head);
            body.copyFrom(super.body);
            leftLeg.copyFrom(super.leftLeg);
            rightLeg.copyFrom(super.rightLeg);
            super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
        }
    }

}

Renderer

public class ModEntityRenderers extends EntityRenderers {   
	public static final Map<Item, HumanoidModel<LivingEntity>> armorModels = new HashMap<>();
    @SubscribeEvent
    public static void registerLayerDefinition(EntityRenderersEvent.RegisterLayerDefinitions event) {
        event.registerLayerDefinition(LAYER_LOCATION_TOP, () ->Test_ArmorModel.createBodyLayer(new CubeDeformation(0.5F)));
        event.registerLayerDefinition(LAYER_LOCATION_BOTTOM, ()-> Test_ArmorModel.createBodyLayer(new CubeDeformation(0.25F)));

    }

    @SubscribeEvent
    public static void registerLayers(EntityRenderersEvent.AddLayers event) {
        EntityRendererProvider.Context context = new EntityRendererProvider.Context(Minecraft.getInstance().getEntityRenderDispatcher(),Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font);
        Test_ArmorModel<LivingEntity> vTop = new Test_ArmorModel<>(context.bakeLayer(LAYER_LOCATION_TOP));
        Test_ArmorModel<LivingEntity> vBot = new Test_ArmorModel<>(context.bakeLayer(LAYER_LOCATION_BOTTOM));
        armorModels.put(ModItems.HELMET.get(), vTop);
        armorModels.put(ModItems.CHESTPLATE.get(), vTop);
        armorModels.put(ModItems.LEGGINGS.get(), vBot);
        armorModels.put(ModItems.BOOTS.get(), vTop);
   }
}

 

Edited by ocome
Link to comment
Share on other sites

Thank you for answering.

We were able to confirm the operation.
However, I felt that this method did not do what I expected it to do (armor model + animate with elytra).

To do this, would it be necessary to create a separate elytra render to display the entity when the armor is installed?

 

It would be nice if the animation could be performed only on the "RightFeather"...

 

Edited by ocome
Link to comment
Share on other sites

Sorry for my bad English.

We are currently creating the left and right wings and they are included in the "body"

On 4/13/2022 at 1:48 PM, ocome said:
        PartDefinition RightFeather2 =Body.addOrReplaceChild("LeftFeather", CubeListBuilder.create().texOffs(4, 2).mirror().addBox(-7.5665F, -16.7195F, 0.0796F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(4, 2).mirror().addBox(-8.5665F, -17.7195F, 0.0796F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 0).mirror().addBox(-11.5665F, -15.7195F, 0.0796F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(24, 0).mirror().addBox(-17.5665F, -18.7195F, 0.0796F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 16).mirror().addBox(-15.5665F, -19.7195F, 0.0796F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 16).mirror().addBox(-15.5665F, -17.7195F, 0.0796F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 20).mirror().addBox(-6.5665F, -19.7195F, 0.0796F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(24, 16).mirror().addBox(-14.5665F, -20.7195F, 0.0796F, 8.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(16, 60).mirror().addBox(-18.5665F, -21.7195F, 0.0796F, 11.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(24, 18).mirror().addBox(-16.5665F, -22.7195F, 0.0796F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(32, 20).mirror().addBox(-13.5665F, -19.7195F, 0.0796F, 5.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
                .texOffs(0, 2).addBox(-6.5665F, -15.7195F, 0.0796F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.0F, 23.0F, 0.0F, 0.0F, 0.2618F, 0.0873F));

        PartDefinition RightFeather = Body.addOrReplaceChild("RightFeather", CubeListBuilder.create().texOffs(4, 2).addBox(0.793F, -17.2424F, 1.6266F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(4, 2).addBox(1.793F, -18.2424F, 1.6266F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 0).addBox(2.793F, -16.2424F, 1.6266F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(24, 0).addBox(7.793F, -19.2424F, 1.6266F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 16).addBox(7.793F, -20.2424F, 1.6266F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 16).addBox(7.793F, -18.2424F, 1.6266F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 20).addBox(-0.207F, -20.2424F, 1.6266F, 1.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(24, 16).addBox(0.793F, -21.2424F, 1.6266F, 8.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(16, 60).addBox(1.793F, -22.2424F, 1.6266F, 11.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(24, 18).addBox(3.793F, -23.2424F, 1.6266F, 7.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(32, 20).addBox(2.793F, -20.2424F, 1.6266F, 5.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
                .texOffs(0, 2).addBox(-0.207F, -16.2424F, 1.6266F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.0F, 23.0F, 0.0F, 0.0F, -0.2618F, -0.0873F));

This causes the "rightfether","leftfether" move, but of course the body moves with it.

			public HumanoidModel<?> getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel<?> _default) {
				HumanoidModel armorModel = ModEntityRenderers.armorModels.get(itemStack.getItem());
				tick ++;
					float f = tick * (float)Math.PI * -0.1F;
					_default.body.getChild("body").yRot = tick * Mth.sin(f) * 5.0F;

            }

I want to animate leftfether,rightfether by itself

Link to comment
Share on other sites

Sorry, it was still in error.

					_default.body.yRot = tick * Mth.sin(f) * 5.0F; //working

					_default.body.getChild("body").yRot = tick * Mth.sin(f) * 5.0F; //not working
					_default.body.getChild("RightFeather").yRot = tick * Mth.sin(f) * 5.0F; //not working
					armorModel.body.getChild("body").yRot = tick * Mth.sin(f) * 5.0F; //not working
					armorModel.body.getChild("RightFeather").yRot = tick * Mth.sin(f) * 5.0F; //not working

It is impossible to get this way

Error

Caused by: java.util.NoSuchElementException: Can't find part body

 

 

--> Ah It may work.  just a minute

Edited by ocome
Link to comment
Share on other sites

  • ocome changed the title to [SOLVED][1.18.2]Implementation of custom armor animations

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I have done this now but have got the error:   'food(net.minecraft.world.food.FoodProperties)' in 'net.minecraft.world.item.Item.Properties' cannot be applied to                '(net.minecraftforge.registries.RegistryObject<net.minecraft.world.item.Item>)' public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register( "lemon_juice", () -> new Item( new HoneyBottleItem.Properties().stacksTo(1).food( (new FoodProperties.Builder()) .nutrition(3) .saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.01f ) .build() ) )); The code above is from the ModFoods class, the one below from the ModItems class. public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModFoods.LEMON_JUICE)));   I shall keep going between them to try and figure out the cause. I am sorry if this is too much for you to help with, though I thank you greatly for your patience and all the effort you have put in to help me.
    • I have been following these exact tutorials for quite a while, I must agree that they are amazing and easy to follow. I have registered the item in the ModFoods class, I tried to do it in ModItems (Where all the items should be registered) but got errors, I think I may need to revert this and figure it out from there. Once again, thank you for your help! 👍 Just looking back, I have noticed in your code you added ITEMS.register, which I am guessing means that they are being registered in ModFoods, I shall go through the process of trial and error to figure this out.
    • ♈+2349027025197ஜ Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join a brotherhood for protection and wealth here’s is your opportunity, but you should know there’s no ritual without repercussions but with the right guidance and support from this great temple your destiny is certain to be changed for the better and equally protected depending if you’re destined for greatness Call now for enquiry +2349027025197☎+2349027025197₩™ I want to join ILLUMINATI occult without human sacrificeGREATORLDRADO BROTHERHOOD OCCULT , Is The Club of the Riches and Famous; is the world oldest and largest fraternity made up of 3 Millions Members. We are one Family under one father who is the Supreme Being. In Greatorldrado BROTHERHOOD we believe that we were born in paradise and no member should struggle in this world. Hence all our new members are given Money Rewards once they join in order to upgrade their lifestyle.; interested viewers should contact us; on. +2349027025197 ۝ஐℰ+2349027025197 ₩Greatorldrado BROTHERHOOD OCCULT IS A SACRED FRATERNITY WITH A GRAND LODGE TEMPLE SITUATED IN G.R.A PHASE 1 PORT HARCOURT NIGERIA, OUR NUMBER ONE OBLIGATION IS TO MAKE EVERY INITIATE MEMBER HERE RICH AND FAMOUS IN OTHER RISE THE POWERS OF GUARDIANS OF AGE+. +2349027025197   SEARCHING ON HOW TO JOIN THE Greatorldrado BROTHERHOOD MONEY RITUAL OCCULT IS NOT THE PROBLEM BUT MAKE SURE YOU'VE THOUGHT ABOUT IT VERY WELL BEFORE REACHING US HERE BECAUSE NOT EVERYONE HAS THE HEART TO DO WHAT IT TAKES TO BECOME ONE OF US HERE, BUT IF YOU THINK YOU'RE SERIOUS MINDED AND READY TO RUN THE SPIRITUAL RACE OF LIFE IN OTHER TO ACQUIRE ALL YOU NEED HERE ON EARTH CONTACT SPIRITUAL GRANDMASTER NOW FOR INQUIRY +2349027025197   +2349027025197 Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join
    • Hi, I'm trying to use datagen to create json files in my own mod. This is my ModRecipeProvider class. public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder { public ModRecipeProvider(PackOutput pOutput) { super(pOutput); } @Override protected void buildRecipes(Consumer<FinishedRecipe> pWriter) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', ModItems.COMPRESSED_DIAMOND.get()) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get(),9) .requires(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .unlockedBy(getHasName(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()), has(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get())) .save(pWriter); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', Blocks.DIAMOND_BLOCK) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); } } When I try to run the runData client, it shows an error:  Caused by: java.lang.IllegalStateException: Duplicate recipe compressed:compressed_diamond I know that it's caused by the fact that there are two recipes for the ModItems.COMPRESSED_DIAMOND. But I need both of these recipes, because I need a way to craft ModItems.COMPRESSED_DIAMOND_BLOCK and restore 9 diamond blocks from ModItems.COMPRESSED_DIAMOND. Is there a way to solve this?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.