Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
9970aeb9
Commit
9970aeb9
authored
Aug 25, 2022
by
AnimeGitB
Browse files
Consolidate random point offsets
parent
6098b51e
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/drop/DropSystem.java
View file @
9970aeb9
...
...
@@ -78,8 +78,8 @@ public class DropSystem extends BaseGameSystem {
}
if
(
itemData
.
isEquip
())
{
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
float
range
=
(
5
f
+
(.
1
f
*
num
));
Position
pos
=
em
.
getPosition
().
clone
().
addX
((
float
)
(
Math
.
random
()
*
range
)
-
(
range
/
2
)).
addY
(
3
f
).
addZ
((
float
)
(
Math
.
random
()
*
range
)
-
(
range
/
2
)
);
float
range
=
(
2.
5f
+
(.
05
f
*
num
));
Position
pos
=
em
.
getPosition
().
nearby2d
(
range
).
addY
(
3
f
);
addDropEntity
(
dd
,
em
.
getScene
(),
itemData
,
pos
,
num
,
gp
);
}
}
else
{
...
...
src/main/java/emu/grasscutter/game/entity/gadget/GadgetGatherObject.java
View file @
9970aeb9
...
...
@@ -68,10 +68,7 @@ public class GadgetGatherObject extends GadgetContent {
scene
,
player
,
GameData
.
getItemDataMap
().
get
(
itemId
),
getGadget
().
getPosition
().
clone
()
.
addY
(
2
f
)
.
addX
(
Utils
.
randomFloatRange
(-
1
f
,
1
f
))
.
addZ
(
Utils
.
randomFloatRange
(-
1
f
,
1
f
)),
getGadget
().
getPosition
().
nearby2d
(
1
f
).
addY
(
2
f
),
1
,
true
);
...
...
src/main/java/emu/grasscutter/game/managers/blossom/BlossomActivity.java
View file @
9970aeb9
...
...
@@ -101,7 +101,7 @@ public class BlossomActivity {
for
(
int
i
=
0
;
i
<
willSpawn
;
i
++)
{
MonsterData
monsterData
=
GameData
.
getMonsterDataMap
().
get
(
candidateMonsters
.
poll
());
int
level
=
scene
.
getEntityLevel
(
1
,
worldLevelOverride
);
EntityMonster
entity
=
new
EntityMonster
(
scene
,
monsterData
,
pos
.
nearby2d
(
4
0
),
level
);
EntityMonster
entity
=
new
EntityMonster
(
scene
,
monsterData
,
pos
.
nearby2d
(
4
f
),
level
);
scene
.
addEntity
(
entity
);
newMonsters
.
add
(
entity
);
}
...
...
src/main/java/emu/grasscutter/game/world/Scene.java
View file @
9970aeb9
...
...
@@ -695,14 +695,14 @@ public class Scene {
return
;
}
if
(
itemData
.
isEquip
())
{
float
range
=
(
3
f
+
(.
1
f
*
amount
));
float
range
=
(
1.5
f
+
(.
05
f
*
amount
));
for
(
int
i
=
0
;
i
<
amount
;
i
++)
{
Position
pos
=
bornForm
.
getPosition
().
clone
().
addX
((
float
)
(
Math
.
random
()
*
range
)
-
(
range
/
2
)).
addZ
((
float
)
(
Math
.
random
()
*
range
)
-
(
range
/
2
)).
addZ
(.
9
f
);
Position
pos
=
bornForm
.
getPosition
().
nearby2d
(
range
).
addZ
(.
9
f
);
// Why Z?
EntityItem
entity
=
new
EntityItem
(
this
,
null
,
itemData
,
pos
,
1
);
addEntity
(
entity
);
}
}
else
{
EntityItem
entity
=
new
EntityItem
(
this
,
null
,
itemData
,
bornForm
.
getPosition
().
clone
().
addZ
(.
9
f
),
amount
);
EntityItem
entity
=
new
EntityItem
(
this
,
null
,
itemData
,
bornForm
.
getPosition
().
clone
().
addZ
(.
9
f
),
amount
);
// Why Z?
addEntity
(
entity
);
}
}
...
...
src/main/java/emu/grasscutter/utils/Position.java
View file @
9970aeb9
...
...
@@ -6,19 +6,21 @@ import com.google.gson.annotations.SerializedName;
import
com.github.davidmoten.rtreemulti.geometry.Point
;
import
dev.morphia.annotations.Entity
;
import
emu.grasscutter.net.proto.VectorOuterClass.Vector
;
import
lombok.Getter
;
import
lombok.Setter
;
@Entity
public
class
Position
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2001232313615923575L
;
@SerializedName
(
value
=
"x"
,
alternate
={
"_x"
,
"X"
})
private
float
x
;
@Getter
@Setter
private
float
x
;
@SerializedName
(
value
=
"y"
,
alternate
={
"_y"
,
"Y"
})
private
float
y
;
@Getter
@Setter
private
float
y
;
@SerializedName
(
value
=
"z"
,
alternate
={
"_z"
,
"Z"
})
private
float
z
;
@Getter
@Setter
private
float
z
;
public
Position
()
{
...
...
@@ -51,30 +53,6 @@ public class Position implements Serializable {
this
.
set
(
pos
);
}
public
float
getX
()
{
return
x
;
}
public
void
setX
(
float
x
)
{
this
.
x
=
x
;
}
public
float
getZ
()
{
return
z
;
}
public
void
setZ
(
float
z
)
{
this
.
z
=
z
;
}
public
float
getY
()
{
return
y
;
}
public
void
setY
(
float
y
)
{
this
.
y
=
y
;
}
public
Position
set
(
float
x
,
float
y
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -150,10 +128,10 @@ public class Position implements Serializable {
return
Math
.
sqrt
(
detX
*
detX
+
detY
*
detY
+
detZ
*
detZ
);
}
public
Position
nearby2d
(
in
t
range
)
{
public
Position
nearby2d
(
floa
t
range
)
{
Position
position
=
clone
();
position
.
z
+=
(
float
)
Utils
.
randomRange
(-
range
,
range
)
/
10
;
position
.
x
+=
(
float
)
Utils
.
randomRange
(-
range
,
range
)
/
10
;
position
.
z
+=
Utils
.
random
Float
Range
(-
range
,
range
);
position
.
x
+=
Utils
.
random
Float
Range
(-
range
,
range
);
return
position
;
}
public
Position
translateWithDegrees
(
float
dist
,
float
angle
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment