Ich versuche, einen Superkonstruktor zu machen, aber ich bekomme immer noch den Fehler: Implizite Superkonstruktor Block() ist nicht definiert. Muss explizit einen anderen Konstruktor aufrufen. auch scheint es, dass in der Hauptklasse gibt es 2 Konstruktoren? aber ich glaube nicht, dass das den Fehler verursacht hat.Java Super() Konstruktor funktioniert nicht?
Hauptklasse:
public Block(Material blockMaterialIn, MapColor blockMapColorIn)
{
this.enableStats = true;
this.blockSoundType = SoundType.STONE;
this.blockParticleGravity = 1.0F;
this.slipperiness = 0.6F;
this.blockMaterial = blockMaterialIn;
this.blockMapColor = blockMapColorIn;
this.blockState = this.createBlockState();
this.setDefaultState(this.blockState.getBaseState());
this.fullBlock = this.getDefaultState().isOpaqueCube();
this.lightOpacity = this.fullBlock ? 255 : 0;
this.translucent = !blockMaterialIn.blocksLight();
}
public Block(Material materialIn)
{
this(materialIn, materialIn.getMaterialMapColor());
}
Unterklasse:
public class ItemVoidiom_Ore extends Block {
public ItemVoidiom_Ore(Material materialIn) {
super(materialIn);
}
public ItemVoidiom_Ore() /** the error is here, Implicit super constructor Block() is undefined. Must explicitly invoke another constructor. */
{ setUnlocalizedName(Reference.enumstuff.VOIDIOM_ORE.getUnlocalizedName());
setRegistryName(Reference.enumstuff.VOIDIOM_ORE.getRegistryName());
}
} Vielen Dank für jede Hilfe!
Edit: Ich habe das Objekt hier definiert, in einer anderen Klasse
public static Block voidiom_ore;
public static void init()
{
voidiom_ore = new ItemVoidiom_Ore();
}
Edit: regelte es, vielen Dank für die Hilfe!
'ItemVoidiom_Ore()' 'versucht, Sperren()' aufzurufen, die nicht existiert. Sie müssen angeben, welcher Superklassenkonstruktor explizit ausgeführt werden soll. – Eran
'ItemVoidiom_Ore()' beginnt implizit mit 'super()', was bedeutet, dass versucht wird, einen Konstruktor zu verwenden, der 'Block()' entspricht. – khelwood
Ich verstehe Eran nicht ganz .. – itay51998