Skip to content

Commit

Permalink
fixed #722
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke100000 committed Sep 10, 2023
1 parent 99b60c0 commit 402a07b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions common/src/main/java/net/mca/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public static Config getInstance() {

//villager behavior
public float twinBabyChance = 0.02f;
public float marriageHeartsRequirement = 100;
public float engagementHeartsRequirement = 50;
public float bouquetHeartsRequirement = 10;
public int marriageHeartsRequirement = 100;
public int engagementHeartsRequirement = 50;
public int bouquetHeartsRequirement = 10;
public int babyItemGrowUpTime = 24000;
public int villagerMaxAgeTime = 384000;
public int villagerMaxHealth = 20;
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/mca/entity/VillagerEntityMCA.java
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ public static DefaultAttributeContainer.Builder createVillagerAttributes() {

private void tickDespawnDelay() {
if (this.despawnDelay > 0 && !this.hasCustomer() && --this.despawnDelay == 0) {
if (getVillagerBrain().getMemories().values().stream().anyMatch(m -> random.nextInt(100) < m.getHearts())) {
if (getRelationships().getPartner().isPresent() || getVillagerBrain().getMemories().values().stream().anyMatch(m -> random.nextInt(Config.getInstance().marriageHeartsRequirement) < m.getHearts())) {
setProfession(VillagerProfession.NONE);
setDespawnDelay(0);
} else {
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/mca/item/BouquetItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public BouquetItem(Item.Settings properties) {
}

@Override
protected float getHeartsRequired() {
protected int getHeartsRequired() {
return Config.getInstance().bouquetHeartsRequirement;
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/mca/item/EngagementRingItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public EngagementRingItem(Settings properties) {
}

@Override
protected float getHeartsRequired() {
protected int getHeartsRequired() {
return Config.getInstance().engagementHeartsRequirement;
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/mca/item/RelationshipItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public RelationshipItem(Settings properties) {
super(properties);
}

abstract float getHeartsRequired();
abstract int getHeartsRequired();

@Override
public boolean handle(ServerPlayerEntity player, VillagerEntityMCA villager) {
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/mca/item/WeddingRingItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public WeddingRingItem(Item.Settings properties) {
}

@Override
protected float getHeartsRequired() {
protected int getHeartsRequired() {
return Config.getInstance().marriageHeartsRequirement;
}

Expand Down

0 comments on commit 402a07b

Please sign in to comment.