Jump to content

pencilgame

Vintarian
  • Posts

    4
  • Joined

  • Last visited

pencilgame's Achievements

Wolf Bait

Wolf Bait (1/9)

1

Reputation

  1. World Interaction! You're a legend. That link will also be a treasure trove of examples. What a class act. Thank you. For anyone who doesn't have github: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.WorldInteraction.html
  2. Hello! Hope everyone is having fun. How do you make the contextual tool tip that appears when you hover over blocks? I've read over the wiki, but could have missed it. For example, when you look at a berry bush, it gives you a tool tip that says "right click to harvest" for the player. How do you enable that for a custom block in a mod? I've seen a bunch of mods that have these help items. I can find their text in the en.json language file. Like this. "viesblocks:helpitem-windowbig-2": "Cycle through different variants", But....I can't find where you associate that with a certain block. Is it part of the API? Fine if solution is in C#. What am I missing?
  3. Thank you! That was it. Was driving me nuts. Although, while I was fixing it, the immensity of my goal dawned on me. This was just the start, I had grand plans to turn all of the grid recipes into either block interactions or one of the other more immersive types of recipes. Would be pretty cool if the community or devs could turn this whole folder into more immersive game interactions. Vintagestory\assets\survival\recipes\grid Sort of like this mod does: https://mods.vintagestory.at/immersivewoodchopping#showchangelog immersive_packed_dirtModSystem.cs
  4. Hi there. And thanks for taking a look. I completed the trampoline advanced block mod making tutorial successfully. Now, I am trying to go one step further by making a really, really simple mod. But, I'm pulling my hair out because it's not working. The mod is supposed to replace crafting packed dirt. If you're holding soil and sneak right click to place that on another block of soil, the target block will be exchanged for packed dirt. I thought this would be really, really simple. I *sort of* got it to work using CanPlaceBlock, so I at least know the AssetLocation is valid. All of the logs show at the correct times, but it's like the two critical lines don't even execute. world.BlockAccessor.ExchangeBlock(world.GetBlock(packedDirt).BlockId, blockSel.Position); world.PlaySoundAt(packSound, byPlayer.Entity); What am I doing wrong? Thanks again, -Nathan Here's the full code. using Vintagestory.API.Client; using Vintagestory.API.Common; using Vintagestory.API.Common.Entities; using Vintagestory.API.Config; using Vintagestory.API.Server; namespace immersive_packed_dirt { public class immersive_packed_dirtModSystem : ModSystem { public override void Start(ICoreAPI api) { base.Start(api); api.RegisterBlockBehaviorClass("ImmersivePackedDirtBehavior", typeof(BlockBehaviorImmersivePackedDirt)); api.Logger.Chat("Registered Soil Mod"); } public class BlockBehaviorImmersivePackedDirt : BlockBehavior { public BlockBehaviorImmersivePackedDirt(Block block) : base(block) { } public AssetLocation packSound = new AssetLocation("game", "thud"); public AssetLocation packedDirt = new AssetLocation("game", "packeddirt"); //DOES NOT WORK //TO DO: show the player the option to shift right click while holding soil. public override bool DoPlaceBlock(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel, ItemStack byItemStack, ref EnumHandling handling) { var heldBlock = world.BlockAccessor.GetBlock(byItemStack.Collectible.Code); world.Logger.Chat("Detected Place on Soil Block"); if (byPlayer.Entity.Controls.Sneak && heldBlock.BlockMaterial == EnumBlockMaterial.Soil) { world.Logger.Chat("Detected sneaking while holding soil material block"); world.BlockAccessor.ExchangeBlock(world.GetBlock(packedDirt).BlockId, blockSel.Position); world.PlaySoundAt(packSound, byPlayer.Entity); world.Logger.Chat("Finished"); return true; } return false; } } } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.