Skip to content

Commit

Permalink
Update to Java Edition 1.20.2 (#37)
Browse files Browse the repository at this point in the history
* Java Edition 1.20.2

* Temporary fix for "gray-ish" text color in input GUIs

Either we wait for setGlow() from sgui or move to something better
  • Loading branch information
nahkd123 authored Sep 21, 2023
1 parent 14daa2c commit 5cb765e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ public ScoreboardEconomyAdapter(Scoreboard scoreboard, String objectiveName, int
public Scoreboard getScoreboard() { return scoreboard; }

public ScoreboardObjective getObjective() {
if (!scoreboard.containsObjective(objectiveName)) {
var objective = scoreboard.getNullableObjective(objectiveName);

if (objective == null) {
return scoreboard.addObjective(
objectiveName,
ScoreboardCriterion.DUMMY,
Text.literal(objectiveName),
RenderType.INTEGER);
} else {
return scoreboard.getObjective(objectiveName);
return objective;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ public ScoreboardObjective getObjective(Product product) {
if (!str.startsWith(PREFIX)) return null;

var objectiveName = str.substring(PREFIX.length());
if (scoreboard.containsObjective(objectiveName)) return scoreboard.getObjective(objectiveName);
return scoreboard.addObjective(objectiveName,
ScoreboardCriterion.DUMMY, Text.literal(objectiveName),
RenderType.INTEGER);
var objective = scoreboard.getNullableObjective(objectiveName);

if (objective == null) {
return scoreboard.addObjective(
objectiveName,
ScoreboardCriterion.DUMMY,
Text.literal(objectiveName),
RenderType.INTEGER);
} else {
return objective;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public OfferCustomPriceInput(ServerPlayerEntity player, OfferPriceConfigureMenu
super(player);
this.menu = menu;

setSignType(Blocks.DARK_OAK_SIGN);
setColor(DyeColor.WHITE);
setSignType(Blocks.ACACIA_WALL_SIGN);
setColor(DyeColor.BLACK);
setLine(0, Text.empty());
setLine(1, Translations.SignInputs.Separator);
setLine(2, Translations.SignInputs.PriceInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public OfferInstantBuyAmountInput(ServerPlayerEntity player, InstantBuyMenu menu
super(player);
this.menu = menu;

setSignType(Blocks.DARK_OAK_SIGN);
setColor(DyeColor.WHITE);
setSignType(Blocks.ACACIA_WALL_SIGN);
setColor(DyeColor.BLACK);
setLine(0, Text.empty());
setLine(1, Translations.SignInputs.Separator);
setLine(2, Translations.SignInputs.AmountInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public OfferSelectCustomAmountInput(ServerPlayerEntity player, OfferAmountConfig
super(player);
this.menu = menu;

setSignType(Blocks.DARK_OAK_SIGN);
setColor(DyeColor.WHITE);
setSignType(Blocks.ACACIA_WALL_SIGN);
setColor(DyeColor.BLACK);
setLine(0, Text.empty());
setLine(1, Translations.SignInputs.Separator);
setLine(2, Translations.SignInputs.AmountInput);
Expand Down
14 changes: 7 additions & 7 deletions fabric/src/main/java/stonks/fabric/translation/Translations.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ public static final class ConfirmOffer {
}
}
public static final class SignInputs {
public static final Text Separator = translatableWithFallback("stonks.signInput.separator", "--------");
public static final Text PriceInput = translatableWithFallback("stonks.signInput.priceInput", "Specify your price per unit");
public static final Text AmountInput = translatableWithFallback("stonks.signInput.amountInput", "Specify your amount");
public static final Text CurrentBuyTarget(int amount, Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentBuyTargetWithAmount", "You're buying %sx %s", amount, product.getProductName()); }
public static final Text CurrentSellTarget(int amount, Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentSellTargetWithAmount", "You're selling %sx %s", amount, product.getProductName()); }
public static final Text CurrentBuyTarget(Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentBuyTarget", "You're buying %s", product.getProductName()); }
public static final Text CurrentSellTarget(Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentSellTarget", "You're selling %s", product.getProductName()); }
public static final Text Separator = translatableWithFallback("stonks.signInput.separator", "\u00a7f--------");
public static final Text PriceInput = translatableWithFallback("stonks.signInput.priceInput", "\u00a7fSpecify your price per unit");
public static final Text AmountInput = translatableWithFallback("stonks.signInput.amountInput", "\u00a7fSpecify your amount");
public static final Text CurrentBuyTarget(int amount, Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentBuyTargetWithAmount", "\u00a7fYou're buying %sx %s", amount, product.getProductName()); }
public static final Text CurrentSellTarget(int amount, Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentSellTargetWithAmount", "\u00a7fYou're selling %sx %s", amount, product.getProductName()); }
public static final Text CurrentBuyTarget(Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentBuyTarget", "\u00a7fYou're buying %s", product.getProductName()); }
public static final Text CurrentSellTarget(Product product) { return translatableWithFallback("stonks.signInput.priceInput.currentSellTarget", "\u00a7fYou're selling %s", product.getProductName()); }
}
public static final class Messages {
public static final Text OfferClaimFailed = translatableWithFallback("stonks.message.offerClaimFailed", "\u00a7cAn error occured. Claim failed!");
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Stonks
stonks_version=2.0.0+1.20.1
stonks_version=2.0.0+1.20.2
maven_group=me.nahkd

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.9
loader_version=0.14.21
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
loader_version=0.14.22

# Spigot Plugin Dependencies
# <Not available yet>

# Fabric Mod Dependencies
nahara_toolkit_version=b6ff2e287b
nahara_modkit_version=c4ee4a7e82
fabric_version=0.85.0+1.20.1
nahara_modkit_version=d1f7cabf9b
fabric_version=0.89.0+1.20.2
common_economy_version=1.1.1
sgui_version=1.2.2+1.20
sgui_version=1.3.0+1.20.2

0 comments on commit 5cb765e

Please sign in to comment.