mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-15 16:34:56 +01:00
Clean up some Position usage to avoid unneccessary unpacks
This commit is contained in:
@@ -13,7 +13,6 @@ import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType;
|
||||
import emu.grasscutter.net.proto.GadgetInteractReqOuterClass.GadgetInteractReq;
|
||||
import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo;
|
||||
import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
|
||||
public class GadgetGatherObject extends GadgetContent {
|
||||
@@ -69,11 +68,10 @@ public class GadgetGatherObject extends GadgetContent {
|
||||
scene,
|
||||
player,
|
||||
GameData.getItemDataMap().get(itemId),
|
||||
new Position(
|
||||
getGadget().getPosition().getX() + (float)Utils.randomRange(1,5) / 5,
|
||||
getGadget().getPosition().getY() + 2f,
|
||||
getGadget().getPosition().getZ() + (float)Utils.randomRange(1,5) / 5
|
||||
),
|
||||
getGadget().getPosition().clone()
|
||||
.addY(2f)
|
||||
.addX(Utils.randomFloatRange(-1f, 1f))
|
||||
.addZ(Utils.randomFloatRange(-1f, 1f)),
|
||||
1,
|
||||
true);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.net.proto.GatherGadgetInfoOuterClass.GatherGadgetInfo;
|
||||
import emu.grasscutter.net.proto.GadgetInteractReqOuterClass.GadgetInteractReq;
|
||||
import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
|
||||
public class GadgetGatherPoint extends GadgetContent {
|
||||
@@ -61,14 +60,13 @@ public class GadgetGatherPoint extends GadgetContent {
|
||||
|
||||
for (int i = 0 ; i < times ; i++) {
|
||||
EntityItem item = new EntityItem(
|
||||
scene,
|
||||
player,
|
||||
scene,
|
||||
player,
|
||||
GameData.getItemDataMap().get(itemId),
|
||||
new Position(
|
||||
getGadget().getPosition().getX() + (float)Utils.randomRange(1,5) / 5,
|
||||
getGadget().getPosition().getY() + 2f,
|
||||
getGadget().getPosition().getZ() + (float)Utils.randomRange(1,5) / 5
|
||||
),
|
||||
getGadget().getPosition().clone()
|
||||
.addY(2f)
|
||||
.addX(Utils.randomFloatRange(-1f, 1f))
|
||||
.addZ(Utils.randomFloatRange(-1f, 1f)),
|
||||
1,
|
||||
true);
|
||||
|
||||
|
||||
@@ -25,11 +25,7 @@ public class MapMark {
|
||||
public MapMark(MapMarkPoint mapMarkPoint) {
|
||||
this.sceneId = mapMarkPoint.getSceneId();
|
||||
this.name = mapMarkPoint.getName();
|
||||
this.position = new Position(
|
||||
mapMarkPoint.getPos().getX(),
|
||||
mapMarkPoint.getPos().getY(),
|
||||
mapMarkPoint.getPos().getZ()
|
||||
);
|
||||
this.position = new Position(mapMarkPoint.getPos());
|
||||
this.mapMarkPointType = mapMarkPoint.getPointType();
|
||||
this.monsterId = mapMarkPoint.getMonsterId();
|
||||
this.mapMarkFromType = mapMarkPoint.getFromType();
|
||||
|
||||
@@ -497,11 +497,7 @@ public class StaminaManager extends BasePlayerManager {
|
||||
}
|
||||
}
|
||||
previousState = currentState;
|
||||
previousCoordinates = new Position(
|
||||
currentCoordinates.getX(),
|
||||
currentCoordinates.getY(),
|
||||
currentCoordinates.getZ()
|
||||
);
|
||||
previousCoordinates = currentCoordinates.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user