fix: перевод, getVelocity

- Исправлен перевод от Item.getName
- Исправлен метод Entity.getVelocity(не работает на физику падения, какова хуя :3)
This commit is contained in:
Reider745
2023-12-29 11:05:09 +03:00
parent 025e5803f5
commit e6f32a6ef4
2 changed files with 11 additions and 6 deletions
@@ -23,6 +23,8 @@ import com.reider745.api.ReflectHelper;
import com.reider745.hooks.ItemUtils;
import com.reider745.world.BlockSourceMethods;
import java.util.Arrays;
public class EntityMethod {
public static Entity getEntityToLong(long ent){
for (Level level : Server.getInstance().getLevels().values())
@@ -337,10 +339,12 @@ public class EntityMethod {
public static void getVelocity(long unwrapEntity, float[] pos) {
Entity entity = getEntityToLong(unwrapEntity);
if(entity != null){
Vector3 motion = entity.getMotion();
pos[0] = (float) motion.x;
pos[1] = (float) motion.y;
pos[1] = (float) motion.z;
if(entity.lastX == 0 || entity.lastY == 0 || entity.lastZ == 0)
return;
pos[0] = (float) (entity.x - entity.lastX);
pos[1] = (float) (entity.y - entity.lastY);
pos[2] = (float) (entity.z - entity.lastZ);
}
}
@@ -5,6 +5,7 @@ import cn.nukkit.item.ItemBlock;
import com.reider745.api.CustomManager;
import com.reider745.block.CustomBlock;
import com.zhekasmirnov.horizon.runtime.logger.Logger;
import com.zhekasmirnov.innercore.api.runtime.other.NameTranslation;
import java.util.ArrayList;
@@ -79,11 +80,11 @@ public class ItemMethod {
public static String getNameForId(int id, int data, long extra){
CustomManager manager = CustomBlock.getBlockManager(id);
if(manager != null)
return CustomBlock.getVariants(manager).get(data);
return NameTranslation.translate(CustomBlock.getVariants(manager).get(data));
manager = getCustomManager(id);
if(manager != null)
return manager.get(PropertiesNames.NAME);
return NameTranslation.translate(manager.get(PropertiesNames.NAME));
return Item.get(id, data).getName();
}