GithubHelp home page GithubHelp logo

Comments (3)

jabelar avatar jabelar commented on August 13, 2024

Thanks for pointing this out.

That mod is developed in Kotlin language which is closely related to Java but I'm not super familiar with it. But one weird thing is that the code in his strobelight block has the following for the erroring method:
override fun getLightValue(state: IBlockState, access: IBlockAccess, pos: BlockPos): Int { val te = access.getTileEntity(pos) if (te == null || te !is IRecordWire || te !is IRecordAmplitude) return 0 return if ((te as IRecordWire).connections.size > 0) 5 else 0 }
which implies that it is overriding the block method (his block extends BlockContainer), but the Block type hierarchy in the 1.12 source I have shows this method prototypes:
int getLightValue(IBlockAccess world, BlockPos pos);

So the weird thing is that his code is expecting another parameter which I would never pass based on the Java interface. I must be missing something. It is further weird because the Java method can handle null parameters, so the best fix would be for the other mod to handle it too -- like give out a value of no light when it is null, or else some other default value.

Anyway, I can handle the crash for now. The strobe light will not (of course) strobe while being held, although it might be fun to try to make that work in the future.

In any case, I'll make an update to handle this mod compatibility. Should be posted in next day or two.

from movinglightsource-1.12.

jabelar avatar jabelar commented on August 13, 2024

Okay, I fixed the issue in version 1.0.11 which should be approved on CurseForge for downloads pretty soon.

from movinglightsource-1.12.

NicholasFeldman avatar NicholasFeldman commented on August 13, 2024

Dev of better records, just chiming in on this issue:

On this line here, you call getDefaultState().getLightValue(null, null); , a method declared in the interface net.minecraft.block.state.IBlockProperties, implemented by IBlockState. in short, the method you're using exists on the BlockState, not the Block. I believe what you should do here is entry.getValue().getLightValue(entry.getDefaultState(), null, null).

int lightValue = entry.getValue().getDefaultState().getLightValue(null, null);

However, the parameters to either method are not marked as @Nullable so I don't believe null should be passed in. This specifically would cause issues with at least BetterRecords for sure, since Kotlin is a null safe language.

from movinglightsource-1.12.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.