diff --git a/src/main/java/com/minecolonies/api/loot/ModLootConditions.java b/src/main/java/com/minecolonies/api/loot/ModLootConditions.java index a019dad11cd..99bdd7b196a 100644 --- a/src/main/java/com/minecolonies/api/loot/ModLootConditions.java +++ b/src/main/java/com/minecolonies/api/loot/ModLootConditions.java @@ -1,57 +1,61 @@ -package com.minecolonies.api.loot; - -import com.minecolonies.api.util.constant.Constants; -import net.minecraft.advancements.critereon.EnchantmentPredicate; -import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.advancements.critereon.MinMaxBounds; -import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.enchantment.Enchantments; -import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; -import net.minecraft.world.level.storage.loot.predicates.MatchTool; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.RegistryObject; - -import static com.minecolonies.api.util.constant.Constants.MOD_ID; - -/** Container class for registering custom loot conditions */ -public final class ModLootConditions -{ - public final static DeferredRegister DEFERRED_REGISTER = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Constants.MOD_ID); - - public static final ResourceLocation ENTITY_IN_BIOME_TAG_ID = new ResourceLocation(MOD_ID, "entity_in_biome_tag"); - public static final ResourceLocation RESEARCH_UNLOCKED_ID = new ResourceLocation(MOD_ID, "research_unlocked"); - - public static final RegistryObject entityInBiomeTag; - public static final RegistryObject researchUnlocked; - - // also some convenience definitions for existing conditions; some stolen from BlockLootSubProvider - public static final LootItemCondition.Builder HAS_SILK_TOUCH = MatchTool.toolMatches(ItemPredicate.Builder.item().hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1)))); - public static final LootItemCondition.Builder HAS_SHEARS = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)); - public static final LootItemCondition.Builder HAS_SHEARS_OR_SILK_TOUCH = HAS_SHEARS.or(HAS_SILK_TOUCH); - public static final LootItemCondition.Builder HAS_NO_SHEARS_OR_SILK_TOUCH = HAS_SHEARS_OR_SILK_TOUCH.invert(); - public static final LootItemCondition.Builder HAS_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.HOES)); - - public static void init() - { - // just for classloading - } - - static - { - entityInBiomeTag = DEFERRED_REGISTER.register(ModLootConditions.ENTITY_IN_BIOME_TAG_ID.getPath(), - () -> new LootItemConditionType(new EntityInBiomeTag.Serializer())); - - researchUnlocked = DEFERRED_REGISTER.register(ModLootConditions.RESEARCH_UNLOCKED_ID.getPath(), - () -> new LootItemConditionType(new ResearchUnlocked.Serializer())); - } - - - private ModLootConditions() - { - throw new IllegalStateException("Tried to initialize: ModLootConditions but this is a Utility class."); - } -} +package com.minecolonies.api.loot; + +import com.minecolonies.api.util.constant.Constants; +import net.minecraft.advancements.critereon.EnchantmentPredicate; +import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; +import net.minecraft.world.level.storage.loot.predicates.MatchTool; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.RegistryObject; + +import static com.minecolonies.api.util.constant.Constants.MOD_ID; + +/** Container class for registering custom loot conditions */ +public final class ModLootConditions +{ + public final static DeferredRegister DEFERRED_REGISTER = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Constants.MOD_ID); + + public static final ResourceLocation ENTITY_IN_BIOME_TAG_ID = new ResourceLocation(MOD_ID, "entity_in_biome_tag"); + public static final ResourceLocation RESEARCH_UNLOCKED_ID = new ResourceLocation(MOD_ID, "research_unlocked"); + + public static final RegistryObject entityInBiomeTag; + public static final RegistryObject researchUnlocked; + + // also some convenience definitions for existing conditions; some stolen from BlockLootSubProvider + public static final LootItemCondition.Builder HAS_SILK_TOUCH = MatchTool.toolMatches(ItemPredicate.Builder.item().hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1)))); + public static final LootItemCondition.Builder HAS_SHEARS = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)); + public static final LootItemCondition.Builder HAS_SHEARS_OR_SILK_TOUCH = HAS_SHEARS.or(HAS_SILK_TOUCH); + public static final LootItemCondition.Builder HAS_NO_SHEARS_OR_SILK_TOUCH = HAS_SHEARS_OR_SILK_TOUCH.invert(); + public static final LootItemCondition.Builder HAS_NETHERITE_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.NETHERITE_HOE)); + public static final LootItemCondition.Builder HAS_DIAMOND_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.DIAMOND_HOE)); + public static final LootItemCondition.Builder HAS_IRON_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.IRON_HOE)); + public static final LootItemCondition.Builder HAS_GOLDEN_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.GOLDEN_HOE)); + public static final LootItemCondition.Builder HAS_HOE = MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.HOES)); + + public static void init() + { + // just for classloading + } + + static + { + entityInBiomeTag = DEFERRED_REGISTER.register(ModLootConditions.ENTITY_IN_BIOME_TAG_ID.getPath(), + () -> new LootItemConditionType(new EntityInBiomeTag.Serializer())); + + researchUnlocked = DEFERRED_REGISTER.register(ModLootConditions.RESEARCH_UNLOCKED_ID.getPath(), + () -> new LootItemConditionType(new ResearchUnlocked.Serializer())); + } + + + private ModLootConditions() + { + throw new IllegalStateException("Tried to initialize: ModLootConditions but this is a Utility class."); + } +} diff --git a/src/main/java/com/minecolonies/api/util/constant/TranslationConstants.java b/src/main/java/com/minecolonies/api/util/constant/TranslationConstants.java index 5a3ddb95359..85dfebcccef 100755 --- a/src/main/java/com/minecolonies/api/util/constant/TranslationConstants.java +++ b/src/main/java/com/minecolonies/api/util/constant/TranslationConstants.java @@ -409,6 +409,8 @@ public final class TranslationConstants @NonNls public static final String CROP_TOOLTIP = "com.minecolonies.core.item.crop.tooltip"; @NonNls + public static final String CROP_TOOLTIP_HOE = "com.minecolonies.core.item.crop.tooltip.hoe"; + @NonNls public static final String TIER_TOOLTIP = "com.minecolonies.core.item.food.tooltip.tier."; @NonNls public static final String BIOME_TOOLTIP = "com.minecolonies.core.item.crop.tooltip.biome"; diff --git a/src/main/java/com/minecolonies/core/client/gui/modules/RestaurantMenuModuleWindow.java b/src/main/java/com/minecolonies/core/client/gui/modules/RestaurantMenuModuleWindow.java index f4264d11c0c..8b7ec370edb 100644 --- a/src/main/java/com/minecolonies/core/client/gui/modules/RestaurantMenuModuleWindow.java +++ b/src/main/java/com/minecolonies/core/client/gui/modules/RestaurantMenuModuleWindow.java @@ -277,7 +277,14 @@ protected void applySorting(final List displayedList) displayedList.sort((o1, o2) -> { int score = o1.getItem() instanceof IMinecoloniesFoodItem foodItem ? foodItem.getTier()* -100 : -o1.getItemStack().getFoodProperties(null).getNutrition(); int score2 = o2.getItem() instanceof IMinecoloniesFoodItem foodItem2 ? foodItem2.getTier()* -100 : -o2.getItemStack().getFoodProperties(null).getNutrition(); - return score - score2 + o1.getItemStack().getDisplayName().getString().toLowerCase(Locale.US).compareTo(o2.getItemStack().getDisplayName().getString().toLowerCase(Locale.US)); + + final int scoreComparison = Integer.compare(score, score2); + if (scoreComparison != 0) + { + return scoreComparison; + } + + return o1.getItemStack().getDisplayName().getString().toLowerCase(Locale.US).compareTo(o2.getItemStack().getDisplayName().getString().toLowerCase(Locale.US)); }); } diff --git a/src/main/java/com/minecolonies/core/event/EventHandler.java b/src/main/java/com/minecolonies/core/event/EventHandler.java index bf0407d2477..d1d26111538 100755 --- a/src/main/java/com/minecolonies/core/event/EventHandler.java +++ b/src/main/java/com/minecolonies/core/event/EventHandler.java @@ -182,9 +182,7 @@ public static void onLootTableLoad(@NotNull final LootTableLoadEvent event) if (crops != null) { // grass blocks have a lot of crops (both MineColonies and vanilla) so the base drop chance is reduced - final float baseChance = event.getName().equals(Blocks.GRASS.getLootTable()) ? 0.001f : 0.01f; - // hoes have a boosted chance - final float hoeChance = 0.1f; + final float chance = event.getName().equals(Blocks.GRASS.getLootTable()) ? 0.001f : 0.01f; for (final MinecoloniesCropBlock crop : crops) { @@ -197,10 +195,27 @@ public static void onLootTableLoad(@NotNull final LootTableLoadEvent event) pool.add(AlternativesEntry.alternatives() .otherwise(LootItem.lootTableItem(crop) - .when(ModLootConditions.HAS_HOE) - .when(LootItemRandomChanceCondition.randomChance(hoeChance))) + .when(ModLootConditions.HAS_NETHERITE_HOE) + .when(LootItemRandomChanceCondition.randomChance(chance * 4f))) .otherwise(LootItem.lootTableItem(crop) - .when(LootItemRandomChanceCondition.randomChance(baseChance)))); + .when(ModLootConditions.HAS_DIAMOND_HOE) + .when(LootItemRandomChanceCondition.randomChance(chance * 3.5f))) + .otherwise(LootItem.lootTableItem(crop) + .when(ModLootConditions.HAS_IRON_HOE) + .when(LootItemRandomChanceCondition.randomChance(chance * 3f))) + .otherwise(LootItem.lootTableItem(crop) + .when(ModLootConditions.HAS_GOLDEN_HOE) + .when(LootItemRandomChanceCondition.randomChance(chance * 2.5f))) + .otherwise(LootItem.lootTableItem(crop) + .when(ModLootConditions.HAS_HOE + .and(ModLootConditions.HAS_NETHERITE_HOE.invert()) + .and(ModLootConditions.HAS_DIAMOND_HOE.invert()) + .and(ModLootConditions.HAS_IRON_HOE.invert()) + .and(ModLootConditions.HAS_GOLDEN_HOE.invert())) + .when(LootItemRandomChanceCondition.randomChance(chance * 2f))) + .otherwise(LootItem.lootTableItem(crop) + .when(ModLootConditions.HAS_HOE.invert()) + .when(LootItemRandomChanceCondition.randomChance(chance)))); event.getTable().addPool(pool.build()); } diff --git a/src/main/java/com/minecolonies/core/items/ItemCrop.java b/src/main/java/com/minecolonies/core/items/ItemCrop.java index 9d5924ee1ac..788e4a007a9 100644 --- a/src/main/java/com/minecolonies/core/items/ItemCrop.java +++ b/src/main/java/com/minecolonies/core/items/ItemCrop.java @@ -4,6 +4,7 @@ import com.minecolonies.api.util.MessageUtils; import com.minecolonies.api.util.constant.TranslationConstants; import com.minecolonies.core.blocks.MinecoloniesCropBlock; +import net.minecraft.ChatFormatting; import net.minecraft.core.Holder; import net.minecraft.network.chat.Component; import net.minecraft.tags.TagKey; @@ -64,11 +65,12 @@ protected boolean canPlace(BlockPlaceContext ctx, @NotNull BlockState state) @Override public void appendHoverText(@NotNull final ItemStack stack, @Nullable final Level worldIn, @NotNull final List tooltip, @NotNull final TooltipFlag flagIn) { - tooltip.add(Component.translatable(TranslationConstants.CROP_TOOLTIP)); + tooltip.add(Component.translatable(TranslationConstants.CROP_TOOLTIP).withStyle(ChatFormatting.GRAY)); if (preferredBiome != null) { tooltip.add(Component.translatable(TranslationConstants.BIOME_TOOLTIP + "." + preferredBiome.location().getPath())); } + tooltip.add(Component.translatable(TranslationConstants.CROP_TOOLTIP_HOE).withStyle(ChatFormatting.DARK_AQUA).withStyle(ChatFormatting.ITALIC)); } /** diff --git a/src/main/resources/assets/minecolonies/lang/manual_en_us.json b/src/main/resources/assets/minecolonies/lang/manual_en_us.json index 6c7f88df3be..23673bffffc 100644 --- a/src/main/resources/assets/minecolonies/lang/manual_en_us.json +++ b/src/main/resources/assets/minecolonies/lang/manual_en_us.json @@ -2644,8 +2644,9 @@ "entity.minecolonies.drownedchiefpirate": "Drowned Pirate Chief", "death.attack.entity.minecolonies.drownedchiefpirate": "%s was put to a watery grave by a drowned Pirate Chief", "com.minecolonies.core.exit_interactions": "Exit Interactions", - "com.minecolonies.core.crop.cantplant": "You do not possess the necessary knowledge to plant this crop. You should ask a Farmer to plant this for you!", + "com.minecolonies.core.crop.cantplant": "You do not possess the necessary knowledge to plant this crop. You should ask a Colony's Farmer to plant this for you!", "com.minecolonies.core.item.crop.tooltip": "Ask a Farmer to plant this for you", + "com.minecolonies.core.item.crop.tooltip.hoe": "Easier to find with a quality hoe", "com.minecolonies.core.item.crop.tooltip.biome.coldbiomes": "Only suitable for Cold Biomes", "com.minecolonies.core.item.crop.tooltip.biome.temperatebiomes": "Only suitable for Temperate Biomes", "com.minecolonies.core.item.crop.tooltip.biome.humidbiomes": "Only suitable for Hot and Humid Biomes", diff --git a/src/main/resources/data/minecolonies/worldgen/structure/amazon_camp.json b/src/main/resources/data/minecolonies/worldgen/structure/amazon_camp.json index ef33a6a27b5..4f8c89b2588 100644 --- a/src/main/resources/data/minecolonies/worldgen/structure/amazon_camp.json +++ b/src/main/resources/data/minecolonies/worldgen/structure/amazon_camp.json @@ -1,7 +1,8 @@ { "type": "minecraft:jigsaw", "biomes": "#minecolonies:has_structure/amazon_camp", - "adapt_noise": false, + "adapt_noise": true, + "terrain_adaptation": "beard_box", "start_pool": "minecolonies:amazon_camp", "spawn_overrides": {}, "size": 7, diff --git a/src/main/resources/data/minecolonies/worldgen/structure/barbarian_camp.json b/src/main/resources/data/minecolonies/worldgen/structure/barbarian_camp.json index b2c0d87bbe3..d292d00e2dd 100644 --- a/src/main/resources/data/minecolonies/worldgen/structure/barbarian_camp.json +++ b/src/main/resources/data/minecolonies/worldgen/structure/barbarian_camp.json @@ -1,12 +1,12 @@ { "type": "minecraft:jigsaw", "biomes": "#minecolonies:has_structure/barbarian_camp", - "adapt_noise": false, + "adapt_noise": true, + "terrain_adaptation": "beard_box", "start_pool": "minecolonies:barbarian_camp", "spawn_overrides": {}, "size": 1, "step": "surface_structures", - "start_height": { "absolute": 0 }, diff --git a/src/main/resources/data/minecolonies/worldgen/structure/desert_camp.json b/src/main/resources/data/minecolonies/worldgen/structure/desert_camp.json index 0e5911c8583..8db3e295d1b 100644 --- a/src/main/resources/data/minecolonies/worldgen/structure/desert_camp.json +++ b/src/main/resources/data/minecolonies/worldgen/structure/desert_camp.json @@ -1,7 +1,8 @@ { "type": "minecraft:jigsaw", "biomes": "#minecolonies:has_structure/desert_camp", - "adapt_noise": false, + "adapt_noise": true, + "terrain_adaptation": "beard_box", "start_pool": "minecolonies:desert_camp", "spawn_overrides": {}, "size": 1, @@ -10,7 +11,6 @@ "start_height": { "absolute": 0 }, - "terrain_adaptation": "beard_box", "project_start_to_heightmap": "WORLD_SURFACE_WG", "max_distance_from_center": 16, "use_expansion_hack": false diff --git a/src/main/resources/data/minecolonies/worldgen/structure_set/empty_colony.json b/src/main/resources/data/minecolonies/worldgen/structure_set/empty_colony.json index fee69aacf5b..56708cee8de 100644 --- a/src/main/resources/data/minecolonies/worldgen/structure_set/empty_colony.json +++ b/src/main/resources/data/minecolonies/worldgen/structure_set/empty_colony.json @@ -51,8 +51,8 @@ ], "placement": { "salt": 1225566777, - "spacing": 55, - "separation": 25, + "spacing": 95, + "separation": 45, "type": "minecraft:random_spread" } } \ No newline at end of file