Mouse's Wheel Action

Started by DutchAT on Sun, 01/08/2017 - 17:38

Topic category: Help with MCreator's application

Last seen on 19:13, 5. Jul 2019
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Mouse's Wheel Action
Sun, 01/08/2017 - 17:38

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 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
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 19:13, 5. Jul 2019
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
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 19:13, 5. Jul 2019
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 19:13, 5. Jul 2019
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

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

it is always something like mcreator_nameOfYourElement.block

Last seen on 19:13, 5. Jul 2019
Joined Oct 2015
User points:

Statistics:

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

@#3 Okay, thanks you so much <3