UpdateInterval .java

net.minecraft.world.entity.UpdateInterval (interface, 34 lines): interface declaring 3 methods. members: nextInterval, periodic, NEVER, test.

net.minecraft.world.entityinterface34 linescommon618 B

API Surface (4)

boolean test(final int tick)
int nextInterval(final int tick)
boolean test(final int tick)
int nextInterval(final int tick)

Fields & Constants (1)

NEVER

Full Source

UpdateInterval.java34 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity;
2
3
public interface UpdateInterval {
4
	UpdateInterval NEVER = new UpdateInterval() {
5
		@Override
6
		public boolean test(final int tick) {
7
			return false;
8
		}
9
10
		@Override
11
		public int nextInterval(final int tick) {
12
			return 0;
13
		}
14
	};
15
16
	boolean test(int tick);
17
18
	int nextInterval(int tick);
19
20
	static UpdateInterval periodic(final int period) {
21
		return new UpdateInterval() {
22
			@Override
23
			public boolean test(final int tick) {
24
				return tick % period == 0;
25
			}
26
27
			@Override
28
			public int nextInterval(final int tick) {
29
				return tick / period * period + period;
30
			}
31
		};
32
	}
33
}
34

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