Tip:
Highlight text to annotate it
X
Hello and welcome back everyone this is Sancarn again here bringing you
another video and in this video we are going to further explore
some other properties of the FarLands.
When I was doing some experimentation in the FarLands
I found this weird flickering sand block.
I was wondering, "Why is this
happening?" so I decided to find out the core properties of sand blocks
and from that make my own hypothesis
as to why this is happening. Then we can find out
exactly how we can use this
little quirk to our own advantage!
So how does a sand block
fall? When a sand block is updated, the game checks
whether there is an air block beneath it. If an air block is found
the game will first obtain the position of the sand block.
Then the game will summon a falling sand entity
into said position. Now if the falling sand entity is inside a sand block
the game will delete the block. Otherwise the game will delete the falling sand
entity
If a falling sand entity is successfully summoned,
it will start to fall. When the entity hits the ground,
the sand entity is deleted and the block is placed at the co-ordinates
of the arithmetic floor of the entities position.
Now we are going to look at very large floating point numbers.
When floating point numbers get very large in programming languages,
they start to become less and less accurate.
This is because of an arithmetic limitation
of computers called integer overflow.
An integer overflow occurs when an arithmetic
operation attempts to create a numeric value
that is too large to be represented within the available storage space.
This can easily be explained with a mechanical number counter.
As we add +1 each time the counter counts up by one.
When we reach the number nine and add +1,
we see the number on the far right hand side
of the counter go to zero and the next number along
goes to 1. When the second cell
goes to 9 and the first cell is also at
9 and we add +1, the number one
ripples across turning the nines
in the first and second cells to 0 and then finally turning
the third cell into a 1. Now let's say we have nine's
in every single cell of our counter. Now
we add +1
Now the carry (the +1) goes through turning
all the 9s to 0s, and that it does
but now we have this extra carry of +1!
However this cannot be displayed on our counter!
So in total we have lost a 1 (We have lost data).
Of course with the complex mathematical program
we do not wish this to happen. Instead
programming languages such as Java come up with their
own ways of dealing with these overflows. However these
algorithms can result in inaccuracies.
These inaccuracies may seem small at first
like turning 10,000 into
9,999.999,
however with many complex arithmetic operations
and many inaccuracies these can lead
too extreme errors! For example:
Let's do 10^33
in mathematics we know that this is a Decillion,
however if 10 had a minor change to let's say
9.99 we would have
9.99^33
this is
9.675 x 10^32
That is, we have an error of about 3.25 x 10^31.
This is a massive error.
So what does this have to do with Minecraft, you might ask.
The point is when we are in the FarLands, we are dealing with these
large numbers. A lot of arithmetic operations occur when translating
integers to floats. When a sand block falls
it takes the integer position of the block and translates that
into the position for the falling sand entity.
The position for the falling sand entity,
like other entities, is a floating-point
number. So it takes the integer position of the sand block
and translates that into the floating-point position
of the falling sand entity.
So when the falling sand entity is summoned by the game (in the FarLands)
it is in a completely different position
to the sand block itself. This is due to the errors
we have just talked about. This explains why some sand blocks
don't fall in the Far Lands. When we place a block of sand
the block instantaneously updates. The game sees
there is an air block beneath the sand. So the game
finds the position of the sand. Then the game converts
the integer position of the sound to a floating-point
representation of the position. This
is a little inaccurate and summons the falling sand entity
outside the block itself. The game checks
whether the falling sand entity is inside a sand block.
After realizing that it isn't inside a sand block at all,
it deletes the falling sand entity and the sand block
is left floating in the air. So let's go back
to this flickering sand block glitch. How does this work?
Well it's actually quite simple. When we place the sand block on the right
it updates the sand block on the left. The game sees there is an
air block beneath the sand. So the game finds the position of the sand.
It then converts the integer position of the send
to a floating-point representation of the position.
This is a little inaccurate and summons the falling sand entity
inside the block on the right.
The game then checks whether the falling sand entity
is inside a block. The game finds that it
is and deletes the sand block it is inside!
Leaving the falling sand entity behind.
This falling sand entity falls and hits the ground
in the next game tick.
When it hits the ground the falling sand entity is deleted
and replaced with a sand block. This
re-updates the sand block on the left
repeating the process. So the final thing
is "What can we use this wonderful glitch
for?". Well there are many meta-data changers
around at the moment aren't there? So I figured, you know,
I'd make my own metadata changer. So
now we have a cheaper meta-data changer
right here. Now of course this only works with falling sand entities, So it only converts:
sand to red sand red sand to sand broken anvils to non broken anvils!
but apart from that, we can't actually do a whole lot with this metadata changer.
Ever wanted a strobe light? Pop a redstone torch behind the sand block
and it'll produce a strobe. When the sand is a block
it blocks the like completely but when it is an
entity light passes straight through it this causes
a strobe effect. The final thing that I found that we could do with this
is we can keep the sand in your sand cannons in a falling state for you
to prepare to launch it.
But I'm afraid guys that
That's all I have time for in this video so I guess I'll see you again
in the next video!