mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 18:45:09 +00:00
Fix forced chunks never being ticked by the server (#10325)
This commit is contained in:
1 parent
464483db5b
commit
79efe2ac36
5 files changed
+182
-4
No files matched your search
@@ -13,6 +13,9 @@ import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -46,14 +49,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());
|
||||
@@ -180,6 +194,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);
|
||||
}
|
||||
@@ -258,6 +280,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