Skip to content

Commit

Permalink
修正甘蔗模式和可可豆模式的方块识别问题
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Dec 14, 2023
1 parent ea9b185 commit b8e717b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void harvest(EntityMaid maid, BlockPos cropPos, BlockState cropState) {
public boolean canPlant(EntityMaid maid, BlockPos basePos, BlockState baseState, ItemStack seed) {
basePos = basePos.above();
baseState = maid.level.getBlockState(basePos);
if (baseState.is(Blocks.JUNGLE_LOG) && seed.getItem() == Items.COCOA_BEANS) {
if (baseState.is(BlockTags.JUNGLE_LOGS) && seed.getItem() == Items.COCOA_BEANS) {
for (Direction direction : Direction.Plane.HORIZONTAL) {
BlockState state = maid.level.getBlockState(basePos.relative(direction));
if (state.canBeReplaced()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
Expand Down Expand Up @@ -68,8 +69,7 @@ public double getCloseEnoughDist() {
}

private boolean canSustainSugarCane(BlockState state) {
return state.is(Blocks.GRASS_BLOCK) || state.is(Blocks.DIRT) || state.is(Blocks.COARSE_DIRT)
|| state.is(Blocks.PODZOL) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND);
return state.is(BlockTags.DIRT) || state.is(BlockTags.SAND);
}

private boolean hasWaterSourceBlock(Level world, BlockPos basePos) {
Expand Down

0 comments on commit b8e717b

Please sign in to comment.