mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
Merge branch 'master' of https://github.com/MightyPirates/OpenComputers into MC1.7
Conflicts: src/main/scala/li/cil/oc/server/component/robot/Player.scala src/main/scala/li/cil/oc/server/component/robot/Robot.scala
This commit is contained in:
commit
fde1488578
@ -103,7 +103,7 @@ oc:gui.ServerRack.Bottom=Снизу
|
|||||||
oc:gui.ServerRack.Left=Слева
|
oc:gui.ServerRack.Left=Слева
|
||||||
oc:gui.ServerRack.Right=Справа
|
oc:gui.ServerRack.Right=Справа
|
||||||
oc:gui.ServerRack.Top=Сверху
|
oc:gui.ServerRack.Top=Сверху
|
||||||
oc:gui.ServerRack.WirelessRange=Радиус беспроводной сети
|
oc:gui.ServerRack.WirelessRange=Радиус
|
||||||
oc:gui.Terminal.InvalidKey=Неверный ключ, возможно к серверу уже подключен другой терминал.
|
oc:gui.Terminal.InvalidKey=Неверный ключ, возможно к серверу уже подключен другой терминал.
|
||||||
oc:gui.Terminal.OutOfRange=Нет сигнала от сервера.
|
oc:gui.Terminal.OutOfRange=Нет сигнала от сервера.
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ oc:tooltip.CuttingWire=Используется для нарезки глиня
|
|||||||
oc:tooltip.Disk=Примитивный носитель, который может быть использован для создания постоянных запоминающих устройств.
|
oc:tooltip.Disk=Примитивный носитель, который может быть использован для создания постоянных запоминающих устройств.
|
||||||
oc:tooltip.DiskDrive.CC=§aПоддерживаются§7 дискеты из ComputerCraft.
|
oc:tooltip.DiskDrive.CC=§aПоддерживаются§7 дискеты из ComputerCraft.
|
||||||
oc:tooltip.DiskDrive=Позволяет читать и записывать дискеты.
|
oc:tooltip.DiskDrive=Позволяет читать и записывать дискеты.
|
||||||
oc:tooltip.GraphicsCard=Передаёт изображение на дисплей.[nl] Максимальное разрешение: §f%sx%s§7.[nl] Максимальная г лубина цвета:§f%s§7.[nl] Операций/тик: §f%s§7.
|
oc:tooltip.GraphicsCard=Передаёт изображение на дисплей.[nl] Максимальное разрешение: §f%sx%s§7.[nl] Максимальная глубина цвета:§f%s§7.[nl] Операций/тик: §f%s§7.
|
||||||
oc:tooltip.InternetCard=Эта карта позволяет создавать HTTP-запросы и использует реальные TCP сокеты.
|
oc:tooltip.InternetCard=Эта карта позволяет создавать HTTP-запросы и использует реальные TCP сокеты.
|
||||||
oc:tooltip.IronNugget=Самородок, созданный из железа. Может именно поэтому он и назван железным самородком, нет?
|
oc:tooltip.IronNugget=Самородок, созданный из железа. Может именно поэтому он и назван железным самородком, нет?
|
||||||
oc:tooltip.Keyboard=Может быть прикреплена к дисплеям, позволяя вводить информацию.
|
oc:tooltip.Keyboard=Может быть прикреплена к дисплеям, позволяя вводить информацию.
|
||||||
|
@ -5,9 +5,9 @@ SYNOPSIS
|
|||||||
wget URL [FILE]
|
wget URL [FILE]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
The pastebin program allows downloading programs from pastebin, identified by their paste ID. I can also be used to upload programs to pastebin.
|
The wget program allows downloading programs from the interwebs, given the URL to download from.
|
||||||
|
|
||||||
The pastebin program requires an internet card and internet access to be enabled in the mod's configuration.
|
The wget program requires an internet card and internet access to be enabled in the mod's configuration.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-f
|
-f
|
||||||
@ -16,8 +16,8 @@ OPTIONS
|
|||||||
only print errors, no status messages
|
only print errors, no status messages
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
pastebin get AbCdEfGh test
|
wget http://example.com/data.zip
|
||||||
Downloads the paste with ID `AbCdEfGh` and writes it to file `test`.
|
Downloads the file `data.zip` and saves it as `data.zip`.
|
||||||
|
|
||||||
pastebin put prog.lua
|
wget http://example.com/data.zip blah.zip
|
||||||
Uploads the program `prog.lua` to pastebin.
|
Downloads the file `data.zip` and saves it as `blah.zip`.
|
@ -491,7 +491,7 @@ class Robot(isRemote: Boolean) extends Computer(isRemote) with ISidedInventory w
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
override def installedMemory = 64 * 1024
|
override def installedMemory = 96 * 1024
|
||||||
|
|
||||||
override def tier = 0
|
override def tier = 0
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile
|
|||||||
import cpw.mods.fml.common.eventhandler.Event
|
import cpw.mods.fml.common.eventhandler.Event
|
||||||
import li.cil.oc.common.tileentity
|
import li.cil.oc.common.tileentity
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
import li.cil.oc.util.mods.PortalGun
|
import li.cil.oc.util.mods.{TinkersConstruct, PortalGun}
|
||||||
import net.minecraft.block.{BlockPistonBase, Block}
|
import net.minecraft.block.{BlockPistonBase, Block}
|
||||||
import net.minecraft.enchantment.EnchantmentHelper
|
import net.minecraft.enchantment.EnchantmentHelper
|
||||||
import net.minecraft.entity.item.EntityItem
|
import net.minecraft.entity.item.EntityItem
|
||||||
@ -259,9 +259,17 @@ class Player(val robot: tileentity.Robot) extends EntityPlayer(robot.world, Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
val stack = getCurrentEquippedItem
|
val stack = getCurrentEquippedItem
|
||||||
|
if (TinkersConstruct.isInfiTool(stack)) {
|
||||||
|
posY -= 1.62
|
||||||
|
prevPosY = posY
|
||||||
|
}
|
||||||
if (stack != null && stack.getItem.onBlockStartBreak(stack, x, y, z, this)) {
|
if (stack != null && stack.getItem.onBlockStartBreak(stack, x, y, z, this)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
if (TinkersConstruct.isInfiTool(stack)) {
|
||||||
|
posY += 1.62
|
||||||
|
prevPosY = posY
|
||||||
|
}
|
||||||
|
|
||||||
world.playAuxSFXAtEntity(this, 2001, x, y, z, Block.getIdFromBlock(block) + (metadata << 12))
|
world.playAuxSFXAtEntity(this, 2001, x, y, z, Block.getIdFromBlock(block) + (metadata << 12))
|
||||||
|
|
||||||
|
@ -201,6 +201,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
result(tryDropIntoInventory(inventory,
|
result(tryDropIntoInventory(inventory,
|
||||||
slot => inventory.isItemValidForSlot(slot, dropped)))
|
slot => inventory.isItemValidForSlot(slot, dropped)))
|
||||||
case _ =>
|
case _ =>
|
||||||
|
val player = robot.player(facing)
|
||||||
for (entity <- player.entitiesOnSide[EntityMinecartContainer](facing) if entity.isUseableByPlayer(player)) {
|
for (entity <- player.entitiesOnSide[EntityMinecartContainer](facing) if entity.isUseableByPlayer(player)) {
|
||||||
if (tryDropIntoInventory(entity, slot => entity.isItemValidForSlot(slot, dropped))) {
|
if (tryDropIntoInventory(entity, slot => entity.isItemValidForSlot(slot, dropped))) {
|
||||||
return result(true)
|
return result(true)
|
||||||
@ -292,6 +293,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
case inventory: IInventory if inventory.isUseableByPlayer(player) =>
|
case inventory: IInventory if inventory.isUseableByPlayer(player) =>
|
||||||
result(trySuckFromInventory(inventory, slot => true))
|
result(trySuckFromInventory(inventory, slot => true))
|
||||||
case _ =>
|
case _ =>
|
||||||
|
val player = robot.player(facing)
|
||||||
for (entity <- player.entitiesOnSide[EntityMinecartContainer](facing) if entity.isUseableByPlayer(player)) {
|
for (entity <- player.entitiesOnSide[EntityMinecartContainer](facing) if entity.isUseableByPlayer(player)) {
|
||||||
if (trySuckFromInventory(entity, slot => true)) {
|
if (trySuckFromInventory(entity, slot => true)) {
|
||||||
return result(true)
|
return result(true)
|
||||||
@ -315,7 +317,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
@Callback
|
@Callback
|
||||||
def detect(context: Context, args: Arguments): Array[AnyRef] = {
|
def detect(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
val side = checkSideForAction(args, 0)
|
val side = checkSideForAction(args, 0)
|
||||||
val (something, what) = blockContent(side)
|
val (something, what) = blockContent(robot.player(side), side)
|
||||||
result(something, what)
|
result(something, what)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +340,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
context.pause(delay)
|
context.pause(delay)
|
||||||
robot.animateSwing(Settings.get.swingDelay)
|
robot.animateSwing(Settings.get.swingDelay)
|
||||||
}
|
}
|
||||||
def attack(entity: Entity) = {
|
def attack(player: Player, entity: Entity) = {
|
||||||
beginConsumeDrops(entity)
|
beginConsumeDrops(entity)
|
||||||
player.attackTargetEntityWithCurrentItem(entity)
|
player.attackTargetEntityWithCurrentItem(entity)
|
||||||
// Mine carts have to be hit quickly in succession to break, so we click
|
// Mine carts have to be hit quickly in succession to break, so we click
|
||||||
@ -349,11 +351,11 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
}
|
}
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
endConsumeDrops(entity)
|
endConsumeDrops(player, entity)
|
||||||
triggerDelay()
|
triggerDelay()
|
||||||
(true, "entity")
|
(true, "entity")
|
||||||
}
|
}
|
||||||
def click(x: Int, y: Int, z: Int, side: Int) = {
|
def click(player: Player, x: Int, y: Int, z: Int, side: Int) = {
|
||||||
val breakTime = player.clickBlock(x, y, z, side)
|
val breakTime = player.clickBlock(x, y, z, side)
|
||||||
val broke = breakTime > 0
|
val broke = breakTime > 0
|
||||||
if (broke) {
|
if (broke) {
|
||||||
@ -376,14 +378,14 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
case _ => MovingObjectType.MISS
|
case _ => MovingObjectType.MISS
|
||||||
}) match {
|
}) match {
|
||||||
case MovingObjectType.ENTITY =>
|
case MovingObjectType.ENTITY =>
|
||||||
attack(hit.entityHit)
|
attack(player, hit.entityHit)
|
||||||
case MovingObjectType.BLOCK =>
|
case MovingObjectType.BLOCK =>
|
||||||
click(hit.blockX, hit.blockY, hit.blockZ, hit.sideHit)
|
click(player, hit.blockX, hit.blockY, hit.blockZ, hit.sideHit)
|
||||||
case _ =>
|
case _ =>
|
||||||
// Retry with full block bounds, disregarding swing range.
|
// Retry with full block bounds, disregarding swing range.
|
||||||
player.closestEntity[EntityLivingBase]() match {
|
player.closestEntity[EntityLivingBase]() match {
|
||||||
case Some(entity) =>
|
case Some(entity) =>
|
||||||
attack(entity)
|
attack(player, entity)
|
||||||
case _ =>
|
case _ =>
|
||||||
if (world.extinguishFire(player, x, y, z, facing.ordinal)) {
|
if (world.extinguishFire(player, x, y, z, facing.ordinal)) {
|
||||||
triggerDelay()
|
triggerDelay()
|
||||||
@ -435,19 +437,19 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
(true, "item_used")
|
(true, "item_used")
|
||||||
case _ => (false, "")
|
case _ => (false, "")
|
||||||
}
|
}
|
||||||
|
def interact(player: Player, entity: Entity) = {
|
||||||
|
beginConsumeDrops(entity)
|
||||||
|
val result = player.interactWith(entity)
|
||||||
|
endConsumeDrops(player, entity)
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
for (side <- sides) {
|
for (side <- sides) {
|
||||||
val player = robot.player(facing, side)
|
val player = robot.player(facing, side)
|
||||||
player.setSneaking(sneaky)
|
player.setSneaking(sneaky)
|
||||||
|
|
||||||
def interact(entity: Entity) = {
|
|
||||||
beginConsumeDrops(entity)
|
|
||||||
val result = player.interactWith(entity)
|
|
||||||
endConsumeDrops(entity)
|
|
||||||
result
|
|
||||||
}
|
|
||||||
val (success, what) = Option(pick(player, Settings.get.useAndPlaceRange)) match {
|
val (success, what) = Option(pick(player, Settings.get.useAndPlaceRange)) match {
|
||||||
case Some(hit) if hit.typeOfHit == MovingObjectType.ENTITY && interact(hit.entityHit) =>
|
case Some(hit) if hit.typeOfHit == MovingObjectType.ENTITY && interact(player, hit.entityHit) =>
|
||||||
triggerDelay()
|
triggerDelay()
|
||||||
(true, "item_interacted")
|
(true, "item_interacted")
|
||||||
case Some(hit) if hit.typeOfHit == MovingObjectType.BLOCK =>
|
case Some(hit) if hit.typeOfHit == MovingObjectType.BLOCK =>
|
||||||
@ -500,7 +502,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
result(false, "already moving")
|
result(false, "already moving")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val (something, what) = blockContent(direction)
|
val (something, what) = blockContent(robot.player(direction), direction)
|
||||||
if (something) {
|
if (something) {
|
||||||
result(false, what)
|
result(false, what)
|
||||||
}
|
}
|
||||||
@ -563,7 +565,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
entity.captureDrops = true
|
entity.captureDrops = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private def endConsumeDrops(entity: Entity) {
|
private def endConsumeDrops(player: Player, entity: Entity) {
|
||||||
entity.captureDrops = false
|
entity.captureDrops = false
|
||||||
for (drop <- entity.capturedDrops) {
|
for (drop <- entity.capturedDrops) {
|
||||||
val stack = drop.getEntityItem
|
val stack = drop.getEntityItem
|
||||||
@ -577,7 +579,7 @@ class Robot(val robot: tileentity.Robot) extends Machine(robot) with RobotContex
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
private def blockContent(side: ForgeDirection) = {
|
private def blockContent(player: Player, side: ForgeDirection) = {
|
||||||
player.closestEntity[Entity](side) match {
|
player.closestEntity[Entity](side) match {
|
||||||
case Some(_@(_: EntityLivingBase | _: EntityMinecart)) =>
|
case Some(_@(_: EntityLivingBase | _: EntityMinecart)) =>
|
||||||
(true, "entity")
|
(true, "entity")
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package li.cil.oc.util.mods
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
|
object TinkersConstruct {
|
||||||
|
def isInfiTool(stack: ItemStack) = stack != null && stack.getItem.getClass.getName.startsWith("""tconstruct.""")
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user