mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Fix forced chunks never being ticked by the server (#10365)
This commit is contained in:
1 parent
5c508efaa9
commit
0749f49b6c
5 files changed
+182
-4
No files matched your search
@@ -9,6 +9,9 @@ import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -42,14 +45,25 @@ public interface IForgeGameTestHelper {
|
||||
}
|
||||
|
||||
default void say(String message, Style style) {
|
||||
var component = ForgeI18n.getPattern(message) != null ? Component.translatable(message) : Component.literal(message);
|
||||
this.say(component.withStyle(style));
|
||||
this.say(this.getMessage(message).withStyle(style));
|
||||
}
|
||||
|
||||
default void say(String message, ChatFormatting style) {
|
||||
this.say(this.getMessage(message).withStyle(style));
|
||||
}
|
||||
|
||||
default void say(String message, int color) {
|
||||
this.say(this.getMessage(message).withColor(color));
|
||||
}
|
||||
|
||||
default void say(Component component) {
|
||||
this.self().getLevel().players().forEach(p -> p.sendSystemMessage(component));
|
||||
}
|
||||
|
||||
private MutableComponent getMessage(String message) {
|
||||
return ForgeI18n.getPattern(message) != null ? Component.translatable(message) : Component.literal(message);
|
||||
}
|
||||
|
||||
default void assertTrue(boolean value, Supplier<String> message) {
|
||||
if (!value)
|
||||
throw new GameTestAssertException(message.get());
|
||||
@@ -136,6 +150,14 @@ public interface IForgeGameTestHelper {
|
||||
return new IntFlag(name);
|
||||
}
|
||||
|
||||
default IntFlag intFlag(String name, int value) {
|
||||
return this.intFlag(name, (long) value);
|
||||
}
|
||||
|
||||
default IntFlag intFlag(String name, long value) {
|
||||
return Util.make(new IntFlag(name), flag -> flag.set(value));
|
||||
}
|
||||
|
||||
default BoolFlag boolFlag(String name) {
|
||||
return new BoolFlag(name);
|
||||
}
|
||||
@@ -184,6 +206,32 @@ public interface IForgeGameTestHelper {
|
||||
super.set(value);
|
||||
}
|
||||
|
||||
public void increment() {
|
||||
this.decrement(1L);
|
||||
}
|
||||
|
||||
public void increment(int amount) {
|
||||
this.decrement((long) amount);
|
||||
}
|
||||
|
||||
public void increment(long amount) {
|
||||
if (this.value != null)
|
||||
this.set(this.value + amount);
|
||||
}
|
||||
|
||||
public void decrement() {
|
||||
this.decrement(1L);
|
||||
}
|
||||
|
||||
public void decrement(int amount) {
|
||||
this.decrement((long) amount);
|
||||
}
|
||||
|
||||
public void decrement(long amount) {
|
||||
if (this.value != null)
|
||||
this.set(this.value - amount);
|
||||
}
|
||||
|
||||
public byte getByte() {
|
||||
return this.value == null ? -1 : this.value.byteValue();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user