Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,26 @@ object EventHandlerGregTech {
val world = e.host.world
val te = world.getTileEntity(e.x, e.y, e.z)
te match {
case turnable : ITurnable =>
case turnable: ITurnable =>
e.data += "facing" -> turnable.getFrontFacing.name
case _ =>
}
val infoDevice = Capabilities.getCapability(te, classOf[IGregTechDeviceInformation])
if (infoDevice != null) {
e.data += "sensorInformation" -> infoDevice.getInfoData
}

te match {
case gtTe: IGregTechTileEntity =>
val meta = gtTe.getMetaTileEntity
if (meta != null) {
e.data += "sensorInformation" -> meta.getInfoData
e.data += "machineType" -> meta.getInventoryName
e.data += "metaId" -> meta.getClass.getSimpleName
e.data += "gtMetaId" -> Int.box(gtTe.getMetaTileID.toInt)
}
case _ =>
}
}

@SubscribeEvent
Expand Down
14 changes: 14 additions & 0 deletions src/main/scala/li/cil/oc/server/agent/Player.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package li.cil.oc.server.agent

import java.util.UUID

import appeng.api.parts.IPartHost
import com.mojang.authlib.GameProfile
import cpw.mods.fml.common.ObfuscationReflectionHelper
import cpw.mods.fml.common.eventhandler.Event
Expand Down Expand Up @@ -245,6 +246,19 @@ class Player(val agent: internal.Agent) extends FakePlayer(agent.world.asInstanc

val block = world.getBlock(x, y, z)
val canActivate = block != null && Settings.get.allowActivateBlocks
// Special handling for ae2 P2Ps
val tile = world.getTileEntity(x, y, z)
if (isSneaking && tile != null && tile.isInstanceOf[IPartHost]) {
val host = tile.asInstanceOf[IPartHost]
val hitVec = Vec3.createVectorHelper(hitX, hitY, hitZ)
val selected = host.selectPart(hitVec)
if (selected != null && selected.part != null) {
return if (selected.part.onShiftActivate(this, hitVec))
ActivationType.BlockActivated
else
ActivationType.None
}
}
val shouldActivate = canActivate && (!isSneaking || (item == null || item.doesSneakBypassUse(world, x, y, z, this)))
val result =
if (shouldActivate && block.onBlockActivated(world, x, y, z, this, side, hitX, hitY, hitZ))
Expand Down
Loading