Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/31/20 in all areas

  1. I got into minecraft modding recently and was surprised by how hard it is to find useful up-to-date information. Because of that, I decided to document my learning journey and write a book about Minecraft modding for beginners. It applies to Minecraft 1.16.1 and the latest version of forge. Keep in mind it is still a work in progress. More chapters will be added in the coming days. Suggestions and questions also are welcomed. Link: https://thebookofmodding.ml/
    1 point
  2. But that's not what that means. What you just said is equivalent to this: int anonymousFunction(BlockState lightLevelToReturn) { return 10; } Notice how the thing named "light level" is not, in fact, the light level?
    1 point
  3. FYI, the parameter you've named "lightLevel" there is badly named. That's a parameter in and is most likely a BlockState
    1 point
  4. Try removing the mod that is causing problems then...the absence of custom main menu won't affect your gameplay. See if you are able to run the game without this mod
    1 point
  5. Someone in your old topic on the same argument gave you the solution to that...go take a look..anyway a ToIntFunction just represent a function that returns an int value..
    1 point
  6. The fact is that Item#onBlockDestroyed gets called before the block is actually removed from the world, so you are basically changing a blockstate which is set to air immediatly after, nullifying your changes. You need to use either Item#onBlockStartBreak and make it return true, or just listen to the BlockEvent.BreakEvent, set the blockstate you want, and cancel the event.
    1 point
  7. Luckily there's a vanilla block that has this functionality already: the daylight detector. The blockstate for that looks like: { "variants": { "inverted=false": { "model": "minecraft:block/daylight_detector" }, "inverted=true": { "model": "minecraft:block/daylight_detector_inverted" } } } So you can adapt your blockstate to use true/false flags like that. Now we need to look at the class file for the daylight detector to see how the tags are implemented. I've added the relevant parts here. public static final BooleanProperty INVERTED = BlockStateProperties.INVERTED; public DaylightDetectorBlock(AbstractBlock.Properties properties) { super(properties); this.setDefaultState(this.stateContainer.getBaseState().with(INVERTED, Boolean.FALSE)); } public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (player.isAllowEdit()) { if (worldIn.isRemote) { return ActionResultType.SUCCESS; } else { BlockState blockstate = state.func_235896_a_(INVERTED); worldIn.setBlockState(pos, blockstate, 4); return ActionResultType.CONSUME; } } else { return super.onBlockActivated(state, worldIn, pos, player, handIn, hit); } }
    1 point
  8. Probably not since most videos on youtube promote bad coding practices. Ask for help on the forums and use your brain. So, as you said, don't be too lazy.
    1 point
×
×
  • Create New...

Important Information

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