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.client.gui.components.AbstractSliderButton;
|
||||||
import net.minecraft.network.chat.Component;
|
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
|
* 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) {
|
if (this.value * this.maxValue >= 1200) {
|
||||||
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
||||||
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
||||||
return new TextComponent(minutes + " " + appendString + doSeconds);
|
return Component.literal(minutes + " " + appendString + doSeconds);
|
||||||
} else {
|
} 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));
|
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;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,28 +1,6 @@
|
|||||||
package me.hypherionmc.craterlib.common.network;
|
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
|
// TODO: FINISH NETWORK IMPLEMENTATION
|
||||||
public interface BaseNetworkPacket {
|
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.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
|
||||||
|
|
||||||
public class LangUtils {
|
public class LangUtils {
|
||||||
|
|
||||||
public static Component getTooltipTitle(String key) {
|
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) {
|
public static String resolveTranslation(String key) {
|
||||||
return new TranslatableComponent(key).getString();
|
return Component.translatable(key).getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getTranslation(String key) {
|
public static Component getTranslation(String key) {
|
||||||
return new TranslatableComponent(key);
|
return Component.translatable(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component makeComponent(String text) {
|
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 com.mojang.math.Vector4f;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
|
||||||
|
|
||||||
public class RenderUtils {
|
public class RenderUtils {
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ public class RenderUtils {
|
|||||||
amount = amount / 81;
|
amount = amount / 81;
|
||||||
capacity = capacity / 81;
|
capacity = capacity / 81;
|
||||||
String text = "" + (int) (((float) amount / capacity) * 100);
|
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) {
|
public static Component getTimeDisplayString(double value) {
|
||||||
@@ -29,9 +28,9 @@ public class RenderUtils {
|
|||||||
if (seconds >= 60) {
|
if (seconds >= 60) {
|
||||||
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
||||||
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
||||||
return new TextComponent(minutes + " " + appendString + doSeconds);
|
return Component.literal(minutes + " " + appendString + doSeconds);
|
||||||
} else {
|
} else {
|
||||||
return new TextComponent(seconds + " Seconds");
|
return Component.literal(seconds + " Seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'idea'
|
id 'idea'
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import net.minecraft.client.gui.screens.Screen;
|
|||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -31,7 +31,7 @@ public class FluidStackWidget extends AbstractWidget {
|
|||||||
private final String toolTipTitle;
|
private final String toolTipTitle;
|
||||||
|
|
||||||
public FluidStackWidget(Screen displayOn, Supplier<FluidTank> getFluid, int pX, int pY, int pWidth, int pHeight, String tooltipTitle) {
|
public FluidStackWidget(Screen displayOn, Supplier<FluidTank> getFluid, int pX, int pY, int pWidth, int pHeight, String tooltipTitle) {
|
||||||
super(pX, pY, pWidth, pHeight, TextComponent.EMPTY);
|
super(pX, pY, pWidth, pHeight, Component.empty());
|
||||||
this.displayOn = displayOn;
|
this.displayOn = displayOn;
|
||||||
this.getFluid = getFluid;
|
this.getFluid = getFluid;
|
||||||
this.toolTipTitle = tooltipTitle;
|
this.toolTipTitle = tooltipTitle;
|
||||||
@@ -85,7 +85,7 @@ public class FluidStackWidget extends AbstractWidget {
|
|||||||
@Override
|
@Override
|
||||||
public void renderToolTip(PoseStack poseStack, int mouseX, int mouseY) {
|
public void renderToolTip(PoseStack poseStack, int mouseX, int mouseY) {
|
||||||
if (this.visible && this.isFocused() && isHoveredOrFocused()) {
|
if (this.visible && this.isFocused() && isHoveredOrFocused()) {
|
||||||
displayOn.renderTooltip(poseStack, Arrays.asList(LangUtils.getTooltipTitle(toolTipTitle), new TextComponent((int) (((float) this.getFluid.get().getAmount() / this.getFluid.get().getCapacity()) * 100) + "%")), Optional.empty(), mouseX, mouseY);
|
displayOn.renderTooltip(poseStack, Arrays.asList(LangUtils.getTooltipTitle(toolTipTitle), Component.literal((int) (((float) this.getFluid.get().getAmount() / this.getFluid.get().getCapacity()) * 100) + "%")), Optional.empty(), mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
|
|||||||
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
|
import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
|
||||||
import net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions;
|
import net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions;
|
||||||
import net.fabricmc.fabric.api.transfer.v1.storage.StorageView;
|
import net.fabricmc.fabric.api.transfer.v1.storage.StorageView;
|
||||||
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleViewIterator;
|
|
||||||
import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
|
import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
@@ -61,6 +60,12 @@ public class FluidTank implements Storage<FluidVariant>, StorageView<FluidVarian
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<StorageView<FluidVariant>> iterator() {
|
||||||
|
// TODO: FIX THIS!
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isResourceBlank() {
|
public boolean isResourceBlank() {
|
||||||
return fluid.isBlank();
|
return fluid.isBlank();
|
||||||
@@ -81,11 +86,6 @@ public class FluidTank implements Storage<FluidVariant>, StorageView<FluidVarian
|
|||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<StorageView<FluidVariant>> iterator(TransactionContext transaction) {
|
|
||||||
return SingleViewIterator.create(this, transaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CompoundTag writeNbt(CompoundTag compound) {
|
public CompoundTag writeNbt(CompoundTag compound) {
|
||||||
FluidUtils.putFluid(compound, "fluid", getResource());
|
FluidUtils.putFluid(compound, "fluid", getResource());
|
||||||
compound.putLong("amt", level);
|
compound.putLong("amt", level);
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
"name": "CraterLib",
|
"name": "CraterLib",
|
||||||
"description": "A library mod used by HypherionSA's Mods",
|
"description": "A library mod used by HypherionSA's Mods",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Me!"
|
"HypherionSA",
|
||||||
|
"Misha"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://fabricmc.net/",
|
"homepage": "https://fabricmc.net/",
|
||||||
@@ -28,12 +29,9 @@
|
|||||||
],
|
],
|
||||||
"accessWidener": "craterlib.aw",
|
"accessWidener": "craterlib.aw",
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.12",
|
"fabricloader": ">=0.14",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.18.x",
|
"minecraft": "1.19.x",
|
||||||
"java": ">=17"
|
"java": ">=17"
|
||||||
},
|
|
||||||
"suggests": {
|
|
||||||
"another-mod": "*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
modLoader = "javafml"
|
modLoader = "javafml"
|
||||||
loaderVersion = "[40,)"
|
loaderVersion = "[41,)"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/"
|
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/"
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ A library mod used by HypherionSA's Mods
|
|||||||
[[dependencies.craterlib]]
|
[[dependencies.craterlib]]
|
||||||
modId = "forge"
|
modId = "forge"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[40,)"
|
versionRange = "[41,)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
[[dependencies.craterlib]]
|
[[dependencies.craterlib]]
|
||||||
modId = "minecraft"
|
modId = "minecraft"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[1.18.2,1.19)"
|
versionRange = "[1.19,1.20)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'com.matyrobbrt.mc.registrationutils' version '0.2.6'
|
id 'com.matyrobbrt.mc.registrationutils' version '1.19-1.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
registrationUtils {
|
registrationUtils {
|
||||||
@@ -15,7 +15,7 @@ registrationUtils {
|
|||||||
subprojects {
|
subprojects {
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
isSnapshot: false
|
isSnapshot = false
|
||||||
}
|
}
|
||||||
|
|
||||||
def version_base = "${project.version_major}.${project.version_minor}"
|
def version_base = "${project.version_major}.${project.version_minor}"
|
||||||
|
@@ -1,22 +1,22 @@
|
|||||||
# Project
|
# Project
|
||||||
version_major=1
|
version_major=1
|
||||||
version_minor=0
|
version_minor=0
|
||||||
version_patch=5
|
version_patch=0
|
||||||
group=me.hypherionmc.craterlib
|
group=me.hypherionmc.craterlib
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
minecraft_version=1.18.2
|
minecraft_version=1.19
|
||||||
common_runs_enabled=false
|
common_runs_enabled=false
|
||||||
common_client_run_name=Common Client
|
common_client_run_name=Common Client
|
||||||
common_server_run_name=Common Server
|
common_server_run_name=Common Server
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
forge_version=40.1.0
|
forge_version=41.0.16
|
||||||
forge_ats_enabled=true
|
forge_ats_enabled=true
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
fabric_version=0.51.1+1.18.2
|
fabric_version=0.55.3+1.19
|
||||||
fabric_loader_version=0.13.3
|
fabric_loader_version=0.14.7
|
||||||
|
|
||||||
# Mod options
|
# Mod options
|
||||||
mod_name=CraterLib
|
mod_name=CraterLib
|
||||||
|
Reference in New Issue
Block a user