mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 00:35:56 -04:00
Added special handling for Magnanimous Tools. Closes #1467.
This commit is contained in:
parent
2ead961841
commit
b99baf0bcc
@ -0,0 +1,7 @@
|
||||
package li.cil.oc.integration.magtools
|
||||
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
object ModMagnanimousTools {
|
||||
def isMagTool(stack: ItemStack) = stack != null && stack.getItem.getClass.getName.startsWith("com.vapourdrive.magtools.items.tools.")
|
||||
}
|
@ -3,6 +3,7 @@ package li.cil.oc.integration.tcon
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.integration.ModProxy
|
||||
import li.cil.oc.integration.Mods
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
|
||||
object ModTinkersConstruct extends ModProxy {
|
||||
@ -13,4 +14,6 @@ object ModTinkersConstruct extends ModProxy {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(EventHandlerTinkersConstruct)
|
||||
}
|
||||
|
||||
def isInfiTool(stack: ItemStack) = stack != null && stack.getItem.getClass.getName.startsWith("tconstruct.")
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
package li.cil.oc.integration.util
|
||||
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
object TinkersConstruct {
|
||||
def isInfiTool(stack: ItemStack) = stack != null && stack.getItem.getClass.getName.startsWith( """tconstruct.""")
|
||||
}
|
@ -12,8 +12,9 @@ import li.cil.oc.api.internal
|
||||
import li.cil.oc.api.network.Connector
|
||||
import li.cil.oc.common.EventHandler
|
||||
import li.cil.oc.integration.Mods
|
||||
import li.cil.oc.integration.magtools.ModMagnanimousTools
|
||||
import li.cil.oc.integration.tcon.ModTinkersConstruct
|
||||
import li.cil.oc.integration.util.PortalGun
|
||||
import li.cil.oc.integration.util.TinkersConstruct
|
||||
import li.cil.oc.util.BlockPosition
|
||||
import li.cil.oc.util.InventoryUtils
|
||||
import net.minecraft.block.Block
|
||||
@ -332,12 +333,13 @@ class Player(val agent: internal.Agent) extends FakePlayer(agent.world.asInstanc
|
||||
// their break logic in onBlockStartBreak but return true to cancel
|
||||
// further processing. We also need to adjust our offset for their ray-
|
||||
// tracing implementation.
|
||||
if (TinkersConstruct.isInfiTool(stack)) {
|
||||
val needsSpecialPlacement = ModTinkersConstruct.isInfiTool(stack) || ModMagnanimousTools.isMagTool(stack)
|
||||
if (needsSpecialPlacement) {
|
||||
posY -= 1.62
|
||||
prevPosY = posY
|
||||
}
|
||||
val cancel = stack != null && stack.getItem.onBlockStartBreak(stack, x, y, z, this)
|
||||
if (cancel && TinkersConstruct.isInfiTool(stack)) {
|
||||
if (cancel && needsSpecialPlacement) {
|
||||
posY += 1.62
|
||||
prevPosY = posY
|
||||
return adjustedBreakTime
|
||||
|
Loading…
x
Reference in New Issue
Block a user