It's a long road, to 1.19
This commit is contained in:
@@ -2,7 +2,6 @@ package me.hypherionmc.craterlib.client.gui.widgets;
|
||||
|
||||
import net.minecraft.client.gui.components.AbstractSliderButton;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
/**
|
||||
* A custom slider widget used for Time. Mostly used by the Hyper Lighting Smoke Machine
|
||||
@@ -35,9 +34,9 @@ public class TimeSliderWidget extends AbstractSliderButton {
|
||||
if (this.value * this.maxValue >= 1200) {
|
||||
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
||||
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
||||
return new TextComponent(minutes + " " + appendString + doSeconds);
|
||||
return Component.literal(minutes + " " + appendString + doSeconds);
|
||||
} else {
|
||||
return new TextComponent(seconds + " Seconds");
|
||||
return Component.literal(seconds + " Seconds");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -94,7 +94,7 @@ public class DyableWaterBottle extends DyeItem implements ItemDyable {
|
||||
playerEntity.getInventory().add(new ItemStack(Items.GLASS_BOTTLE));
|
||||
}
|
||||
}
|
||||
level.gameEvent(user, GameEvent.DRINKING_FINISH, user.getOnPos());
|
||||
level.gameEvent(user, GameEvent.DRINK, user.getOnPos());
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@@ -1,28 +1,6 @@
|
||||
package me.hypherionmc.craterlib.common.network;
|
||||
|
||||
import me.hypherionmc.craterlib.Constants;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
// TODO: FINISH NETWORK IMPLEMENTATION
|
||||
public interface BaseNetworkPacket {
|
||||
|
||||
Map<String, Handler<?>> PACKETS = Util.make(new HashMap<>(), map -> {
|
||||
Constants.LOG.info("Registering Config Packets");
|
||||
});
|
||||
|
||||
void write(FriendlyByteBuf buf);
|
||||
|
||||
void handle(Level level);
|
||||
|
||||
record Handler<T extends BaseNetworkPacket>(Class<T> clazz, BiConsumer<T, FriendlyByteBuf> write,
|
||||
Function<FriendlyByteBuf, T> read,
|
||||
BiConsumer<T, Level> handle) {
|
||||
}
|
||||
}
|
||||
|
@@ -2,25 +2,23 @@ package me.hypherionmc.craterlib.util;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
|
||||
public class LangUtils {
|
||||
|
||||
public static Component getTooltipTitle(String key) {
|
||||
return new TextComponent(ChatFormatting.YELLOW + new TranslatableComponent(key).getString());
|
||||
return Component.literal(ChatFormatting.YELLOW + Component.translatable(key).getString());
|
||||
}
|
||||
|
||||
public static String resolveTranslation(String key) {
|
||||
return new TranslatableComponent(key).getString();
|
||||
return Component.translatable(key).getString();
|
||||
}
|
||||
|
||||
public static Component getTranslation(String key) {
|
||||
return new TranslatableComponent(key);
|
||||
return Component.translatable(key);
|
||||
}
|
||||
|
||||
public static Component makeComponent(String text) {
|
||||
return new TranslatableComponent(text);
|
||||
return Component.translatable(text);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ package me.hypherionmc.craterlib.util;
|
||||
import com.mojang.math.Vector4f;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public class RenderUtils {
|
||||
|
||||
@@ -20,7 +19,7 @@ public class RenderUtils {
|
||||
amount = amount / 81;
|
||||
capacity = capacity / 81;
|
||||
String text = "" + (int) (((float) amount / capacity) * 100);
|
||||
return amount > 0 ? new TextComponent(ChatFormatting.AQUA + text + "%") : new TextComponent(text + "%");
|
||||
return amount > 0 ? Component.literal(ChatFormatting.AQUA + text + "%") : Component.literal(text + "%");
|
||||
}
|
||||
|
||||
public static Component getTimeDisplayString(double value) {
|
||||
@@ -29,9 +28,9 @@ public class RenderUtils {
|
||||
if (seconds >= 60) {
|
||||
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
||||
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
||||
return new TextComponent(minutes + " " + appendString + doSeconds);
|
||||
return Component.literal(minutes + " " + appendString + doSeconds);
|
||||
} else {
|
||||
return new TextComponent(seconds + " Seconds");
|
||||
return Component.literal(seconds + " Seconds");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user