Modding:Advanced Blocks: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
Line 17: Line 17:


We will create this class, to give the block the desired functionality, so make sure if you pick a different name it matches the one below.
We will create this class, to give the block the desired functionality, so make sure if you pick a different name it matches the one below.
You can download the assets of the mod [http://wiki.vintagestory.at/images/b/b9/Trampoline_-_No_CS_FILE.zip here].
You can download the assets of the mod [https://wiki.vintagestory.at/images/b/b9/Trampoline_-_No_CS_FILE.zip here].
All you need to do is to place this zip file in your <code>assets</code> directory in your development project.
All you need to do is to place this zip file in your <code>assets</code> directory in your development project.


Line 63: Line 63:
This should solve all syntax errors.
This should solve all syntax errors.


So how do we implement a bouncy block? It's pretty helpful to take a look at the [http://apidocs.vintagestory.at/api/Vintagestory.API.Common.Block.html api documentation] to find a proper way to implement it.
So how do we implement a bouncy block? It's pretty helpful to take a look at the [https://apidocs.vintagestory.at/api/Vintagestory.API.Common.Block.html api documentation] to find a proper way to implement it.


The method <code>void onEntityCollide(IWorldAccessor world, Entity entity, BlockPos pos, BlockFacing facing, bool isImpact)</code> seems to be a good way to implement a bouncy functionality.
The method <code>void onEntityCollide(IWorldAccessor world, Entity entity, BlockPos pos, BlockFacing facing, bool isImpact)</code> seems to be a good way to implement a bouncy functionality.
Line 142: Line 142:
</syntaxhighlight>
</syntaxhighlight>


Of course you can download the file directly [http://wiki.vintagestory.at/images/8/8a/Trampoline.cs Trampoline.cs].
Of course you can download the file directly [https://wiki.vintagestory.at/images/8/8a/Trampoline.cs Trampoline.cs].


== Testing ==
== Testing ==
Line 156: Line 156:
In order to finish everything, open the modtools and type in <code>pack <your mod id></code>. Now you can take the zip file and share it with other people. It will work in the same way as ordinary mods, you can install it by copying it into the <code>mods</code> folder.
In order to finish everything, open the modtools and type in <code>pack <your mod id></code>. Now you can take the zip file and share it with other people. It will work in the same way as ordinary mods, you can install it by copying it into the <code>mods</code> folder.


Here is my version: [http://wiki.vintagestory.at/images/c/ce/Trampoline.zip Trampoline.zip]
Here is my version: [https://wiki.vintagestory.at/images/c/ce/Trampoline.zip Trampoline.zip]




{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}
Confirmedusers, editor, Administrators
886

edits