Skip to content

Commit

Permalink
Updated to Version 1.19.4-rc.3
Browse files Browse the repository at this point in the history
  • Loading branch information
VintageStory CI committed Feb 27, 2024
1 parent ec42ea0 commit d7fa849
Show file tree
Hide file tree
Showing 1,013 changed files with 25,864 additions and 25,140 deletions.
22 changes: 11 additions & 11 deletions Client/UI/Dialog/GuiDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public GuiComposer this[string key]
value.OnFocusChanged = dialog.OnFocusChanged;
}
}


IEnumerator IEnumerable.GetEnumerator()
{
Expand Down Expand Up @@ -206,7 +206,7 @@ public virtual void OnBlockTexturesLoaded()
}

/// <summary>
///
///
/// </summary>
public virtual void OnLevelFinalize()
{
Expand Down Expand Up @@ -250,14 +250,14 @@ public virtual void OnOwnPlayerDataReceived() { }
/// Fires when the GUI is opened.
/// </summary>
public virtual void OnGuiOpened() {

}

/// <summary>
/// Fires when the GUI is closed.
/// </summary>
public virtual void OnGuiClosed() {

}

/// <summary>
Expand Down Expand Up @@ -365,7 +365,7 @@ public virtual bool IsOpened(string dialogComposerName)
/// <param name="deltaTime">The time that has elapsed.</param>
public virtual void OnBeforeRenderFrame3D(float deltaTime)
{

}

public string MouseOverCursor;
Expand Down Expand Up @@ -409,12 +409,12 @@ internal virtual bool OnKeyCombinationToggle(KeyCombination viaKeyComb)
{
ignoreNextKeyPress = true;
}*/

return true;
}

/// <summary>
/// Fires when keys are held down.
/// Fires when keys are held down.
/// </summary>
/// <param name="args">The key or keys that were held down.</param>
public virtual void OnKeyDown(KeyEvent args)
Expand All @@ -430,7 +430,7 @@ public virtual void OnKeyDown(KeyEvent args)

HotKey hotkey = capi.Input.GetHotKeyByCode(ToggleKeyCombinationCode);
if (hotkey == null) return;


bool toggleKeyPressed = hotkey.DidPress(args, capi.World, capi.World.Player, true);
if (toggleKeyPressed && TryClose())
Expand Down Expand Up @@ -460,7 +460,7 @@ public virtual void OnKeyPress(KeyEvent args)
composer.OnKeyPress(args);
if (args.Handled) return;
}

}

/// <summary>
Expand Down Expand Up @@ -596,7 +596,7 @@ public virtual void OnMouseMove(MouseEvent args)
composer.OnMouseMove(args);
if (args.Handled) return;
}

foreach (GuiComposer composer in Composers.Values)
{
if (composer.Bounds.PointInside(args.X, args.Y))
Expand Down Expand Up @@ -719,7 +719,7 @@ public void ClearComposers()
public abstract string ToggleKeyCombinationCode { get; }

/// <summary>
/// Checks if the player is in range (pickingrange) of the given position eg. for Trader to auto close the dialog.
/// Checks if the player is in range (pickingrange) of the given position
/// </summary>
/// <param name="pos"></param>
/// <returns>In range or no?</returns>
Expand Down
6 changes: 3 additions & 3 deletions Client/UI/Dialog/GuiDialogBlockEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public override void OnGuiClosed()
}

capi.Network.SendBlockEntityPacket(BlockEntityPosition.X, BlockEntityPosition.Y, BlockEntityPosition.Z, (int)EnumBlockEntityPacketId.Close);

capi.Gui.PlaySound(CloseSound, true);
}

Expand All @@ -188,7 +188,7 @@ public override void OnGuiClosed()
/// </summary>
public void ReloadValues()
{

}


Expand All @@ -198,7 +198,7 @@ public EnumPosFlag GetFreePos(string code)

int flags = 0;
posFlagDict().TryGetValue(code, out flags);

