Noob questions

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
1. Why is grass block sides so special that they need a mask (turned on by BLOCK_HINT_GRASS)?
2. Have there been any conclusions about liquids and how they should/will operate at a block data level? (I have see threads about it, but it seems it is still under debate)
3. Is there plans/rejected-plans to make an API library for modding purposes?
4 The purpose of MiniatureChunk eludes me... what is it for?
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
1. The color of grass/foliage is modified based on the humidity and other factors of the region it is in - the mask indicates which parts of the grass block sides have grass (and thus should be altered).
2. No-one is working on it, so no. I specifically think that there should be no water block, and instead there would be separate data per block about water depth/flow/direction/whatever - this will allow liquids to overlap with other blocks. Then you can have underwater plants, partially submerged slopes and stairs and so forth.
3. The engine library is the API library - specifically packages and classes marked with @API are available for modules (our API isn't finalized though). Modules are currently our unit of modding - they can provide new assets and code, and can be enabled/disabled for each game (they are loaded dynamically at runtime). In the future we'll have some more formal units of modding (gametypes, mods, override packs), but they will all be built upon modules.
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
1. The color of grass/foliage is modified based on the humidity and other factors of the region it is in - the mask indicates which parts of the grass block sides have grass (and thus should be altered).
It appears to only modify rendering of the sides of the block. What about the top? (likely I have missed where the top is handled)
Code:
if (block.getURI().toNormalisedString().equals("core:grass") && dir != Side.TOP && dir != Side.BOTTOM) {
                    blockAppearance.getPart(BlockPart.fromSide(dir)).appendTo(mesh, x, y, z, colorOffset, renderType, ChunkVertexFlag.COLOR_MASK);
}
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
The top, and other blocks that are uniformally foliage are uniformally modified. Grass sides are special because they are a mixture of grass and dirt.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
4) The miniature chunk is more of a toy / proof of concept. The idea was to take a selection of blocks and shrink them down into a single object. When that was done (a long time ago) it was done using a miniature chunk complete with lighting etc. That might be useful for displaying a "physical" map in-world, like on a table-top, although that might not be the most efficient way to do so. Another version would turn the resulting object into a single new block that you could then place in the world. There's some stuff on that somewhere in the forum too, like under crafting topics - imagine making a giant chair out of full-sized blocks then shrinking it down to "normal" chair size :)

DizzyDragon has worked on the liquid system most recently
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
5. I have been attempting to get drop replacement to turn grass into dirt when dropped. I have followed the execution deep into the entity system, but have not figured out how to make it work. Can anyone give me a hint on what to do or where to look?
Code:
    @ReceiveEvent(components = BlockComponent.class)
    public void OnBlockToItem(OnBlockToItem event, EntityRef entity) {
 
        BlockItemComponent blockItem = event.getItem().getComponent(BlockItemComponent.class); // block that was destroyed
        ItemComponent item = event.getItem().getComponent(ItemComponent.class); // item information that is used in the pickup stuff
 
        if(blockItem.blockFamily.hasCategory("dirt")) {
            item.name = "some random text"; // doesnt do anything
            item.stackId = "block:" + dirt.getURI().toString(); // tried replicating the other URI convention; it doesnt do anything when changed
            item.stackCount = (byte) 5; // this works
        }
    }
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Looks like we need a BeforeDropBlock event to allow the family being dropped to be intercepted.
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
I suppose the purpose of the OnBlockToItem event is to:
- modify the stack size
- change what the dropped items can stack with
- transform/copy components from a block to an item
- trigger other actions (like dumping the contents of a chest on to the ground as apposed to keeping the items in the chest while in your inventory)


On that note, triggering actions... I suppose we could trigger dropping other items (like my dirt) and then set the stack size of dropped grass to 0.
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
It is awkward trying to change things afterwards though. A general pattern for events is to have a Before event that can be used to modify or cancel something that is about to happen, and an On/After event to trigger other actions in response to the action - but not modifying it. Damage works this way, for instance.

I'll add the new event this weekend (and also look into chunk entities).
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
Thinking of popular voxel mod ideas in the field, it might be useful to allow for a list of item stacks to be dropped. This would allow dropping the contents of chests (vanilla MC), or disintegrating blocks into their comprised parts (IC2 windmills, gregtech machines, AE minerals).

Just ideas to allow the engine to be as mod friendly as possible.
 
Top