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
ec0a8177
Commit
ec0a8177
authored
3 years ago
by
Ashijin
Browse files
Options
Download
Email Patches
Plain Diff
aaaaaaaaaaaaaaa
parent
4a036363
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
60 deletions
+40
-60
dist/pom.xml
dist/pom.xml
+0
-6
plugin/pom.xml
plugin/pom.xml
+1
-2
pom.xml
pom.xml
+0
-1
v1_18/pom.xml
v1_18/pom.xml
+2
-12
v1_18/src/main/java/io/lumine/cosmetics/nms/v1_18_R1/cosmetic/VolatileHatImpl.java
...mine/cosmetics/nms/v1_18_R1/cosmetic/VolatileHatImpl.java
+28
-36
v1_18_R2/pom.xml
v1_18_R2/pom.xml
+9
-3
No files found.
dist/pom.xml
View file @
ec0a8177
...
...
@@ -47,12 +47,6 @@
<version>
${project.parent.version}
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
io.lumine
</groupId>
<artifactId>
MCCosmetics-v1_18
</artifactId>
<version>
${project.parent.version}
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
...
...
This diff is collapsed.
Click to expand it.
plugin/pom.xml
View file @
ec0a8177
...
...
@@ -167,8 +167,7 @@
<groupId>
io.lumine
</groupId>
<artifactId>
MCCosmetics-API
</artifactId>
<version>
${project.parent.version}
</version>
<scope>
compile
</scope>
<optional>
true
</optional>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
io.lumine
</groupId>
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
ec0a8177
...
...
@@ -28,7 +28,6 @@
<modules>
<module>
api
</module>
<module>
plugin
</module>
<module>
v1_18
</module>
<module>
v1_18_R2
</module>
<module>
dist
</module>
</modules>
...
...
This diff is collapsed.
Click to expand it.
v1_18/pom.xml
View file @
ec0a8177
...
...
@@ -78,7 +78,7 @@
<dependency>
<groupId>
io.lumine
</groupId>
<artifactId>
MCCosmetics-API
</artifactId>
<version>
${
mccosmetics
.version}
</version>
<version>
${
project.parent
.version}
</version>
<scope>
provided
</scope>
</dependency>
<!-- Main dependencies -->
...
...
@@ -92,8 +92,7 @@
<groupId>
io.lumine
</groupId>
<artifactId>
MCCosmetics
</artifactId>
<version>
${project.parent.version}
</version>
<scope>
compile
</scope>
<optional>
true
</optional>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
...
...
@@ -107,7 +106,6 @@
<groupId>
org.spigotmc
</groupId>
<artifactId>
spigot-api
</artifactId>
<version>
1.18-R0.1-SNAPSHOT
</version>
<classifier>
shaded
</classifier>
<scope>
provided
</scope>
</dependency>
...
...
@@ -138,14 +136,6 @@
<scope>
provided
</scope>
</dependency>
<!-- Other -->
<dependency>
<groupId>
com.comphenix.protocol
</groupId>
<artifactId>
ProtocolLib
</artifactId>
<version>
4.6.0-SNAPSHOT
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
v1_18/src/main/java/io/lumine/cosmetics/nms/v1_18_R1/cosmetic/VolatileHatImpl.java
View file @
ec0a8177
package
io.lumine.cosmetics.nms.v1_18_R1.cosmetic
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack
;
import
org.bukkit.entity.Player
;
import
org.bukkit.inventory.ItemStack
;
import
com.comphenix.protocol.PacketType
;
...
...
@@ -11,61 +14,50 @@ import com.google.common.collect.Lists;
import
com.mojang.datafixers.util.Pair
;
import
io.lumine.cosmetics.MCCosmeticsPlugin
;
import
io.lumine.cosmetics.api.cosmetics.Cosmetic
;
import
io.lumine.cosmetics.api.cosmetics.ItemCosmetic
;
import
io.lumine.cosmetics.api.players.CosmeticProfile
;
import
io.lumine.cosmetics.nms.VolatileCodeEnabled_v1_18_R1
;
import
io.lumine.cosmetics.nms.cosmetic.VolatileHatHelper
;
import
io.lumine.utils.protocol.Protocol
;
import
lombok.Getter
;
import
net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket
;
import
net.minecraft.world.entity.EquipmentSlot
;
public
class
VolatileHatImpl
implements
VolatileHatHelper
{
@Getter
private
final
MCCosmeticsPlugin
plugin
;
public
VolatileHatImpl
(
MCCosmeticsPlugin
plugin
)
{
@Getter
private
final
MCCosmeticsPlugin
plugin
;
private
final
VolatileCodeEnabled_v1_18_R1
nmsHandler
;
public
VolatileHatImpl
(
MCCosmeticsPlugin
plugin
,
VolatileCodeEnabled_v1_18_R1
nmsHandler
)
{
this
.
plugin
=
plugin
;
this
.
nmsHandler
=
nmsHandler
;
}
@Override
public
void
applyHatPacket
(
CosmeticProfile
profile
)
{
if
(
profile
==
null
)
{
return
;
}
final
var
player
=
profile
.
getPlayer
();
final
var
packet
=
Protocol
.
manager
().
createPacket
(
PacketType
.
Play
.
Server
.
ENTITY_EQUIPMENT
);
packet
.
getEntityModifier
(
player
.
getWorld
()).
write
(
0
,
player
);
try
{
if
(
profile
==
null
)
return
;
Player
player
=
profile
.
getPlayer
();
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquippedHat
();
/*
if(profile.getHat().isPresent()) {
profile.setHatIsActive(true);
writeHeadItem(packet, profile.getEquippedHat());
Protocol.broadcastPacket(packet);
} else if(profile.getHatIsActive()) {
writeHeadItem(packet, player.getInventory().getHelmet());
Protocol.broadcastPacket(packet);
}*/
}
if
(
cosmetic
.
isEmpty
()
||
!(
cosmetic
.
get
()
instanceof
ItemCosmetic
hat
))
return
;
public
boolean
writeHeadItem
(
PacketContainer
packet
,
ItemStack
item
)
{
List
<
Pair
<
EquipmentSlot
,
net
.
minecraft
.
world
.
item
.
ItemStack
>>
slots
=
(
List
<
Pair
<
EquipmentSlot
,
net
.
minecraft
.
world
.
item
.
ItemStack
>>)
packet
.
getModifier
().
read
(
1
);
List
<
Pair
<
EquipmentSlot
,
net
.
minecraft
.
world
.
item
.
ItemStack
>>
newSlots
=
Lists
.
newArrayList
();
var
nmsHat
=
CraftItemStack
.
asNMSCopy
(
hat
.
getCosmetic
());
boolean
foundHead
=
false
;
for
(
Pair
<
EquipmentSlot
,
net
.
minecraft
.
world
.
item
.
ItemStack
>
pair
:
slots
)
{
final
EquipmentSlot
slot
=
pair
.
getFirst
();
if
(
slot
==
EquipmentSlot
.
HEAD
)
{
foundHead
=
true
;
newSlots
.
add
(
Pair
.
of
(
pair
.
getFirst
(),
CraftItemStack
.
asNMSCopy
(
item
)));
}
else
{
newSlots
.
add
(
pair
);
}
}
if
(!
foundHead
)
{
newSlots
.
add
(
Pair
.
of
(
EquipmentSlot
.
HEAD
,
CraftItemStack
.
asNMSCopy
(
item
)));
List
<
Pair
<
EquipmentSlot
,
net
.
minecraft
.
world
.
item
.
ItemStack
>>
slots
=
new
ArrayList
<>();
slots
.
add
(
Pair
.
of
(
EquipmentSlot
.
HEAD
,
nmsHat
));
ClientboundSetEquipmentPacket
equipmentPacket
=
new
ClientboundSetEquipmentPacket
(
player
.
getEntityId
(),
slots
);
nmsHandler
.
broadcast
(
player
.
getWorld
(),
equipmentPacket
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
packet
.
getModifier
().
write
(
1
,
newSlots
);
return
true
;
}
}
This diff is collapsed.
Click to expand it.
v1_18_R2/pom.xml
View file @
ec0a8177
...
...
@@ -78,7 +78,7 @@
<dependency>
<groupId>
io.lumine
</groupId>
<artifactId>
MCCosmetics-API
</artifactId>
<version>
${
mccosmetics
.version}
</version>
<version>
${
project.parent
.version}
</version>
<scope>
provided
</scope>
</dependency>
<!-- Main dependencies -->
...
...
@@ -92,8 +92,7 @@
<groupId>
io.lumine
</groupId>
<artifactId>
MCCosmetics
</artifactId>
<version>
${project.parent.version}
</version>
<scope>
compile
</scope>
<optional>
true
</optional>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
...
...
@@ -137,6 +136,13 @@
<version>
4.1.25.Final
</version>
<scope>
provided
</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.8.0-beta4
</version>
</dependency>
</dependencies>
...
...
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