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

How to make a Pushable hasTileEntity Block with Pistons?


Jade_Knightblazer
 Share

Recommended Posts

Looking for a way to allow pistons to move my block, with extends BlockContainer and has an TileEntity,

 

Do to BlockPistonBase's: return !par1World.blockHasTileEntity(par2, par3, par4); , my block well.... blocks pistons from extending.

 

private static boolean canPushBlock(int par0, World par1World, int par2, int par3, int par4, boolean par5)
    {
        if (par0 == Block.obsidian.blockID)
        {
            return false;
        }
        else
        {
            if (par0 != Block.pistonBase.blockID && par0 != Block.pistonStickyBase.blockID)
            {
                if (Block.blocksList[par0].getBlockHardness(par1World, par2, par3, par4) == -1.0F)
                {
                    return false;
                }

                if (Block.blocksList[par0].getMobilityFlag() == 2)
                {
                    return false;
                }

                if (Block.blocksList[par0].getMobilityFlag() == 1)
                {
                    if (!par5)
                    {
                        return false;
                    }

                    return true;
                }
            }
            else if (isExtended(par1World.getBlockMetadata(par2, par3, par4)))
            {
                return false;
            }

            ------------------------->   return !par1World.blockHasTileEntity(par2, par3, par4);     <--------------------------------
        }
    }

 

Is there a hook I can use to bypass the normal piston behavioral or another way to backdoor this problem?

 

-Thanks

 

 

Btw, I am using TileEntity to store the blocks "Durability", which when its durabiliy reaches 0, the block and tileentity are removed. via breakBlock();

 

I found TileEntitys are the only way to store NBT infomation for the block which they are located at =/, since the Block Meta is taken up by its placement direction (block is place able on walls).

Link to comment
Share on other sites

There is no way a piston can push a TE, since the piston mechanics can only store and "mimic" a block id and metadata while being pushed. You either need to write a coremod and modify that behavior or make a new type of piston.

Be warned though: mojang choose this behavior for a reason. Pushing TileEntities causes a lot of quirks.

Link to comment
Share on other sites

  • 5 years later...
5 minutes ago, GDavid said:

You can use multiple blocks as a workaround. Like one block for 20 hp, one for 19 and so on and all drop the same block, even with silk touch.

Please don't necropost. This is 5 years old.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

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