Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BluMasc

Members
  • Joined

  • Last visited

Everything posted by BluMasc

  1. Sorry, I didnt know a forum about forge/minecraft wasnt about coding a mod for forge/minecraft. Wont happen again. PS: Thats not the error. Particles do spwan, just not the right ones.
  2. I am trying to make mobs, that have a certain number of times they can do a task. I have completed the first one and it works fine, but the second one won't work. Here is the code in the first one: public void aiStep() { super.aiStep(); if (!this.level.isClientSide) { int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY()); int k = Mth.floor(this.getZ()); BlockPos blockpos = new BlockPos(i, j, k); if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) { return; } if(workTimes > 0) { BlockState blockstate = ModBlocks.SLIME_LAYER.get().defaultBlockState(); for (int l = 0; l < 4; ++l) { i = Mth.floor(this.getX() + (double) ((float) (l % 2 * 2 - 1) * 0.25F)); j = Mth.floor(this.getY()); k = Mth.floor(this.getZ() + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos1 = new BlockPos(i, j, k); if (this.level.isEmptyBlock(blockpos1) && blockstate.canSurvive(this.level, blockpos1)) { this.level.setBlockAndUpdate(blockpos1, blockstate); this.level.gameEvent(GameEvent.BLOCK_PLACE, blockpos1, GameEvent.Context.of(this, blockstate)); this.workTimes--; } else if (this.level.getBlockState(blockpos1).is(blockstate.getBlock())) { if (this.jumping) { int size = this.level.getBlockState(blockpos1).getValue(SlimeLayerBlock.LAYERS); int newsize = size + (Math.round(random.nextInt(0, 18) / (10 + size))); if (newsize>size) { BlockState higherslime = this.level.getBlockState(blockpos1).setValue(SlimeLayerBlock.LAYERS, Math.min(newsize, 8)); this.level.setBlockAndUpdate(blockpos1, higherslime); this.level.gameEvent(GameEvent.BLOCK_PLACE, blockpos1, GameEvent.Context.of(this, higherslime)); this.workTimes--; } } } } } } The variable is the "workTimes" one. In the second mob, this code seem to never go into the if block: protected ParticleOptions getParticleType() { if(workTimes > 0){return ParticleTypes.HEART;} return ParticleTypes.ITEM_SNOWBALL; } I don't know why it is working in one mob but not the other. Here is my full source code, if the code above isn't enough.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.