Skip to content

Commit

Permalink
Update to new Oraxen version b8daf9f42d (1.149.0)
Browse files Browse the repository at this point in the history
Took 12 minutes
  • Loading branch information
DerFrZocker committed Dec 19, 2022
1 parent 91c6933 commit 8aca181
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
import de.derfrzocker.custom.ore.generator.impl.v1_19_R1.customdata.OraxenApplier_v1_19_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_19_R2.customdata.OraxenApplier_v1_19_R2;
import de.derfrzocker.spigot.utils.Version;
import io.th0rgal.oraxen.compatibilities.provided.itembridge.OraxenItemBridge;
import io.th0rgal.oraxen.items.OraxenItems;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanic;
import io.th0rgal.oraxen.api.OraxenItems;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanicFactory;
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanicFactory;
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanicFactory;
import io.th0rgal.oraxen.utils.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.block.data.type.NoteBlock;
import org.bukkit.block.data.type.Tripwire;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

public class OraxenCustomData extends AbstractCustomData<CustomDataApplier> {
Expand Down Expand Up @@ -91,7 +91,7 @@ public boolean hasCustomData(@NotNull BlockState blockState) {

// Check for block mechanic
if (blockState.getType() == Material.MUSHROOM_STEM) {
return BlockMechanicFactory.getBlockMechanic(BlockMechanic.getCode((MultipleFacing) blockData)) != null;
return BlockMechanicFactory.getBlockMechanic(getCode((MultipleFacing) blockData)) != null;
}

// Check for note block mechanic
Expand All @@ -115,7 +115,7 @@ public Object getCustomData(@NotNull BlockState blockState) {

// Check for block mechanic
if (blockState.getType() == Material.MUSHROOM_STEM) {
return BlockMechanicFactory.getBlockMechanic(BlockMechanic.getCode((MultipleFacing) blockData)).getItemID();
return BlockMechanicFactory.getBlockMechanic(getCode((MultipleFacing) blockData)).getItemID();
}

// Check for note block mechanic
Expand All @@ -132,6 +132,17 @@ public Object getCustomData(@NotNull BlockState blockState) {
return false;
}

private int getCode(MultipleFacing blockData) {
int sum = 0;
List<BlockFace> properties = Arrays.asList(BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH, BlockFace.DOWN, BlockFace.UP);

for (BlockFace blockFace : blockData.getFaces()) {
sum += Math.pow(2.0, properties.indexOf(blockFace));
}

return sum;
}

@NotNull
@Override
protected CustomDataApplier getCustomDataApplier0() {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<version.non-maven1>1.0.0</version.non-maven1>
<spigot-utils.version>cog-3</spigot-utils.version>
<ItemMods.version>2.0.0-alpha.1</ItemMods.version>
<Oraxen.version>b8daf9f42d</Oraxen.version>
<Oraxen.version>ebd90cfbb2</Oraxen.version>
</properties>

<repositories>
Expand Down

0 comments on commit 8aca181

Please sign in to comment.