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 was trying to make a super slime block that is more bouncy than the vanilla one.

When I place it adjacent to another block. The block side becomes invisible so that I can look through it.

Spoiler

2020-04-15_01_28_11.thumb.png.8daf42f1c327f93e4752e75b143068e2.png

This is my custom slime block. It still has the vanilla texture though.

Here is my super_slime_block.json models file:

Spoiler

{
  "parent": "block/block",
  "textures": {
    "particle": "learnforge:block/super_slime_block",
    "texture": "learnforge:block/super_slime_block"
  },
  "elements": [
    {   "from": [ 3, 3, 3 ],
      "to": [ 13, 13, 13 ],
      "faces": {
        "down":  { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
        "up":    { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
        "north": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
        "south": { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
        "west":  { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" },
        "east":  { "uv": [ 3, 3, 13, 13 ], "texture": "#texture" }
      }
    },
    {   "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
        "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "up" },
        "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "north" },
        "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "south" },
        "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "west" },
        "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "cullface": "east" }
      }
    }
  ]
}

 

I set the renderlingtype to translucent:

public LearnForge() {
        // Register the setup method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);

        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);
    }

    private void setup(final FMLCommonSetupEvent event) {
        // some preinit code

    }

    private void clientSetup(final FMLClientSetupEvent event) {
        RenderTypeLookup.setRenderLayer(ModBlocks.SUPER_SLIME_BLOCK, RenderType.getTranslucent());
        
    }
	@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
    public static class RegistryEvents {
        @SubscribeEvent
        public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) {
            event.getRegistry().register(new Block1());
            event.getRegistry().register(new SuperSlimeBlock());
        }

        @SubscribeEvent
        public static void onItemsRegistry(final RegistryEvent.Register<Item> event) {
            event.getRegistry().register(new BlockItem(ModBlocks.BLOCK_1, new Item.Properties()).setRegistryName("block1"));
            event.getRegistry().register(new BlockItem(ModBlocks.SUPER_SLIME_BLOCK, new Item.Properties()).setRegistryName("super_slime_block"));
        }
    }
}

You can ask for more details if you need them.

I am very new to modding so bear with me.

  • Author

My Block class now looks like this:

public class SuperSlimeBlock extends BreakableBlock {
    public SuperSlimeBlock() {
        super(Block.Properties.create(Material.CLAY, MaterialColor.GRASS).
                slipperiness(0.8F)
                .sound(SoundType.SLIME)
                .notSolid()
        );
        setRegistryName("super_slime_block");
    }

    @Override
    public boolean isSlimeBlock(BlockState state) {

        return true;
    }


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

    public void onFallenUpon(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
        if (p_180658_3_.isSuppressingBounce()) {
            super.onFallenUpon(p_180658_1_, p_180658_2_, p_180658_3_, p_180658_4_);
        } else {
            p_180658_3_.onLivingFall(p_180658_4_, 0.0F);
        }

    }

    public void onLanded(IBlockReader p_176216_1_, Entity p_176216_2_) {
        if (p_176216_2_.isSuppressingBounce()) {
            super.onLanded(p_176216_1_, p_176216_2_);
        } else {
            this.func_226946_a_(p_176216_2_);
        }

    }

    private void func_226946_a_(Entity entity) {
        Vec3d lvt_2_1_ = entity.getMotion();
        if (lvt_2_1_.y < 0.0D) {
            double lvt_3_1_ = entity instanceof LivingEntity ? 1D : 0.8D;
            entity.setMotion(lvt_2_1_.x, -lvt_2_1_.y * lvt_3_1_, lvt_2_1_.z);
        }

    }

    public void onEntityWalk(World p_176199_1_, BlockPos p_176199_2_, Entity p_176199_3_) {
        double lvt_4_1_ = Math.abs(p_176199_3_.getMotion().y);
        if (lvt_4_1_ < 0.1D && !p_176199_3_.isSteppingCarefully()) {
            double lvt_6_1_ = 0.4D + lvt_4_1_ * 0.2D;
            p_176199_3_.setMotion(p_176199_3_.getMotion().mul(lvt_6_1_, 1.0D, lvt_6_1_));
        }

        super.onEntityWalk(p_176199_1_, p_176199_2_, p_176199_3_);
    }
}

Now it works. But this confuses me because I copied the exact properties of the vanilla slime block into my block class and it didnt have the notSolid(). Why doesnt the vanilla block need the notSolid()?

 

Edit:

I still had old files from Forge 1.14. So I copied the properties there.

Apparently "notSolid" its something new that came with 1.15

Edited by earomc
question answered myself

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.