ChestLidController .java

net.minecraft.world.level.block.entity.ChestLidController (class): members: shouldBeOpen, getOpenness, oOpenness, tickLid, openness. imports: Mth.

net.minecraft.world.level.block.entityclass28 linescommon708 B

API Surface (3)

void tickLid()
float getOpenness(final float a)
void shouldBeOpen(final boolean shouldBeOpen)

Fields & Constants (3)

shouldBeOpen
openness
oOpenness

Code Graph: Dependencies (1)

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

Full Source

ChestLidController.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block.entity;
2
3
import net.minecraft.util.Mth;
4
5
public class ChestLidController {
6
	private boolean shouldBeOpen;
7
	private float openness;
8
	private float oOpenness;
9
10
	public void tickLid() {
11
		this.oOpenness = this.openness;
12
		float speed = 0.1F;
13
		if (!this.shouldBeOpen && this.openness > 0.0F) {
14
			this.openness = Math.max(this.openness - 0.1F, 0.0F);
15
		} else if (this.shouldBeOpen && this.openness < 1.0F) {
16
			this.openness = Math.min(this.openness + 0.1F, 1.0F);
17
		}
18
	}
19
20
	public float getOpenness(final float a) {
21
		return Mth.lerp(a, this.oOpenness, this.openness);
22
	}
23
24
	public void shouldBeOpen(final boolean shouldBeOpen) {
25
		this.shouldBeOpen = shouldBeOpen;
26
	}
27
}
28

Decompiled Minecraft 26.3 source of ChestLidController (net/minecraft/world/level/block/entity/ChestLidController.java) with Mojang official mappings, stored verbatim on the site.