Jump to content

Ideki

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by Ideki

  1. So nobody knows how to spawn a book with written text ?
  2. Hi, I want to add to my mod a book with custom text inside it. Like a book and quill that has text in it. So it would be an item (ex: Book01) that already contains text when taken from the creative inventory. I cannot find any up to date tutorial. Does anyone know how to achieve this or point me in the right direction.
  3. nvm found the problem. There is actually a criteria section in the json and the name has to match. Anyone coming here, I suggest to use Advancements (thedestruc7i0n.ca)
  4. From what I understand (and tried), I need to define my advancements in json files. I am following: https://minecraft.fandom.com/wiki/Advancement/JSON_format What I do not understand are the criterion. When I debug, minecraft complains with the following error: [09:03:30] [Render thread/ERROR]: Parsing error loading custom advancement testmod:test_advancement: Unknown required criterion 'test_advancement' I looked at other mods and I cannot find where the criterion are defined.
  5. Hello, Does anyone know a tutorial about how to add achievements for a mod? For the mod I am creating, I want to add new achievements. I want them to display with branching (meaning one achievement leading to multiple sub-achievements) But I cannot find anything on google or youtube. IT's entirely possible that I am querying wrong.
  6. Ok, I think I understand what is going on. I seems that it gets the light from a nearby light source I placed and that triggers the shadow. So I guess it is solved, just not in a way I would like. But still works.
  7. Hum no, that did not change anything. I can still see the difference in colors.
  8. Never mind, I found it. It it the small star on the block property that controls it. Thanks for your help :)
  9. I am using BlockBench to make my model. Is there a way to change the shade setting for all blocks in it, or do I have to do it manually for each element in the json files?
  10. Hello, I made my custom multiblock (4 blocks tall, 2 blocks wide, 1 block deep) model with custom texture. But there is something weird happening with the shadow on the upper section. There is a clear color change between blocks. The following screenshot shows a difference in brown color when the texture is actually all the same brown. Each custom block has its own override of 'getShape' that returns the correct VoxelShape as I can see the edge of the microblocks highlighted correctly. My blocks all use the same properties: public static final BlockBehaviour.Properties BODY_BLOCK_PROPERTIES = BlockBehaviour.Properties .of(Material.HEAVY_METAL, MaterialColor.TERRACOTTA_BROWN) .strength(-1.0F, 3600000.0F) .noDrops() .noOcclusion() .lightLevel(s -> 2) .sound(SoundType.METAL);
  11. Sorry for the late reply. I have been busy working on the model. From BlockBench I exported the VoxelShape model. I copied the Stream.of code into my class. The shape has some IBooleanFunction. Ex: IBooleanFunction.LEG Leg is the name of a group of cubes I created in BlockBench. The problem is that I cannot find where IBooleanFunction comes from. Or is there a replacement?
  12. Hello, As you can see in the screenshot, the bounding box wire is showing a full cube. How can I make it stick to my shape? Like stairs and slabs.
  13. Started a separate post for another question
  14. Worked like a charm. Thanks a lot
  15. I just put textures on, and still get the same result with the floor under my model being see-through. I am not supposed to see the sky blue square. It should be grass.
  16. Hi, I made a custom shape (no textures yet). And when I place it, I can see through the floor for some reason. Am I missing a setting to tell it to render the top texture of the block under? The block is declared like this: public static final BlockBehaviour.Properties RUNE_BLOCK_PROPERTIES = BlockBehaviour.Properties .of(Material.HEAVY_METAL, MaterialColor.TERRACOTTA_BLACK) .strength(-1.0F, 3600000.0F) .noDrops() .sound(SoundType.METAL) .lightLevel(s -> 10); public static final RegistryObject<Block> SHAPED_BLOCK_00 = BLOCKS.register("shaped_block_00", () -> new Block(RUNE_BLOCK_PROPERTIES)); This is my model: { "credit": "Made with Blockbench", "elements": [ { "from": [9, 0, 1], "to": [14, 1, 9], "color": 1, "faces": { "north": {"uv": [0, 0, 5, 1], "texture": "#missing"}, "east": {"uv": [0, 0, 8, 1], "texture": "#missing"}, "south": {"uv": [0, 0, 5, 1], "texture": "#missing"}, "west": {"uv": [0, 0, 8, 1], "texture": "#missing"}, "up": {"uv": [0, 0, 5, 8], "texture": "#missing"}, "down": {"uv": [0, 0, 5, 8], "texture": "#missing"} } }, { "from": [9, 1, 3], "to": [14, 2, 9], "color": 2, "faces": { "north": {"uv": [0, 0, 5, 1], "texture": "#missing"}, "east": {"uv": [0, 0, 6, 1], "texture": "#missing"}, "south": {"uv": [0, 0, 5, 1], "texture": "#missing"}, "west": {"uv": [0, 0, 6, 1], "texture": "#missing"}, "up": {"uv": [0, 0, 5, 6], "texture": "#missing"}, "down": {"uv": [0, 0, 5, 6], "texture": "#missing"} } }, { "from": [9, 2, 6], "to": [14, 3, 9], "color": 4, "faces": { "north": {"uv": [0, 0, 5, 1], "texture": "#missing"}, "east": {"uv": [0, 0, 3, 1], "texture": "#missing"}, "south": {"uv": [0, 0, 5, 1], "texture": "#missing"}, "west": {"uv": [0, 0, 3, 1], "texture": "#missing"}, "up": {"uv": [0, 0, 5, 3], "texture": "#missing"}, "down": {"uv": [0, 0, 5, 3], "texture": "#missing"} } }, { "from": [9, 3, 7], "to": [14, 16, 9], "color": 7, "faces": { "north": {"uv": [0, 0, 5, 13], "texture": "#missing"}, "east": {"uv": [0, 0, 2, 13], "texture": "#missing"}, "south": {"uv": [0, 0, 5, 13], "texture": "#missing"}, "west": {"uv": [0, 0, 2, 13], "texture": "#missing"}, "up": {"uv": [0, 0, 5, 2], "texture": "#missing"}, "down": {"uv": [0, 0, 5, 2], "texture": "#missing"} } } ] }
  17. Works like a charm. Thank you so much
  18. { "parent": "block/cube_all", "textures": { "east": "testmod:blocks/rune_block_top_right", "north": "testmod:blocks/rune_block_top_left", "south": "testmod:blocks/undestructinium_block", "west": "testmod:blocks/undestructinium_block", "up": "testmod:blocks/rune_block_top_right", "down": "testmod:blocks/undestructinium_block" } }
  19. Got it. Not sure why, but intellij was not showing me BEDROCK as found when I searched for it the first time. I will change my settings to .strength(-1.0F, 3600000.0F).noDrops() Thank you
  20. Hello, Which properties should I set to make my block unbreakable (like Bedrock) ? For now I am using: public static final BlockBehaviour.Properties NO_BREAK_BLOCK_PROPERTIES = BlockBehaviour .Properties .of(Material.HEAVY_METAL, MaterialColor.TERRACOTTA_BLACK) .strength(8.0f, 1200) .sound(SoundType.METAL) .lightLevel(s -> 5);
  21. Hi, When I break my custom block (with custom texture) I see purple and black particles flying. Is there a setting I need to set for it to use my block texture instead?
  22. Got it! I am still using the onUse override. The only thing I was missing for all the blocks to show was a call the following function after the level.setBlock : level.sendBlockUpdated(pos, blockState, blockState, Block.UPDATE_ALL_IMMEDIATE);
  23. The extra code are left overs from code I found in another mod. I am still in the process of learning what everything does. I took a look at your code, and I am not sure how the PlayerInteractEvent.RightClickBlock applies to the item I am using to place the blocks. When I integrate your rightClickBlock function into my item, it did nothing. Is it not something that should be applied to a block directly? I mean an event that a block receives when the player right click on it ? If so, that would be the opposite of what I am trying to achieve.
  24. Following your suggestions I made progress. I changed my approach to use an item that will place the blocks in the world. The blocks are placed, but something is still wonky as they do not appear until I quit and join again the world. Could someone tell me why this is happening? I am posting here my code. public class RuneCubeItem extends Item { public RuneCubeItem() { super(ITEM_PROPERTIES); } @Override public InteractionResult useOn(UseOnContext context) { System.out.println("useOn"); Player player = context.getPlayer(); if (player instanceof ServerPlayer) { System.out.println("A"); build((ServerPlayer) player); } System.out.println("B"); return super.useOn(context); } private void build(ServerPlayer player) { Level world = player.level; HashMap<BlockPos, Block> coords = Util.make(Maps.newHashMap(), (map) -> { map.put(new BlockPos(-1, 0, -1), Blocks.STONE); map.put(new BlockPos(0, 0, -1), Blocks.STONE); map.put(new BlockPos(1, 0, -1), Blocks.STONE); // and so on }); for (Map.Entry<BlockPos, Block> entry : coords.entrySet()) { BlockPos coordinate = entry.getKey(); Block block = entry.getValue(); placeBlock(world, player, coordinate, block); } } private void placeBlock(Level world, ServerPlayer player, BlockPos pos, Block setBlock) { System.out.println("C"); if ((pos.getY() > world.getMaxBuildHeight() || pos.getY() < world.getMinBuildHeight()) || !player.mayBuild()) { System.out.println("D"); return; } ItemStack heldItem = new ItemStack(setBlock, 1); if (heldItem.isEmpty()) { System.out.println("E"); return; } BlockSnapshot blockSnapshot = BlockSnapshot.create(world.dimension(), world, pos); if (ForgeEventFactory.onBlockPlace(player, blockSnapshot, Direction.UP) || !world.mayInteract(player, pos)) { System.out.println("F"); return; } Vec3 playerPosition = player.position(); BlockPos newPos = new BlockPos( playerPosition.x + pos.getX(), playerPosition.y + pos.getY(), playerPosition.z + pos.getZ()); System.out.println("G"); //BlockItem item = (BlockItem) stack.getItem(); BlockState state = setBlock.defaultBlockState(); world.setBlock(newPos, state, 3); } }
  25. Do you think it would be possible position the texture I have now (the 3x3x3) correctly, and fill it inside with 27 blocks ? Or would the texture of the 27 blocks appear through the 3x3x3 I have now ? Otherwise I will have to create 27 blocks with individual textures that I would assemble automatically into a 3x3x3 using a map like you suggested.
×
×
  • Create New...

Important Information

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