Jump to content

Recommended Posts

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.

Posted (edited)

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...

×   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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.