foreach (EnumPosFlag flag in values)
{
if ((flags & (int)flag) > 0) continue;
Expand Down
9 changes: 9 additions & 0 deletions Common/API/IEventAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ public interface IEventAPI
/// <returns>listenerId</returns>
long RegisterCallback(Action<float> OnTimePassed, int millisecondDelay);

/// <summary>
/// Calls given method after supplied amount of milliseconds. The engine may call your method slightly later since these event are handled only during fixed interval game ticks.
/// This overload can be used to signify callbacks which do no harm if registered while the game is paused (otherwise, registering a callback while paused will produce an error in logs, or an intentional exception in Developer Mode)
/// </summary>
/// <param name="OnTimePassed"></param>
/// <param name="millisecondDelay"></param>
/// <returns>listenerId</returns>
long RegisterCallback(Action<float> OnTimePassed, int millisecondDelay, bool permittedWhilePaused);

/// <summary>
/// Calls given method after supplied amount of milliseconds, lets you supply a block position to be passed to the method. The engine may call your method slightly later since these event are handled only during fixed interval game ticks.
/// </summary>
Expand Down
8 changes: 7 additions & 1 deletion Common/API/IWorldAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ public interface IWorldAccessor
/// </summary>
List<GridRecipe> GridRecipes { get; }

/// <summary>
/// Retrieve a previously registered recipe registry
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
RecipeRegistryBase GetRecipeRegistry(string code);

/// <summary>
/// The range in blocks within a client will receive regular updates for an entity
Expand Down Expand Up @@ -666,4 +672,4 @@ public interface IWorldAccessor
/// <returns></returns>
IBlockAccessor GetLockFreeBlockAccessor();
}
}
}
21 changes: 20 additions & 1 deletion Common/Collectible/Block/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,17 @@ public virtual BlockSounds GetSounds(IBlockAccessor blockAccessor, BlockPos pos,
return Sounds;
}

/// <summary>
/// Position-aware version of Attributes, for example can be used by BlockMultiblock
/// </summary>
/// <param name="blockAccessor"></param>
/// <param name="pos"></param>
/// <returns></returns>
public virtual JsonObject GetAttributes(IBlockAccessor blockAccessor, BlockPos pos)
{
return Attributes;
}

