1
1
package me .yamakaja .runtimetransformer .plugin .transformer ;
2
2
3
- import com .google .common .base .Predicate ;
4
3
import com .mojang .authlib .GameProfile ;
4
+
5
5
import me .yamakaja .runtimetransformer .annotation .CallParameters ;
6
6
import me .yamakaja .runtimetransformer .annotation .Inject ;
7
7
import me .yamakaja .runtimetransformer .annotation .InjectionType ;
8
8
import me .yamakaja .runtimetransformer .annotation .TransformByName ;
9
- import net .minecraft .server .v1_11_R1 .GameProfileSerializer ;
10
- import net .minecraft .server .v1_11_R1 .NBTTagCompound ;
11
- import net .minecraft .server .v1_11_R1 .TileEntitySkull ;
12
9
13
- import javax .annotation .Nullable ;
10
+ import net .minecraft .server .v1_12_R1 .GameProfileSerializer ;
11
+ import net .minecraft .server .v1_12_R1 .NBTTagCompound ;
12
+ import net .minecraft .server .v1_12_R1 .TileEntitySkull ;
14
13
15
14
/**
16
15
* Created by Yamakaja on 3/3/18.
17
16
*/
18
- @ TransformByName ("org.bukkit.craftbukkit.v1_11_R1 .inventory.CraftMetaSkull" )
17
+ @ TransformByName ("org.bukkit.craftbukkit.v1_12_R1 .inventory.CraftMetaSkull" )
19
18
public class SkullMetaTransformer {
20
19
21
20
private GameProfile profile ;
22
21
23
22
@ CallParameters (
24
23
type = CallParameters .Type .SPECIAL ,
25
- owner = "org/bukkit/craftbukkit/v1_11_R1 /inventory/CraftMetaItem" ,
24
+ owner = "org/bukkit/craftbukkit/v1_12_R1 /inventory/CraftMetaItem" ,
26
25
name = "applyToItem" ,
27
- desc = "(Lnet/minecraft/server/v1_11_R1 /NBTTagCompound;)V"
26
+ desc = "(Lnet/minecraft/server/v1_12_R1 /NBTTagCompound;)V"
28
27
)
29
28
private native void super_applyToItem (NBTTagCompound tag );
30
29
@@ -36,16 +35,13 @@ void applyToItem(final NBTTagCompound tag) {
36
35
GameProfileSerializer .serialize (owner , this .profile );
37
36
tag .set ("SkullOwner" , owner );
38
37
System .out .println ("Set owner to " + owner );
39
- TileEntitySkull .b (this .profile , new Predicate <GameProfile >() {
40
- @ Override
41
- public boolean apply (@ Nullable GameProfile gameProfile ) {
42
- NBTTagCompound newOwner = new NBTTagCompound ();
43
- GameProfileSerializer .serialize (newOwner , gameProfile );
44
- tag .set ("SkullOwner" , newOwner );
45
- System .out .println ("Received game profile!" );
46
- return false ;
47
- }
48
- });
38
+ TileEntitySkull .b (this .profile , gameProfile -> {
39
+ NBTTagCompound newOwner = new NBTTagCompound ();
40
+ GameProfileSerializer .serialize (newOwner , gameProfile );
41
+ tag .set ("SkullOwner" , newOwner );
42
+ System .out .println ("Received game profile!" );
43
+ return false ;
44
+ }, true );
49
45
}
50
46
51
47
}
0 commit comments