Jump to content

Sireous

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Sireous

  1. That helped🥳. Thank you a lot!
  2. Hi, I need to accesses byPath field of net.minecraft.client.renderer.texture.TextureManager. As I found out I need to use accesstransformer.cfg file and make the field public via it. In this file field names of class look like f_<numbers>. And I was unable to figure out, how to get those. It seems like it is connected to something called mappings (thing left after Minecraft decompile process). How can I get such a name for a field of a class?
  3. Thanks! By the way, does this method return creatures/minecarts/ect. as part of list?
  4. Hi, Let say I have an instance of ServerLevel and I what to get a painting as entity at BlockPos. level.getBlockEntity(pos) (level is instance of ServerLevel) returns null for some reason. How can I get painting at given position (if it exists there)?
  5. Hi I have recently developed Minecraft mod, that exports world portions, which then are imported with my Blender addon into Blender scene. The idea was to be able to export modded minecraft worlds. Currently it proved to work nicely. But there are 2 majior drawbacks: 1) It does not export paintings, armor stands and item frames. 2) It does not export blocks, that use custom renderers (like chisel and bits mod blocks) My approach is that I ask minecraft renderers (BlockRenderDispatcher, BlockEntityRenderDispatcher) to render what they see at some block position into my custom VertexConsumer classes. Seems like I am missing some other types of renderes. How paintings, armor stands and item frames render themselves? Can I somehow access renderers, that are introduced by other mods?
  6. Well, nobody was asking for that. By the way, why are you using class approach and not MinecraftForge.EVENT_BUS.addListener or FMLJavaModLoadingContext.get().getModEventBus().addListener?
  7. Well, I've added FMLJavaModLoadingContext.get().getModEventBus().addListener( EventPriority.NORMAL, false, RegisterClientReloadListenersEvent.class, this::a); into my mod constructor. a is private void a(RegisterClientReloadListenersEvent event){ LOGGER.debug("Resources loaded"); } And it seems it is not working (I don't see this string in console)
  8. After game is loaded or resource-packs are reloaded debug console fill with some info, ending with: [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 4096x2048x4 minecraft:textures/atlas/blocks.png-atlas [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x256x4 minecraft:textures/atlas/signs.png-atlas [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/banner_patterns.png-atlas [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/shield_patterns.png-atlas [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x512x4 minecraft:textures/atlas/chest.png-atlas [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/beds.png-atlas [20:16:17] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/shulker_boxes.png-atlas [20:16:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/particles.png-atlas [20:16:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/paintings.png-atlas [20:16:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 256x256x0 minecraft:textures/atlas/mob_effects.png-atlas I wonder, if there is any event fired after that load or reload happenes?
  9. Thanks! By the way, getColor returns int. How it is converted to RGB or something of that kind?
  10. Well, to make things clear. You might know that things like BlockEntityRenderer are used by Minecraft to render things into our monitor. But lets say I have asked such renderers to render some portion of the world into my own buffer => I got Minecraft geometry as it is rendered right now in my screen. I also dumped current texture atlases as .png (basic ones, because I can't yet figure out how to get full list of atlases in code). So I got geometry, I got textures. But: I need to know color for each block to setup Blender materials, so it will look exactly, like in my world. Because right now all grass/water/leaves are in greyscale. So, I want to know that:
  11. So, maybe, it can be done like this? block.getMaterial().getColor().col I found out I can call such thing from a BlockState. Is that a current block color?
  12. Most Biomes in Minecraft have unique grass/foliage/water color. It can be accessed via methods .getFoliageColor(), .getGrassColor() and .getWaterColor() of the Biome class. That means, technically, that game has an awairness of whenever block is grass/foliage and fluid is water. Am I able to gain such awairness too? Considering that I have access to instance of ServerLevel class and BlockPosition, where I want to check these conditions.
  13. Well, I inserted bunch of code to just point out the place, where I want this to happen, because I my opinion task "make block at BlockPosition invisible" is quite scenario independent. I was asking if something like level.setBlockInvisible(position) is possible (level is instance of ServerLevel).
  14. Well, the scenario... It's quite complicated. You can view the whole source code here: https://github.com/Dreadoom/RenderCube I am interested in this piece of code: // Min and max coordinates over each axes int region_min_x = Math.min(position1.getX(), position2.getX()); int region_max_x = Math.max(position1.getX(), position2.getX()); int region_min_y = Math.min(position1.getY(), position2.getY()); int region_max_y = Math.max(position1.getY(), position2.getY()); int region_min_z = Math.min(position1.getZ(), position2.getZ()); int region_max_z = Math.max(position1.getZ(), position2.getZ()); // Loop over coordinates for(int x = region_min_x; x <= region_max_x; x++){ for(int y = region_min_y; y <= region_max_y; y++){ for(int z = region_min_z; z <= region_max_z; z++){ // Current block position BlockPos position = new BlockPos(x, y, z); // Process block boolean success = RenderCubeUtils.renderBlock( source, jsonWriter, position, new BlockPos( position.getX() - region_min_x, position.getY() - region_min_y, position.getZ() - region_min_z)); // We finish with success only if RenderCubeUtils.RenderBlock(...) returned true if(!success){ // Finish with failure return -1; } } } } I want it to look something like this: // Min and max coordinates over each axes int region_min_x = Math.min(position1.getX(), position2.getX()); int region_max_x = Math.max(position1.getX(), position2.getX()); int region_min_y = Math.min(position1.getY(), position2.getY()); int region_max_y = Math.max(position1.getY(), position2.getY()); int region_min_z = Math.min(position1.getZ(), position2.getZ()); int region_max_z = Math.max(position1.getZ(), position2.getZ()); // Loop over coordinates for(int x = region_min_x; x <= region_max_x; x++){ for(int y = region_min_y; y <= region_max_y; y++){ for(int z = region_min_z; z <= region_max_z; z++){ // Current block position BlockPos position = new BlockPos(x, y, z); if(x == region_min_x){ makeInvisible(position.mutable().setWithOffset(position, Direction.WEST))); } // Same for other 5 vars // Process block boolean success = RenderCubeUtils.renderBlock( source, jsonWriter, position, new BlockPos( position.getX() - region_min_x, position.getY() - region_min_y, position.getZ() - region_min_z)); if(x == region_min_x){ makeVisible(position.mutable().setWithOffset(position, Direction.WEST))); } // Same for other 5 vars // We finish with success only if RenderCubeUtils.RenderBlock(...) returned true if(!success){ // Finish with failure return -1; } } } }
  15. Let's say I have those 2 variables: ServerLevel level = source.getLevel(); BlockState block = level.getBlockState(levelPosition); I want to make block near one I got (in any direction) temporarily invisible, perform some actions with block I have and then make invisible one visible again. How can I do this?
  16. Well, I hope this picture explains my intentions: https://drive.google.com/file/d/1BTx4zqqn6_K-P3j7d_iK2hb4Ia3t6HKv/view?usp=share_link
  17. By the way, I see a lot of renderers use VertexConsumer. Seems like all renderers use them to send verticies to graphics engine. Can I make such consumer and act as OpenGL to get rendered verticies in a block?
  18. Thanks warjort. I was afraid, that this is because they are entities. Now I know where to dig. But what about water, for example? I have checked via debug code, that there is no entity there (appropriate method return null). What is wrong with liquids?
  19. When I try to get quads for beds/chests/fluids via this code // Get level, where command is executed ServerLevel level = source.getLevel(); // Get BlockState at position BlockState block = level.getBlockState(levelPosition); // We do not want to render air if (!block.isAir()) { // Is used to get IBakedModel BlockRenderDispatcher blockRenderer = Minecraft.getInstance().getBlockRenderer(); // Is used in getQuads(...) Random rand = new Random(); // Rendered block RenderedBlock renderedBlock = new RenderedBlock(regionPosition.getX(), regionPosition.getY(), regionPosition.getZ()); // Block extra model data IModelData data = blockRenderer.getBlockModel(block).getModelData(level, levelPosition, block, EmptyModelData.INSTANCE); // Get model quads List<BakedQuad> quads = blockRenderer.getBlockModel(block).getQuads(block, null, rand, data); // List of all possible directions ArrayList<Direction> directions = RenderCubeUtils.getAllPossibleDirections(); // Through all directions for (Direction direction : directions) { // Get model quads, corresponding to this direction List<BakedQuad> quadsTemp = blockRenderer.getBlockModel(block).getQuads(block, direction, rand, data); // Join lists of quads quads = Stream.concat(quads.stream(), quadsTemp.stream()).toList(); } } I get empty 'quads' list. Why is this happening? How can I fix this?
  20. Hi there, Is there a way I can get texture atlases ResourceLocation in Minecraft 1.18.2 forge? Or something like it, because on startup game log has these lines: [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 4096x2048x4 minecraft:textures/atlas/blocks.png-atlas [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x256x4 minecraft:textures/atlas/signs.png-atlas [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/banner_patterns.png-atlas [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/shield_patterns.png-atlas [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x512x4 minecraft:textures/atlas/chest.png-atlas [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/beds.png-atlas [15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/shulker_boxes.png-atlas [15:15:30] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/particles.png-atlas [15:15:30] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/paintings.png-atlas [15:15:30] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 256x256x0 minecraft:textures/atlas/mob_effects.png-atlas This means somewhere there is ResourceLocation that holds these files. I can get, for example, minecraft:textures/atlas/blocks.png-atlas via this code TextureManager textureManager = Minecraft.getInstance().getTextureManager(); TextureAtlas textureAtlas = (TextureAtlas) textureManager.getTexture(new ResourceLocation("textures/atlas/blocks.png")); but what if, for example, some mod has added new atlas? I want to get whole list of those, via something like this Collection<ResourceLocation> resourceLocations = Minecraft.getInstance().getResourceManager().listResources( "textures/atlas", res -> res.chars().noneMatch(i -> Character.isLetter(i) && Character.isUpperCase(i))); but this approach sadly is not working.
  21. Well, now, when I understand this a bit better, question has changed. I need a way to get this big composite image(s), the TextureAtlas(es) and save as .png or something.
  22. Well, minecraft is obviously able to interpret that stream as 2D image. Am I able to interpret it the same way? And create usual image from that stream.
  23. Hi there, Let's say, I've got a BakedModel via this code BlockRenderDispatcher blockRenderer = Minecraft.getInstance().getBlockRenderer(); BakedModel blockModel = blockRenderer.getBlockModel(block); where block is an instance of BlockState. Then I do List<BakedQuad> quads = blockModel.getQuads(...); to get all BakedQuads of this model. While I iterate over them, I want to get a texture file (eg. .txt or .jpg) witch each of this quads use. Is that possible, and, if so, how can I do that? P. S. I see, that BakedQuad has a TextureAtlasSprite inside, witch I can get, but I don't know if that is what I need, and how to get texture file from it.
×
×
  • Create New...

Important Information

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