public virtual bool DoEmitSideAo(IGeometryTester caller, BlockFacing facing)
{
return (EmitSideAo & facing.Flag) != 0;
Expand Down Expand Up @@ -2144,7 +2155,15 @@ public virtual string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPl
BlockEntity be = world.BlockAccessor.GetBlockEntity(pos);
if (be != null)
{
be.GetBlockInfo(forPlayer, sb);
try
{
be.GetBlockInfo(forPlayer, sb);
}
catch (Exception e)
{
sb.AppendLine("(error in " + be.GetType().Name + ")");
api.Logger.Error(e);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion Common/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,8 @@ public virtual void OnGameTick(float dt)

if (IsOnFire)
{
if (World.BlockAccessor.GetBlock(Pos.AsBlockPos, BlockLayersAccess.Fluid).LiquidCode == "water" || World.ElapsedMilliseconds - OnFireBeginTotalMs > 12000)
Block fluidBlock = World.BlockAccessor.GetBlock(Pos.AsBlockPos, BlockLayersAccess.Fluid);
if (fluidBlock.IsLiquid() && fluidBlock.LiquidCode != "lava" || World.ElapsedMilliseconds - OnFireBeginTotalMs > 12000)
{
IsOnFire = false;
}
Expand Down
2 changes: 2 additions & 0 deletions Common/Entity/EntityControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ public class EntityControls
public long UsingBeginMS;
public ModelTransform LeftUsingHeldItemTransformBefore;

[Obsolete("Setting this value has no effect anymore. Add an animation to the seraph instead")]
public ModelTransform UsingHeldItemTransformBefore;
[Obsolete("Setting this value has no effect anymore. Add an animation to the seraph instead")]
public ModelTransform UsingHeldItemTransformAfter;

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions Common/Entity/EntityItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ public override void OnGameTick(float dt)

if (IsOnFire)
{
if (World.BlockAccessor.GetBlock(Pos.AsBlockPos, BlockLayersAccess.Fluid).LiquidCode == "water" || World.ElapsedMilliseconds - OnFireBeginTotalMs > 12000)
Block fluidBlock = World.BlockAccessor.GetBlock(Pos.AsBlockPos, BlockLayersAccess.Fluid);
if (fluidBlock.IsLiquid() && fluidBlock.LiquidCode != "lava" || World.ElapsedMilliseconds - OnFireBeginTotalMs > 12000)
{
IsOnFire = false;
}
Expand Down Expand Up @@ -390,4 +391,4 @@ public override double SwimmingOffsetY
get { return base.SwimmingOffsetY; }
}
}
}
}
12 changes: 9 additions & 3 deletions Common/Entity/EntityProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ public class EntityProperties

/// <summary>
/// Whether the entity should take fall damage
/// </summary>
public bool FallDamage = true;
/// </summary>
public bool FallDamage = true;

/// <summary>
/// If less than one, mitigates fall damage (e.g. could be used for mountainous creatures); if more than one, increases fall damage (e.g fragile creatures?)
/// </summary>
public float FallDamageMultiplier = 1.0f;

public float ClimbTouchDistance;

Expand Down Expand Up @@ -208,7 +213,8 @@ public EntityProperties Clone()
CanClimb = CanClimb,
Weight = Weight,
CanClimbAnywhere = CanClimbAnywhere,
FallDamage = FallDamage,
FallDamage = FallDamage,
FallDamageMultiplier = FallDamageMultiplier,
ClimbTouchDistance = ClimbTouchDistance,
RotateModelOnClimb = RotateModelOnClimb,
KnockbackResistance = KnockbackResistance,
Expand Down
4 changes: 2 additions & 2 deletions Config/GameVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static class GameVersion
/// <summary>
/// Version number in the format: major.minor.revision[appendix]
/// </summary>
public const string ShortGameVersion = OverallVersion + "-rc.2";
public const string ShortGameVersion = OverallVersion + "-rc.3";

public static EnumReleaseType ReleaseType => GetReleaseType(ShortGameVersion);

Expand All @@ -66,7 +66,7 @@ public static class GameVersion
/// <summary>
/// Version of the Network Protocol
/// </summary>
public const string NetworkVersion = "1.19.6";
public const string NetworkVersion = "1.19.7";

/// <summary>
/// Version of the world generator - a change in version will insert a smoothed chunk between old and new version
Expand Down
28 changes: 24 additions & 4 deletions Localization/TranslationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private string PluralFormat(string value, object[] args)
StringBuilder sb = new StringBuilder();
sb.Append(TryFormat(before, args));
sb.Append(BuildPluralFormat(plural, N));
sb.Append(TryFormat(after, args)); // there could be further instances of {p#:...} after this
sb.Append(Format(after, args)); // there could be further instances of {p#:...} after this
return sb.ToString();
}

Expand All @@ -262,9 +262,11 @@ internal static string BuildPluralFormat(string input, float n)
int round = 3;
if (plurals.Length >= 2)
{
string numberFormatting = GetNumberFormattingFrom(plurals[1], out string _);
round = numberFormatting.Length - 1;
if (numberFormatting.IndexOf('.') > 0) round--;
// Attempt to guess the number of digits best to round to before choosing which plural form to use, by examining the displayed format of the number
// If no number formatting found in plurals[1], try the last one instead (which may be the same ...)
if (!TryGuessRounding(plurals[1], out round)) TryGuessRounding(plurals[plurals.Length - 1], out round);

if (round < 0 || round > 15) round = 3; // Prevent invalid rounding if the above code failed for any reason
}

int index = (int)Math.Ceiling(Math.Round(n, round)); // this implments a rule: 0 -> 0; 0.5 -> 1; 1 -> 1; 1.5 -> 2 etc. This may not be appropriate for all languages e.g. French. A future extension can allow more customisation by specifying math formulae
Expand All @@ -287,6 +289,24 @@ internal static string BuildPluralFormat(string input, float n)
return WithNumberFormatting(rawResult, n);
}

private static bool TryGuessRounding(string entry, out int round)
{
string numberFormatting = GetNumberFormattingFrom(entry, out string _);
if (numberFormatting.IndexOf('.') > 0)
{
round = numberFormatting.Length - numberFormatting.IndexOf('.') - 1; // Number with decimal places: round to that number of decimal places
return true;
}
else if (numberFormatting.Length > 0) // Number with no decimal places: round to integer value
{
round = 0;
return true;
}

round = 3; // Default value
return false;
}

