Skip to content

Commit

Permalink
Some fixes and polish translation update
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Oct 31, 2022
1 parent de8dbd3 commit cf729f1
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 34 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ dependencies {

modImplementation include("eu.pb4:sgui:1.1.5+1.19.1")
modImplementation include("eu.pb4:hologram-api:0.2.2+1.19")
modImplementation include("eu.pb4:placeholder-api:2.0.0-beta.7+1.19")
modImplementation include("eu.pb4:polymer:0.2.16+1.19.2")
modImplementation include("eu.pb4:placeholder-api:2.0.0-pre.1+1.19.2")
modImplementation include("eu.pb4:polymer:0.2.17+1.19.2")
modImplementation include("eu.pb4:common-protection-api:1.0.0")
modImplementation include("fr.catcore:server-translations-api:1.4.17+1.19.2")
modImplementation include("fr.catcore:server-translations-api:1.4.18+1.19.2")
modImplementation include("me.lucko:fabric-permissions-api:0.1-SNAPSHOT")

modCompileOnly "dev.emi:trinkets:3.0.4"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fabric_version=0.60.0+1.19.2


# Mod Properties
mod_version = 2.1.2+1.19.2
mod_version = 2.1.3+1.19.2
maven_group = eu.pb4
archives_base_name = graves

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/eu/pb4/graves/other/GraveUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,13 @@ public static boolean hasSkippedEnchantment(ItemStack stack) {
public static void teleportToGrave(ServerPlayerEntity player, Grave grave, BooleanConsumer finishedCallback) {
var config = ConfigManager.getConfig();
var pos = grave.getLocation();
var movingText = config.configData.allowMovingDuringTeleportation ? config.teleportTimerAllowMovingText : config.teleportTimerText;
var movingText = config.configData.allowMovingDuringTeleportation || player.isCreative() ? config.teleportTimerAllowMovingText : config.teleportTimerText;

MinecraftServer server = Objects.requireNonNull(player.getServer(), "server; running on client?");
ServerWorld world = server.getWorld(RegistryKey.of(Registry.WORLD_KEY, pos.world()));
if (world != null) {
player.sendMessage(Placeholders.parseText(movingText, Placeholders.PREDEFINED_PLACEHOLDER_PATTERN, Map.of("time", Text.of(Integer.toString(config.configData.teleportTime)))));
player.sendMessage(Placeholders.parseText(movingText, Placeholders.PREDEFINED_PLACEHOLDER_PATTERN, Map.of("time",
Text.of(player.isCreative() ? "0" : Integer.toString(config.configData.teleportTime)))));

GravesMod.DO_ON_NEXT_TICK.add(new Runnable() {
double x = pos.x();
Expand All @@ -238,7 +239,7 @@ public static void teleportToGrave(ServerPlayerEntity player, Grave grave, Boole
final Vec3d currentPosition = player.getPos();

// Non-final to allow for decrementing.
int teleportTicks = config.configData.teleportTime * 20;
int teleportTicks = player.isCreative() ? 1 : config.configData.teleportTime * 20;
int invulnerableTicks = config.configData.invincibleTime * 20;

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/pb4/graves/registry/GraveBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public boolean canAddPlayer(ServerPlayerEntity player) {
if (texts.size() != self.hologram.getElements().size()) {
self.hologram.clearElements();
for (Text text : texts) {
if (text.getContent() == TextContent.EMPTY) {
if (text.getContent() == TextContent.EMPTY && text.getSiblings().size() == 0) {
self.hologram.addElement(new SpacingHologramElement(0.28));
} else {
self.hologram.addText(text);
Expand All @@ -235,7 +235,7 @@ public boolean canAddPlayer(ServerPlayerEntity player) {
} else {
int x = 0;
for (Text text : texts) {
if (text.getContent() == TextContent.EMPTY) {
if (text.getContent() == TextContent.EMPTY && text.getSiblings().size() == 0) {
self.hologram.setElement(x, new SpacingHologramElement(0.28));
} else {
self.hologram.setText(x, text);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/eu/pb4/graves/registry/VisualGraveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void onClose() {
this.getLine(2),
this.getLine(3)
};
grave.markDirty();
}
};
sign.setSignType(Blocks.BIRCH_SIGN);
Expand Down
52 changes: 28 additions & 24 deletions src/main/java/eu/pb4/graves/registry/VisualGraveBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,57 +117,61 @@ public static <T extends BlockEntity> void tick(World world, BlockPos pos, Block

Config config = ConfigManager.getConfig();

Map<String, Text> placeholders = self.visualData.getPlaceholders(self.world.getServer());

if (self.textOverrides != self.deltaTextOverride && !self.textOverrides.equals(self.deltaTextOverride)) {
self.updateForAllPlayers();
self.deltaTextOverride = self.textOverrides.clone();
}

if (config.configData.hologram) {
if (self.hologram == null) {
self.hologram = new WorldHologram((ServerWorld) world, new Vec3d(pos.getX(), pos.getY(), pos.getZ()).add(0.5, config.configData.hologramOffset, 0.5)){
self.hologram = new WorldHologram((ServerWorld) world, new Vec3d(pos.getX(), pos.getY(), pos.getZ()).add(0.5, config.configData.hologramOffset, 0.5)) {
@Override
public boolean canAddPlayer(ServerPlayerEntity player) {
return !config.configData.hologramDisplayIfOnClient ? !GraveNetworking.canReceive(player.networkHandler) : true;
return config.configData.hologramDisplayIfOnClient || !GraveNetworking.canReceive(player.networkHandler);
}
};
self.hologram.show();
}

boolean dirty = false;
List<Text> texts = new ArrayList<>();

if (self.textOverrides != null) {
for (Text text : self.textOverrides) {
if (text.getContent() == TextContent.EMPTY) {
texts.add(text);
} else {
texts.add(Text.empty());
if ((self.deltaTextOverride == null || !Arrays.equals(self.textOverrides, self.deltaTextOverride))) {
for (Text text : self.textOverrides) {
texts.add(text.copy());
}

self.updateForAllPlayers();
self.deltaTextOverride = new Text[self.textOverrides.length];
for (int i = 0; i < self.textOverrides.length; i++) {
self.deltaTextOverride[i] = self.textOverrides[i].copy();
}
dirty = true;
}
} else {
Map<String, Text> placeholders = self.visualData.getPlaceholders(self.world.getServer());

for (var text : config.hologramVisualText) {
if (!text.equals(EmptyNode.INSTANCE)) {
texts.add(Placeholders.parseText(text, Placeholders.PREDEFINED_PLACEHOLDER_PATTERN, placeholders));
} else {
texts.add(Text.empty());
}
}
dirty = true;
}


if (texts.size() != self.hologram.getElements().size()) {
self.hologram.clearElements();
}
if (dirty) {
if (texts.size() != self.hologram.getElements().size()) {
self.hologram.clearElements();
}

int x = 0;
for (Text text : texts) {
if (text.getContent() == TextContent.EMPTY) {
self.hologram.setElement(x, new SpacingHologramElement(0.28));
} else {
self.hologram.setText(x, text);
int x = 0;
for (Text text : texts) {
if (text.getContent() == TextContent.EMPTY && text.getSiblings().size() == 00) {
self.hologram.setElement(x, new SpacingHologramElement(0.28));
} else {
self.hologram.setText(x, text);
}
x++;
}
x++;
}
} else {
if (self.hologram != null) {
Expand Down
34 changes: 33 additions & 1 deletion src/main/resources/data/universal_graves/lang/pl_pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,37 @@
"text.graves.created_at": "Stworzono grób na %s (%s)",
"text.graves.creation_failed": "Nie można było stworzyć grobu! Twoje przedmioty leżą na %s (%s)",
"text.graves.creation_failed_pvp": "Nie stworzono grobu, ponieważ zostałeś zabity przez gracza! Twoje przedmioty leżą na %s (%s)",
"text.graves.creation_failed_claim": "Nie stworzono grobu, ponieważ byłeś na działce! Twoje przedmioty leżą na %s (%s)"
"text.graves.creation_failed_claim": "Nie stworzono grobu, ponieważ byłeś na działce! Twoje przedmioty leżą na %s (%s)",

"text.graves.protected_time_sign": "Chroniony przez",
"text.graves.break_time_sign": "Zniszczy się za",
"text.graves.created_at_expire": "Stworzono grób na %s (%s). Wygaśnie on za %s",
"text.graves.creation_failed_void": "Grób nie mógł zostać stworzony, ponieważ umarłeś w próżni!",
"text.graves.about.version": "Wersja: %s",
"text.graves.about.contributors": "Kontrybutorze",
"text.graves.gui.next_page": "Następna Strona",
"text.graves.gui.previous_page": "Poprzednia Strona",
"text.graves.gui.remove_protection": "Usuń Zabezpieczenia",
"text.graves.gui.break_grave": "Zniszcz Grób",
"text.graves.gui.quick_pickup": "Zabierz Wszytkie Przedmioty",
"text.graves.gui.teleport": "Teleportuj do grobu",
"text.graves.gui.teleport.not_enough": "Nie masz wystarczających surowców!",
"text.graves.gui.teleport.cost": "Koszt:",
"text.graves.gui.fetch": "Przenieś grób do swojej pozycji",
"text.graves.gui.fetch_failed": "Przeniesienie grobu nie powiodło się!",
"text.graves.gui.cant_reverse": "Nie możesz cofnąć tej akcji!",
"text.graves.gui.click_to_confirm": "Kliknij ponownie aby potwierdzić",
"text.graves.teleport.teleport_timer": "Zostaniesz teleportowany za %s sekund, nie ruszaj się!",
"text.graves.teleport.teleport_timer_moving": "Zostaniesz teleportowany za %s sekund",
"text.graves.teleport.teleport_location": "Zostałeś przeteleportowany do %s",
"text.graves.teleport.teleport_cancelled": "Teleportacja odwołana",
"item.universal_graves.grave_compass": "Kompas Grobowy",
"block.universal_graves.grave": "Grób",
"block.universal_graves.visual_grave": "Nagrobek",
"gamerule.universal_graves:protection_time": "Czas ochrony grobu przeciw innymi graczami",
"gamerule.universal_graves:breaking_time": "Czas zniszczenia grobu",
"text.graves.teleportation_cost.level": "Poziomów XP",
"text.graves.teleportation_cost.creative": "Tryb Kreatywny",
"text.graves.teleportation_cost.free": "Za darmo",
"text.graves.teleportation_cost.item": "Przedmioty"
}

0 comments on commit cf729f1

Please sign in to comment.