Started by
SkylieTuff
on
Topic category: General discussion
I'm trying to learn bitwise or, and, xor. I'm curious how each works. Plus I want to know what this would do
Y min -4 bitwiseOr y max 4
Topic category: General discussion
I'm trying to learn bitwise or, and, xor. I'm curious how each works. Plus I want to know what this would do
Y min -4 bitwiseOr y max 4
Basically if you use one or the other it will trigger the effect, but using both wont trigger it.
So basically Lets say Place a block and Break a block for XOR if they do both, it wont trigger the effect, but if they do one or the other it will.
hm, yes and no. Logic operations AND, OR and XOR take 2 boolean values as input. AND returns true if both inputs are true, OR if at least one is true, XOR if only one is true. Bitwise operations work by converting the number to binary and working bit by bit. For example, 6 can be converted to 0110 and 3 to 0011. Bitwise AND returns 1 if both bits are, bitwise OR returns 1 if at least one is, bitwise XOR returns 1 if only one is.
6 AND 3 becomes:
0110 AND
0011 =
0010 --> 2 in decimal system
6 OR 3 becomes:
0110 AND
0011 =
0111 --> 7 in decimal system
6 XOR 3 becomes:
0110 XOR
0011 =
0101 --> 5 in decimal system
Generally you won't really have to use bitwise operations, so don't worry about them too much
So let's say on the "move provided entity to x", how would I give it so the player can choose the moved position but doesn't feel jenky while being thrown upwards. I'm wanting to make a sword when right clicked moves the player up 5 spaces and than again 2 spaces, but no more and still move freely in the air after the move. So far it's not easy. This was similar concept due to when I posted this, except I was trying to make it work with a key bind back then. I mean I got a sword that moves you up 5 and than 2 relying on the ground block but it still after the move code makes it hard for a player to move while going up.