40
40
import de .derfrzocker .custom .ore .generator .impl .v1_19_R1 .customdata .OraxenApplier_v1_19_R1 ;
41
41
import de .derfrzocker .custom .ore .generator .impl .v1_19_R2 .customdata .OraxenApplier_v1_19_R2 ;
42
42
import de .derfrzocker .spigot .utils .Version ;
43
- import io .th0rgal .oraxen .compatibilities .provided .itembridge .OraxenItemBridge ;
44
- import io .th0rgal .oraxen .items .OraxenItems ;
45
- import io .th0rgal .oraxen .mechanics .provided .gameplay .block .BlockMechanic ;
43
+ import io .th0rgal .oraxen .api .OraxenItems ;
46
44
import io .th0rgal .oraxen .mechanics .provided .gameplay .block .BlockMechanicFactory ;
47
45
import io .th0rgal .oraxen .mechanics .provided .gameplay .noteblock .NoteBlockMechanicFactory ;
48
46
import io .th0rgal .oraxen .mechanics .provided .gameplay .stringblock .StringBlockMechanicFactory ;
49
- import io .th0rgal .oraxen .utils .Utils ;
50
47
import org .bukkit .Bukkit ;
51
48
import org .bukkit .Material ;
49
+ import org .bukkit .block .BlockFace ;
52
50
import org .bukkit .block .BlockState ;
53
51
import org .bukkit .block .data .BlockData ;
54
52
import org .bukkit .block .data .MultipleFacing ;
55
53
import org .bukkit .block .data .type .NoteBlock ;
56
54
import org .bukkit .block .data .type .Tripwire ;
57
55
import org .jetbrains .annotations .NotNull ;
58
56
57
+ import java .util .Arrays ;
58
+ import java .util .List ;
59
59
import java .util .function .Function ;
60
60
61
61
public class OraxenCustomData extends AbstractCustomData <CustomDataApplier > {
@@ -91,7 +91,7 @@ public boolean hasCustomData(@NotNull BlockState blockState) {
91
91
92
92
// Check for block mechanic
93
93
if (blockState .getType () == Material .MUSHROOM_STEM ) {
94
- return BlockMechanicFactory .getBlockMechanic (BlockMechanic . getCode ((MultipleFacing ) blockData )) != null ;
94
+ return BlockMechanicFactory .getBlockMechanic (getCode ((MultipleFacing ) blockData )) != null ;
95
95
}
96
96
97
97
// Check for note block mechanic
@@ -115,7 +115,7 @@ public Object getCustomData(@NotNull BlockState blockState) {
115
115
116
116
// Check for block mechanic
117
117
if (blockState .getType () == Material .MUSHROOM_STEM ) {
118
- return BlockMechanicFactory .getBlockMechanic (BlockMechanic . getCode ((MultipleFacing ) blockData )).getItemID ();
118
+ return BlockMechanicFactory .getBlockMechanic (getCode ((MultipleFacing ) blockData )).getItemID ();
119
119
}
120
120
121
121
// Check for note block mechanic
@@ -132,6 +132,17 @@ public Object getCustomData(@NotNull BlockState blockState) {
132
132
return false ;
133
133
}
134
134
135
+ private int getCode (MultipleFacing blockData ) {
136
+ int sum = 0 ;
137
+ List <BlockFace > properties = Arrays .asList (BlockFace .EAST , BlockFace .WEST , BlockFace .SOUTH , BlockFace .NORTH , BlockFace .DOWN , BlockFace .UP );
138
+
139
+ for (BlockFace blockFace : blockData .getFaces ()) {
140
+ sum += Math .pow (2.0 , properties .indexOf (blockFace ));
141
+ }
142
+
143
+ return sum ;
144
+ }
145
+
135
146
@ NotNull
136
147
@ Override
137
148
protected CustomDataApplier getCustomDataApplier0 () {
0 commit comments