Jump to content

[SOLVED] Falling Blocks?


cherrylime

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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