mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Merge remote-tracking branch 'master-MC1.11' into master-MC1.12
This commit is contained in:
commit
22f9af2ab0
@ -599,6 +599,26 @@ opencomputers {
|
||||
nanomachines: 100000
|
||||
}
|
||||
|
||||
# Carpeted Capacitor settings
|
||||
# Carpeted Capacitors generate power when sheep or ocelots walk on them
|
||||
# Power is generated when at least 2 of a type of animal are present.
|
||||
# A single sheep and a single ocelot generates no power. Note that a
|
||||
# computer constantly flashing the screen from white to black drains
|
||||
# approximately 36 units of power per second. Thus, as an example with the
|
||||
# default values, it would take 12 carpeted capacitors and 24 sheep
|
||||
# (2 each) to keep the charge rate. Or, 6 carpeted capacitors and 12
|
||||
# ocelots to do the same. Values are: units of power per carpeted
|
||||
# capacitor per second with 2 animals of a type.
|
||||
carpetedCapacitors {
|
||||
# Chance one animal (per capacitor) will take some damage per minute
|
||||
# Damage chance is only dealt when power is generated
|
||||
damageChance: 0.001
|
||||
# power generated from ocelots
|
||||
ocelotPower: 6
|
||||
# power generated from sheep
|
||||
sheepPower: 3
|
||||
}
|
||||
|
||||
# Default "costs", i.e. how much energy certain operations consume.
|
||||
cost {
|
||||
# The amount of energy a computer consumes per tick when running.
|
||||
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"variants": {
|
||||
"normal": { "model": "opencomputers:carpetedcapacitor" }
|
||||
}
|
||||
}
|
@ -194,7 +194,6 @@ oc:gui.Chat.WarningClassTransformer=Es gab §cFehler§f beim Ausführen des Clas
|
||||
oc:gui.Chat.WarningFingerprint=§cWARNUNG§f - ungültige Signatur! Sollte '§a%s§f' sein, aber war '§e%s§f'. Falls du kein Modder bist und die "deobfuscated"-Version des Mods benutzt, solltest du OpenComputers erneut herunterladen, da die JAR, die du benutzt, vermutlich modifiziert wurde.
|
||||
oc:gui.Chat.WarningLink=Link konnte nicht geöffnet werden: %s
|
||||
oc:gui.Chat.WarningLuaFallback=Die native Lua-Implementierung ist nicht verfügbar. Computer können ihren Ausführungszustand nicht speichern. Sie werden automatisch neu starten, sobald ein Chunk neu geladen wird.
|
||||
oc:gui.Chat.WarningPower=Es ist keine unterstützte, Strom erzeugende Mod verfügbar. Computer, Bildschirme und alle anderen Komponenten werden §lkeine§f Energie benötigen. Installiere eine der folgenden Mods, um Stromnutzung zu ermöglichen: BuildCraft, Electrical Age, IndustrialCraft2, Mekanism oder Thermal Expansion. Deaktiviere Stromverbrauch in der Konfiguration, um diese Warnung auszublenden.
|
||||
oc:gui.Chat.WarningProjectRed=Die verwendete Version von Project: Red ist nicht mit OpenComputers kompatibel. Aktualisiere bitte deine Version von Project: Red.
|
||||
oc:gui.Chat.WarningRecipes=Es gab Fehler beim Laden eines oder mehrerer Rezepte. Einige Gegenstände können unter Umständen nicht gefertigt werden. Bitte wirf einen Blick in deine Log-Datei für weitere Informationen.
|
||||
oc:gui.Chat.WarningSimpleComponent=Eine Erweiterung (deine?) welche das §aSimpleComponent§f-Interface verwendet, hat etwas §efalsch gemacht§f. Komponentenlogik konnte nicht eingefügt werden. Bitte wirf einen Blick in deine Log-Datei für weitere Informationen.
|
||||
|
@ -7,6 +7,7 @@ tile.oc.adapter.name=Adapter
|
||||
tile.oc.assembler.name=Electronics Assembler
|
||||
tile.oc.cable.name=Cable
|
||||
tile.oc.capacitor.name=Capacitor
|
||||
tile.oc.carpetedcapacitor.name=Carpeted Capacitor
|
||||
tile.oc.case1.name=Computer Case (Tier 1)
|
||||
tile.oc.case2.name=Computer Case (Tier 2)
|
||||
tile.oc.case3.name=Computer Case (Tier 3)
|
||||
@ -195,7 +196,6 @@ oc:gui.Chat.WarningClassTransformer=There were §cerrors§f running the class tr
|
||||
oc:gui.Chat.WarningFingerprint=§cWARNING§f - fingerprint mismatch! Expected '§a%s§f' but got '§e%s§f'. Unless you are a modder and are running the deobfuscated version of the mod, it is §lstrongly§f recommended to redownload OpenComputers, because the JAR you are using may have been tampered with.
|
||||
oc:gui.Chat.WarningLink=Could not open link: %s
|
||||
oc:gui.Chat.WarningLuaFallback=Native Lua libraries are not available, computers will not be able to persist their state. They will reboot on chunk reloads.
|
||||
oc:gui.Chat.WarningPower=No supported power providing mod available. Computers, screens and all other components will §lnot§f require energy. Install one of the following mods to enable power: BuildCraft, Electrical Age, IndustrialCraft2, Mekanism or Thermal Expansion. Disable power in the config to suppress this warning.
|
||||
oc:gui.Chat.WarningProjectRed=You are using a version of Project: Red that is incompatible with OpenComputers. Try updating your version of Project: Red.
|
||||
oc:gui.Chat.WarningRecipes=There were errors loading one or more recipes. Some items may be uncraftable. Please check your log file for more information.
|
||||
oc:gui.Chat.WarningSimpleComponent=An addon (yours?) using the §aSimpleComponent§f interface did §esomething wrong§f. Component logic could not be injected. Please check your log file for more information.
|
||||
@ -259,6 +259,7 @@ oc:tooltip.apu=This is a CPU with an integrated GPU (or IGP), when you just need
|
||||
oc:tooltip.assembler=Allows constructing robots and other devices from a number of different computer parts.
|
||||
oc:tooltip.cable=A cheap way of connecting blocks.
|
||||
oc:tooltip.capacitor=Stores energy for later use. Can be filled and emptied very quickly.
|
||||
oc:tooltip.carpetedcapacitor=Stores energy for later use. Can be filled and emptied very quickly. Charges when Sheep or Ocelots walk on it
|
||||
oc:tooltip.cardbase=As the name indicates, this is the basic building block for all expansion cards.
|
||||
oc:tooltip.case=The Computer Case is the basic building block for computers and houses the computer's §fextension cards§7, §fRAM§7 and §fhard disks§7.[nl] Slots: §f%s§7
|
||||
oc:tooltip.chamelium=Raw material for 3D prints. Do not swallow: may lead to blindness and temporary lack of presence.
|
||||
|
@ -186,7 +186,6 @@ oc:gui.Chat.WarningClassTransformer=Il y a §cerrors§f lancement dans le transf
|
||||
oc:gui.Chat.WarningFingerprint=§cALERTE§f - Disparité d'empreinte digitale! Attendu '§a%s§f' mais eu '§e%s§f'. À moins que vous ne soyez un modder et que vous exécutiez la version deobfuscated du mod, Il est §lfortement§f recommendé de re-télécharger OpenComputers, parce que le JAR que vous utilisez peut avoir été falsifié.
|
||||
oc:gui.Chat.WarningLink=Impossible d'ouvrir le lien : %s
|
||||
oc:gui.Chat.WarningLuaFallback=Les bibliothèques natives Lua ne sont pas disponibles, les ordinateurs ne pourront pas persister en leur état. Ils réamorceront sur la recharge des chunks.
|
||||
oc:gui.Chat.WarningPower=Aucun mod supporté produisant de la puissance. Les ordinateurs, écrans et autres composants §lne réclamerons pas§f d'énergie. Installez l'un de ses mods pour activer la puissance: BuildCraft, Electrical Age, IndustrialCraft2, Mekanism or Thermal Expansion. Mettez hors service la puissance dans la config pour supprimer cet avertissement.
|
||||
oc:gui.Chat.WarningProjectRed=Vous utilisez une version de Project: Red qui est incompatible avec OpenComputers. Essayez de mettre à jour votre version de Project: Red.
|
||||
oc:gui.Chat.WarningRecipes=il y a des erreurs au lancement de recettes. Certains éléments doivent être infabricables. Veuillez vérifier votre fichier log pour plus d'information.
|
||||
oc:gui.Chat.WarningSimpleComponent=Un ajout (le votre ?) utilisant l'interface §aComposant Simple§f produit §equelquechose de mauvais§f. Le composant logique ne peut être inséré. Veuillez vérifier votre fichier log pour plus d'information.
|
||||
|
@ -140,7 +140,6 @@ oc:gui.Assembler.Warning.Screen=Schermo
|
||||
oc:gui.Chat.NewVersion=Una nuova versione è disponibile: %s
|
||||
oc:gui.Chat.WarningFingerprint=§cATTENZIONE§f - mancata corrispondenza dei fingerprint! Atteso '§a%s§f' ma ottenuto '§e%s§f'. Tranne nel caso tu sia un mod che stai utilizzando una versione decomppilata, è §lfortemente§f raccomantado riscaricare OpenComputers, perché il file JAR che stai utilizzando potrebbe essere stato corrotto.
|
||||
oc:gui.Chat.WarningLuaFallback=Le librerie Lua Native non sono disponibili, i computers non saranno in gredo di mantenere il loro stato di persostenza. Essi verranno riavviati quando il chunk viene ricaricato.
|
||||
oc:gui.Chat.WarningPower=Nessun mod che fornisce energia disponibile. Computer, monitor e tutti gli altri componenti §lnon§f avranno bisogno di energia per funzionare. Installa uno dei seguenti mod per utilizzare il consumo di energia: BuildCraft, Electrical Age, IndustrialCraft2, Mekanism or Thermal Expansion. Disabilita l'utilizzo di energia nella configurazione per rimuovere questo avviso.
|
||||
oc:gui.Chat.WarningProjectRed=Stai utilizzando una versione di Project: Red che è incompatibile con OpenComputers. Prova ad aggriornare la tua versione di Project: Red.
|
||||
oc:gui.Error.ComponentOverflow=Troppi componenti connessi al computer.
|
||||
oc:gui.Error.InternalError=Errore interno, per favore vedi il file di log. Questo è probabilmente un bug.
|
||||
|
@ -194,7 +194,6 @@ oc:gui.Chat.WarningClassTransformer=Houve um erro §cerros§f ao rodar o 'class
|
||||
oc:gui.Chat.WarningFingerprint=§cATENÇÃO§f - impressão digital não reconhecida! Experado '§a%s§f' mas recebido '§e%s§f'. Há não ser que seja um moderador e esteja rodando uma versão desofuscada, é §lextremamente§f recomendável que baixe novamente o OpenComputers, por que o JAR que está usando talvez esteja adulterado.
|
||||
oc:gui.Chat.WarningLink=Não pode abrir o atalho: %s
|
||||
oc:gui.Chat.WarningLuaFallback=Bibliotecas de LUA nativas não disponíveis, computadores não serão capazes de persistir seus estados. Eles reiniciarizaram com chunkloaders.
|
||||
oc:gui.Chat.WarningPower=Nenhum mod supprtado que provê energia foi encontrado. Computadores, monitores e todos os outros componentes §lnão§f requiriram energia. Instale um dos mods para habilitar a energia: BuildCraft, Electrical Age, IndustrialCraft2, Mekanism ou Thermal Expansion. Disabilite a energia nas confgurações para que esse aviso não apareça.
|
||||
oc:gui.Chat.WarningProjectRed=Você está usando a versão Project: Red que é incompativel com OpenComputers. Tente atualizar sua versão do Project: Red.
|
||||
oc:gui.Chat.WarningRecipes=Houve erros ao carregar uma ou mais receitas. Algumas não poderão ser construídas. Por favor verifique seu arquivo de log para mais informações.
|
||||
oc:gui.Chat.WarningSimpleComponent=Um addon (seu?) usa a interface §aSimpleComponent§f que faz §ealgo errado§f. A lógica de componente não pode ser injetada. Por favor verifique seu arquivo de log para mais informações.
|
||||
|
@ -196,7 +196,6 @@ oc:gui.Chat.WarningClassTransformer=Возникли §cошибки§f при
|
||||
oc:gui.Chat.WarningFingerprint=§cВНИМАНИЕ§f - несовпадение отпечатка файла! Ожидаемый: '§a%s§f', полученный: '§e%s§f'. Если Вы не разработчик, использующий деобфусцированную версию мода, то §lкрайне§f желательно заново скачать OpenComputers, поскольку JAR-файл, возможно, был изменён.
|
||||
oc:gui.Chat.WarningLink=Невозможно открыть ссылку: %s
|
||||
oc:gui.Chat.WarningLuaFallback=Исходные библиотеки Lua не доступны, компьютеры не смогут сохранять своё состояние. Они перезагрузятся после выгрузки чанка.
|
||||
oc:gui.Chat.WarningPower=Подходящие моды, предоставляющие энергию, не найдены. Компьютеры, мониторы и прочие компоненты §lне будут§f требовать энергию. Для активации данной функции установите один из следующих модов: BuildCraft, IndustrialCraft2, Thermal Expansion или Resonant Engine. Отключите требование энергии в файле конфигурации, чтобы скрыть это предупреждение.
|
||||
oc:gui.Chat.WarningProjectRed=Вы используете версию Project: Red, несовместимую с OpenComputers. Попробуйте обновить Project: Red.
|
||||
oc:gui.Chat.WarningRecipes=Произошла ошибка при загрузке одного или нескольких рецептов. Некоторые предметы могут не крафтиться. Проверьте логи, чобы узнать подробнее.
|
||||
oc:gui.Chat.WarningSimpleComponent=Некоторый мод §eневерно§f использует интрефейс §aSimpleComponent§f. Логика компонента не смогла быть внедрена. Проверьте логи, чобы узнать подробнее.
|
||||
|
@ -195,7 +195,6 @@ oc:gui.Chat.WarningClassTransformer=执行类转换器时发生§c错误§f. 请
|
||||
oc:gui.Chat.WarningFingerprint=§c警告§f - 指纹校验不匹配! 预期对应 '§a%s§f' 但识别到 '§e%s§f'. 如果您不是模组的作者, 或运行的不是反混淆版本, 我§l强烈§f 建议你重新下载开放式电脑模组, 因为当前使用的JAR文件已被篡改.
|
||||
oc:gui.Chat.WarningLink=无法打开链接: %s
|
||||
oc:gui.Chat.WarningLuaFallback=无法使用原有的Lua库, 电脑不会持续现在的状态. 它们会在区块载入时重启.
|
||||
oc:gui.Chat.WarningPower=没有检测到可提供能源的模组. 电脑,显示屏和所有其它组件将§l不需要§f能量来运作. 安装下列任意一个组来启用能量需求:建筑(Buildcraft),电子时代(Electrical Age),工业2(IndustrialCraft 2),通用机械(Mekanism)或热力膨胀(Thermal Expansion). 在配置文件中禁用能量设定可以让这条信息不再显示.
|
||||
oc:gui.Chat.WarningProjectRed=你目前使用的Project:Red版本不兼容OpenComputers. 请升级您的Project:Red后再试.
|
||||
oc:gui.Chat.WarningRecipes=加载合成表时遇到一个或多个错误. 部分物品或因此无法合成. 查阅日志文件以获取详细信息.
|
||||
oc:gui.Chat.WarningSimpleComponent=一个(您的?)扩展Mod使用了§aSimpleComponent§f接口但§e做错了一些事情§f. Component logic无法注入. 查阅日志文件以获取详细信息.
|
||||
|
@ -190,7 +190,6 @@ oc:gui.Chat.WarningClassTransformer=There were §cerrors§f running the class tr
|
||||
oc:gui.Chat.WarningFingerprint=§c警告§f - 指紋不符!預期 '§a%s§f' 但得到 '§e%s§f'. Unless you are a modder and are running the deobfuscated version of the mod, it is §lstrongly§f recommended to redownload OpenComputers, because the JAR you are using may have been tampered with.
|
||||
oc:gui.Chat.WarningLink=無法打開鏈接: %s
|
||||
oc:gui.Chat.WarningLuaFallback=本機 LUA 函式庫無法使用,電腦將無法維持狀態,他會重新啟動並且載入區塊
|
||||
oc:gui.Chat.WarningPower=沒有發現支援的能量供應模組. 電腦螢幕與全部其他的電腦設備 §lnot§f 需要能量. 安裝下列模組之一能夠提供能源: BuildCraft 或 IndustrialCraft2. 在配置裡面可以設定不使用這個電源警告
|
||||
oc:gui.Chat.WarningProjectRed=你正在使用的 Project: Red 模組與 OpenComputers 不相容. 請嘗試更新 Project: Red.
|
||||
oc:gui.Chat.WarningRecipes=There were errors loading one or more recipes. Some items may be uncraftable. Please check your log file for more information.
|
||||
oc:gui.Chat.WarningSimpleComponent=An addon (yours?) using the §aSimpleComponent§f interface did §esomething wrong§f. Component logic could not be injected. Please check your log file for more information.
|
||||
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"parent": "block/cube_bottom_top",
|
||||
"textures": {
|
||||
"bottom": "opencomputers:blocks/generic_top",
|
||||
"top": "opencomputers:blocks/carpeted_capacitor_top",
|
||||
"side": "opencomputers:blocks/capacitor_side"
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"parent": "opencomputers:block/carpetedcapacitor",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
@ -560,6 +560,14 @@ cable {
|
||||
["", iron_nugget, ""]]
|
||||
output: 4
|
||||
}
|
||||
luaBios {
|
||||
type: shapeless
|
||||
input: ["oc:eeprom", "oc:manual"]
|
||||
}
|
||||
carpetedcapacitor {
|
||||
type: shapeless
|
||||
input: [carpet, "oc:capacitor"]
|
||||
}
|
||||
capacitor {
|
||||
input: [[ingotIron, "oc:materialTransistor", ingotIron]
|
||||
[nuggetGold, paper, nuggetGold]
|
||||
|
@ -271,6 +271,10 @@ cable {
|
||||
time: 64
|
||||
output: 8
|
||||
}
|
||||
carpetedcapacitor {
|
||||
type: shapeless
|
||||
input: [carpet, "oc:capacitor"]
|
||||
}
|
||||
capacitor {
|
||||
# 7 = CESU
|
||||
input: [["", {item="ic2.blockElectric", subID=7}, ""]
|
||||
|
@ -316,6 +316,10 @@ cable {
|
||||
["", iron_nugget, ""]]
|
||||
output: 4
|
||||
}
|
||||
carpetedcapacitor {
|
||||
type: shapeless
|
||||
input: [carpet, "oc:capacitor"]
|
||||
}
|
||||
capacitor {
|
||||
input: [[ingotIron, "oc:materialTransistor", ingotIron]
|
||||
[nuggetGold, paper, nuggetGold]
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 767 B |
@ -9,6 +9,7 @@ object Constants {
|
||||
final val Assembler = "assembler"
|
||||
final val Cable = "cable"
|
||||
final val Capacitor = "capacitor"
|
||||
final val CarpetedCapacitor = "carpetedcapacitor"
|
||||
final val CaseCreative = "casecreative"
|
||||
final val CaseTier1 = "case1"
|
||||
final val CaseTier2 = "case2"
|
||||
|
@ -88,8 +88,6 @@ object Localization {
|
||||
|
||||
def WarningProjectRed: ITextComponent = new TextComponentString("§aOpenComputers§f: ").appendSibling(localizeLater("gui.Chat.WarningProjectRed"))
|
||||
|
||||
def WarningPower: ITextComponent = new TextComponentString("§aOpenComputers§f: ").appendSibling(localizeLater("gui.Chat.WarningPower"))
|
||||
|
||||
def WarningFingerprint(event: FMLFingerprintViolationEvent): ITextComponent = new TextComponentString("§aOpenComputers§f: ").appendSibling(localizeLater("gui.Chat.WarningFingerprint", event.getExpectedFingerprint, event.getFingerprints.toArray.mkString(", ")))
|
||||
|
||||
def WarningRecipes: ITextComponent = new TextComponentString("§aOpenComputers§f: ").appendSibling(localizeLater("gui.Chat.WarningRecipes"))
|
||||
|
@ -153,6 +153,11 @@ class Settings(val config: Config) {
|
||||
val printerTickAmount = config.getDouble("power.printerTickAmount") max 1
|
||||
val powerModBlacklist = config.getStringList("power.modBlacklist")
|
||||
|
||||
// power.carpetedCapacitors
|
||||
val sheepPower = config.getDouble("power.carpetedCapacitors.sheepPower") max 0
|
||||
val ocelotPower = config.getDouble("power.carpetedCapacitors.ocelotPower") max 0
|
||||
val carpetDamageChance = config.getDouble("power.carpetedCapacitors.damageChance") max 0 min 1.0
|
||||
|
||||
// power.buffer
|
||||
val bufferCapacitor = config.getDouble("power.buffer.capacitor") max 0
|
||||
val bufferCapacitorAdjacencyBonus = config.getDouble("power.buffer.capacitorAdjacencyBonus") max 0
|
||||
|
@ -0,0 +1,8 @@
|
||||
package li.cil.oc.common.block
|
||||
|
||||
import li.cil.oc.common.tileentity
|
||||
import net.minecraft.world.World
|
||||
|
||||
class CarpetedCapacitor extends Capacitor {
|
||||
override def createNewTileEntity(world: World, metadata: Int) = new tileentity.CarpetedCapacitor()
|
||||
}
|
@ -14,6 +14,7 @@ object Blocks {
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.Assembler], Settings.namespace + "assembler")
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.Cable], Settings.namespace + "cable")
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.Capacitor], Settings.namespace + "capacitor")
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.CarpetedCapacitor], Settings.namespace + "carpetedCapacitor")
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.Case], Settings.namespace + "case")
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.Charger], Settings.namespace + "charger")
|
||||
GameRegistry.registerTileEntity(classOf[tileentity.DiskDrive], Settings.namespace + "diskDrive")
|
||||
@ -79,5 +80,8 @@ object Blocks {
|
||||
|
||||
// v1.5.16
|
||||
Recipes.addBlock(new Transposer(), Constants.BlockName.Transposer, "oc:transposer")
|
||||
|
||||
// v1.7.2
|
||||
Recipes.addBlock(new CarpetedCapacitor(), Constants.BlockName.CarpetedCapacitor, "oc:carpetedCapacitor")
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,16 @@ import scala.collection.convert.WrapAsScala._
|
||||
import scala.collection.mutable
|
||||
|
||||
trait ComponentInventory extends Inventory with network.Environment {
|
||||
lazy val components = Array.fill[Option[ManagedEnvironment]](getSizeInventory)(None)
|
||||
private var _components: Array[Option[ManagedEnvironment]] = _
|
||||
protected var isSizeInventoryReady: Boolean = true
|
||||
|
||||
def components: Array[Option[ManagedEnvironment]] = {
|
||||
if (_components == null && isSizeInventoryReady) {
|
||||
_components = Array.fill[Option[ManagedEnvironment]](getSizeInventory)(None)
|
||||
}
|
||||
if (_components == null) Array[Option[ManagedEnvironment]]() else _components
|
||||
}
|
||||
|
||||
protected val updatingComponents = mutable.ArrayBuffer.empty[ManagedEnvironment]
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
@ -99,11 +108,19 @@ trait ComponentInventory extends Inventory with network.Environment {
|
||||
for (slot <- 0 until getSizeInventory) {
|
||||
val stack = getStackInSlot(slot)
|
||||
if (!stack.isEmpty) {
|
||||
components(slot) match {
|
||||
case Some(component) =>
|
||||
// We're guaranteed to have a driver for entries.
|
||||
save(component, Driver.driverFor(stack), stack)
|
||||
case _ => // Nothing special to save.
|
||||
if (slot >= components.length) {
|
||||
// isSizeInventoryReady was added to resolve issues where an inventory was used before its
|
||||
// nbt data had been parsed. See https://github.com/MightyPirates/OpenComputers/issues/2522
|
||||
// If this error is hit again, perhaps another subtype needs to handle nbt loading like Case does
|
||||
OpenComputers.log.error(s"ComponentInventory components length ${components.length} does not accommodate inventory size ${getSizeInventory}")
|
||||
return
|
||||
} else {
|
||||
components(slot) match {
|
||||
case Some(component) =>
|
||||
// We're guaranteed to have a driver for entries.
|
||||
save(component, Driver.driverFor(stack), stack)
|
||||
case _ => // Nothing special to save.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,5 +76,5 @@ class Capacitor extends traits.Environment with DeviceInfo {
|
||||
|
||||
private def indirectNeighbors = EnumFacing.values.map(getPos.offset(_, 2))
|
||||
|
||||
private def maxCapacity = Settings.get.bufferCapacitor + Settings.get.bufferCapacitorAdjacencyBonus * 9
|
||||
protected def maxCapacity = Settings.get.bufferCapacitor + Settings.get.bufferCapacitorAdjacencyBonus * 9
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
package li.cil.oc.common.tileentity
|
||||
|
||||
import java.util
|
||||
|
||||
import li.cil.oc.Constants
|
||||
import li.cil.oc.api.driver.DeviceInfo.DeviceAttribute
|
||||
import li.cil.oc.api.driver.DeviceInfo.DeviceClass
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.entity.passive.{EntityOcelot, EntitySheep}
|
||||
import net.minecraft.util.DamageSource
|
||||
import net.minecraft.util.EnumFacing
|
||||
|
||||
import scala.collection.convert.WrapAsJava._
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
import li.cil.oc.common.tileentity.traits.Tickable
|
||||
|
||||
class CarpetedCapacitor extends Capacitor with Tickable {
|
||||
private final lazy val deviceInfo = Map(
|
||||
DeviceAttribute.Class -> DeviceClass.Power,
|
||||
DeviceAttribute.Description -> "Battery",
|
||||
DeviceAttribute.Vendor -> Constants.DeviceInfo.DefaultVendor,
|
||||
DeviceAttribute.Product -> "CarpetedCapBank3x",
|
||||
DeviceAttribute.Capacity -> maxCapacity.toString
|
||||
)
|
||||
|
||||
override def getDeviceInfo: util.Map[String, String] = deviceInfo
|
||||
|
||||
private def _world: net.minecraft.world.World = getWorld
|
||||
private val rng = scala.util.Random
|
||||
private val chance: Double = Settings.get.carpetDamageChance
|
||||
private var nextChanceTime: Long = 0
|
||||
|
||||
private def energyFromGroup(entities: Set[EntityLivingBase], power: Double): Double = {
|
||||
if (entities.size < 2) return 0
|
||||
def tryDamageOne(): Unit = {
|
||||
for (ent <- entities) {
|
||||
if (rng.nextDouble() < chance) {
|
||||
ent.attackEntityFrom(DamageSource.GENERIC, 1)
|
||||
ent.setRevengeTarget(ent) // panic
|
||||
ent.knockBack(ent, 0, .25, 0)
|
||||
// wait a minute before the next possible shock
|
||||
nextChanceTime = _world.getTotalWorldTime + (20 * 60)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chance > 0 && nextChanceTime < _world.getTotalWorldTime) {
|
||||
tryDamageOne()
|
||||
}
|
||||
power
|
||||
}
|
||||
|
||||
override def updateEntity() {
|
||||
if (node != null && (_world.getTotalWorldTime + hashCode) % 20 == 0) {
|
||||
val entities = _world.getEntitiesWithinAABB(classOf[EntityLivingBase], capacitorPowerBounds)
|
||||
.filter(entity => entity.isEntityAlive)
|
||||
.toSet
|
||||
val sheepPower = energyFromGroup(entities.filter(_.isInstanceOf[EntitySheep]), Settings.get.sheepPower)
|
||||
val ocelotPower = energyFromGroup(entities.filter(_.isInstanceOf[EntityOcelot]), Settings.get.ocelotPower)
|
||||
val totalPower = sheepPower + ocelotPower
|
||||
if (totalPower > 0) {
|
||||
node.changeBuffer(totalPower)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def capacitorPowerBounds = position.offset(EnumFacing.UP).bounds
|
||||
}
|
@ -26,7 +26,12 @@ import net.minecraftforge.fml.relauncher.SideOnly
|
||||
import scala.collection.convert.WrapAsJava._
|
||||
|
||||
class Case(var tier: Int) extends traits.PowerAcceptor with traits.Computer with traits.Colored with internal.Case with DeviceInfo {
|
||||
def this() = this(0)
|
||||
def this() = {
|
||||
this(0)
|
||||
// If no tier was defined when constructing this case, then we don't yet know the inventory size
|
||||
// this is set back to true when the nbt data is loaded
|
||||
isSizeInventoryReady = false
|
||||
}
|
||||
|
||||
// Used on client side to check whether to render disk activity/network indicators.
|
||||
var lastFileSystemAccess = 0L
|
||||
@ -87,6 +92,7 @@ class Case(var tier: Int) extends traits.PowerAcceptor with traits.Computer with
|
||||
tier = nbt.getByte(TierTag) max 0 min 3
|
||||
setColor(Color.rgbValues(Color.byTier(tier)))
|
||||
super.readFromNBTForServer(nbt)
|
||||
isSizeInventoryReady = true
|
||||
}
|
||||
|
||||
override def writeToNBTForServer(nbt: NBTTagCompound) {
|
||||
|
@ -212,6 +212,7 @@ object ModOpenComputers extends ModProxy {
|
||||
Constants.BlockName.Keyboard,
|
||||
Constants.BlockName.ScreenTier1,
|
||||
Constants.BlockName.Transposer,
|
||||
Constants.BlockName.CarpetedCapacitor,
|
||||
Constants.ItemName.AngelUpgrade,
|
||||
Constants.ItemName.BatteryUpgradeTier1,
|
||||
Constants.ItemName.BatteryUpgradeTier2,
|
||||
@ -234,6 +235,7 @@ object ModOpenComputers extends ModProxy {
|
||||
Constants.BlockName.Keyboard,
|
||||
Constants.BlockName.ScreenTier1,
|
||||
Constants.BlockName.Transposer,
|
||||
Constants.BlockName.CarpetedCapacitor,
|
||||
Constants.ItemName.APUTier1,
|
||||
Constants.ItemName.APUTier2,
|
||||
Constants.ItemName.GraphicsCardTier1,
|
||||
@ -248,6 +250,7 @@ object ModOpenComputers extends ModProxy {
|
||||
blacklistHost(classOf[internal.Microcontroller],
|
||||
Constants.BlockName.Keyboard,
|
||||
Constants.BlockName.ScreenTier1,
|
||||
Constants.BlockName.CarpetedCapacitor,
|
||||
Constants.ItemName.APUTier1,
|
||||
Constants.ItemName.APUTier2,
|
||||
Constants.ItemName.GraphicsCardTier1,
|
||||
@ -273,10 +276,12 @@ object ModOpenComputers extends ModProxy {
|
||||
Constants.ItemName.TradingUpgrade)
|
||||
blacklistHost(classOf[internal.Robot],
|
||||
Constants.BlockName.Transposer,
|
||||
Constants.BlockName.CarpetedCapacitor,
|
||||
Constants.ItemName.LeashUpgrade)
|
||||
blacklistHost(classOf[internal.Tablet],
|
||||
Constants.BlockName.ScreenTier1,
|
||||
Constants.BlockName.Transposer,
|
||||
Constants.BlockName.CarpetedCapacitor,
|
||||
Constants.ItemName.NetworkCard,
|
||||
Constants.ItemName.RedstoneCardTier1,
|
||||
Constants.ItemName.AngelUpgrade,
|
||||
|
Loading…
x
Reference in New Issue
Block a user