ZeroBitStorage .java

net.minecraft.util.ZeroBitStorage (class, 71 lines): members: RAW, getAndSet, getBits, getRaw, getAll, fill, getSize, unpack, set, copy, size, get.

net.minecraft.utilclass71 linescommon1.3 KB

Implements

API Surface (10)

int getAndSet(final int index, final int value)
void set(final int index, final int value)
void fill(final int value)
int get(final int index)
long[] getRaw()
int getSize()
int getBits()
void getAll(final IntConsumer output)
void unpack(final int[] output)
BitStorage copy()

Fields & Constants (2)

RAW
size

Code Graph: Dependencies (1)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ZeroBitStorage.java71 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util;
2
3
import java.util.Arrays;
4
import java.util.function.IntConsumer;
5
import org.apache.commons.lang3.Validate;
6
7
public class ZeroBitStorage implements BitStorage {
8
	public static final long[] RAW = new long[0];
9
	private final int size;
10
11
	public ZeroBitStorage(final int size) {
12
		this.size = size;
13
	}
14
15
	@Override
16
	public int getAndSet(final int index, final int value) {
17
		Validate.inclusiveBetween(0L, this.size - 1, index);
18
		Validate.inclusiveBetween(0L, 0L, value);
19
		return 0;
20
	}
21
22
	@Override
23
	public void set(final int index, final int value) {
24
		Validate.inclusiveBetween(0L, this.size - 1, index);
25
		Validate.inclusiveBetween(0L, 0L, value);
26
	}
27
28
	@Override
29
	public void fill(final int value) {
30
		Validate.inclusiveBetween(0L, 0L, value);
31
	}
32
33
	@Override
34
	public int get(final int index) {
35
		Validate.inclusiveBetween(0L, this.size - 1, index);
36
		return 0;
37
	}
38
39
	@Override
40
	public long[] getRaw() {
41
		return RAW;
42
	}
43
44
	@Override
45
	public int getSize() {
46
		return this.size;
47
	}
48
49
	@Override
50
	public int getBits() {
51
		return 0;
52
	}
53
54
	@Override
55
	public void getAll(final IntConsumer output) {
56
		for (int i = 0; i < this.size; i++) {
57
			output.accept(0);
58
		}
59
	}
60
61
	@Override
62
	public void unpack(final int[] output) {
63
		Arrays.fill(output, 0, this.size, 0);
64
	}
65
66
	@Override
67
	public BitStorage copy() {
68
		return this;
69
	}
70
}
71

Decompiled Minecraft 26.3 source of ZeroBitStorage (net/minecraft/util/ZeroBitStorage.java) with Mojang official mappings, stored verbatim on the site.