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.

Featured Replies

Posted

I have created a new slime block and it extends the SlimeBlock class, so why doesn't it work with pistons like a normal slime block does? It doesn't pull blocks with it, or bounce the player when it hits them being pushed by the piston. The player bounces fine when landing on it, but that is it.

The Class:

package com.nulldev.modbase.blocks;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.SlimeBlock;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class PinkSlimeBlock extends SlimeBlock {

    public PinkSlimeBlock() {
        super(AbstractBlock.Properties.create(Material.SPONGE).hardnessAndResistance(0, 1));
    }

    @Override
    public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) {
        double x = entityIn.getMotion().getX();
        double y = entityIn.getMotion().getY() * 1.75;
        double z = entityIn.getMotion().getZ();


        entityIn.setMotion(x, y, z);
        super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
    }


}

 

Edit: I have also tried adding this:

@Override
public boolean isSlimeBlock(BlockState state) {
  return true;
}

It changed nothing

Edited by NullDev

Besides IForgeBlock.isSlimeBlock() there is also IForgeBlock.isStickyBlock() and IForgeBlock.canStickTo() that you might need to override.

  • Author
11 hours ago, vemerion said:

there is also IForgeBlock.isStickyBlock() and IForgeBlock.canStickTo() that you might need to override.

I have overriden both of them and nothing has changed. They both always return true.

@Override
public boolean isStickyBlock(BlockState state) {
	return true;
}

@Override
public boolean canStickTo(BlockState state, BlockState other) {
	return true;
}

 

  • Author

Turns out it was a problem with IntelliJ. Not sure what, but I restarted it and everything is working fine now.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.