Mouse's Wheel Action

Started by DutchAT on

Topic category: Help with MCreator software

Last seen on 18:46, 16. Oct 2021
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mouse's Wheel Action

You know that when you are in creative and you click the middle button of your mouse (the wheel) you get the block that you're aiming to.

But, for example, when yo do this in wheat crops, you get seeds, if you do this in potatoes or carrots crops, you'll get carrots or potatoes.

I want to do this last thing. I have a block with custom model and i want to, if you click the wheel while you're aiming this block, you get another block.

For example, if i aim this block, i just want to get Obsidian Block. How can i do this? Thanks everyone

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try:    @SideOnly(Side.CLIENT
Sun, 01/08/2017 - 18:54

Try:
    @SideOnly(Side.CLIENT)
    public Item getItem(World worldIn, BlockPos pos)
    {
        return Item.getItemFromBlock(Blocks.obsidian);
    }

Last seen on 18:46, 16. Oct 2021
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Try:    @SideOnly(Side.CLIENT
Mon, 01/09/2017 - 19:27

@#1 I got this:

   
:sourceMainJava
C:\Users\---\Desktop\MCreator 1.7.1 [1.10.2] Windows 64bit\forge\build\sources\main\java\mod\mcreator\mcreator_woodenCrate.java:166: error: cannot find symbol
               return Item.getItemFromBlock(Blocks.obsidian);
                                                  ^
  symbol:   variable obsidian
  location: class Blocks
1 error
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 28.101 secs
 

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You are using 1.10.x , right?
Mon, 01/09/2017 - 19:46

You are using 1.10.x , right? Then just make all letters in "obsidian" upper case.

Last seen on 18:46, 16. Oct 2021
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:Try:    @SideOnly(Side.CLIENT
Mon, 01/09/2017 - 19:48

@#1.1 Ok, it works. I looked the Forge's Farmland code and i copied it.

I think the problem was that i added another 

@SideOnly(Side.CLIENT).

 

The code now is this one:

@SideOnly(Side.CLIENT)
        @Override
        public BlockRenderLayer getBlockLayer() {
            return BlockRenderLayer.SOLID;
        }
          public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state){
               return new ItemStack(Blocks.DIRT);
          }

Last seen on 18:46, 16. Oct 2021
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:You are using 1.10.x , right?
Mon, 01/09/2017 - 22:22

@#2 And how can i change the Minecraft Vanilla Block for one of my mod? 

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it is always something like
Mon, 01/09/2017 - 22:51

it is always something like mcreator_nameOfYourElement.block

Last seen on 18:46, 16. Oct 2021
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:it is always something like
Mon, 01/09/2017 - 23:31

@#3 Okay, thanks you so much <3