Skip to content

Commit

Permalink
Update to 1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Aug 7, 2022
1 parent e949391 commit 2507bcd
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 75 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.3
loader_version=0.14.8
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.1
loader_version=0.14.9
# Mod Properties
mod_version=1.0.1
maven_group=mendedminecarts
archives_base_name=mendedminecarts
# Dependencies
fabric_version=0.57.0+1.18.2
fabric_version=0.59.0+1.19.2
50 changes: 25 additions & 25 deletions src/main/java/mendedminecarts/MendedMinecartsMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import mendedminecarts.settings.*;
import net.fabricmc.api.ModInitializer;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -41,25 +41,25 @@ public static <T extends Setting> T addSetting(T setting) {
return setting;
}

public static final BooleanSetting DISPLAY_CART_DATA_POS = new BooleanSetting("Position", false, new TranslatableText("mendedminecarts.display_cart_data.position.description"));
public static final BooleanSetting DISPLAY_CART_DATA_VELOCITY = new BooleanSetting("Velocity", false, new TranslatableText("mendedminecarts.display_cart_data.velocity.description"));
public static final BooleanSetting DISPLAY_CART_DATA_SPEED = new BooleanSetting("Speed", false, new TranslatableText("mendedminecarts.display_cart_data.speed.description"));
public static final BooleanSetting DISPLAY_CART_DATA_FILL_LEVEL = new BooleanSetting("FillLevel", false, new TranslatableText("mendedminecarts.display_cart_data.fill_level.description"));
public static final BooleanSetting DISPLAY_CART_DATA_ON_GROUND = new BooleanSetting("OnGround", false, new TranslatableText("mendedminecarts.display_cart_data.on_ground.description"));
public static final BooleanSetting DISPLAY_CART_DATA_IN_WATER = new BooleanSetting("InWater", false, new TranslatableText("mendedminecarts.display_cart_data.in_water.description"));
public static final BooleanSetting DISPLAY_CART_DATA_SLOWDOWN_RATE = new BooleanSetting("SlowdownRate", false, new TranslatableText("mendedminecarts.display_cart_data.slowdown_rate.description"));
public static final BooleanSetting DISPLAY_CART_DATA_ESTIMATED_DISTANCE = new BooleanSetting("EstimatedDistance", false, new TranslatableText("mendedminecarts.display_cart_data.estimated_distance.description"));
public static final BooleanSetting DISPLAY_CART_DATA_BOX = new BooleanSetting("BoundingBox", false, new TranslatableText("mendedminecarts.display_cart_data.bounding_box.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_PICKUP_VOLUME = new BooleanSetting("HopperPickupVolume", false, new TranslatableText("mendedminecarts.display_cart_data.hopper_pickup_box.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_EXTRACT_VOLUME = new BooleanSetting("HopperExtractVolume", false, new TranslatableText("mendedminecarts.display_cart_data.hopper_extract_volume.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_EXTRACT_BLOCK = new BooleanSetting("HopperExtractBlock", false, new TranslatableText("mendedminecarts.display_cart_data.hopper_extract_block.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_CART_LOCKED = new BooleanSetting("HopperLocked", false, new TranslatableText("mendedminecarts.display_cart_data.hopper_locked.description"));
public static final BooleanSetting DISPLAY_CART_DATA_WOBBLE = new BooleanSetting("Wobble", false, new TranslatableText("mendedminecarts.display_cart_data.wobble.description"));
public static final IntegerSetting DISPLAY_CART_DATA_PRECISION = new IntegerSetting("DataPrecision", 4, new TranslatableText("mendedminecarts.data_precision.description"));
public static final BooleanSetting DISPLAY_CART_DATA_POS = new BooleanSetting("Position", false, Text.translatable("mendedminecarts.display_cart_data.position.description"));
public static final BooleanSetting DISPLAY_CART_DATA_VELOCITY = new BooleanSetting("Velocity", false, Text.translatable("mendedminecarts.display_cart_data.velocity.description"));
public static final BooleanSetting DISPLAY_CART_DATA_SPEED = new BooleanSetting("Speed", false, Text.translatable("mendedminecarts.display_cart_data.speed.description"));
public static final BooleanSetting DISPLAY_CART_DATA_FILL_LEVEL = new BooleanSetting("FillLevel", false, Text.translatable("mendedminecarts.display_cart_data.fill_level.description"));
public static final BooleanSetting DISPLAY_CART_DATA_ON_GROUND = new BooleanSetting("OnGround", false, Text.translatable("mendedminecarts.display_cart_data.on_ground.description"));
public static final BooleanSetting DISPLAY_CART_DATA_IN_WATER = new BooleanSetting("InWater", false, Text.translatable("mendedminecarts.display_cart_data.in_water.description"));
public static final BooleanSetting DISPLAY_CART_DATA_SLOWDOWN_RATE = new BooleanSetting("SlowdownRate", false, Text.translatable("mendedminecarts.display_cart_data.slowdown_rate.description"));
public static final BooleanSetting DISPLAY_CART_DATA_ESTIMATED_DISTANCE = new BooleanSetting("EstimatedDistance", false, Text.translatable("mendedminecarts.display_cart_data.estimated_distance.description"));
public static final BooleanSetting DISPLAY_CART_DATA_BOX = new BooleanSetting("BoundingBox", false, Text.translatable("mendedminecarts.display_cart_data.bounding_box.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_PICKUP_VOLUME = new BooleanSetting("HopperPickupVolume", false, Text.translatable("mendedminecarts.display_cart_data.hopper_pickup_box.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_EXTRACT_VOLUME = new BooleanSetting("HopperExtractVolume", false, Text.translatable("mendedminecarts.display_cart_data.hopper_extract_volume.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_EXTRACT_BLOCK = new BooleanSetting("HopperExtractBlock", false, Text.translatable("mendedminecarts.display_cart_data.hopper_extract_block.description"));
public static final BooleanSetting DISPLAY_CART_DATA_HOPPER_CART_LOCKED = new BooleanSetting("HopperLocked", false, Text.translatable("mendedminecarts.display_cart_data.hopper_locked.description"));
public static final BooleanSetting DISPLAY_CART_DATA_WOBBLE = new BooleanSetting("Wobble", false, Text.translatable("mendedminecarts.display_cart_data.wobble.description"));
public static final IntegerSetting DISPLAY_CART_DATA_PRECISION = new IntegerSetting("DataPrecision", 4, Text.translatable("mendedminecarts.data_precision.description"));


public static final SettingGroup DISPLAY_CART_DATA = addSetting(
new SettingGroup("DisplayCartData", false, new TranslatableText("mendedminecarts.display_cart_data.description"))
new SettingGroup("DisplayCartData", false, Text.translatable("mendedminecarts.display_cart_data.description"))
.children(
DISPLAY_CART_DATA_BOX,
DISPLAY_CART_DATA_POS,
Expand All @@ -79,14 +79,14 @@ public static <T extends Setting> T addSetting(T setting) {
)
);

public static final BooleanSetting ACCURATE_CLIENT_MINECARTS = addSetting(new BooleanSetting("AccurateClientMinecarts", false, new TranslatableText("mendedminecarts.accurate_client_minecarts.description")));
public static final BooleanSetting NO_CLIENT_CART_INTERPOLATION = addSetting(new BooleanSetting("NoClientCartInterpolation", false, new TranslatableText("mendedminecarts.no_cart_interpolation.description")));
public static final BooleanSetting ALWAYS_SYNC_CART_POSITION = addSetting(new BooleanSetting("AlwaysSyncCartPosition", false, new TranslatableText("mendedminecarts.always_sync_cart_position.description")));
public static final DoubleSetting CART_SPEED = addSetting(new DoubleSetting("CartSpeed", 8d / 20d, new TranslatableText("mendedminecarts.custom_cart_speed.description"), 0d, 5000d));
public static final BooleanSetting DERAILING_CART_FIX = addSetting(new BooleanSetting("DerailingCartFix", false, new TranslatableText("mendedminecarts.derailing_cart_fix.description")));
// public static BooleanSetting DERAILING_CART_FIX_DEMO = new BooleanSetting("DerailingCartFixDemo", false, new TranslatableText("mendedminecarts.derailing_cart_fix_demo.description")));
public static final BooleanSetting ROTATE_CART_TO_RAIL = addSetting(new BooleanSetting("RotateCartToRail", false, new TranslatableText("mendedminecarts.rotate_cart_to_rail.description")));
public static final BooleanSetting EXPLODING_CART_FIX = addSetting(new BooleanSetting("ExplodeRailsFix", false, new TranslatableText("mendedminecarts.explode_rail_fix.description")));
public static final BooleanSetting ACCURATE_CLIENT_MINECARTS = addSetting(new BooleanSetting("AccurateClientMinecarts", false, Text.translatable("mendedminecarts.accurate_client_minecarts.description")));
public static final BooleanSetting NO_CLIENT_CART_INTERPOLATION = addSetting(new BooleanSetting("NoClientCartInterpolation", false, Text.translatable("mendedminecarts.no_cart_interpolation.description")));
public static final BooleanSetting ALWAYS_SYNC_CART_POSITION = addSetting(new BooleanSetting("AlwaysSyncCartPosition", false, Text.translatable("mendedminecarts.always_sync_cart_position.description")));
public static final DoubleSetting CART_SPEED = addSetting(new DoubleSetting("CartSpeed", 8d / 20d, Text.translatable("mendedminecarts.custom_cart_speed.description"), 0d, 5000d));
public static final BooleanSetting DERAILING_CART_FIX = addSetting(new BooleanSetting("DerailingCartFix", false, Text.translatable("mendedminecarts.derailing_cart_fix.description")));
// public static BooleanSetting DERAILING_CART_FIX_DEMO = new BooleanSetting("DerailingCartFixDemo", false, Text.translatable("mendedminecarts.derailing_cart_fix_demo.description")));
public static final BooleanSetting ROTATE_CART_TO_RAIL = addSetting(new BooleanSetting("RotateCartToRail", false, Text.translatable("mendedminecarts.rotate_cart_to_rail.description")));
public static final BooleanSetting EXPLODING_CART_FIX = addSetting(new BooleanSetting("ExplodeRailsFix", false, Text.translatable("mendedminecarts.explode_rail_fix.description")));

@Override
public void onInitialize() {
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/mendedminecarts/MendedMinecartsSettingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import mendedminecarts.settings.Setting;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;

/**
* Class for the /counter command which allows to use hoppers pointing into wool
Expand All @@ -27,15 +26,14 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
}


private static int listSettings(ServerCommandSource source)
{
source.sendFeedback(new TranslatableText("mendedminecarts.available_settings"), false);
source.sendFeedback(new TranslatableText(""), false);
private static int listSettings(ServerCommandSource source) {
source.sendFeedback(Text.translatable("mendedminecarts.available_settings"), false);
source.sendFeedback(Text.translatable(""), false);
for (Setting setting : MendedMinecartsMod.SETTINGS) {
source.sendFeedback(setting.asText(), false);
source.sendFeedback(setting.getDefault(), false);
source.sendFeedback(setting.getDescription(), false);
source.sendFeedback(new LiteralText(""), false);
source.sendFeedback(Text.literal(""), false);
}
return 1;
}
Expand Down
29 changes: 14 additions & 15 deletions src/main/java/mendedminecarts/MinecartDisplayData.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
Expand Down Expand Up @@ -68,9 +67,9 @@ private static int getComparatorOutput(StorageMinecartEntity inventory, NbtCompo

public Text getDisplayPosText() {
if (this.pos() == null) {
return new TranslatableText("mendedminecarts.pos").append(": ").append(new TranslatableText("mendedminecarts.unknown"));
return Text.translatable("mendedminecarts.pos").append(": ").append(Text.translatable("mendedminecarts.unknown"));
}
return new TranslatableText("mendedminecarts.pos").append(": ").append(formatVec3d(this.pos()));
return Text.translatable("mendedminecarts.pos").append(": ").append(formatVec3d(this.pos()));
}

public static String formatVec3d(Vec3d vec) {
Expand All @@ -79,28 +78,28 @@ public static String formatVec3d(Vec3d vec) {

public Text getDisplayVelocityText() {
if (this.velocity() == null) {
return new TranslatableText("mendedminecarts.velocity").append(": ").append(new TranslatableText("mendedminecarts.unknown"));
return Text.translatable("mendedminecarts.velocity").append(": ").append(Text.translatable("mendedminecarts.unknown"));
}
return new TranslatableText("mendedminecarts.velocity").append(": ").append(formatVec3d(this.velocity()));
return Text.translatable("mendedminecarts.velocity").append(": ").append(formatVec3d(this.velocity()));
}

public Text getDisplaySpeedText() {
if (this.velocity() == null) {
return new TranslatableText("mendedminecarts.speed").append(": ").append(new TranslatableText("mendedminecarts.unknown"));
return Text.translatable("mendedminecarts.speed").append(": ").append(Text.translatable("mendedminecarts.unknown"));
}
double speed = this.velocity().multiply(20d).length();
if (this.entity().hasPassengers()) {
speed *= 0.75;
}
speed = Math.min(speed, 20d * CartHelper.getMaxSpeed(this.entity()));
return new TranslatableText("mendedminecarts.speed").append(": ").append(String.format(getDoubleFormatString(), speed)).append(new TranslatableText("mendedminecarts.blocks_per_second"));
return Text.translatable("mendedminecarts.speed").append(": ").append(String.format(getDoubleFormatString(), speed)).append(Text.translatable("mendedminecarts.blocks_per_second"));
}

public Text getDisplayEstimatedDistanceText() {
if (this.velocity() == null) {
return new TranslatableText("mendedminecarts.estimated_distance").append(": ").append(new TranslatableText("mendedminecarts.unknown"));
return Text.translatable("mendedminecarts.estimated_distance").append(": ").append(Text.translatable("mendedminecarts.unknown"));
}
return new TranslatableText("mendedminecarts.estimated_distance").append(": ").append(String.format(getDoubleFormatString(), this.estimatedDistance())).append(new TranslatableText("mendedminecarts.blocks_distance"));
return Text.translatable("mendedminecarts.estimated_distance").append(": ").append(String.format(getDoubleFormatString(), this.estimatedDistance())).append(Text.translatable("mendedminecarts.blocks_distance"));
}

private static double estimateDistance(double velocity, AbstractMinecartEntity entity, double slowdownFactor) {
Expand Down Expand Up @@ -156,7 +155,7 @@ public Optional<Text> getFillLevel() {
if (this.fillLevel == -1) {
return Optional.empty();
}
return Optional.of(new TranslatableText("mendedminecarts.fill_level").append(": ").append(String.valueOf(this.fillLevel)));
return Optional.of(Text.translatable("mendedminecarts.fill_level").append(": ").append(String.valueOf(this.fillLevel)));
}

public ArrayList<Text> getInfoTexts() {
Expand All @@ -175,22 +174,22 @@ public ArrayList<Text> getInfoTexts() {
infoTexts.add(fillLevelText.get());
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_SLOWDOWN_RATE.isEnabled() && this.velocity() != null && MendedMinecartsMod.ACCURATE_CLIENT_MINECARTS.isEnabled()) {
infoTexts.add(new TranslatableText("mendedminecarts.slowdown_rate").append(": ").append(String.format(getDoubleFormatString(), this.slowdownFactor())));
infoTexts.add(Text.translatable("mendedminecarts.slowdown_rate").append(": ").append(String.format(getDoubleFormatString(), this.slowdownFactor())));
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_ESTIMATED_DISTANCE.isEnabled() && this.velocity() != null) {
infoTexts.add(this.getDisplayEstimatedDistanceText());
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_IN_WATER.isEnabled() && MendedMinecartsMod.ACCURATE_CLIENT_MINECARTS.isEnabled()) {
infoTexts.add(new TranslatableText("mendedminecarts.in_water").append(": ").append(String.valueOf(this.inWater())));
infoTexts.add(Text.translatable("mendedminecarts.in_water").append(": ").append(String.valueOf(this.inWater())));
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_ON_GROUND.isEnabled()) {
infoTexts.add(new TranslatableText("mendedminecarts.onGround").append(": ").append(String.valueOf(this.onGround())));
infoTexts.add(Text.translatable("mendedminecarts.onGround").append(": ").append(String.valueOf(this.onGround())));
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_WOBBLE.isEnabled()) {
infoTexts.add(new TranslatableText("mendedminecarts.wobble").append(": ").append(String.format(getDoubleFormatString(), this.wobble())));
infoTexts.add(Text.translatable("mendedminecarts.wobble").append(": ").append(String.format(getDoubleFormatString(), this.wobble())));
}
if (MendedMinecartsMod.DISPLAY_CART_DATA_HOPPER_CART_LOCKED.isEnabled() && this.entity() instanceof HopperMinecartEntity) {
infoTexts.add(new TranslatableText("mendedminecarts.hopper_locked").append(": ").append(String.valueOf(this.hopperLocked())));
infoTexts.add(Text.translatable("mendedminecarts.hopper_locked").append(": ").append(String.valueOf(this.hopperLocked())));
}


Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mendedminecarts/mixin/CommandManagerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.brigadier.CommandDispatcher;
import mendedminecarts.MendedMinecartsSettingCommand;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -20,7 +21,7 @@ public abstract class CommandManagerMixin
private CommandDispatcher<ServerCommandSource> dispatcher;

@Inject(method = "<init>", at = @At("RETURN"))
private void registerCommands(CommandManager.RegistrationEnvironment environment, CallbackInfo ci) {
private void registerCommands(CommandManager.RegistrationEnvironment environment, CommandRegistryAccess commandRegistryAccess, CallbackInfo ci) {
MendedMinecartsSettingCommand.register(this.dispatcher);
}
}
Loading

0 comments on commit 2507bcd

Please sign in to comment.