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));

    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:

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.

public boolean isStickyBlock(BlockState state) {
	return true;

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.

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.

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • trying to override onItemRightClick so i look in the list of overridable functions in Item class and it doesnt exist?
    • hm... when I had a similar issue the discord pointed me towards using baked models. but multiparts does seem way simpler, and with datagen I could even do it proceduraly
    • You don't need a custom baked model for this. Look at the composter model for an example.
    • whenever you find a solution by yourself, you can leave the original question, but add a comment mentioning that you fixed it, and how. so that if anyone comes accross the same problem, they can find your solution and try it without needing to make a new topic. also, I don't see how intellij syncing with github has anything to do with forge
    • you need to create a new class which implements IBakedModel, overwrite getQuads (the one which takes an IModelData) an make it return the quads for your model, the IModelData shouls contain the info on the list and you set the info on the IModelData by overwriting getModelData in your tile entity. you need to sync the data from, the Server tile entity, to the client, which you can do by overwriting getUpdatePacket (Server sends updated data to the client), and onDataPacket  (Client handles an update packet received). then, whenever that data changes you can call World#notifyUpdate, and whenever the client receives an update (so in the end of onDataPacket) you call requestModelUpdate().   for the BakedModel, what I do is: I pass in an existing IBakedModel (that works as a base that I can add quads to) to the constructor, and store it in a field. then I can call IBakedModel#getQuads on the base model, which gives a list of BakedQuads, and add any new quads to it. and you can create your quads by using FaceBakey#bakeQuad, it takes the start and end positions of the quad (in block space, so 0 -> 16), an instance of a BlockPartFace, the sprite you want to use, which you can get from an AtlasTexture, the Direction of that quad, a transform (I just use SimpleModelTransform.IDENTITY), a rotation, which you can just pass null, a boolean that tells wether that face should be shaded or not, and then a throwaway ResourceLocation. and you can decide on all those properties, and on what faces to add, given the IModelData   EDIT: oh, and to register it you can do so through the modelRegistry in the ModelBakeEvent (this event is client-side only (I think)) if you need some examples, I used this repo to learn how to use BakedModels: https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe04_block_dynamic_block_models
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

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