Skip to content

Commit

Permalink
Better config logic for enableBeekeeperVillagerProfession
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Mar 31, 2022
1 parent 1d602ee commit 1619313
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## mc1.18.2-1.3.1, Mar 31, 2022

- Fixed villagers disappearing due to disabled beekeeper villager profession

## mc1.18.2-1.3.0, Mar 29, 2022

- Mod is now using Architectury (Forge port)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.faboslav.friendsandfoes.init;

import com.faboslav.friendsandfoes.FriendsAndFoes;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -28,7 +29,10 @@ private static void expandBeehive() {
BEEHIVE_STATES.forEach((state) -> {
PointOfInterestType.BLOCK_STATE_TO_POINT_OF_INTEREST_TYPE.put(state, PointOfInterestType.BEEHIVE);
});
PointOfInterestType.BEEHIVE.ticketCount = 1;

if (FriendsAndFoes.getConfig().enableBeekeeperVillagerProfession) {
PointOfInterestType.BEEHIVE.ticketCount = 1;
}
}

private ModPointOfInterestTypes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class ModVillagerProfessions
public static final RegistrySupplier<VillagerProfession> BEEKEEPER;

static {
BEEKEEPER = FriendsAndFoes.getConfig().enableBeekeeperVillagerProfession ? VILLAGER_PROFESSIONS.register("beekeeper", () -> new VillagerProfession(FriendsAndFoes.makeStringID("beekeeper"), PointOfInterestType.BEEHIVE, ImmutableSet.of(Items.HONEYCOMB), ImmutableSet.of(), SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM)):null;
BEEKEEPER = VILLAGER_PROFESSIONS.register("beekeeper", () -> new VillagerProfession(FriendsAndFoes.makeStringID("beekeeper"), PointOfInterestType.BEEHIVE, ImmutableSet.of(Items.HONEYCOMB), ImmutableSet.of(), SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM));
}

public static void initRegister() {
Expand All @@ -37,36 +37,34 @@ public static void init() {
}

private static void initTradeOffers() {
if (FriendsAndFoes.getConfig().enableBeekeeperVillagerProfession) {
TradeOffers.PROFESSION_TO_LEVELED_TRADE.put(
BEEKEEPER.get(), new Int2ObjectOpenHashMap(ImmutableMap.of(
1,
new TradeOffers.Factory[]{
new TradeOffersUtil.BuyForOneEmeraldFactory(ModItems.BUTTERCUP.get(), 10, 16, 2),
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.DANDELION, 10, 16, 2),
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.SUNFLOWER, 10, 16, 2),
},
2,
new TradeOffers.Factory[]{
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.GLASS_BOTTLE, 9, 12, 10),
new TradeOffersUtil.SellItemFactory(Items.HONEY_BOTTLE, 3, 1, 12, 5),
},
3,
new TradeOffers.Factory[]{
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.SHEARS, 1, 12, 20),
new TradeOffersUtil.SellItemFactory(Items.HONEY_BLOCK, 10, 1, 12, 10),
},
4,
new TradeOffers.Factory[]{
new TradeOffersUtil.SellItemFactory(Items.HONEYCOMB, 4, 1, 12, 15),
},
5,
new TradeOffers.Factory[]{
new TradeOffersUtil.SellItemFactory(Items.HONEYCOMB_BLOCK, 12, 1, 12, 30),
}
))
);
}
TradeOffers.PROFESSION_TO_LEVELED_TRADE.put(
BEEKEEPER.get(), new Int2ObjectOpenHashMap(ImmutableMap.of(
1,
new TradeOffers.Factory[]{
new TradeOffersUtil.BuyForOneEmeraldFactory(ModItems.BUTTERCUP.get(), 10, 16, 2),
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.DANDELION, 10, 16, 2),
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.SUNFLOWER, 10, 16, 2),
},
2,
new TradeOffers.Factory[]{
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.GLASS_BOTTLE, 9, 12, 10),
new TradeOffersUtil.SellItemFactory(Items.HONEY_BOTTLE, 3, 1, 12, 5),
},
3,
new TradeOffers.Factory[]{
new TradeOffersUtil.BuyForOneEmeraldFactory(Items.SHEARS, 1, 12, 20),
new TradeOffersUtil.SellItemFactory(Items.HONEY_BLOCK, 10, 1, 12, 10),
},
4,
new TradeOffers.Factory[]{
new TradeOffersUtil.SellItemFactory(Items.HONEYCOMB, 4, 1, 12, 15),
},
5,
new TradeOffers.Factory[]{
new TradeOffersUtil.SellItemFactory(Items.HONEYCOMB_BLOCK, 12, 1, 12, 30),
}
))
);
}

private ModVillagerProfessions() {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ org.gradle.configureondemand=false
# Mod
mod_name=Friends&Foes
mod_id=friendsandfoes
mod_version=1.3.0
mod_version=1.3.1
mod_author=Faboslav
mod_description=Adds all eliminated mobs from the minecraft mob votes with rich lore.
maven_group=com.faboslav.friendsandfoes
Expand Down

0 comments on commit 1619313

Please sign in to comment.