From d670b80f4a4de291e3b6dd2333b8d7ac489bd598 Mon Sep 17 00:00:00 2001 From: repo_alt Date: Mon, 20 Dec 2021 22:15:40 +0300 Subject: [PATCH] GT blocks facing and sensor information added to geolyzer.analyze https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9204 --- .../gregtech/EventHandlerGregTech.scala | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala b/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala index ae349f30c..1bb280bcb 100644 --- a/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala +++ b/src/main/scala/li/cil/oc/integration/gregtech/EventHandlerGregTech.scala @@ -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 {