internal static string GetNumberFormattingFrom(string rawResult, out string partB)
{
var j = GetStartIndexOfNumberFormat(rawResult);
Expand Down
4 changes: 4 additions & 0 deletions api/.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4523,6 +4523,7 @@
"Vintagestory.API.Common.Block.FirstTextureInventory": "Vintagestory.API.Common.Block.yml",
"Vintagestory.API.Common.Block.ForFluidsLayer": "Vintagestory.API.Common.Block.yml",
"Vintagestory.API.Common.Block.Frostable": "Vintagestory.API.Common.Block.yml",
"Vintagestory.API.Common.Block.GetAttributes(Vintagestory.API.Common.IBlockAccessor,Vintagestory.API.MathTools.BlockPos)": "Vintagestory.API.Common.Block.yml",
"Vintagestory.API.Common.Block.GetBEBehavior``1(Vintagestory.API.MathTools.BlockPos)": "Vintagestory.API.Common.Block.yml",
"Vintagestory.API.Common.Block.GetBehavior(System.Type,System.Boolean)": "Vintagestory.API.Common.Block.yml",
"Vintagestory.API.Common.Block.GetBlastResistance(Vintagestory.API.Common.IWorldAccessor,Vintagestory.API.MathTools.BlockPos,Vintagestory.API.MathTools.Vec3f,Vintagestory.API.Common.EnumBlastType)": "Vintagestory.API.Common.Block.yml",
Expand Down Expand Up @@ -5847,6 +5848,7 @@
"Vintagestory.API.Common.Entities.EntityProperties.DropsPacket": "Vintagestory.API.Common.Entities.EntityProperties.yml",
"Vintagestory.API.Common.Entities.EntityProperties.EyeHeight": "Vintagestory.API.Common.Entities.EntityProperties.yml",
"Vintagestory.API.Common.Entities.EntityProperties.FallDamage": "Vintagestory.API.Common.Entities.EntityProperties.yml",
"Vintagestory.API.Common.Entities.EntityProperties.FallDamageMultiplier": "Vintagestory.API.Common.Entities.EntityProperties.yml",
"Vintagestory.API.Common.Entities.EntityProperties.Habitat": "Vintagestory.API.Common.Entities.EntityProperties.yml",
"Vintagestory.API.Common.Entities.EntityProperties.Id": "Vintagestory.API.Common.Entities.EntityProperties.yml",
"Vintagestory.API.Common.Entities.EntityProperties.IdleSoundChance": "Vintagestory.API.Common.Entities.EntityProperties.yml",
Expand Down Expand Up @@ -7405,6 +7407,7 @@
"Vintagestory.API.Common.IEventAPI.OnTestBlockAccess": "Vintagestory.API.Common.IEventAPI.yml",
"Vintagestory.API.Common.IEventAPI.PushEvent(System.String,Vintagestory.API.Datastructures.IAttribute)": "Vintagestory.API.Common.IEventAPI.yml",
"Vintagestory.API.Common.IEventAPI.RegisterCallback(System.Action{System.Single},System.Int32)": "Vintagestory.API.Common.IEventAPI.yml",
"Vintagestory.API.Common.IEventAPI.RegisterCallback(System.Action{System.Single},System.Int32,System.Boolean)": "Vintagestory.API.Common.IEventAPI.yml",
"Vintagestory.API.Common.IEventAPI.RegisterCallback(System.Action{Vintagestory.API.Common.IWorldAccessor,Vintagestory.API.MathTools.BlockPos,System.Single},Vintagestory.API.MathTools.BlockPos,System.Int32)": "Vintagestory.API.Common.IEventAPI.yml",
"Vintagestory.API.Common.IEventAPI.RegisterEventBusListener(Vintagestory.API.Common.EventBusListenerDelegate,System.Double,System.String)": "Vintagestory.API.Common.IEventAPI.yml",
"Vintagestory.API.Common.IEventAPI.RegisterGameTickListener(System.Action{System.Single},System.Action{System.Exception},System.Int32,System.Int32)": "Vintagestory.API.Common.IEventAPI.yml",
Expand Down Expand Up @@ -7813,6 +7816,7 @@
"Vintagestory.API.Common.IWorldAccessor.GetLockFreeBlockAccessor": "Vintagestory.API.Common.IWorldAccessor.yml",
"Vintagestory.API.Common.IWorldAccessor.GetNearestEntity(Vintagestory.API.MathTools.Vec3d,System.Single,System.Single,Vintagestory.API.Common.ActionConsumable{Vintagestory.API.Common.Entities.Entity})": "Vintagestory.API.Common.IWorldAccessor.yml",
"Vintagestory.API.Common.IWorldAccessor.GetPlayersAround(Vintagestory.API.MathTools.Vec3d,System.Single,System.Single,Vintagestory.API.Common.ActionConsumable{Vintagestory.API.Common.IPlayer})": "Vintagestory.API.Common.IWorldAccessor.yml",
"Vintagestory.API.Common.IWorldAccessor.GetRecipeRegistry(System.String)": "Vintagestory.API.Common.IWorldAccessor.yml",
"Vintagestory.API.Common.IWorldAccessor.GridRecipes": "Vintagestory.API.Common.IWorldAccessor.yml",
"Vintagestory.API.Common.IWorldAccessor.HighlightBlocks(Vintagestory.API.Common.IPlayer,System.Int32,System.Collections.Generic.List{Vintagestory.API.MathTools.BlockPos},System.Collections.Generic.List{System.Int32},Vintagestory.API.Client.EnumHighlightBlocksMode,Vintagestory.API.Common.EnumHighlightShape,System.Single)": "Vintagestory.API.Common.IWorldAccessor.yml",
"Vintagestory.API.Common.IWorldAccessor.HighlightBlocks(Vintagestory.API.Common.IPlayer,System.Int32,System.Collections.Generic.List{Vintagestory.API.MathTools.BlockPos},Vintagestory.API.Client.EnumHighlightBlocksMode,Vintagestory.API.Common.EnumHighlightShape)": "Vintagestory.API.Common.IWorldAccessor.yml",
Expand Down
12 changes: 6 additions & 6 deletions api/CompactExifLib.ExifByteOrder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ items:
source:
remote:
path: VintagestoryApi/Util/ExifData.cs
branch: b694fee1bf3e4ebb962b650b962504ea17bce166
repo: https://gitlab-ci-token:64_nSEkar94LMeYjNTUoKdg@git.striver.net/vintagecraft/game.git
branch: d6806ed2527579840d2aaf86b17f0c5078d743b1
repo: https://gitlab-ci-token:64_N9Sxr9MX2YqsptD_Zy3q@git.striver.net/vintagecraft/game.git
id: ExifByteOrder
path: Util/ExifData.cs
startLine: 4417
Expand All @@ -42,8 +42,8 @@ items:
source:
remote:
path: VintagestoryApi/Util/ExifData.cs
branch: b694fee1bf3e4ebb962b650b962504ea17bce166
repo: https://gitlab-ci-token:64_nSEkar94LMeYjNTUoKdg@git.striver.net/vintagecraft/game.git
branch: d6806ed2527579840d2aaf86b17f0c5078d743b1
repo: https://gitlab-ci-token:64_N9Sxr9MX2YqsptD_Zy3q@git.striver.net/vintagecraft/game.git
id: LittleEndian
path: Util/ExifData.cs
startLine: 4417
Expand All @@ -68,8 +68,8 @@ items:
source:
remote:
path: VintagestoryApi/Util/ExifData.cs
branch: b694fee1bf3e4ebb962b650b962504ea17bce166
repo: https://gitlab-ci-token:64_nSEkar94LMeYjNTUoKdg@git.striver.net/vintagecraft/game.git
branch: d6806ed2527579840d2aaf86b17f0c5078d743b1
repo: https://gitlab-ci-token:64_N9Sxr9MX2YqsptD_Zy3q@git.striver.net/vintagecraft/game.git
id: BigEndian
path: Util/ExifData.cs
startLine: 4417
Expand Down
Loading

0 comments on commit d7fa849

Please sign in to comment.