Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved] Custom Slime Block not working with Pistons


Recommended Posts

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
Link to post
Share on other sites
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;
}

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.