My mob won't collect and build

Started by gamerat on

Topic category: Help with modding (Java Edition)

Last seen on 00:17, 31. Dec 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My mob won't collect and build

I want to have my mob collect wood and build a campfire. I put "Break block of type [all wood] speed [0.5] max detection height [64] conditions [infinite]" so it will collect wood. I also said that it has 9 inventory slots and 64 max items per slot. I didn't bind it to a GUI. Then, I put this script in a separate procedure and set it to work on entity tick update:

if (((entity instanceof PlayerEntity) ? ((PlayerEntity) entity).inventory.hasItemStack(new ItemStack(Blocks.OAK_LOG, (int) (1))) : false)) {
            world.setBlockState(new BlockPos((int) (entity.getPosX()), (int) (entity.getPosY()), (int) (entity.getPosZ())),
                    Blocks.CAMPFIRE.getDefaultState(), 3);

BuildCampfire

Why isn't it working?

Last seen on 00:17, 31. Dec 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The code above the image is…
Tue, 04/20/2021 - 14:34

The code above the image is what the image showed