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
MythicCosmetics
Commits
0f929dbe
Commit
0f929dbe
authored
2 years ago
by
Ashijin
Browse files
Options
Download
Email Patches
Plain Diff
Fixed support for paper build 174+
parent
e7c04b67
master
Terminated/dev
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
pom.xml
pom.xml
+1
-1
v1_19_R1_2/src/main/java/io/lumine/cosmetics/nms/VolatileCodeEnabled_v1_19_R1_2.java
.../lumine/cosmetics/nms/VolatileCodeEnabled_v1_19_R1_2.java
+24
-3
No files found.
pom.xml
View file @
0f929dbe
...
...
@@ -15,7 +15,7 @@
<properties>
<mccosmetics.version>
0.8.0
</mccosmetics.version>
<paperapi.version>
1.19-R0.1-SNAPSHOT
</paperapi.version>
<lumineutils.version>
1.1
8
-SNAPSHOT
</lumineutils.version>
<lumineutils.version>
1.1
9
-SNAPSHOT
</lumineutils.version>
<lombok.version>
1.18.22
</lombok.version>
<!--suppress UnresolvedMavenProperty -->
<build.number>
${CI_COMMIT_SHORT_SHA}
</build.number>
...
...
This diff is collapsed.
Click to expand it.
v1_19_R1_2/src/main/java/io/lumine/cosmetics/nms/VolatileCodeEnabled_v1_19_R1_2.java
View file @
0f929dbe
...
...
@@ -22,6 +22,8 @@ import net.minecraft.network.protocol.Packet;
import
net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket
;
import
net.minecraft.server.level.ServerLevel
;
import
net.minecraft.server.level.ServerPlayer
;
import
net.minecraft.world.level.entity.LevelEntityGetter
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Location
;
import
org.bukkit.World
;
...
...
@@ -32,6 +34,7 @@ import org.bukkit.entity.Entity;
import
org.bukkit.entity.LivingEntity
;
import
org.bukkit.entity.Player
;
import
java.lang.reflect.Method
;
import
java.util.Collection
;
import
java.util.Map
;
...
...
@@ -40,6 +43,8 @@ public class VolatileCodeEnabled_v1_19_R1_2 implements VolatileCodeHandler {
@Getter
private
final
MCCosmeticsPlugin
plugin
;
private
final
Map
<
Class
<?
extends
Cosmetic
>,
VolatileCosmeticHelper
>
cosmeticHelpers
=
Maps
.
newConcurrentMap
();
private
Method
entityGetter
;
public
VolatileCodeEnabled_v1_19_R1_2
(
MCCosmeticsPlugin
plugin
)
{
this
.
plugin
=
plugin
;
cosmeticHelpers
.
put
(
Hat
.
class
,
new
VolatileHatImpl
(
plugin
,
this
));
...
...
@@ -47,6 +52,13 @@ public class VolatileCodeEnabled_v1_19_R1_2 implements VolatileCodeHandler {
cosmeticHelpers
.
put
(
Spray
.
class
,
new
VolatileSprayImpl
(
plugin
,
this
));
cosmeticHelpers
.
put
(
Offhand
.
class
,
new
VolatileOffhandImpl
(
plugin
,
this
));
cosmeticHelpers
.
put
(
Gesture
.
class
,
new
VolatileGestureImpl
(
plugin
,
this
));
for
(
var
method
:
ServerLevel
.
class
.
getMethods
())
{
if
(
LevelEntityGetter
.
class
.
isAssignableFrom
(
method
.
getReturnType
())
&&
method
.
getReturnType
()
!=
LevelEntityGetter
.
class
)
{
entityGetter
=
method
;
break
;
}
}
}
@Override
...
...
@@ -135,9 +147,18 @@ public class VolatileCodeEnabled_v1_19_R1_2 implements VolatileCodeHandler {
public
Entity
getEntity
(
World
world
,
int
id
)
{
ServerLevel
level
=
((
CraftWorld
)
world
).
getHandle
();
final
var
entityManager
=
level
.
entityManager
;
final
var
entity
=
entityManager
.
getEntityGetter
().
get
(
id
);
return
entity
==
null
?
null
:
entity
.
getBukkitEntity
();
try
{
var
getter
=
entityGetter
!=
null
?
(
LevelEntityGetter
<
net
.
minecraft
.
world
.
entity
.
Entity
>)
entityGetter
.
invoke
(
level
)
:
level
.
entityManager
.
getEntityGetter
();
final
var
entity
=
getter
.
get
(
id
);
return
entity
==
null
?
null
:
entity
.
getBukkitEntity
();
}
catch
(
Exception
|
Error
ex
)
{
ex
.
printStackTrace
();
return
null
;
}
}
@Override
...
...
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