1111#include " ll/api/memory/Memory.h"
1212#include " ll/api/service/Bedrock.h"
1313#include " lse/api/MoreGlobal.h"
14- #include " mc/common /HitDetection.h"
14+ #include " mc/world/phys /HitDetection.h"
1515#include " mc/deps/core/string/HashedString.h"
16- #include " mc/entity/utilities /ActorDamageCause.h"
17- #include " mc/entity/utilities /ActorEquipment.h"
16+ #include " mc/world/actor /ActorDamageCause.h"
17+ #include " mc/world/actor/provider /ActorEquipment.h"
1818#include " mc/entity/utilities/ActorMobilityUtils.h"
19- #include " mc/entity/utilities /ActorType.h"
20- #include " mc/math/Vec2.h"
19+ #include " mc/world/actor /ActorType.h"
20+ #include " mc/deps/core/ math/Vec2.h"
2121#include " mc/nbt/CompoundTag.h"
2222#include " mc/world/SimpleContainer.h"
2323#include " mc/world/actor/ActorDefinitionIdentifier.h"
2424#include " mc/world/actor/Mob.h"
25- #include " mc/world/actor/components /SynchedActorDataAccess.h"
25+ #include " mc/world/actor/provider /SynchedActorDataAccess.h"
2626#include " mc/world/actor/item/ItemActor.h"
2727#include " mc/world/actor/player/Player.h"
2828#include " mc/world/attribute/AttributeInstance.h"
3535#include " mc/world/level/block/Block.h"
3636#include " mc/world/level/material/Material.h"
3737#include " mc/world/phys/AABB.h"
38+ #include " mc/common/ActorUniqueID.h"
39+ #include " mc/world/phys/HitResult.h"
40+ #include " mc/world/effect/EffectDuration.h"
3841
3942#include < climits>
4043#include < entt/entt.hpp>
@@ -211,9 +214,6 @@ void EntityClass::set(Actor* actor) {
211214 }
212215}
213216
214- WeakStorageEntity& WeakStorageEntity::operator =(WeakStorageEntity const &) = default ;
215- WeakStorageEntity::WeakStorageEntity (WeakStorageEntity const &) = default;
216-
217217Actor* EntityClass::get () {
218218 if (mValid ) {
219219 return mWeakEntity .tryUnwrap <Actor>().as_ptr ();
@@ -226,7 +226,7 @@ Local<Value> EntityClass::getUniqueID() {
226226 try {
227227 Actor* entity = get ();
228228 if (!entity) return Local<Value>();
229- else return String::newString (std::to_string (entity->getOrCreateUniqueID ().id ));
229+ else return String::newString (std::to_string (entity->getOrCreateUniqueID ().rawID ));
230230 }
231231 CATCH (" Fail in getUniqueID!" )
232232}
@@ -296,7 +296,7 @@ Local<Value> EntityClass::isOnHotBlock() {
296296 Actor* entity = get ();
297297 if (!entity) return Local<Value>();
298298
299- return Boolean::newBoolean (entity->isOnHotBlock ());
299+ return Boolean::newBoolean (entity->getDimensionBlockSource (). getBlock (entity-> getFeetBlockPos ()). getMaterial (). isSuperHot ()); // TODO: Unsure
300300 }
301301 CATCH (" Fail in isOnHotBlock!" )
302302}
@@ -1029,7 +1029,7 @@ Local<Value> EntityClass::setHealth(const Arguments& args) {
10291029 Actor* entity = get ();
10301030 if (!entity) return Local<Value>();
10311031
1032- AttributeInstance* healthAttribute = entity->getMutableAttribute (SharedAttributes::HEALTH);
1032+ AttributeInstance* healthAttribute = entity->getMutableAttribute (SharedAttributes::HEALTH () );
10331033
10341034 healthAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
10351035
@@ -1046,7 +1046,7 @@ Local<Value> EntityClass::setAbsorption(const Arguments& args) {
10461046 Actor* entity = get ();
10471047 if (!entity) return Local<Value>();
10481048
1049- AttributeInstance* absorptionAttribute = entity->getMutableAttribute (SharedAttributes::ABSORPTION);
1049+ AttributeInstance* absorptionAttribute = entity->getMutableAttribute (SharedAttributes::ABSORPTION () );
10501050
10511051 absorptionAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
10521052
@@ -1063,7 +1063,7 @@ Local<Value> EntityClass::setAttackDamage(const Arguments& args) {
10631063 Actor* entity = get ();
10641064 if (!entity) return Local<Value>();
10651065
1066- AttributeInstance* attactDamageAttribute = entity->getMutableAttribute (SharedAttributes::ATTACK_DAMAGE);
1066+ AttributeInstance* attactDamageAttribute = entity->getMutableAttribute (SharedAttributes::ATTACK_DAMAGE () );
10671067
10681068 attactDamageAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
10691069
@@ -1080,7 +1080,7 @@ Local<Value> EntityClass::setMaxAttackDamage(const Arguments& args) {
10801080 Actor* entity = get ();
10811081 if (!entity) return Local<Value>();
10821082
1083- AttributeInstance* attactDamageAttribute = entity->getMutableAttribute (SharedAttributes::ATTACK_DAMAGE);
1083+ AttributeInstance* attactDamageAttribute = entity->getMutableAttribute (SharedAttributes::ATTACK_DAMAGE () );
10841084
10851085 attactDamageAttribute->setMaxValue (args[0 ].asNumber ().toFloat ());
10861086
@@ -1097,7 +1097,7 @@ Local<Value> EntityClass::setFollowRange(const Arguments& args) {
10971097 Actor* entity = get ();
10981098 if (!entity) return Local<Value>();
10991099
1100- AttributeInstance* followRangeAttribute = entity->getMutableAttribute (SharedAttributes::FOLLOW_RANGE);
1100+ AttributeInstance* followRangeAttribute = entity->getMutableAttribute (SharedAttributes::FOLLOW_RANGE () );
11011101
11021102 followRangeAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
11031103
@@ -1115,7 +1115,7 @@ Local<Value> EntityClass::setKnockbackResistance(const Arguments& args) {
11151115 if (!entity) return Local<Value>();
11161116
11171117 AttributeInstance* knockbackResistanceAttribute =
1118- entity->getMutableAttribute (SharedAttributes::KNOCKBACK_RESISTANCE);
1118+ entity->getMutableAttribute (SharedAttributes::KNOCKBACK_RESISTANCE () );
11191119
11201120 knockbackResistanceAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
11211121
@@ -1132,7 +1132,7 @@ Local<Value> EntityClass::setLuck(const Arguments& args) {
11321132 Actor* entity = get ();
11331133 if (!entity) return Local<Value>();
11341134
1135- AttributeInstance* luckAttribute = entity->getMutableAttribute (SharedAttributes::LUCK);
1135+ AttributeInstance* luckAttribute = entity->getMutableAttribute (SharedAttributes::LUCK () );
11361136
11371137 luckAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
11381138
@@ -1149,7 +1149,7 @@ Local<Value> EntityClass::setMovementSpeed(const Arguments& args) {
11491149 Actor* entity = get ();
11501150 if (!entity) return Local<Value>();
11511151
1152- AttributeInstance* movementSpeedAttribute = entity->getMutableAttribute (SharedAttributes::MOVEMENT_SPEED);
1152+ AttributeInstance* movementSpeedAttribute = entity->getMutableAttribute (SharedAttributes::MOVEMENT_SPEED () );
11531153 if (movementSpeedAttribute) {
11541154 movementSpeedAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
11551155 return Boolean::newBoolean (true );
@@ -1169,7 +1169,7 @@ Local<Value> EntityClass::setUnderwaterMovementSpeed(const Arguments& args) {
11691169 if (!entity) return Local<Value>();
11701170
11711171 AttributeInstance* underwaterMovementSpeedAttribute =
1172- entity->getMutableAttribute (SharedAttributes::UNDERWATER_MOVEMENT_SPEED);
1172+ entity->getMutableAttribute (SharedAttributes::UNDERWATER_MOVEMENT_SPEED () );
11731173
11741174 underwaterMovementSpeedAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
11751175
@@ -1187,7 +1187,7 @@ Local<Value> EntityClass::setLavaMovementSpeed(const Arguments& args) {
11871187 if (!entity) return Local<Value>();
11881188
11891189 AttributeInstance* lavaMovementSpeedAttribute =
1190- entity->getMutableAttribute (SharedAttributes::LAVA_MOVEMENT_SPEED);
1190+ entity->getMutableAttribute (SharedAttributes::LAVA_MOVEMENT_SPEED () );
11911191
11921192 lavaMovementSpeedAttribute->setCurrentValue (args[0 ].asNumber ().toFloat ());
11931193
@@ -1204,7 +1204,7 @@ Local<Value> EntityClass::setMaxHealth(const Arguments& args) {
12041204 Actor* entity = get ();
12051205 if (!entity) return Local<Value>();
12061206
1207- AttributeInstance* healthAttribute = entity->getMutableAttribute (SharedAttributes::HEALTH);
1207+ AttributeInstance* healthAttribute = entity->getMutableAttribute (SharedAttributes::HEALTH () );
12081208
12091209 healthAttribute->setMaxValue (args[0 ].asNumber ().toFloat ());
12101210
@@ -1420,7 +1420,7 @@ Local<Value> EntityClass::getBlockFromViewVector(const Arguments& args) {
14201420 if (includeLiquid && res.mIsHitLiquid ) {
14211421 bp = res.mLiquidPos ;
14221422 } else {
1423- bp = res.mBlockPos ;
1423+ bp = res.mBlock ;
14241424 }
14251425 Block const & bl = actor->getDimensionBlockSource ().getBlock (bp);
14261426 if (bl.isEmpty ()) {
@@ -1491,10 +1491,11 @@ Local<Value> EntityClass::addEffect(const Arguments& args) {
14911491 return Boolean::newBoolean (false );
14921492 }
14931493 unsigned int id = args[0 ].asNumber ().toInt32 ();
1494- int tick = args[1 ].asNumber ().toInt32 ();
1494+ EffectDuration duration;
1495+ duration.mUnk178312 .as <int >() = args[1 ].asNumber ().toInt32 ();
14951496 int level = args[2 ].asNumber ().toInt32 ();
14961497 bool showParticles = args[3 ].asBoolean ().value ();
1497- MobEffectInstance effect = MobEffectInstance (id, tick , level, false , showParticles, false );
1498+ MobEffectInstance effect = MobEffectInstance (id, duration , level, false , showParticles, false );
14981499 actor->addEffect (effect);
14991500 return Boolean::newBoolean (true );
15001501 }
0 commit comments