GT blocks facing and sensor information added to geolyzer.analyze

https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9204
This commit is contained in:
repo_alt 2021-12-20 22:15:40 +03:00
parent 2618389715
commit d670b80f4a

View File

@ -2,11 +2,24 @@ package li.cil.oc.integration.gregtech
import cpw.mods.fml.common.eventhandler.SubscribeEvent
import gregtech.api.interfaces.IDamagableItem
import gregtech.api.interfaces.tileentity.IGregTechTileEntity
import gregtech.api.items.GT_MetaGenerated_Tool
import li.cil.oc.api.event.RobotUsedToolEvent
import li.cil.oc.api.event.{GeolyzerEvent, RobotUsedToolEvent}
import net.minecraft.item.ItemStack
import net.minecraftforge.common.util.ForgeDirection
import scala.collection.convert.WrapAsScala._
object EventHandlerGregTech {
@SubscribeEvent
def onGeolyzerAnalyze(e: GeolyzerEvent.Analyze) {
val world = e.host.world
world.getTileEntity(e.x, e.y, e.z) match {
case tile : IGregTechTileEntity =>
e.data += "facing" -> ForgeDirection.getOrientation(tile.getFrontFacing).name()
e.data += "sensorInformation" -> tile.getInfoData()
}
}
@SubscribeEvent
def onRobotApplyDamageRate(e: RobotUsedToolEvent.ApplyDamageRate) {
(e.toolBeforeUse.getItem, e.toolAfterUse.getItem) match {