fix forgedirection dismatch

This commit is contained in:
GlodBlock committed 2022-01-30 18:50:14 +08:00
1 parent 6cb24abad6
commit 40f28610ca
2 files changed
+11 -4

No files matched your search

@@ -1,7 +1,5 @@
package com.projecturanus.betterp2p
import appeng.items.tools.ToolMemoryCard
import appeng.items.tools.ToolNetworkTool
import com.projecturanus.betterp2p.client.render.RenderHandler
import com.projecturanus.betterp2p.config.BetterP2PConfig
import com.projecturanus.betterp2p.item.ItemAdvancedMemoryCard
@@ -7,7 +7,6 @@ import appeng.api.parts.IPart
import appeng.api.parts.PartItemStack
import appeng.me.GridAccessException
import appeng.parts.p2p.PartP2PTunnel
import appeng.util.Platform
import com.projecturanus.betterp2p.network.P2PInfo
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
@@ -93,8 +92,18 @@ var PartP2PTunnel<*>.outputProperty
field.setBoolean(this, value)
}
fun ForgeDirection.getEnumIndex(): Int {
if (this == ForgeDirection.WEST) {
return 5
}
if (this == ForgeDirection.EAST) {
return 4
}
return this.ordinal
}
val PartP2PTunnel<*>.hasChannel
get() = isPowered && isActive
fun PartP2PTunnel<*>.getInfo(index: Int)
= P2PInfo(index, frequency, location.x, location.y, location.z, EnumFacing.getFront(side.ordinal), isOutput, hasChannel)
= P2PInfo(index, frequency, location.x, location.y, location.z, EnumFacing.getFront(side.getEnumIndex()), isOutput, hasChannel)