Smoke Machine Problems

Started by joshuawl on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Smoke Machine Problems

I decided to make a smoke machine in my mod that turns on when given a redstone signal. I made it turn on properly and it does work, except for the fact that every smoke machine in the world turns on when I power only one. I used the particle spawing condition that allows paricles to spawn when a variable is true, but using this makes all of them in the world turn on at the same time. I also tried using the spawn particles event, but that wouldn't even spawn any particles at all. Anyone know of a different way I could make this work?

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make 2 blocks :one that
Wed, 10/11/2017 - 09:15

Make 2 blocks :one that spawns particles, one that doesn't. The first one drops the second. It has got a redstone off events taht adds the second block. The second has got a redstone on events that adds the first. Go to the code of the second. Remove the world else where there is else if

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok you can do this:Go create
Wed, 10/11/2017 - 16:00

Ok you can do this:
Go create 2 blocks in mcreator who both will have the smoke Machine texture.
Name the first SmokeMachine or whatever and the other SmokeMachineActive to be able to separate them from eachother.
Now on the "active" block you add your smoke.
And on the "not active" block you add no smoke

Then you add any event for "Redstone On" onthe "not active" block.
(add just any event, this event will be overwritten later)
Then you add any event for "Redstone Off" on the "active" block.
(This event will be overwritten aswell)

For the "active" block you enter code view so you can edit source code and you scroll down till you find:
"public void neighborChanged(IBlockState state, ..."

Then you overwrite that whole function with this code:

 public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos fromPos){
               super.neighborChanged(state,world,pos,neighborBlock,fromPos);
               int i = pos.getX();
               int j = pos.getY();
               int k = pos.getZ();
               if (world.isBlockIndirectlyGettingPowered(new BlockPos(i, j, k))<=0){

                    if(true){
                         world.setBlockState(new BlockPos(i, j, k), mcreator_smokeMachine.block.getDefaultState(), 3);
                    }

               }
          }

You see the last line of code in this function is:
mcreator_smokeMachine.block.getDefaultState(), 3);
If you named your smoke machine something else than "smokeMachine" you replace "mcreator_smokeMachine" with "mcreator_yourMachineName"
 

Now, for the "not active" block you enter code view once again and find:
"public void neighborChanged(IBlockState state, ..."

then you overwrite that fuction with this code:
 

 public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos fromPos){
               super.neighborChanged(state,world,pos,neighborBlock,fromPos);
               int i = pos.getX();
               int j = pos.getY();
               int k = pos.getZ();
               if (world.isBlockIndirectlyGettingPowered(new BlockPos(i, j, k))>0){

                    if(true){
                         world.setBlockState(new BlockPos(i, j, k), mcreator_smokeMachineActive.block.getDefaultState(), 3);
                    }

               }
          }

And oce again, If you named your smoke machine something else than "smokeMachine" you replace "mcreator_smokeMachineActive" with "mcreator_yourMachineNameActive"

If this didn't work, you can download my workspace and compare to see if you missed something.
Download My Workspace

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Ok you can do this:Go create
Wed, 10/11/2017 - 22:17

@#2 Thanks! This should work out great, but do you know if it is possible to make it where the active one doesn't appear in the creative inventory? If not it should be fine, it would only annoy me for a little while. :)

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:Ok you can do this:Go create
Wed, 10/11/2017 - 22:33

@#2.1 I don't know anything about that one, but I could mess around with the code and see if something works

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:Ok you can do this:Go create
Wed, 10/11/2017 - 22:37

@#2.1.1 OK, thanks. :)

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:Ok you can do this:Go create
Wed, 10/11/2017 - 22:37

@#2.1 Ahaha! The first thing I tried worked! xD

You just find this line:

block = (BlockSmokeMachineActive) (new BlockSmokeMachineActive().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F) .setUnlocalizedName("SmokeMachineActive").setLightOpacity(0).setCreativeTab(CreativeTabs.BUILDING_BLOCKS));   And remove the ".setCreativeTab(CreativeTabs.BUILDING_BLOCKS)" so it looks like this:   block = (BlockSmokeMachineActive) (new BlockSmokeMachineActive().setHardness(2.0F).setResistance(10.0F).setLightLevel(0.0F) .setUnlocalizedName("SmokeMachineActive").setLightOpacity(0));
Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:Ok you can do this:Go create
Wed, 10/11/2017 - 23:39

@#2.1.2 Thanks, now my creative inventory looks how it should.

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:I noticed some of the text
Thu, 10/12/2017 - 00:32

@#3 Uh... For some reason when I put an event for the SmokeMachineActive in the redstone off i get an error, but if I also put something in redstone on it works.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:I noticed some of the text
Thu, 10/12/2017 - 00:35

@#3.1 just make sure mcreator doesn't overwrite the previous code you've written

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
upload your mod when it's
Thu, 10/12/2017 - 00:36

upload your mod when it's done, I wanna see it :D

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:upload your mod when it's
Thu, 10/12/2017 - 00:40

@#4 I plan on doing that, I just need to fix a few things before I do. But mostly everything is done, at least for version 1.0.