Skip to content

Commit

Permalink
Fix incorrect saving, add german translation (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jun 24, 2023
1 parent 5f94c08 commit d17eeff
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 10 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation include('xyz.nucleoid:server-translations-api:2.0.0+1.20')
modImplementation include('eu.pb4:polymer-core:0.5.0+1.20')
modImplementation include('eu.pb4:polymer-virtual-entity:0.5.0+1.20')
modImplementation include('eu.pb4:polymer-resource-pack:0.5.0+1.20')
modLocalRuntime 'eu.pb4:polymer-autohost:0.5.0+1.20'
modImplementation include('eu.pb4:polymer-core:0.5.3+1.20.1')
modImplementation include('eu.pb4:polymer-virtual-entity:0.5.3+1.20.1')
modImplementation include('eu.pb4:polymer-resource-pack:0.5.3+1.20.1')
modLocalRuntime 'eu.pb4:polymer-autohost:0.5.3+1.20.1'
modImplementation include("eu.pb4:sgui:1.2.2+1.20")
modImplementation include("eu.pb4:placeholder-api:2.1.1+1.20")
modImplementation include("eu.pb4:common-protection-api:1.0.0")
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G

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

# Mod Properties
mod_version = 1.3.1+1.20
mod_version = 1.3.2+1.20.1
maven_group = eu.pb4
archives_base_name = universal_shops

# Dependencies
fabric_version=0.83.0+1.20
fabric_version=0.83.0+1.20.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

import java.util.ArrayList;
import java.util.List;

public abstract class SingleGenericShopGui extends BaseShopGui {
Expand Down Expand Up @@ -113,7 +114,8 @@ protected void updateValueDisplays() {
try {
tooltip = item.getTooltip(this.player, TooltipContext.Default.BASIC);
} catch (Throwable e) {
tooltip = List.of(item.getName());
tooltip = new ArrayList<>();
tooltip.add(item.getName());
}

secondStack = new GuiElementBuilder(Items.BARRIER).setName(tooltip.remove(0)).setLore(tooltip).asStack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.InventoryChangedListener;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand All @@ -40,7 +41,7 @@

import java.util.stream.IntStream;

public class TradeShopBlockEntity extends BlockEntity implements RemappedInventory, SidedInventory {
public class TradeShopBlockEntity extends BlockEntity implements RemappedInventory, SidedInventory, InventoryChangedListener {
private final TextDisplayElement textDisplay = new TextDisplayElement();
private final ItemDisplayElement itemDisplay = new ItemDisplayElement();
@Nullable
Expand Down Expand Up @@ -285,6 +286,11 @@ public boolean canExtract(int slot, ItemStack stack, Direction dir) {
return this.allowHoppers;
}

@Override
public void onInventoryChanged(Inventory sender) {
this.markDirty();
}

public enum HologramMode {
FULL,
ICON,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public PriceHandler createInitial(TradeShopBlockEntity blockEntity) {
protected SingleItem(PriceHandler.Definition creator, ItemStack initialValue, TradeShopBlockEntity blockEntity) {
super(creator, blockEntity);
this.value = initialValue;
this.currencyInventory.addListener(blockEntity);
}

@Override
Expand Down
71 changes: 71 additions & 0 deletions src/main/resources/data/universal_shops/lang/de_de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"text.universal_shops.about.version": "Version: %s",
"text.universal_shops.about.contributors": "Helfer",

"gui.universal_shops.stock_left": "Übriger Vorrat: %s",
"gui.universal_shops.max_stock_left": "Du kannst erwerben: %s",

"gui.universal_shops.shop.price_info": "Prreis: %s",
"gui.universal_shops.shop.stock_info": "Vorrat: %s",
"gui.universal_shops.shop.currency_storage": "Währungslager",
"gui.universal_shops.shop.settings": "Shop Einstellungen",
"gui.universal_shops.shop.title": "%s's Shop",
"gui.universal_shops.shop.title.admin": "Admin Shop",

"gui.universal_shops.click_to_buy": "Klicke auf den Gegenstand um ihn zu kaufen.",
"gui.universal_shops.out_of_stock": "Ausverkauft!",
"gui.universal_shops.setup.cant_change_pricehandler.1": "Einstellung kann nicht geändert werden!",
"gui.universal_shops.setup.cant_change_pricehandler.2": "Stelle sicher, dass alle Währung entnommen wurde!",
"gui.universal_shops.setup.click_to_change_mode.1": "Klicke um Modus zu wechseln",
"gui.universal_shops.setup.click_to_change_mode.2": "Halte UMSCHALT um zurück zu wechseln",
"gui.universal_shops.setup.price_type": "Preistyp: %s",
"gui.universal_shops.setup.stock_type": "Vorratstyp: %s",
"gui.universal_shops.setup.hologram": "Hologramm: %s",
"gui.universal_shops.setup.allow_hoppers": "Erlaube Trichter: %s",
"gui.universal_shops.setup.virtual_balance.currency": "Währung: %s",
"gui.universal_shops.setup.virtual_balance.value": "Preis: %s",
"gui.universal_shops.modifying_item.title": "Gegenstand bearbeiten",
"gui.universal_shops.modifying_item.stack_size": "Setze Menge: %s",
"gui.universal_shops.modifying_item.stack_decrease": "Verringere Gegenstand Menge",
"gui.universal_shops.modifying_item.stack_increase": "Erhöhe Gegenstand Menge",
"gui.universal_shops.modifying_item.change_item": "Ändere Gegenstand",
"gui.universal_shops.modifying_item.change_item.title": "Wähle Gegenstand",
"gui.universal_shops.virtual_balance.collect": "Geld einsammeln",
"gui.universal_shops.virtual_balance.stored": "Gelagert: %s",
"gui.universal_shops.virtual_balance.cost.title": "Preis ändern",
"gui.universal_shops.virtual_balance.cost.invalid_input": "Inkorrekte Eingabe!",
"gui.universal_shops.virtual_balance.settings.title": "Währungseinstellungen",
"gui.universal_shops.virtual_balance.selected_account": "Aktiver Account: %s",
"gui.universal_shops.virtual_balance.balance": "Kontostand: %s",

"text.universal_shops.prefix": "Shop",
"text.universal_shops.not_enough_shop_storage_space": "Kein Platz im Shop!",
"text.universal_shops.not_enough_currency": "Das kannst du dir nicht leisten!",
"text.universal_shops.not_enough_inventory_space": "Dafür hast du keinen Platz!",
"text.universal_shops.not_enough_stack_space": "Deine Maus ist voll!",
"text.universal_shops.not_enough_stock": "Der Vorrat ist aufgebraucht!",
"text.universal_shops.stock_missing": "Ausverkauft!",
"text.universal_shops.not_set": "Nicht festgelegt!",
"text.universal_shops.requires_setup_by_owner": "Dieser Shop ist nicht konfiguriert!",
"text.universal_shops.price": "Preis: %s",
"text.universal_shops.select_anything": "Wähle irgendetwas",
"text.universal_shops.free": "Kostenlos",
"text.universal_shops.configure": "Konfigurieren...",
"text.universal_shops.virtual_money.cant_store": "Kontostand kann nicht gespeichert werden!",
"text.universal_shops.virtual_money.not_enough_money": "Transaktion fehlgeschlagen! %s",
"text.universal_shops.virtual_money.no_account": "Du hast keinen erforderlichen Account!",

"pricehandler.universal_shops.free": "Kostenlos",
"pricehandler.universal_shops.items": "Gegenstand",
"pricehandler.universal_shops.virtual_balance": "Kontostand",

"stockhandler.universal_shops.single_item": "Spezifischer Gegenstand",
"stockhandler.universal_shops.selected_item": "Jeder Inventar Slot",

"hologram_type.universal_shops.full": "Komplett",
"hologram_type.universal_shops.icon": "Nur Ikone",
"hologram_type.universal_shops.disabled": "Deaktiviert",

"block.universal_shops.trade_block": "Handels Shop",
"block.universal_shops.admin_trade_block": "Admin Handels Shop"
}

0 comments on commit d17eeff

Please sign in to comment.