Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
MythicCraft
MEG MoLang Extension
Commits
ca5c47f1
Commit
ca5c47f1
authored
2 years ago
by
Ticxo
Browse files
Options
Download
Email Patches
Plain Diff
Updated to use R3.1.5
parent
555dc5dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
pom.xml
pom.xml
+2
-2
src/main/java/com/ticxo/megml/ModelQuery.java
src/main/java/com/ticxo/megml/ModelQuery.java
+5
-5
src/main/java/com/ticxo/megml/QueryData.java
src/main/java/com/ticxo/megml/QueryData.java
+2
-2
src/main/java/com/ticxo/megml/RuntimeManager.java
src/main/java/com/ticxo/megml/RuntimeManager.java
+3
-3
No files found.
pom.xml
View file @
ca5c47f1
...
...
@@ -6,7 +6,7 @@
<groupId>
com.ticxo.megmolang
</groupId>
<artifactId>
Meg-Molang
</artifactId>
<version>
R1.0.
0
</version>
<version>
R1.0.
1
</version>
<properties>
<maven.compiler.source>
16
</maven.compiler.source>
...
...
@@ -67,7 +67,7 @@
<dependency>
<groupId>
com.ticxo.modelengine
</groupId>
<artifactId>
api
</artifactId>
<version>
R3.1.
1
</version>
<version>
R3.1.
5
</version>
<scope>
provided
</scope>
</dependency>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/ticxo/megml/ModelQuery.java
View file @
ca5c47f1
package
com.ticxo.megml
;
import
com.bedrockk.molang.runtime.MoParams
;
import
com.ticxo.modelengine.api.animation.AnimationProperty
;
import
com.ticxo.modelengine.api.animation.
property.I
AnimationProperty
;
import
com.ticxo.modelengine.api.entity.BaseEntity
;
import
com.ticxo.modelengine.api.model.ModeledEntity
;
import
org.bukkit.attribute.Attribute
;
...
...
@@ -19,7 +19,7 @@ public class ModelQuery {
private
static
final
Vector
ZERO
=
new
Vector
();
public
static
final
Map
<
String
,
BiFunction
<
MoParams
,
AnimationProperty
,
Object
>>
MODEL_QUERY
=
new
HashMap
<>()
{
public
static
final
Map
<
String
,
BiFunction
<
MoParams
,
I
AnimationProperty
,
Object
>>
MODEL_QUERY
=
new
HashMap
<>()
{
{
put
(
"anim_time"
,
(
params
,
property
)
->
property
.
getTime
());
put
(
"body_y_rotation"
,
(
params
,
property
)
->
getBase
(
property
).
getYBodyRot
());
...
...
@@ -41,18 +41,18 @@ public class ModelQuery {
return
attr
==
null
?
0
:
attr
.
getValue
();
}
private
static
Object
livingOrZero
(
AnimationProperty
property
,
Function
<
LivingEntity
,
Object
>
function
)
{
private
static
Object
livingOrZero
(
I
AnimationProperty
property
,
Function
<
LivingEntity
,
Object
>
function
)
{
if
(
getBase
(
property
).
getOriginal
()
instanceof
LivingEntity
living
)
{
return
function
.
apply
(
living
);
}
return
0
;
}
private
static
BaseEntity
<?>
getBase
(
AnimationProperty
property
)
{
private
static
BaseEntity
<?>
getBase
(
I
AnimationProperty
property
)
{
return
getModel
(
property
).
getBase
();
}
private
static
ModeledEntity
getModel
(
AnimationProperty
property
)
{
private
static
ModeledEntity
getModel
(
I
AnimationProperty
property
)
{
return
property
.
getModel
().
getModeledEntity
();
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/ticxo/megml/QueryData.java
View file @
ca5c47f1
package
com.ticxo.megml
;
import
com.bedrockk.molang.Expression
;
import
com.ticxo.modelengine.api.animation.AnimationProperty
;
import
com.ticxo.modelengine.api.animation.keyframe.IKeyframeData
;
import
com.ticxo.modelengine.api.animation.property.IAnimationProperty
;
import
lombok.RequiredArgsConstructor
;
import
java.util.List
;
...
...
@@ -14,7 +14,7 @@ public class QueryData implements IKeyframeData {
private
final
List
<
Expression
>
script
;
@Override
public
double
getValue
(
AnimationProperty
property
)
{
public
double
getValue
(
I
AnimationProperty
property
)
{
var
runtime
=
manager
.
getOrCreateRuntime
(
property
);
try
{
var
value
=
runtime
.
execute
(
script
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/ticxo/megml/RuntimeManager.java
View file @
ca5c47f1
...
...
@@ -3,7 +3,7 @@ package com.ticxo.megml;
import
com.bedrockk.molang.MoLang
;
import
com.bedrockk.molang.runtime.MoLangRuntime
;
import
com.bedrockk.molang.runtime.struct.QueryStruct
;
import
com.ticxo.modelengine.api.animation.AnimationProperty
;
import
com.ticxo.modelengine.api.animation.
property.I
AnimationProperty
;
import
org.bukkit.scheduler.BukkitRunnable
;
import
java.util.Map
;
...
...
@@ -11,7 +11,7 @@ import java.util.concurrent.ConcurrentHashMap;
public
class
RuntimeManager
extends
BukkitRunnable
{
private
final
Map
<
AnimationProperty
,
MoLangRuntime
>
runtimes
=
new
ConcurrentHashMap
<>();
private
final
Map
<
I
AnimationProperty
,
MoLangRuntime
>
runtimes
=
new
ConcurrentHashMap
<>();
@Override
public
void
run
()
{
...
...
@@ -21,7 +21,7 @@ public class RuntimeManager extends BukkitRunnable {
}
}
public
MoLangRuntime
getOrCreateRuntime
(
AnimationProperty
property
)
{
public
MoLangRuntime
getOrCreateRuntime
(
I
AnimationProperty
property
)
{
return
runtimes
.
computeIfAbsent
(
property
,
p
->
{
var
runtime
=
MoLang
.
createRuntime
();
runtime
.
getEnvironment
().
getStructs
().
put
(
"query"
,
new
QueryStruct
<>(
p
,
ModelQuery
.
MODEL_QUERY
));
...
...
This diff is collapsed.
Click to expand it.
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