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

How would i make a falling block out of this block class? I have tried extending FallingBlock instead of BlockBase, but then the

super(name, material)

gets messed up.

Here is my block class:

Spoiler

package com.artemaniac.islands.blocks;

import net.minecraft.block.BlockFalling;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;

public class BeachSand extends BlockBase
{
	public BeachSand(String name, Material material)
	{
		super(name, material);
		
		setSoundType(SoundType.SAND);
		setHardness(0.5F);
		setResistance(2.5F);
		setHarvestLevel("spade", 0);
	}
}

ย 

Thanks in advance!

Edited by cherrylime

9 minutes ago, cherrylime said:

BlockBase๏ปฟ๏ปฟ, ๏ปฟbut then the


super(name, ๏ปฟmaterial๏ปฟ)

gets messed up.

Learn Java. Constructors and supers are basics of polymorphism.

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.

  • Author
26 minutes ago, Animefan8888 said:

Learn Java. Constructors and supers are basics of polymorphism.

I just don't know what class I should extend or what I should do. This is not a problem with not knowing java, it's just not knowing forge, which is what this forum is about.

Edited by cherrylime

17 minutes ago, cherrylime said:

I just don't know what class I should extend or what I should do. This is not a problem with not knowing java, it's just not knowing forge, which is what this forum is about.

Well if you want the functionality of BlockFalling you have to have the code in it apply to your block. Which normally means to extend it, but you also want the functionality of your BlockBase class. So here your solution would be recreating the constructor to simulate your BlockBase while extending BlockFalling or recreating the functionality of BlockFalling and extend BlockBase. The first one being the easiest.

ย 

Ultimately a Java problem not a forge problem.

Edited by Animefan8888

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.

1 hour ago, cherrylime said:

BlockBase

This is an antipattern. You should never need to create your own "base" block class separate from vanilla.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.ย  If you think this is the case, JUST REPORT ME.ย  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

ย 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

ย 

DO NOT PM ME WITH PROBLEMS. No help will be given.

13 minutes ago, Draco18s said:

This is an antipattern. You should never need to create your own "base" block class separate from vanilla.

I don't see this being ineffective or in any way counterproductive. It might need a rename of sorts, maybe "DecorativeBlock". Seeing as how it is useful for simple stuff such as Solid Blocks IE a solid block of steel. But it is more simply a way to cut down on writing similar code.

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.

7 minutes ago, Animefan8888 said:

I don't see this being ineffective or in any way counterproductive. It might need a rename of sorts, maybe "DecorativeBlock". Seeing as how it is useful for simple stuff such as Solid Blocks IE a solid block of steel. But it is more simply a way to cut down on writing similar code.

Having a common class for related functionality is fine.

But by making all of your blocks extend BlockBase which extends Block, you've locked yourself out of extending other vanilla blocks (like BlockFalling).

BlockBase does nothing for a modder. I don't use it and my mod works just fine.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.ย  If you think this is the case, JUST REPORT ME.ย  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

ย 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

ย 

DO NOT PM ME WITH PROBLEMS. No help will be given.

2 minutes ago, Draco18s said:

But by making all of your blocks extend BlockBase which extends Block, you've locked yourself out of extending other vanilla blocks (like BlockFalling).

So the problem isn't having a class like BlockBase, but with how a lot of people are using it.

3 minutes ago, Draco18s said:

I don't use it and my mod works just fine.

Well of course it does. ?

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.

26 minutes ago, Animefan8888 said:

So the problem isn't having a class like BlockBase, but with how a lot of people are using it.

Block is already a "BlockBase" class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.ย  If you think this is the case, JUST REPORT ME.ย  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

ย 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

ย 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.