Skip to content

Commit

Permalink
Fix required biome check for crops
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeBr0 committed Dec 29, 2024
1 parent 11b6e1f commit 8bfb4b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -152,8 +151,7 @@ private boolean canGrow(Level level, BlockPos pos) {

if (!biomes.isEmpty()) {
var biome = level.getBiome(pos);
var biomeId = ForgeRegistries.BIOMES.getKey(biome.value());
return biomes.contains(biomeId);
return biomes.stream().anyMatch(biome::is);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.ForgeRegistries;
import snownee.jade.api.BlockAccessor;
import snownee.jade.api.IBlockComponentProvider;
import snownee.jade.api.ITooltip;
Expand Down Expand Up @@ -62,8 +61,7 @@ public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfi
var biomes = crop.getRequiredBiomes();
if (!biomes.isEmpty()) {
var biome = level.getBiome(pos);
var id = ForgeRegistries.BIOMES.getKey(biome.value());
if (!biomes.contains(id)) {
if (biomes.stream().noneMatch(biome::is)) {
tooltip.add(ModTooltips.INVALID_BIOME.color(ChatFormatting.RED).build());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.function.Function;

Expand Down Expand Up @@ -65,9 +64,7 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo info, Player player, Level l
var biomes = crop.getRequiredBiomes();
if (!biomes.isEmpty()) {
var biome = level.getBiome(pos);
var id = ForgeRegistries.BIOMES.getKey(biome.value());

if (!biomes.contains(id)) {
if (biomes.stream().noneMatch(biome::is)) {
info.text(ModTooltips.INVALID_BIOME.color(ChatFormatting.RED).build());
}
}
Expand Down

0 comments on commit 8bfb4b1

Please sign in to comment.