Jump to content

earomc

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by earomc

  1. 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
  2. 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. This is my custom slime block. It still has the vanilla texture though. Here is my super_slime_block.json models file: 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.
×
×
  • Create New...

Important Information

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