Skip to content

Iron's Spells 'n Spellbooks incompatibility, shields have no collision #651

Open

Description

@carrotinsoup

Version Information

lithium-neoforge-0.15.0+mc1.21.1

Expected Behavior

Shields from shield spell have collisions and stop entities

Actual Behavior

Entities can pass through shields freely

Reproduction Steps

  1. Cast shield
  2. Lure mob through it
  3. It goes through it

Other Mods

  1. Iron's Spells 'n Spellbooks [1.21.1-3.12.0]
  2. Curios API [9.5.1+1.21.1]
  3. Geckolib [4.7.5.1]
  4. playerAnimator [2.0.1]

Activity

  1. added
    T-bug
    A-mods
    on May 14, 2025
  2. 2No2Name commented on May 14, 2025

    @2No2Name
    Member

    Seems like shields are multipart entities with possibly hard hitboxes, lithium might not expect that. If this is correct, this requires change in lithium

  3. added
    F-good-first-issue
    F-good-issue
    on May 14, 2025
  4. Mbrenneman0 commented on Jun 3, 2026

    @Mbrenneman0

    I would be interested in contributing to this as my first open source contribution.

    This would be a new check for hitboxes that are not part of existing entities?
    Would you be able to point me to the area of the code I should look at in Lithium?

    I would have to look at the code of Iron's Spells 'n Spellbooks for how hitboxes work in that mod.

    EDIT:
    I found some code in Iron's Spells 'n Spellbooks that may be relevant.
    The shield parts are registered as sub-entities.

    line 20:

    public class ShieldEntity extends AbstractShieldEntity {
        protected ShieldPart[] subEntities;
        protected final Vec3[] subPositions;
        protected final int LIFETIME;
        protected int width;
        protected int height;
        protected int age;
    
        public ShieldEntity(EntityType<?> pEntityType, Level pLevel) {
            super(pEntityType, pLevel);
            width = 5;
            height = 5;
            subEntities = new ShieldPart[width * height];
            subPositions = new Vec3[width * height];
            this.setHealth(10);
            //this.setXRot(45);
            //this.setYRot(45);
            LIFETIME = 20 * 20;
            createShield();
    
        }

    which has collision
    line 19:

       public ShieldPart(AbstractShieldEntity shieldEntity, String name, float scaleX, float scaleY, boolean hasCollision) {
            super(shieldEntity);
            this.size = EntityDimensions.scalable(scaleX, scaleY);
            this.refreshDimensions();
            this.parentEntity = shieldEntity;
            this.name = name;
            this.hasCollision = hasCollision;
        }

    A workaround has been mentioned here:
    #1101

    The workaround is to add to config file lithium.properties such a line:
    mixin.entity.collisions.intersection=false

  5. Mbrenneman0 commented on Jun 3, 2026

    @Mbrenneman0

    It seems like the issue is somewhere in the getOtherEntitiesForCollision path

    The shield parent entity has canBeCollidedWith = false, with the subEntities having canBeCollidedWith = true. It seems that subentities with collision are only returned if the parent entity also has collision.

  6. 2No2Name commented on Jun 3, 2026

    @2No2Name
    Member

    Maybe this is fixed by 6b41b4b but I think it didn't make it into the 1.21.1 release. You could check whether that code is in the 1.21.1 branch and backport it if needed

  7. 2No2Name commented on Jun 3, 2026

    @2No2Name
    Member

    Seems like the addEnderDragonParts method is also not called in the right place, only in the projectile optimization.

  8. Mbrenneman0 commented on Jun 4, 2026

    @Mbrenneman0

    It looks like the names like ...WithoutDragonPieces and ...PlusDragonPieces are misleading where it's actually intended to get entities with or without subentities/parts listed in general.

    Is getOtherEntitiesForCollision() meant to return getEntitiesOfEntityGroupPlusDragonPieces() instead of getEntitiesOfEntityGroupWithoutDragonPieces()?
    if that's the case, then it looks like the bug would still occur on the develop branch.

  9. 2No2Name commented on Jun 4, 2026

    @2No2Name
    Member

    Neoforge has the weird patch where they change dragon pieces to a general piece system, the names reflect the view from the fabric side, where this piece system does not exist. We can change it though if it is less confusing. I think it is best to return with the subentities exactly when the vanilla / fabric / neoforge method does

  10. Mbrenneman0 commented on Jun 4, 2026

    @Mbrenneman0

    Neoforge has the weird patch where they change dragon pieces to a general piece system, the names reflect the view from the fabric side, where this piece system does not exist. We can change it though if it is less confusing. I think it is best to return with the subentities exactly when the vanilla / fabric / neoforge method does

    Makes sense! It still seems like the issue could be the return on getOtherEntitiesForCollision. I'll test it out tonight

  11. added 2 commits that reference this issue on Jul 9, 2026
    25eef8a
    b33a4ab
  12. 2No2Name commented on Jul 16, 2026

    @2No2Name
    Member

    This might be fixed by 4280765 . Backporting to 1.21.1 is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-modsF-good-first-issueF-good-issueT-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions