From 98a5f38d3ee218f165855b00481f4d4ec2222bf5 Mon Sep 17 00:00:00 2001 From: Thom van den Akker Date: Sun, 18 Aug 2024 13:19:50 +0200 Subject: [PATCH] Several fixes for bottles and mod compilationn errors --- gradle.properties | 1 + .../minecolonies/core/items/ItemLargeBottle.java | 14 +++++++------- src/main/resources/META-INF/mods.toml | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 80cdf66683e..ca776820c81 100755 --- a/gradle.properties +++ b/gradle.properties @@ -76,6 +76,7 @@ isFMLLibrary=false extendDefaultSourceSetConfiguration=true mainExcludedResources=assets/minecolonies/lang/manual_en_us.json;assets/minecolonies/lang/default.json;assets/minecolonies/lang/quests.json +usesResourceDataExpansionFromProjectKeys=true usesMergableTranslations=true translationMergeSources[0]=src/main/resources/assets/minecolonies/lang/manual_en_us.json diff --git a/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java b/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java index a001fab3ccb..7cc142097bd 100644 --- a/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java +++ b/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java @@ -12,7 +12,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Cow; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.*; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; @@ -39,11 +40,11 @@ public ItemLargeBottle(@NotNull final Properties builder) @Override public InteractionResult interactLivingEntity(@NotNull final ItemStack stack, @NotNull final Player player, @NotNull final LivingEntity entity, @NotNull final InteractionHand hand) { - if (entity instanceof Cow && !entity.isBaby()) { + if (stack.is(ModItems.large_empty_bottle) && entity instanceof Cow && !entity.isBaby()) + { player.playSound(SoundEvents.COW_MILK, 1.0F, 1.0F); + InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_milk_bottle.getDefaultInstance()); stack.shrink(1); - final ItemStack newStack = ModItems.large_milk_bottle.getDefaultInstance(); - InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), newStack); return InteractionResult.SUCCESS; } return super.interactLivingEntity(stack, player, entity, hand); @@ -65,12 +66,11 @@ public InteractionResultHolder use(@NotNull final Level level, final return InteractionResultHolder.pass(itemstack); } - if (level.getFluidState(blockpos).is(FluidTags.WATER)) + if (itemstack.is(ModItems.large_empty_bottle) && level.getFluidState(blockpos).is(FluidTags.WATER)) { level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); + InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_water_bottle.getDefaultInstance()); itemstack.shrink(1); - final ItemStack newStack = ModItems.large_water_bottle.getDefaultInstance(); - InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), newStack); return InteractionResultHolder.success(itemstack); } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 1a1fc9bd31e..bd955470361 100755 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -80,12 +80,12 @@ MineColonies is a colony simulator within Minecraft! There are numerous types of [[dependencies.minecolonies]] modId="journeymap" mandatory=false - versionRange="[${project.jmapVersion},)" + versionRange="[${jmapVersion},)" ordering="NONE" side="BOTH" [[dependencies.minecolonies]] modId="dynamictrees" mandatory=false - versionRange="[${project.dynamicTreesVersion},)" + versionRange="[${dynamicTreesVersion},)" ordering="NONE" side="BOTH"