Jump to content

Recommended Posts

Posted

I am trying to implement a block with metadata in scala. Here is my code:

 

  Reveal hidden contents

 

 

There seems to be some problems. At (1), The compiler says that

 

[pre]Error:(45, 56) inferred type arguments [Any,Int] do not conform to method withProperty's type parameter bounds [T <: Comparable[T],V <: T]

getDefaultState.withProperty(propertyFacing, facing).withProperty(propertyIndex, index)

                                                    ^[/pre]

 

At (2), it says [pre]Error:(57, 33) type mismatch;

found  : Array[net.minecraft.block.properties.PropertyHelper[_ >: Integer with net.minecraft.util.EnumFacing <: Comparable[_ >: Integer with net.minecraft.util.EnumFacing <: java.io.Serializable] with java.io.Serializable]]

required: net.minecraft.block.properties.IProperty[?0] forSome { type ?0 <: Comparable[?0] }

new BlockStateContainer(this, properties)

                              ^[/pre]

 

These codes are from MinecraftByExamples and work perfectly fine in Java. What should I change to fix the problem? For (2), I have tried casting the elements to type [pre]IProperty[_ <: Comparable[_]][/pre] and to [pre]IProperty[_][/pre], but that did not solve the problem.

 

Are there any examples/tutorials of scala modding? Thanks in advance.

Posted

I found the problem. Mysteriously my Java version was set to Java 6 when it should be Java 8. Now all the errors are gone and minecraft runs without problem.

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.