Basically, my attributes for my TankEntity are not going through. I'm DIRECTLY porting from 1.17, and it worked fine on 1.17 and 16, so I'm pretty confused here. The Entity extends Pig and within it, this is for creating the attributes.
public static AttributeSupplier.Builder createAttributes() {
return Pig.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 90.0D)
.add(Attributes.MOVEMENT_SPEED, 0.14f)
.add(Attributes.KNOCKBACK_RESISTANCE, 10.0D)
.add(Attributes.FOLLOW_RANGE, 0.0D);
}
Then, in my EntityTypes Registry, I add the attributes.
@Mod.EventBusSubscriber(modid = TankMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class TankModEntityTypes {
.....
@SubscribeEvent
public static void entityAttributesInit(EntityAttributeCreationEvent event) {
event.put(TANK_ENTITY_TYPE.get(), TankEntity.createAttributes().build());
}
I just don't understand why its not working. This worked fine , before. The Entity spawns, but it weirdly just floats in the air, and when hit it goes red and doesn't stop being red. When the player rides it, its health also doesn't go down. Really strange stuff. I looked at some other mods which have entity attributes, and it works fine in them. If there's anything else I need to show let me know.