1
0
Fork 0
Commit Graph

53 Commits

Author SHA1 Message Date
Tiger Wang 9b97d63f8f
Chest, weather, crash, and miscellaneous fixes (#5215)
* Alpha-sort cChestEntity

* Chests: use SendUpdateBlockEntity

* Pathfinder: fix out of range Y

* 1.13: correct weather packet ID

* Chests: fix neighbour scanner

+ Add OnAddToWorld and overload to scan neighbours there, instead of in the constructor/OnUse. This fixes hoppers accessing newly loaded double chests and seeing a null m_Neighbour, thus thinking its a single chest.
* Fix typo in cross coords computation.
* Simplify hopper logic.

* Block entities: ASSERT that type is correct

If you match the block type first before calling DoWithBlockEntity, the corresponding block entity must either be empty or correspond to the block type.

* Chunk: fix some forgotten PendingSendBE cleanup

+ Add cleanup in SetAllData, WriteBlockArea
- Remove RemoveBlockEntity (used once), HasBlockEntity (not used)

* Replace MakeIndex with MakeIndexNoCheck

* Remove extraneous MarkDirty in hopper & chests
2021-04-30 13:23:46 +00:00
npresley0506 d117a6c5db
Repaired Hoppers Treating Chests as two entities (#5202)
* Repaired Hoppers Treating Chests as two entities

* Style changes

* style fixes

* Fixed style issues, also condensed logic in MoveItemsFromChest

* Used m_Neighbour, fixed styling

* GetNeighbour not ReturnNeighbour

Co-authored-by: npresley <npresley@umich.edu>
2021-04-23 12:51:59 +00:00
Tiger Wang 4cd49d7eca Fix sending incorrect date values on world change
Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
2021-04-12 22:35:07 +01:00
Tiger Wang 813176fbd1
cChunk: don't inherit from cChunkDef (#5106) 2021-01-18 16:09:10 +00:00
KrystilizeNevaDies 23bca00831
Implement Dropspenser Hook (#4903)
* Implement Dropspenser Hook

Implemented a hook for dropspensing.
HOOK_DROPSPENSE

When plugin callback returns true then dropspense is cancelled

* Update src/Bindings/PluginManager.h

Co-authored-by: peterbell10 <peterbell10@live.co.uk>

* Create OnDropSpense.lua

* Fix indent

* Forgot include

Forgot to include the plugin manager. Although now im confused why it was working on my end without including the plugin manager

* Update plugins.lua with dropspense

* fix typos

* haha notepad++ go brr

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-09-21 15:31:45 +00:00
12xx12 c2f8ceb554
Add more statistic tracking (#4837)
+ Added possible 1.8 stats
+ Added stat tracking for 1.8.2
+ Added stat tracking for 1.9
+ Added the breed cow achievement

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-09-05 16:13:44 +01:00
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Bond-009 ea386eaab1
Lock hopper when powered by redstone (#4347)
* Lock hopper when powered by redstone

* Add to manual bindings

* Add hopper API documentation

Co-authored-by: Mat <mail@mathias.is>
2020-03-27 12:03:28 +00:00
Mattes D 61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
NiLSPACE 241d97bbf9
Fixed crash in hopper while pulling items from blockentity above itself (#4412) 2019-10-04 15:50:47 +02:00
Mattes D 365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
peterbell10 4727ed2084 Add a formatting function for Vector3 (#4282)
* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
2018-09-24 21:33:39 +01:00
peterbell10 a4dbb5c582
Prefer static_cast to reinterpret_cast (#4223)
* Change reinterpret_cast -> static_cast wherever possible
* Remove more unnecessary `const_cast`s.

reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
2018-05-02 08:50:36 +01:00
Bond-009 5badb9bcca cChunkInterface GetBlock, GetBlockMeta, GetBlockTypeMeta use vectors (#4050) 2017-11-20 11:13:11 +00:00
peterbell10 e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
LogicParrot 49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10 496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
Mattes D 0dd1cd750b BlockEntities: Support cloning self. 2017-06-16 14:11:28 +02:00
Lukas Pioch 7922e6addb Fixes problems with windows:
- Changed cPlayer:OpenWindow to accept a ref, tolua adds a nil check
- Close open lua window in destructor, to avoid dangling pointers
2017-06-05 15:14:23 +02:00
LogicParrot 83459d0d89 Proper entity destruction in non-ticking chunks 2016-02-19 07:05:22 +02:00
Gargaj f9008a4860 allow use failures to propagate from the entity/block to the player 2015-12-13 13:27:38 +01:00
Mattes D 6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Tiger Wang 813ca04676 Fixes #2245
Whoops :/
2015-06-17 00:27:50 +01:00
Tiger Wang 30b17bcb97 Improved hoppers
* Fixes #1994
2015-05-11 22:58:27 +01:00
Howaner 1eedccc56a Merge branch 'master' into Inventory 2015-01-25 00:34:19 +01:00
Tycho 2a9664d6ca Initial convertion of a_Dt to std::chrono
also refactored cWorld::m_WorldAge and cWorld::m_TimeOfDay
2015-01-11 21:12:26 +00:00
Howaner b6fd400276 Own classes for all windows. 2014-12-13 15:06:55 +01:00
Tiger Wang a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Steven Riehl 856764dee8 convert old style casts to fix warnings 2014-10-11 20:39:55 -06:00
Tiger Wang 9e4a5f824a Removed WSSCompact 2014-09-30 22:20:21 +01:00
Tycho a3f940f47c Removed more unessicary includes 2014-09-26 18:13:19 +01:00
Tycho 5623a045f5 Fixed potential null dereference
Fixes CID 70466
2014-08-10 22:06:56 +01:00
madmaxoft 2423fbf2ef Normalized comments.
This was mostly done automatically and then visually inspected for obvious errors.
All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
2014-07-17 22:15:34 +02:00
worktycho e1a561286a Fixed Issue with Comparing agast the wrong chest, potentially causing crashes. 2014-07-13 16:03:14 +01:00
madmaxoft d72a81cb8e cHopperEntity: Simplified chest conditions. 2014-07-12 23:34:32 +02:00
Tiger Wang e71e432633 Suggestions and bug fix
* Fixed hoppers pushing/pulling to/from (trapped)chests that do not form
a double-chest with the chest type directly connected to said hopper;
thank you, @madmaxoft
2014-07-12 22:06:25 +01:00
Tiger Wang 9e44b0aae1 Implemented trapped chests & others
+ Added trapped chests
* Fixed a bunch of bugs in the redstone simulator concerning wires and
repeaters
* Other potential bugfixes
2014-07-06 23:50:22 +01:00
Mattes D 742370497a Fixed crashes in HopperEntity.
Some of the coords were off and some functions were assuming too much.
Fixes the crash reported in http://forum.mc-server.org/showthread.php?tid=1497
2014-06-24 09:46:04 +02:00
jfhumann 013da806ec Did some static analysis, fixed some bugs and optimized a lot of code 2014-04-18 21:09:44 +02:00
madmaxoft 89027cb675 Fixed double to float conversions. 2014-03-16 22:00:28 +01:00
madmaxoft 46f6cef99f Fixed compilation in MSVC (forward class definitions). 2014-02-24 22:47:58 +01:00
Tycho df193c8f6f BlockEntities is warnings free 2014-02-24 11:29:59 -08:00
Tiger Wang c6a2e8c688 Removed debug messages again 2014-02-15 12:58:17 +00:00
Tiger Wang f4f0099947 Added proper debug messages 2014-02-13 20:20:37 +00:00
Tiger Wang c0e7d6fec9 Fancy stuff with constant references 2014-02-13 19:57:23 +00:00
Tiger Wang f97ce30151 Changed inheritance a bit
* cBlockEntityWithItems now inherits from cBlockEntityWindowOwner
2014-02-12 22:01:22 +00:00
Tiger Wang 9d54f2b761 Fixed #190
+ Hoppers now collect pickups above them
2014-02-11 22:54:01 +00:00
Tiger Wang 74645fdfaa Removed obsoleted functions 2014-01-16 19:00:49 +00:00
madmaxoft 9c8af58b75 Fixed a few MSVC warnings. 2014-01-06 22:22:33 +01:00