Giter Club home page Giter Club logo

Comments (11)

RedMonster2 avatar RedMonster2 commented on July 29, 2024

heeellll... LO?

from minekhan.

Oranamous avatar Oranamous commented on July 29, 2024

This is a feature I don't see a point for. However I do think we could use blockstates, and then mods could use that to simulate the effect you're talking about. I see the issue with modeling, but again blockstates could help since you could make 1 boolean state for each of the connecting directions, then if it's true, render the connector in that direction.

from minekhan.

RedMonster2 avatar RedMonster2 commented on July 29, 2024

well i definitely see a use, because it would mean i don't have to model every single state of a block to make it!

from minekhan.

Willard21 avatar Willard21 commented on July 29, 2024

Blocks already have states. Right now I think there's only 5 bits being used for shape, rotation, and whether it's flipped (upside down slab), with 8 bits reserved for the block ID. So only 13 bits being used right now. We can use up to 32.

Having multiple blocks in the same space is a very bad idea for performance reasons though. The main issue being memory usage. With an 8 chunk render distance, there'd be about 5.9 million blocks loaded. By using a 4 byte number for each block, that comes out to about 23.6MB of memory (could be reduced significantly with bit packing).
In order to store multiple blocks per position, I'd need an array for every block space, so the same number of blocks would end up using around 300MB, just from the different storage scheme. Additionally, it becomes much much slower to lookup block positions, which happens tens of millions of times during world gen. Basically everything would become way less efficient. And the code would get more complex, since a single position would no longer resolve to a block, but instead resolve to an array of blocks.

So this definitely won't be implemented. As Oranamous mentioned, waterlogging can be achieved with block states. Meaning you flip a bit on the block's 32 bit number, and that bit means it's waterlogged. For blocks with more states than can be stored in a few bits, entities or tile entities are the solution.

If your only concern is block modeling, then just copy/paste the models from 2 blocks into the same array, and you're done. It's just 1 block with double the vertices.

from minekhan.

sauron65 avatar sauron65 commented on July 29, 2024

If your only concern is block modeling, then just copy/paste the models from 2 blocks into the same array, and you're done. It's just 1 block with double the vertices.

will that still cull correctly?

from minekhan.

Willard21 avatar Willard21 commented on July 29, 2024

No worse than 2 separate blocks in the same space lol

from minekhan.

RedMonster2 avatar RedMonster2 commented on July 29, 2024

ok... fine, just to give you an idea of what all i have to model: wall post, wall 1 extension, wall corner, wall 2 extension, wall T, wall 4 extension, wall 1 extension raised, wall corner raised, wall 2 extension raised, wall T raised, wall 4 extension raised, wall 2 extension no post, and finally: wall 2 extension no post raised.... so.... i have to make a seperate block shape for every one of those... right, that'll be fun, to help me along, chance you could tell me how those CONSTs work for the block shape? because... i've noticed they don't like just any number

from minekhan.

Willard21 avatar Willard21 commented on July 29, 2024

You mean these?
image

As the comments suggest, they're bit flags. Meaning powers of 2. Fences can't be slabs, stairs, or upside down, so you can just re-use those bits.
Here's 16 values that would be fine to use:

0x0000
0x0100
0x0200
0x0300
0x0400
0x0500
0x0600
0x0700
0x2000
0x2100
0x2200
0x2300
0x2400
0x2500
0x2600
0x2700

And you would use blockState & 0x2700 to extract them from the block state. So for example

const wallTRaised = 0x2000 // define shape bits
const fenceMask = 0x2700
...
const blockState = blockIds.oakFence | wallTRaised // store block state
...
if ((blockState & fenceMask) === wallTRaised) // read block state

from minekhan.

RedMonster2 avatar RedMonster2 commented on July 29, 2024

yes those are what i mean... it's just... i don't fully understand the code, i only know basic html and javascript, so i don't know how to implement what you just told me

from minekhan.

RedMonster2 avatar RedMonster2 commented on July 29, 2024

oh and... another reason for it is water logging... do you have a fix for that?

from minekhan.

Willard21 avatar Willard21 commented on July 29, 2024

So this definitely won't be implemented. As Oranamous mentioned, waterlogging can be achieved with block states. Meaning you flip a bit on the block's 32 bit number, and that bit means it's waterlogged.

from minekhan.

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.