From e6bbfdc80183073635c4b2b686b29097ff77e98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Mon, 21 Oct 2013 18:17:12 +0200 Subject: [PATCH] multi-tier screens and gpus. three tiers, with increasing resolutions and (at some point) color starting with the second tierl; custom "Ordering" implementation so we can just sort screens by their coordinates one by one instead of hashing them; Tuple (and untested Seq) return values supported for driver callbacks (converted to tables); added a field called "n" to all "arrays" returned from driver calls (so also tuples and seqs) mimicking Lua's table.pack --- assets/opencomputers/lang/de_DE.lang | 9 ++- assets/opencomputers/lang/en_US.lang | 8 ++- .../textures/blocks/screen/b.png | Bin 325 -> 325 bytes .../textures/blocks/screen/b2.png | Bin 462 -> 462 bytes .../textures/blocks/screen/bbl.png | Bin 309 -> 309 bytes .../textures/blocks/screen/bbl2.png | Bin 442 -> 441 bytes .../textures/blocks/screen/bbm.png | Bin 311 -> 311 bytes .../textures/blocks/screen/bbm2.png | Bin 452 -> 452 bytes .../textures/blocks/screen/bbr.png | Bin 316 -> 316 bytes .../textures/blocks/screen/bbr2.png | Bin 443 -> 443 bytes .../textures/blocks/screen/bhb.png | Bin 324 -> 324 bytes .../textures/blocks/screen/bhb2.png | Bin 445 -> 446 bytes .../textures/blocks/screen/bhm.png | Bin 312 -> 312 bytes .../textures/blocks/screen/bhm2.png | Bin 445 -> 448 bytes .../textures/blocks/screen/bht.png | Bin 320 -> 320 bytes .../textures/blocks/screen/bht2.png | Bin 448 -> 447 bytes .../textures/blocks/screen/bml.png | Bin 308 -> 308 bytes .../textures/blocks/screen/bmm.png | Bin 290 -> 290 bytes .../textures/blocks/screen/bmr.png | Bin 312 -> 312 bytes .../textures/blocks/screen/btl.png | Bin 317 -> 317 bytes .../textures/blocks/screen/btm.png | Bin 317 -> 317 bytes .../textures/blocks/screen/btr.png | Bin 319 -> 318 bytes .../textures/blocks/screen/bvb.png | Bin 321 -> 321 bytes .../textures/blocks/screen/bvb2.png | Bin 436 -> 435 bytes .../textures/blocks/screen/bvm.png | Bin 317 -> 317 bytes .../textures/blocks/screen/bvt.png | Bin 316 -> 316 bytes .../textures/blocks/screen/f.png | Bin 268 -> 268 bytes .../textures/blocks/screen/f2.png | Bin 326 -> 327 bytes .../textures/blocks/screen/fbl.png | Bin 227 -> 227 bytes .../textures/blocks/screen/fbl2.png | Bin 251 -> 252 bytes .../textures/blocks/screen/fbm.png | Bin 193 -> 193 bytes .../textures/blocks/screen/fbm2.png | Bin 188 -> 188 bytes .../textures/blocks/screen/fbr.png | Bin 219 -> 219 bytes .../textures/blocks/screen/fbr2.png | Bin 259 -> 259 bytes .../textures/blocks/screen/fhb.png | Bin 242 -> 242 bytes .../textures/blocks/screen/fhb2.png | Bin 290 -> 290 bytes .../textures/blocks/screen/fhm.png | Bin 214 -> 215 bytes .../textures/blocks/screen/fhm2.png | Bin 230 -> 230 bytes .../textures/blocks/screen/fht.png | Bin 248 -> 248 bytes .../textures/blocks/screen/fht2.png | Bin 287 -> 285 bytes .../textures/blocks/screen/fml.png | Bin 207 -> 207 bytes .../textures/blocks/screen/fmr.png | Bin 195 -> 195 bytes .../textures/blocks/screen/ftl.png | Bin 229 -> 230 bytes .../textures/blocks/screen/ftm.png | Bin 190 -> 190 bytes .../textures/blocks/screen/ftr.png | Bin 220 -> 221 bytes .../textures/blocks/screen/fvb.png | Bin 241 -> 241 bytes .../textures/blocks/screen/fvb2.png | Bin 304 -> 303 bytes .../textures/blocks/screen/fvm.png | Bin 239 -> 239 bytes .../textures/blocks/screen/fvt.png | Bin 249 -> 249 bytes .../textures/items/{gpu.png => gpu0.png} | Bin assets/opencomputers/textures/items/gpu1.png | Bin 0 -> 250 bytes assets/opencomputers/textures/items/gpu2.png | Bin 0 -> 250 bytes li/cil/oc/Blocks.scala | 8 ++- li/cil/oc/Config.scala | 7 ++ li/cil/oc/Items.scala | 10 ++- li/cil/oc/client/PacketHandler.scala | 29 ++++---- li/cil/oc/client/gui/Screen.scala | 6 +- .../renderer/tileentity/ScreenRenderer.scala | 4 +- li/cil/oc/common/block/Adapter.scala | 2 +- li/cil/oc/common/block/Computer.scala | 4 +- li/cil/oc/common/block/Delegate.scala | 15 ++-- li/cil/oc/common/block/Delegator.scala | 66 +++++++++++------- li/cil/oc/common/block/DiskDrive.scala | 5 +- li/cil/oc/common/block/Keyboard.scala | 2 +- li/cil/oc/common/block/PowerDistributor.scala | 2 +- li/cil/oc/common/block/PowerSupply.scala | 5 +- li/cil/oc/common/block/Screen.scala | 35 ++++++++-- li/cil/oc/common/component/Screen.scala | 29 ++++---- li/cil/oc/common/item/GraphicsCard.scala | 8 ++- li/cil/oc/common/tileentity/Screen.scala | 27 +++++-- li/cil/oc/server/PacketHandler.scala | 32 ++++----- li/cil/oc/server/PacketSender.scala | 36 ++++++++-- li/cil/oc/server/component/Computer.scala | 27 ++++--- li/cil/oc/server/component/GraphicsCard.scala | 8 +-- li/cil/oc/server/driver/GraphicsCard.scala | 10 ++- 75 files changed, 258 insertions(+), 136 deletions(-) rename assets/opencomputers/textures/items/{gpu.png => gpu0.png} (100%) create mode 100644 assets/opencomputers/textures/items/gpu1.png create mode 100644 assets/opencomputers/textures/items/gpu2.png diff --git a/assets/opencomputers/lang/de_DE.lang b/assets/opencomputers/lang/de_DE.lang index 2de97ffb4..273cd974c 100644 --- a/assets/opencomputers/lang/de_DE.lang +++ b/assets/opencomputers/lang/de_DE.lang @@ -2,11 +2,16 @@ oc.block.Adapter.name=Adapter oc.block.Computer.name=Computer oc.block.DiskDrive.name=Diskettenlaufwerk oc.block.Keyboard.name=Tastatur -oc.block.Screen.name=Bildschirm +oc.block.ScreenAdvanced.name=Hochwertiger Bildschirm +oc.block.ScreenBasic.name=Einfacher Bildschirm +oc.block.ScreenProfessional.name=Professioneller Bildschirm oc.container.Computer=Computer oc.container.DiskDrive=Diskettenlaufwerk oc.item.Disk.name=Diskette -oc.item.GraphicsCard.name=Grafikkarte +oc.item.GraphicsCard.name= +oc.item.GraphicsCardAdvanced.name=Hochwertige Grafikkarte +oc.item.GraphicsCardBasic.name=Einfache Grafikkarte +oc.item.GraphicsCardProfessional.name=Professionelle Grafikkarte oc.item.HardDiskDrive2m.name=Festplatte (2MB) oc.item.HardDiskDrive4m.name=Festplatte (4MB) oc.item.HardDiskDrive8m.name=Festplatte (8MB) diff --git a/assets/opencomputers/lang/en_US.lang b/assets/opencomputers/lang/en_US.lang index 025b57cf9..8c5d336f6 100644 --- a/assets/opencomputers/lang/en_US.lang +++ b/assets/opencomputers/lang/en_US.lang @@ -2,11 +2,15 @@ oc.block.Adapter.name=Adapter oc.block.Computer.name=Computer oc.block.DiskDrive.name=Disk Drive oc.block.Keyboard.name=Keyboard -oc.block.Screen.name=Screen +oc.block.ScreenAdvanced.name=Advanced Screen +oc.block.ScreenBasic.name=Basic Screen +oc.block.ScreenProfessional.name=Professional Screen oc.container.Computer=Computer oc.container.DiskDrive=Disk Drive oc.item.Disk.name=Floppy Disk -oc.item.GraphicsCard.name=Graphics Card +oc.item.GraphicsCardAdvanced.name=Advanced Graphics Card +oc.item.GraphicsCardBasic.name=Basic Graphics Card +oc.item.GraphicsCardProfessional.name=Professional Graphics Card oc.item.HardDiskDrive2m.name=Hard Disk Drive (2MB) oc.item.HardDiskDrive4m.name=Hard Disk Drive (4MB) oc.item.HardDiskDrive8m.name=Hard Disk Drive (8MB) diff --git a/assets/opencomputers/textures/blocks/screen/b.png b/assets/opencomputers/textures/blocks/screen/b.png index 3f8aa24b3883fafdce263aee677513f9a10adb8e..11858ab2e524d94ef2b856a9731efaf0bd623cc2 100644 GIT binary patch delta 180 zcmV;l089VH0>uK5PE@3%q@tptrlzJNBO@XrBB-dSprD|foSY#cA*!mXtgNh_o}QYT znwXfFBqSuVva*zvl$Ms3B_$;v2x?~l005#%L_t(|+ANRTasx38LP1x{-fWSgPE{@c zq@_Yhy_a>qsxZn(=00kctupxFrmUD6J6l?Z|7$6H>H)B^Y`Ki;BcPKm-Sg8~_$@W{ i+hhG5zm_lm3NQd6Sp;1tiAur%0000uK5PE=A-Qc+P+Q&UqTBO@XrB2-jVP*6}#PEH{qAy!saRaI3_Pftxv zO(Y~FOiWBlN=i#hOIcZ2B_$;V;_UAL005#%L_t(|+ANRTasx38LP1ws-c6CBPE}X_ zNlS&2dN1pIRbiBo%ze}>TV?RUO<6HDcDA$*|JPFZ)B|8+*>V}xM?fcCy64?l_$f8@ i+hhG5zm_lm3NQd6)dXG3zSR`~0000%rY0sPet&*`8X6j^s;XdMU|wEc zQZ0cv0002gNklGv>#9o9fn9 kH~a-L|8t?GFZdN;0QUY5`|trBO#lD@07*qoM6N<$g4~(0cK`qY delta 390 zcmV;10eSw;1I`1GQGZTOP9-HJOG`^nPfsHwBRe}gLPA0_Gc!R!K{+`&I5;>mGBPwY zG(|;4LqkJ8K0X^88%jz_H#av?QBg)lMm;?}NJvOEH8mU@98geDM@L6gR8%@TIy^i) zKtMo5L_|$ZO(G&9OiWB29UV3{HX0flQ&Uq_RaHqzNhT&HQh!oXF)=YeKR+-qFfT7J zTodBp0002gNklL&|v(o$@oB#j- delta 62 zcmdnWw3TUspGixmqy%&qg9z)C%pj!09PrAn|$txjpBH4&{eflqpJ(%EbMQ_ATJe38;B ztF9FxVhdjE)#t7DQ-O{DlG<`~4vw-#e7(&yGMW6aK7I=)mB5N=1xkCtG z^K1$uOsIeN-I#os+0?^Z3`WegsCV!|2vLjowheWL4gB$BjPqv>e=*Mf1sDMGj1B`p SX!8#M0000_ delta 373 zcmV-*0gC>)1G)o{PJdETQX(QEOiWBUIXNREBQi2FLqkJNO-)WtPDDgRH8nL#N=ipZ zM@vgfIyyR0QBgB9Gd?~(Jv}`^K|wq`JWo$gKtMn{J3Bu=KQS>eNl8gGG&E39P&PI; zLPA1FNJuX)FH=)fMMXt7H#b#PRUsiEI5;>kFfde9R3#-PB!46%Mn*;;U^bxu007KM zL_t(|+6;&Zl7t`>L&FzPHbHQ=U3>4j|NVxfl6nakJP03x@9@D{;d|o5BO9o2s{rPm zFK?yKyF!;A)_Ed_Ds$(&A+XZSr6V#_X4w*~vb(d!8bd@o&ET_{opkEj|EzW90w1MR zR@p1b3`v1+Np32snoVx~s8RxpeLwb1im`2)K8|2*JJfZIL(w*EGZgp@uOe$L?z!u_ z23roSdAjtgNc4sv;sHn3$L&BO@Up zA)1<+mX?;TuC5>;ARwE;ng9R*nn^@KRCwAHPXQ9cFbDz_W7Brq|6e{F> zp^Zp1SUJD~q2NjJtpIW=6Mh9yU{tKEBwenWIDL1~UKqGNENZ>RF=VG2VtN+m3siYT zLV94LvDN_)tfTAD8lGtB6D^_$wjzq5_UdazTVcL!(yUc%WI%Hmd_~ihj;neZ!s0;6JOCFye2#Ob?>_QJsJVQT3$jv+hM5Yw|bU!ck( z64C<`jkOMdU>#kD*6>72-)Iphe`oSdARnwo5EY;tmPZfOi zYXATM&`Cr=RCwAHi3e`PFc1UR>ax157I*tDJ^BClqJY3)NCG@20Avh$^^Zh delta 383 zcmV-_0f7F*1H=Q6PJdETQb$KePEJlXHa1O7O*uI^H#avkGczJ0B0M}iMMXtXQBg}v zOFlk6G&D3&P*6`#PfAKkNl8gNJ3B)|LrhFeQ&Uq!L_|0^I5ILaBO@b0K|w%3KuAbP zLPA11IyyBqH8C+UKR-WJRaHhtMkFL8T3T8#FfctmJs=<;A%7tuR#sM2R8%i7FSEl; zzW@LL&`Cr=RCwAHi3e`PFc1URs#foo9CzQPC;$Im6c88;Nr1-$fV@ZF?oB~=50e80 z@KBTMwF^vMfpQ9YM^L|z)1+vmi*`i)1O$kXNIVG|Aw&w%FbqR1TPPt!y_Mi0#6HPk z>#SRp5v1IQx_C>O<#U&LctT#6dgpyLd0A_%3m9WQ#ImmUVzLpp03k%8^iC-mL8&-^ z9+Vx8vP2s@5^I1lYq&8+aW~d1@Y9~yVt(TJw3c(={Iav1fB7}f*Zalc_2qLMUwZ!W dHI9D*3;v^OMj#kA zV0x5+pnuaaK&Km6DfF2lTv{s$<{es*o*qA$Z*7TS2It0hU=w`s-V&gKuD3Trji>_q z7D}{8VbHF^PycZhjek%%FGu?+ACp97x40aR5M{eVaz9bOg{Qb-dCBM=N5 zFg?mZ(0^$dpwkVk6#6U?F0GXW>kh3*Pmiz6r?x~egKJ_sFbN*Kw*;u5>+OwDBdWl> zg%T}N7__VKcv@H9mi5vrZ%T&Jo`-T+GTiqYnQDz^!Cl1e9=k{P>8*MG0t^5Y#bg88 TUR40K00000NkvXXu0mjfoj_Bw diff --git a/assets/opencomputers/textures/blocks/screen/bbr2.png b/assets/opencomputers/textures/blocks/screen/bbr2.png index daedd6c376f5d2e18f690b3c057ce19bbfe037b7..f8ee4cc3837e29a0bfe96e71d08d4047395c5ca5 100644 GIT binary patch delta 374 zcmV-+0g3**1G@u|PJg1Jq9P(9YHDhnoSb-gc$k=&a&mH{q@;j=fR2uiZfIqk108OtO#@|IxIOs)|1Pp6k8A^sJ)l&F?o0hL{GmekI8>){9ncXl zC;*uW%M>zpyqI8Fh?mNhpa_o4(rhOy>POfk!X`bXTO@rXCtUKFCp~Mu+-}l#o^JxZ zjD0^1{o;mO_iv7%SsFJEP1P{gwif-nX`jvbGrrrJ5u8ij^6IDLvgJFZ}5tmhIX~xyrTCLMg!>Jt5vlvPa@cB>w^o0GPlI U!!IAh*Z=?k07*qoM6N<$g8O8x=>Px# delta 374 zcmV-+0g3**1G@u|PJdBRQ6eHDH8nL(PEI^LJWNbXIXO8}Qc_1pM?gS8H#avUBO^;o zOGQORHa0dhGc!IuK2T6lAt51CQ&UPxN<%|KLPA1FNJv3JK}ktTG&D3sL_|hLMlv!o zO-)TCBqT5}FgQ3kJ3Bj1Pft`-R6063RaI3zJv~1^KUP*&Ab%hrF)=Zqjinm^007NN zL_t(|+6;;Zj>I4U15GE?KuGUfZm<0Re}`D``VsEPa7E8$6Gb1z3tue8S&v$;o1e8C$BjU* zQ{T@+zxrX*y>BOI*2YgmQ#DMrtwsN7+D9{ePoK7C2IrEuy!s)zZ21W(xw+rB)xiXFQxgIK-Ir@wXbgXW(#2RTaliH$uXyb=Qc7@UONh0ZoS9gX$-e*t0I-n` U!?p}(LI3~&07*qoM6N<$f+p0B8UO$Q diff --git a/assets/opencomputers/textures/blocks/screen/bhb.png b/assets/opencomputers/textures/blocks/screen/bhb.png index 6506260ea9fb572db13c1ae9ae593d1dae769566..62f59d542e845bc1bd966b6a4d248d565e35b8ba 100644 GIT binary patch delta 141 zcmV;80CNAt0>lE4PCcZgq@tptprD|prly>noSvSZA|fKFsHh_&BdV&ZAt50oBqXe? ztRNsDn3$NFnwqe%u&%DIw6wI`S{~(*i$VeKkZ+Bn5zwhqdUjYUHAO8dhpwt+L00000NkvXXu0mjfAS*%G delta 141 zcmV;80CNAt0>lE4PCZgmQc+P+P*6})Q&Ub(PESuyA|fJGR8%7)BUM#ZAt50oBqUZ= zRv;iCT3T9HS65hASWHYzO-)VS`6|nii$VdZ+Bn5zwhqdUjYUHAI<~_WYQ{_00000NkvXXu0mjfz~D6X diff --git a/assets/opencomputers/textures/blocks/screen/bhb2.png b/assets/opencomputers/textures/blocks/screen/bhb2.png index 4d701c02402c837095343dfb88fcb7655829d6a4..c1a3548d0f50b26374f59c791f6fd415b43d0cf4 100644 GIT binary patch delta 371 zcmV-(0gV2=1HJ>0RDYnLpmK6@n3$M^goJ8pYG!6;qN1XXj*g6sjAUeFhK7cuq@Alk>hS;|H~gL;CwKh&__0fgj`TyRC(xSfT|SCoB|y$c{xY=OeLRr36#;SF&bVP%lW(#7_(kOu?{9atu+xCuA&|a zVXe&(23SPi*K8sRAw<218^W^hq2AAP+3Pmc1fg$3&qCX?vu|0yfwA`9v<++S4PzAp zWR-7XQXbRP$O=$ODko)gOzx1AB2X{&aLy_BdcPmaWp8Hx)Emf_{oB6)0|34x4&qs_ R{nP*e002ovPDHLkV1lthvVH&n delta 370 zcmV-&0ge8?1HA)~RDV!VP&qj{LPA1JOiVR3H8V3aQBhGxM@L3RMlv!oKtMo4Lqk$h zQa3j@I5;>VAt5_EJ5NtfJv}{6PEJZnN=r*iJUl!_MMYFpR6#*OO-)TUHa1B~Nk2b7 zBqSs>G&DXwK14)BQ&UqhF)>I;NG~rhFfcGWIyxXAAXQaWc7II%eE72 Sf`WptudmboDGMhyZ36&HJQEoJ diff --git a/assets/opencomputers/textures/blocks/screen/bhm2.png b/assets/opencomputers/textures/blocks/screen/bhm2.png index b6abbfa12240cc849921e3b1066f510542dbdd47..73a8b445b973db9218d90a2a501dc8caed02a962 100644 GIT binary patch delta 379 zcmV->0fhd&1Hc22PJbdIBAlF@prD{+WMm^FBW!GJq@<)~W@ea}n1+UiaBy&dfPiRd zXq1$cmX?;HqM{)oA#QGNjEszaetwdYl6-u8goK28dU|+xc#4XOc6N4ha&m}>h?<(3 zbaZr(kdTg!j)H=MYHDhpo}OS}V5X*~tgNhFUS1#|AgZdWB!46%Vq#*bsHoo*-v|Hz z0MAK8K~#9!9FJFy#2^#|AIW447#p0^%xt{>`Ia4(R8rSp1Hd-`c%W}QKyx=3zwmF< zR`3%6ZY#KH?p8d%kZ1v;1|cNey(ZiuhoG)itZv1~?k+h2R@i-y*18(3SOvr}xfGXU zNym5`DZ&`_GITETj8cwL#uIcm3_~8e$|ALv(Dz+0bG6P|pE-jnUB8twO=_CUR5BD5 zW;KQR+O~NPN`YZ)3x+8c*uNQ&i*tUl5D4MKZ~{Mse3%Cz#&BNS11Npp_Vm+J>cRgB ZFaW;44+hTA+_3-v002ovPDHLkV1mz?tAhXl delta 376 zcmV-;0f+v;1HA)~PJd2LP9h>AP*6}ZGBP70BQ`cRI5;>`Qc^QBGfYfOLqkJGMn+0X zN=_&vK z0L)25K~#9!9FIqm!yps|KRF8l0_AK^zW@0K`*l?>diMaKUxbiH^o>U#PJ!_!{t;~j zKLBuB!9tv^dVGUw0fPVl70xN+76QCBsVPht>>hGZV3pl>V{NFxs!4%abI4}dmb|Uo zmJO`NE$gB$qjB}BwYk7`eczY9t1Q|%4a3k4x>UR3+*Jzj)D1^U8O9kF4YMfNfSa!V<179$~&G?KsvA%D%2kfxEcwkJ^fzU}Fkr_>|=FTeo5 WSPuqW*D#*|0000A>0PCBHdq@bXnqN1XvrlukyA|oRstgNh_o}QeXoT#X%At52Es;Zir znwFN9n3$L(BqXk`t{@;FENY8?k%%J&d}6KmY>}`y2uqe_33w~TUXk!T6d))B7$A0P Q5&!@I07*qoM6N<$f(iF6=l}o! delta 110 zcmX@Wbbx7spH)y$P(VOHU|?WyaIlh+lCrXLSXh|9zrUZKUr0!ZqM~AGXsEBRuZoI_ zkB^VHw|97WxPpShm)rl+Cw3^a?nzo(kvnmN1&8~zRL% zc6xexXlQ7Xl9Gssh=zuSW@cuboSb-gcye-bBqStoaBz^2ke;5NWMpK5f`X=|rXe9A zl$4ZUU|@7~bbfw*Vq#*bsHlK|fUK;njEsyRARt~|UY3@YC4VI)s2@0m0002aNklmPUQiYem7Pza%cs%n=1Hc22RDVrPO-DyZMMXt7H#apkHBeAcQc_YjHa0#!K2cFoOiWBdLP9h& zG)YNGJv}`;J3BKoGebi|L_|bRPEI*FIY>xIBqSs}JUlo!I8RScGBPqjK|vuQAyZRR zFfcGWIyy>9N>o%-F)=Y#R#rbhKR`f0Mn*;@B_&HsOD``kAb%hrr#kGv0002bNkl%o%ABnMp(TuFN8=PnCi@9L{ z;Vti2`ynqVi*C1bZfjqx6yv4<+9y&q?`C{skBSO12I_ T{tAQZ9T V146dpI=~LpufL=NJvO%XlPhin39r`va+(GqN1;_ueZ0i zs;X*4Le@IA(pPye?SXgLisIRYYczC#vkI#~l(mNB& G)&Kya7!lzB diff --git a/assets/opencomputers/textures/blocks/screen/bmr.png b/assets/opencomputers/textures/blocks/screen/bmr.png index 7002b116a80d8026936948b9d5097c6b1fccb430..5725153feed7200a4e68d639e34f474fc622a682 100644 GIT binary patch delta 211 zcmV;^04)Ew0=NQ@PBx^Zq@tptprD|prly{ro~Wp(oSdAhs;aE4tRf;JBO@c4nwlXY zA+D~jmX?;Vu&^W~B!8pUk%S|ECQ+^QDe(btBNG{D25N(tfEI$efHDy@mDR)2XuAM4 zr{fRu-^6gz*W#JH(1^h6!DYL!AvDRAMq}~!o;zXe?KpAKPEJ-Q}C$wS!;RKrHsOT@2>y@0J#AY16h~ZlNA5} N002ovPDHLkV1hJ7WGesw delta 211 zcmV;^04)Ew0=NQ@PBv0fQc+P+P*6})Q&Ue*PgGP?RaI3^PEJ-0J)eF16cuB4;TOd N002ovPDHLkV1i1WQ=0$) diff --git a/assets/opencomputers/textures/blocks/screen/btl.png b/assets/opencomputers/textures/blocks/screen/btl.png index 6db340a180e369b4422b01757c4712412016ce0c..aa2f9633f0cb94a41cf10af438b728b5eeaf2033 100644 GIT binary patch delta 247 zcmV<{9ph-kQRCwAHk4b_BF$h9I)R@%p`~IhG%B4OAvDR;0 zYwvsSYv1?AP81Xv0g)N_kq^!^Jb?sm9TiB4I8newMVpKa^>Dloc8e-s8qa)^g?LUd z8q=BjB-RtfV7I}KkWp5Z&lDB`jVeyUZi)3`Y&BiYFoJzt$Oa*>x-9{dhf}DN;jk+^ xyldi9yiTFt(4P%Tsh3z;?)^o%L=OH17ywv^1O9VTOHcp+002ovPDHLkV1hzSZBzgN delta 247 zcmVt1JPNhtuej;jk+! xyer~U+)kn2(4P%jshe2Y?)^o%L=OH17yw?A1OBvS*<%0z002ovPDHLkV1j=kVgUdE diff --git a/assets/opencomputers/textures/blocks/screen/btm.png b/assets/opencomputers/textures/blocks/screen/btm.png index 7c66aa89b4063bbb29738e32d85f6e31f37b1e39..e8f0dc38c78f7ec2748706eae9fb759522e1369a 100644 GIT binary patch delta 217 zcmV;~04D#v0=)u|PCBHdq@tptsHmu*prEFvrktFdo}Qkns;aE4tRf;Jnwpv+At56p zBd)HlBqSu5n3%G%vb40cM*bRfk%%IHc;9Eg_ultDcR%~0`C|xJrW+8ta1S`%ET(@FHZaK7KR1Fm{ce23Nv~xt0f$~MgY$%51_yiQG$V?EdB~th#;z3 zW-~fTq(PY%EC(MFHZaK7KRDJSX3x9hR;rLC(Yjc6<`1qG6n;g T^SmA800000NkvXXu0mjfI)PLk diff --git a/assets/opencomputers/textures/blocks/screen/btr.png b/assets/opencomputers/textures/blocks/screen/btr.png index bef5b2143cfa8f288c359fc9f9957c017e9eac30..a2fbe069022606cd27fed579dfd906e3c37602a6 100644 GIT binary patch delta 248 zcmV1)~PJdETQd3h?P*6}&QBh7#PE=G>Pft%HBO_H+RaRD3A|fIoAt6mo zO(Y~FARr)ESXfF*N>^7`OiWCpGJezm005jxL_t(|+8mCFZUZ3@L*JatvYV#O|9@;u zg^-N##olY(=j?;_#)d273HZ%&erTI^M7jl6EgbO^L@+*f6LMIUAtFnd*=7Ia@Z}d8t~l^>k=QH6>5N z@$w?$pK$f_47V`qxAL%q78;~`LYhBpe+3u-OH~8d8GFW)00000NkvXXu0mjf!Qf}S diff --git a/assets/opencomputers/textures/blocks/screen/bvb.png b/assets/opencomputers/textures/blocks/screen/bvb.png index 3d98bab66c0c3ce44385902ff7dddd3344d67240..13aa7468e4ab4c71ddaba8915cf4e63ccc9ebb31 100644 GIT binary patch delta 118 zcmV-+0Ez#>0>J{1PCBHdq@tptrlzK#prD?fo+2V5sHmu%oSdwztRW#Gs;a6ZBO@dv zB(AQmARr*Hu&|n%nkFVD;cf6wk%%G@Z#dRn25$batbz^ZQM^8QzLC321pWjae3J?R YBona&K2PRzqyPW_07*qoM6N<$g3cH+_5c6? delta 118 zcmX@ebdYI+pH)y$P+(wSaBy%yK!Cr$zmk$tNJxmEpI=y5n4+R$XlSUiva*VbN_cp< zudlC~nwo-wLPSKw?%$CUCw3?an##P^V>Yjk2s_C3StCx~=KsXq-Yj-aeE%kMF{%j1 Wv)Ij?oNhYrIq2t@IY zw-ejhqiNFd|6f=N(h0#kbU;kcH`cTM&5iE+1{!W~WL!tS8O8vBGtRb68_t-H=1&ZD zV3q47;wmCh^-z{!sZqycxCuZxC_TzTYbnQ40LU$ArS$Rdn^FQqX8Fi6f2quwX0*uG zx3b0ZV)YUUAz_5~!i$$*#VQCi-TV{|<@s9YE+FATH;;R8!OeT;Fvpmz3t@L-H`?9e zQ+1}KtWA?jV^Wyoqtt09JAKqSO=klaLd^xJc!Udn0t^5*ISvkemhC8 delta 361 zcmV-v0ha!=1GEE>RDVZDM^8^rQBhGoK0ZT3Lo_rrIXO8qGc!<7P$3~9Qc_YtKtM`L zN={BrIyyQpH8nguJTfveHa0d)OiWEpO;l7=F)=YWH#a>!Jw!xA zQ&Uq&NJu+7J4s1NBqSt1KR;GhRxd9vMn*=$<2*M2007TPM1Mh4c-j<>hYo`<3`Cth z$RH$PL!r>||6f?wmQI%a&N?7&VFzFM@@CF1O9KsaIC5qqI~?Z#z&PW_VIAY#M)xP? zJoC)#6mb=i$aW6XJmqNPIbQ@IoRpqnqB(?f3IODiG*kNc_eCiIB9nY1nZ8t}L=#$M z=R4V9d9izmgkliFd*Q{)?_w7Onznxmjq-f$eOr*wrR~S9=%V|r)tF z@TpmAHA>aN)Ug`O@iAsqgBm_&9fq}m8=>X~R6N2BKLG{+ROb#3B`(Sn00000NkvXX Hu0mjfge8rs diff --git a/assets/opencomputers/textures/blocks/screen/bvm.png b/assets/opencomputers/textures/blocks/screen/bvm.png index 36f8028fb16b8bb24256a232c9e3c908fd46a366..b676b2fd0de8ee29f107737c154520492a3b7397 100644 GIT binary patch delta 130 zcmV-|0Db?x0=)u|PCBHdq@bXnqN1Xvrly>noSvSZA|fKFsHm*0tg5Q2BO@c2n3y3U zAs`?inwpxHmX@xrt|TNRzhIo>k%&bBzLCy1IG^{sLn(%yoI}JIt6@Z((Ql(miWXmy kw^A_pptWoaYW)Qm0O`g9*{BE&DgXcg07*qoM6N<$f++Pm_y7O^ delta 130 zcmV-|0Db?x0=)u|PC8OjQczG(QBhG-Q&Ub(PESuyA|fJGR8&@0R#jD1BO@bBOiUpm zAs`?iO-)T#S63t?Buh(6%CH(Uk%&bBK9SBhIIs7+Ln(%yoI}JIt6@Z((Ql(miWXmy kw^A_pp|xxbYW)Qm0O;BS*)4bLO8@`>07*qoM6N<$f)C#=VE_OC diff --git a/assets/opencomputers/textures/blocks/screen/bvt.png b/assets/opencomputers/textures/blocks/screen/bvt.png index 052aca50b21eda18c23cf2cfacf8c942c6de6e47..b9eb6b1f7ed8fb17d2ba0b5c104f280e7abf219a 100644 GIT binary patch delta 217 zcmV;~04D#u0=xo{PB)~aq^72(prD{4A|j%qqNu2-oSdAVo}MEkBdV&ZAt52GtgIv? zB$}FzJ{v1!?C-{BC<)F1AYPPkLjhE{1a)2_lyQW z9E?psP3y8X;qozImx;trc#*u=knsphI1+{TgUtocon>WeOqqef$tWTo)|IdnM0Sxm z!$Qz5RF`qSZXgzpqAh-WeOqqefNiV`5){(FjM0Sxm z-CWQvRF`qSj>8wOqAh-oSdAhs;VR;B&evUqN1XfmX;+Y zB_JRmnwpve#R@=?h$3Q*gb}H4F2eZ5aBW9p`s@%>De5NJ6|{8p3Y^0Ba;)oyL-=_| z<^{6FD>x8D1v9~@Kr?dH=Ic0@BU>VN+p0cvsI~;aA|7xVa`+cu03@ygAeRZU0RR91 M07*qoM6N<$f&*Sfr2qf` delta 158 zcmV;P0Ac@(0*nHXS1}yeLh$3Q@gc7N5F2eZ4bZf_A_~;NdDe5ZN6|{8p3Y^0Ba;)oyL->0~ z#s#v)D>x8D1tY<%z%p{x=Ic0@BU>VN+h#s(nzaPLA|7xla`+cu03aj+AcOx7y8r+H M07*qoM6N<$g4-uN82|tP diff --git a/assets/opencomputers/textures/blocks/screen/f2.png b/assets/opencomputers/textures/blocks/screen/f2.png index f1967ecd5740c2489eaeca1b204de00d4ac0a488..f2a6656fe0574c16783b7b886009ba672e9f80fa 100644 GIT binary patch delta 245 zcmV=W7T7PC{W+Wseq@<)|WMrbEqMn|foSd9uVq$D;Y@nc^rlzKbhK81w zmSA9Dc6N4%h=?E{Ac~5Ln3$MuZf=5tf`o*GbaZrnetsn-C611cl$4ZsczCR=tlEuy zUH||9dPzh%Q6T7NS$Gg4AgBqSs;F)>a~PESuyGBPqzQBgKFHcLxOQ&Uq=P*5;1 zFhfH_J3BiiB_$vrAXZjZMMXtHK|wb+H%dxML_|bKM@K(DKRP-(JUl!?LPAVTOlq~< z+yDRoc}YY;RCwB4&sPq^KnMg-2DYzD;`Hj=|CGUhlOQ3aCvA!l0A^|m-Ks*glxdEq zI#0cqSXDF%MKnQW=nxwjMhHF(H-|gJ-bYr3hhI7Wb>PWx@s5RIQNf$xGs3NQe|UITF*Mzt#d00000sH}wRDUBQBW7l1At51PU|?!$YGh<&mX?+zBqV5PXr`v7o}QkHii)D5 zqIh_CaBy&pjEp5EC4hi{n3$M^goHSN9TETl08mLpK~#9!WXwqxfG`LHP-qxz9qM@h ztEx*Q4>tcLh>r3dT?p#LiIboVocO`UFf&~I^x#A%u$5pBt|>IGpdmd0hi4$9sJ{E0 enW@%WfB^uPjsajdIc7}&0000MMXtGKtMu5LM0_7JUl#4PfrI9sWt!r08dFoK~#9!WXwqxfG`LHP(m46r#jyM zs_N3ngUx>lf-c{|LeMTwOax`%#1BS>m0{|#KRw*NfQeng-KyLS!;|eeU4Nm}>sG4}Q00000NkvXXu0mjffjlGX delta 85 zcmX@ec#v^IxN2Bfn4h1Yii%1|NQl3`e_&u>KtO(pw?v-~$#o=8?_yaBj23|gfnK`H0dl`Vh)78&qol`;+0IRVaRsaA1 diff --git a/assets/opencomputers/textures/blocks/screen/fbm2.png b/assets/opencomputers/textures/blocks/screen/fbm2.png index 85ca1a58243e574558c7fe844ccf19a35c25d0e9..1db3e077e96811b5df6e3ec16f1a483f87127de7 100644 GIT binary patch delta 86 zcmdnPxQB5)}@Qc_Y}TwFpzf`WoVMn(qj=5C*fm9lD4 pi}ZHxSee<%T_!3t^VmV*1O~2$3=@_Lyf0?}0#8>zmvv4FO#s?59VP$( delta 86 zcmdnPxQB52E#!AEk$EdO zR$wS#RfF0YyJpx^i>{WCV36N7+L*C21AxNaHE%9{0R{k9F#z@P1EOmH0000jhbCww zgf-ui+?{qKxO?5S2?-PKo85{qG-hr%bk{Urua1$8AzX>!>vqjR3kD$YboFyt=akR{ E07mvCbN~PV diff --git a/assets/opencomputers/textures/blocks/screen/fbr2.png b/assets/opencomputers/textures/blocks/screen/fbr2.png index 8991dc092d07fdd7c8a748f35bcad299cce4a247..41ec09967c0e0b736433b465b054fe6e0855f00c 100644 GIT binary patch delta 177 zcmV;i08amd0)qmOT7P6@WNK<^q@<)^U|@!Zh9o2;Vq#)uW@eh2ntXhGoSdAXprCAQ zY<6~bARr(mB_)J}glK4JaBy&rj*dke*bD#w08vRqK~#9!gw8nJL1S1Bf=LM;hVd6p-ZAsrjZapFn<}AZDFs&`QbhnrF50u3 fsax)){t7Svk1qj^@J(ng00000NkvXXu0mjfKhi_G delta 177 zcmV;i08amd0)qmOT7NP!GBq_dF)=YPFfcp#O%>>Iq>~9hS5_%Xq2uk%BEl-9-z=lJ}Snz+bRofS4dZ8S}y>p#O%>>Iq>~?UuAW%Xp~t9hK7cAc6Kk}4}6iPFHNh|aUbjODBCpG zLi^1Gf#EOQT;Nc6>&mLIXz54cehNHwCETK?)Ov~@(OM)J!0hnrgzE`@1sDKdL;_{h S*f`Pv0000X|O;l7=H8nL=RaHVl zLQhXmIXO8{P*77-Q$9XENJvOaOG`UDJ0Kt+R#sL+Lqj5;MWKgl-05J%|0CR*~{g=DmHsbL}Z;6@aB&hr;jwlRx?O4Z0$xA!9 qU?A2GXJd$|YBHPeww|8=0|21P0XA5C9ykC1002ovPDHLkU;%gl(z%UHMY|B^9{l~4kMg)O;Q_M6ELFG?zL}9>d$6P*2UfRM1 o12K0v8$(Q0li7T?_4x!C0HUt}HoMb$O8@`>07*qoM6N<$f(HIG7XSbN diff --git a/assets/opencomputers/textures/blocks/screen/fhm2.png b/assets/opencomputers/textures/blocks/screen/fhm2.png index c3ee2d6671e47bddbdfbeeffb10a720dfee5c1fa..0a18b66264dcb59275e47ea9d9f667d9cc2f9f9c 100644 GIT binary patch delta 116 zcmV-)0E_?T0pn zoUE*@ARr)KIJB0Liz7JQp=JteKXQ{BnHMup=CR~Y_=pIviZN@ty8!*Y*Vq@}6<`3$ W0s&6L{(xct00002gziaBbyy8!*Y*Vq@}6<`3$ W4*^b_prDqP zmLMP?B_$nz003f1L_t(|+FX!X3Ijn1 z1$}ByugUD|{SP{w&pbthf>KlfwO&EZ3_(?_)#1}~sPS$!Mnu6b{}CnvxCrRO%Ero< zfHA<#U}0tCwTXfAjFdf>)w8>oGZlgUj_)795zyN!zyMW50$uz)NdN!<002ovPDHLk FV1f~vTr2

F+M<5^|L_|c?)uL7a003l3L_t(|+FX!X4#O}A z1$ltuEzZ8Qx&J}ye&&G?(ntdW0n~a0H8TWNu~vqu=TP#}N=D9tP2Le^0$2&?hn0tw zk$^G4#o%CN=e3D}^NbWd*3+ZA*E>~#{*Uh;z&D_`p8x{@PP+nKmlTAJ00000NkvXX Hu0mjfC)Rv;iCQBhG>S65S0Q%_G%P*6}MB_-Uv zhFJgr06R%UK~#9!Vqj!pKn2W9XacP00_+%CxX}a{ISHA8VJ$BQx(Xh2YthYMW+UWu kMsyX77-n#x@&N)208mi?k?!j(Gynhq07*qoM6N<$g5gCgZvX%Q diff --git a/assets/opencomputers/textures/blocks/screen/fmr.png b/assets/opencomputers/textures/blocks/screen/fmr.png index 2759e1a20df5776e466972a07801574bb646e3ce..2b8136fa4df207b958a73cb996b125ebae7e7cd7 100644 GIT binary patch delta 121 zcmV-<0EYj=0mA{1QF5fDq#`0BAt50nBO@dvB%q+6sHmu{tgNc4s-mKzrlzJ_-7`G^ z001>fL_t(|+G1cp0c=dDdhR2MURCW(C9{-`f~yFen1Eb$E1A-wD`Y@Oup1Vv^$)U=;w^Jpmb962Q{{0000< KMNUMnLSTY=-!?G- diff --git a/assets/opencomputers/textures/blocks/screen/ftm.png b/assets/opencomputers/textures/blocks/screen/ftm.png index 326d5433f2eeaf252dadc0d13b93cc4677f8cdbc..e8ccc65ec878759182e1225bce1b89033b526465 100644 GIT binary patch delta 110 zcmV-!0FnQ`0loo{S7)T8q#+?8sHmu-qN1RnpqQALBqSuJrlzW@s-B*n*}DnJ0000j zNklm!N$tW#>&mk#>_CH06>5N0E}t?k9#M* QU;qFB07*qoM6N<$f=c}{`~Uy| delta 110 zcmV-!0FnQ`0loo{S7%XCQBY7&R8&+UAt6#yQdLz|Pft%wOiUysBvVsUz9Buw0000j zNkl5N0F3qkk2|wT Q=Kufz07*qoM6N<$f}=bt*Z=?k diff --git a/assets/opencomputers/textures/blocks/screen/ftr.png b/assets/opencomputers/textures/blocks/screen/ftr.png index f81c8bde4140efcf1fb8d9b14a623ec09844b8c5..60ca5747c7d66cbbaedd1ffd29a2712d35359223 100644 GIT binary patch delta 142 zcmV;90CE4^0o?(RSAV3Wq@0|bsHmtRAt9ooqMn|fBqSuPtgN7*pdcV1rlzI}$8$yi z002ozL_t(|+Jw$I62LGB1VJsA0Nelnu465M2&Wo~6@pg^0Rak9E8V;Oan&?6m35Ad w01BIhvPc%r;tL9WJvtuSSD`UhegOsm$_fDs?A~Rb00000Ne4wvM6N<$g5QES?*IS* delta 141 zcmV;80CNA`0o(zQSASAcQcg}zR8&+UAt59rBu`IIR#sL~QBhMI@S`1aH^qLA^0Q_5FjDB%DvlPS1nUhS?AaY vps-mei(=s{o}kdzqvNrC6&hpZ7hnLzfdLCE(#`(>0000Uq#+?8o}QklsHmo@FoAXsyQ0ODakl)P;~3Sf nZyUCD>%?@CqBKc9(kH+GlPm#*-hGEN00000NkvXXu0mjf&ki%o diff --git a/assets/opencomputers/textures/blocks/screen/fvb2.png b/assets/opencomputers/textures/blocks/screen/fvb2.png index 7d17c551bcac46d815ae076423aac4f63d54869c..057db22438a2ac9098deabaaa6816e272d1baceb 100644 GIT binary patch delta 221 zcmV<303!de0CWS`WRbdLqOG_y&rKFZi4xp39c=wMvPXPu1 XQiB4fd)gQp00000NkvXXu0mjfg_vUQ delta 222 zcmV<403rXc0>O-)fzQ8F?zN=iyjPEIy9 zHbq56IyyQ-LqkA7KvYyzARr(@LPAGJM^I2uPft%%Q&TlHHA_oNv)&_Q0001NNklrV-j}a{vGU07*qoM6N<$f}CDU!vFvP diff --git a/assets/opencomputers/textures/blocks/screen/fvm.png b/assets/opencomputers/textures/blocks/screen/fvm.png index 2808d8f076db8c9772eef6b431561ce915f1fefe..5c6d9c139f7da9ff8fbb7261a0afedd2c90c738b 100644 GIT binary patch delta 163 zcmV;U09^m?0q+5jRDYzTq$49EAt50oBqXAuqM)FlrlzKuqs002ovPDHLkV1lQoM4bQt delta 163 zcmV;U09^m?0q+5jRDV)ZQX?ZHAt50oBqUQ)Q&CY-P*6}#PEJ)-RZmY(R#sLZARts! zR7^}v6nXz;00010Nkl}ZRtf9%tS1Y8Xq#+?8rlzKxoSdMbprWFpsHmu_s;VF$AS5Ito}Qj1B_*1g zn%^|Y{*i(rRW7nn|BD6kyLNN8*2b`#cpAc0q1XX9A~1p}F&2uagtjGuxhpk-wxBlx tCp43GgML_eCi2pG9hJVP_pJQ{7yuL#0l}IK+*|+v002ovPDHLkV1gQJJ`ex^ delta 139 zcmV;60CfNP0r>%tS1VFdQXwHBQ&Uq;PEJu#QBY7&R8&+TARtv$RZmY(BqSsyB_&Nw zP1$N6gpqNqg&2pz_37=W5eoz?$bcC89ZJ6T-G@yGywp^!d%?| literal 0 HcmV?d00001 diff --git a/assets/opencomputers/textures/items/gpu2.png b/assets/opencomputers/textures/items/gpu2.png new file mode 100644 index 0000000000000000000000000000000000000000..166023eadbfd33fec63e65af9d31f83ee0d6d9f5 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!fo^#Gp`S0F8BW_I)DO*t5GY4O)g zOH2Cp?f?J(%}(7XfJ%8wg8YJkTsUB`eWBC_lnC&2aSW-rHKpI1>wp1=%iNxy*M866 z-Zq6zr}dj|j161q5vEU$OGJeI6}f$;NjQ6SZR@i>c(`@>wgiE`to$A87`7(qo1Rt` im(Q>Nqg&2pz_4H?$A;6BE@lGFX7F_Nb6Mw<&;$SvFJ2%3 literal 0 HcmV?d00001 diff --git a/li/cil/oc/Blocks.scala b/li/cil/oc/Blocks.scala index 4310ba5b8..f7fd22769 100644 --- a/li/cil/oc/Blocks.scala +++ b/li/cil/oc/Blocks.scala @@ -7,7 +7,7 @@ object Blocks { var blockSpecial: SpecialDelegator = null var computer: Computer = null - var screen: Screen = null + var screen1, screen2, screen3: Screen = null var keyboard: Keyboard = null var powerSupply: PowerSupply = null @@ -24,7 +24,11 @@ object Blocks { blockSpecial = new SpecialDelegator(Config.blockSpecialId) computer = new Computer(blockSimple) - screen = new Screen(blockSimple) + + screen1 = new ScreenTier1(blockSimple) + screen2 = new ScreenTier2(blockSimple) + screen3 = new ScreenTier3(blockSimple) + keyboard = new Keyboard(blockSpecial) powerSupply = new PowerSupply(blockSimple) diff --git a/li/cil/oc/Config.scala b/li/cil/oc/Config.scala index e3abb954d..99c409aca 100644 --- a/li/cil/oc/Config.scala +++ b/li/cil/oc/Config.scala @@ -8,6 +8,13 @@ object Config { val scriptPath = "/assets/" + resourceDomain + "/lua/" val driverPath = "/assets/" + resourceDomain + "/lua/drivers/" + // Let's stick to "common" ratios of 4:3 and 16:9, pixel wise. Corrected + // for the font size that's 2.4:1 and 3.2:1. + val screenResolutionsByTier = Array( + List((40, 16)), + List((40, 16), (60, 25), (80, 25)), + List((40, 16), (60, 25), (80, 25), (120, 50), (160, 50))) + // ----------------------------------------------------------------------- // var blockRenderId = 0 diff --git a/li/cil/oc/Items.scala b/li/cil/oc/Items.scala index 9edd8c606..12c41bae1 100644 --- a/li/cil/oc/Items.scala +++ b/li/cil/oc/Items.scala @@ -5,10 +5,13 @@ import li.cil.oc.common.item object Items { var multi: item.Delegator = null - var gpu: item.GraphicsCard = null var rs: item.RedstoneCard = null var lan: item.NetworkCard = null + var gpu1: item.GraphicsCard = null + var gpu2: item.GraphicsCard = null + var gpu3: item.GraphicsCard = null + var ram1: item.Memory = null var ram2: item.Memory = null var ram3: item.Memory = null @@ -21,10 +24,13 @@ object Items { def init() { multi = new item.Delegator(Config.itemId) - gpu = new item.GraphicsCard(multi) rs = new item.RedstoneCard(multi) lan = new item.NetworkCard(multi) + gpu1 = new item.GraphicsCard(multi, 0) + gpu2 = new item.GraphicsCard(multi, 1) + gpu3 = new item.GraphicsCard(multi, 2) + ram1 = new item.Memory(multi, 32) ram2 = new item.Memory(multi, 64) ram3 = new item.Memory(multi, 128) diff --git a/li/cil/oc/client/PacketHandler.scala b/li/cil/oc/client/PacketHandler.scala index d0deb327f..a8a260270 100644 --- a/li/cil/oc/client/PacketHandler.scala +++ b/li/cil/oc/client/PacketHandler.scala @@ -33,41 +33,40 @@ class PacketHandler extends CommonPacketHandler { def onScreenResolutionChange(p: PacketParser) = p.readTileEntity[Screen]() match { - case None => // Invalid packet. case Some(t) => { val w = p.readInt() val h = p.readInt() - t.screen.resolution = (w, h) + t.instance.resolution = (w, h) } + case _ => // Invalid packet. } def onScreenSet(p: PacketParser) = p.readTileEntity[Screen]() match { - case None => // Invalid packet. case Some(t) => { val col = p.readInt() val row = p.readInt() val s = p.readUTF() - t.screen.set(col, row, s) + t.instance.set(col, row, s) } + case _ => // Invalid packet. } def onScreenFill(p: PacketParser) = p.readTileEntity[Screen]() match { - case None => // Invalid packet. case Some(t) => { val col = p.readInt() val row = p.readInt() val w = p.readInt() val h = p.readInt() val c = p.readChar() - t.screen.fill(col, row, w, h, c) + t.instance.fill(col, row, w, h, c) } + case _ => // Invalid packet. } def onScreenCopy(p: PacketParser) = p.readTileEntity[Screen]() match { - case None => // Invalid packet. case Some(t) => { val col = p.readInt() val row = p.readInt() @@ -75,42 +74,46 @@ class PacketHandler extends CommonPacketHandler { val h = p.readInt() val tx = p.readInt() val ty = p.readInt() - t.screen.copy(col, row, w, h, tx, ty) + t.instance.copy(col, row, w, h, tx, ty) } + case _ => // Invalid packet. } def onScreenBufferResponse(p: PacketParser) = p.readTileEntity[Screen]() match { - case None => // Invalid packet. case Some(t) => + val w = p.readInt() + val h = p.readInt() + t.instance.resolution = (w, h) p.readUTF.split('\n').zipWithIndex.foreach { - case (line, i) => t.screen.set(0, i, line) + case (line, i) => t.instance.set(0, i, line) } + case _ => // Invalid packet. } def onComputerStateResponse(p: PacketParser) = p.readTileEntity[Computer]() match { - case None => // Invalid packet. case Some(t) => { t.isOn = p.readBoolean() } + case _ => // Invalid packet. } def onRotatableStateResponse(p: PacketParser) = p.readTileEntity[Rotatable]() match { - case None => // Invalid packet. case Some(t) => t.pitch = p.readDirection() t.yaw = p.readDirection() + case _ => // Invalid packet. } def onRedstoneStateResponse(p: PacketParser) = p.readTileEntity[TileEntity with Redstone]() match { - case None => // Invalid packet. case Some(t) => t.isOutputEnabled = p.readBoolean() for (d <- ForgeDirection.VALID_DIRECTIONS) { t.output(d, p.readByte()) } + case _ => // Invalid packet. } } \ No newline at end of file diff --git a/li/cil/oc/client/gui/Screen.scala b/li/cil/oc/client/gui/Screen.scala index 83af09ccd..65e666921 100644 --- a/li/cil/oc/client/gui/Screen.scala +++ b/li/cil/oc/client/gui/Screen.scala @@ -47,11 +47,11 @@ class Screen(tileEntity: tileentity.Screen) extends MCGuiScreen { // Re-build display lists. Screen.compileBackground(innerWidth, innerHeight) - Screen.compileText(scale, screen.screen.lines) + Screen.compileText(scale, screen.instance.lines) } /** Must be called whenever the buffer of the underlying screen changes. */ - def updateText() = Screen.compileText(scale, screen.screen.lines) + def updateText() = Screen.compileText(scale, screen.instance.lines) override def handleKeyboardInput() { super.handleKeyboardInput() @@ -83,7 +83,7 @@ class Screen(tileEntity: tileentity.Screen) extends MCGuiScreen { super.initGui() MonospaceFontRenderer.init(mc.renderEngine) Screen.init(mc.renderEngine) - val (w, h) = screen.screen.resolution + val (w, h) = screen.instance.resolution changeSize(w, h) } diff --git a/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala b/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala index dfd5bb5ac..8c7550f9d 100644 --- a/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala +++ b/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala @@ -114,13 +114,13 @@ object ScreenRenderer extends TileEntitySpecialRenderer with Callable[Int] with GL11.glTranslatef(0, 0, 0.01f) // Scale based on actual buffer size. - val (w, h) = screen.screen.resolution + val (w, h) = screen.instance.resolution val scaleX = sx.toFloat / (w * MonospaceFontRenderer.fontWidth) val scaleY = sy.toFloat / (h * MonospaceFontRenderer.fontHeight) val scale = scaleX min scaleY GL11.glScalef(scale / sx.toFloat, scale / sy.toFloat, 1) - for ((line, i) <- screen.screen.lines.zipWithIndex) { + for ((line, i) <- screen.instance.lines.zipWithIndex) { MonospaceFontRenderer.drawString(line, 0, i * MonospaceFontRenderer.fontHeight) } diff --git a/li/cil/oc/common/block/Adapter.scala b/li/cil/oc/common/block/Adapter.scala index 2d6003a1a..bebe6621f 100644 --- a/li/cil/oc/common/block/Adapter.scala +++ b/li/cil/oc/common/block/Adapter.scala @@ -37,7 +37,7 @@ class Adapter(val parent: SimpleDelegator) extends SimpleDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.Adapter) + override def createTileEntity(world: World) = Some(new tileentity.Adapter) // ----------------------------------------------------------------------- // // Block detection diff --git a/li/cil/oc/common/block/Computer.scala b/li/cil/oc/common/block/Computer.scala index 4dd310603..bce4bc32b 100644 --- a/li/cil/oc/common/block/Computer.scala +++ b/li/cil/oc/common/block/Computer.scala @@ -57,7 +57,7 @@ class Computer(val parent: SimpleDelegator) extends SimpleDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.Computer(world.isRemote)) + override def createTileEntity(world: World) = Some(new tileentity.Computer(world.isRemote)) // ----------------------------------------------------------------------- // @@ -70,7 +70,7 @@ class Computer(val parent: SimpleDelegator) extends SimpleDelegate { override def isProvidingWeakPower(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = world.getBlockTileEntity(x, y, z).asInstanceOf[tileentity.Computer].output(side) - override def onBlockPreDestroy(world: World, x: Int, y: Int, z: Int, metadata: Int) = + override def onBlockPreDestroy(world: World, x: Int, y: Int, z: Int) = if (!world.isRemote) world.getBlockTileEntity(x, y, z) match { case computer: tileentity.Computer => computer.turnOff() diff --git a/li/cil/oc/common/block/Delegate.scala b/li/cil/oc/common/block/Delegate.scala index c11c3ac64..9dc68f709 100644 --- a/li/cil/oc/common/block/Delegate.scala +++ b/li/cil/oc/common/block/Delegate.scala @@ -19,18 +19,21 @@ trait Delegate { // Block // ----------------------------------------------------------------------- // - def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int, metadata: Int) {} + def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int) {} def canConnectRedstone(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false - def createTileEntity(world: World, metadata: Int): Option[TileEntity] = None + def colorMultiplier(world: IBlockAccess, x: Int, y: Int, z: Int) = getRenderColor - def getBlockTextureFromSide(world: IBlockAccess, x: Int, y: Int, z: Int, worldSide: ForgeDirection, localSide: ForgeDirection): Option[Icon] = icon(localSide) + def createTileEntity(world: World): Option[TileEntity] = None + + def getBlockTextureFromSide(world: IBlockAccess, x: Int, y: Int, z: Int, + worldSide: ForgeDirection, localSide: ForgeDirection): Option[Icon] = icon(localSide) def getCollisionBoundingBoxFromPool(world: World, x: Int, y: Int, z: Int) = AxisAlignedBB.getAABBPool.getAABB(x, y, z, x + 1, y + 1, z + 1) - def icon(side: ForgeDirection): Option[Icon] = None + def getRenderColor = 0xFFFFFF def getLightOpacity(world: World, x: Int, y: Int, z: Int) = 255 @@ -40,6 +43,8 @@ trait Delegate { def hasTileEntity = false + def icon(side: ForgeDirection): Option[Icon] = None + def isProvidingStrongPower(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = 0 def isProvidingWeakPower(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = 0 @@ -50,7 +55,7 @@ trait Delegate { def onBlockPlacedBy(world: World, x: Int, y: Int, z: Int, player: EntityLivingBase, item: ItemStack) {} - def onBlockPreDestroy(world: World, x: Int, y: Int, z: Int, metadata: Int) {} + def onBlockPreDestroy(world: World, x: Int, y: Int, z: Int) {} def onBlockRemovedBy(world: World, x: Int, y: Int, z: Int, player: EntityPlayer) = true diff --git a/li/cil/oc/common/block/Delegator.scala b/li/cil/oc/common/block/Delegator.scala index 0d0c59834..18395bee0 100644 --- a/li/cil/oc/common/block/Delegator.scala +++ b/li/cil/oc/common/block/Delegator.scala @@ -101,23 +101,34 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) { override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int, metadata: Int) = { subBlock(metadata) match { - case None => // Invalid but avoid match error. case Some(subBlock) => { world.getBlockTileEntity(x, y, z) match { case node: Node => node.network.foreach(_.remove(node)) case _ => // Nothing special to do. } - subBlock.breakBlock(world, x, y, z, blockId, metadata) + subBlock.breakBlock(world, x, y, z, blockId) } + case _ => // Invalid but avoid match error. } super.breakBlock(world, x, y, z, blockId, metadata) } + override def getRenderColor(metadata: Int) = + subBlock(metadata) match { + case Some(subBlock) => subBlock.getRenderColor + case _ => super.getRenderColor(metadata) + } + + override def colorMultiplier(world: IBlockAccess, x: Int, y: Int, z: Int) = + subBlock(world, x, y, z) match { + case Some(subBlock) => subBlock.colorMultiplier(world, x, y, z) + case _ => super.colorMultiplier(world, x, y, z) + } + override def getDamageValue(world: World, x: Int, y: Int, z: Int) = world.getBlockMetadata(x, y, z) override def canConnectRedstone(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) = subBlock(world, x, y, z) match { - case None => false case Some(subBlock) => subBlock.canConnectRedstone( world, x, y, z, toLocal(world, x, y, z, side match { case -1 => ForgeDirection.UP @@ -126,53 +137,54 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) { case 2 => ForgeDirection.SOUTH case 3 => ForgeDirection.WEST })) + case _ => false } override def canProvidePower = true override def createTileEntity(world: World, metadata: Int): TileEntity = subBlock(metadata) match { - case None => null - case Some(subBlock) => subBlock.createTileEntity(world, metadata).orNull + case Some(subBlock) => subBlock.createTileEntity(world).orNull + case _ => null } override def getCollisionBoundingBoxFromPool(world: World, x: Int, y: Int, z: Int) = subBlock(world, x, y, z) match { - case None => super.getCollisionBoundingBoxFromPool(world, x, y, z) // TODO Rotate to world space if we have a Rotatable? case Some(subBlock) => subBlock.getCollisionBoundingBoxFromPool(world, x, y, z) + case _ => super.getCollisionBoundingBoxFromPool(world, x, y, z) } override def getBlockTexture(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) = subBlock(world, x, y, z) match { - case None => super.getBlockTexture(world, x, y, z, side) case Some(subBlock) => val orientation = ForgeDirection.getOrientation(side) subBlock.getBlockTextureFromSide(world, x, y, z, orientation, toLocal(world, x, y, z, orientation)) match { - case None => super.getBlockTexture(world, x, y, z, side) case Some(icon) => icon + case _ => super.getBlockTexture(world, x, y, z, side) } + case _ => super.getBlockTexture(world, x, y, z, side) } override def getLightValue(world: IBlockAccess, x: Int, y: Int, z: Int) = subBlock(world, x, y, z) match { - case None => 0 case Some(subBlock) => subBlock.getLightValue(world, x, y, z) + case _ => 0 } override def getIcon(side: Int, metadata: Int) = subBlock(metadata) match { - case None => super.getIcon(side, metadata) case Some(subBlock) => subBlock.icon(ForgeDirection.getOrientation(side)) match { - case None => super.getIcon(side, metadata) case Some(icon) => icon + case _ => super.getIcon(side, metadata) } + case _ => super.getIcon(side, metadata) } override def getLightOpacity(world: World, x: Int, y: Int, z: Int) = subBlock(world, x, y, z) match { - case None => 255 case Some(subBlock) => subBlock.getLightOpacity(world, x, y, z) + case _ => 255 } override def getSubBlocks(itemId: Int, creativeTab: CreativeTabs, list: util.List[_]) = { @@ -186,33 +198,33 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) { def getUnlocalizedName(metadata: Int) = subBlock(metadata) match { - case None => "oc.block" case Some(subBlock) => subBlock.unlocalizedName + case _ => "oc.block" } override def getValidRotations(world: World, x: Int, y: Int, z: Int) = subBlock(world, x, y, z) match { - case None => super.getValidRotations(world, x, y, z) case Some(subBlock) => subBlock.getValidRotations(world, x, y, z) + case _ => super.getValidRotations(world, x, y, z) } override def hasTileEntity(metadata: Int) = subBlock(metadata) match { - case None => false case Some(subBlock) => subBlock.hasTileEntity + case _ => false } override def isProvidingStrongPower(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) = subBlock(world, x, y, z) match { - case None => 0 case Some(subBlock) => subBlock.isProvidingStrongPower( world, x, y, z, toLocal(world, x, y, z, ForgeDirection.getOrientation(side).getOpposite)) + case _ => 0 } override def isProvidingWeakPower(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) = subBlock(world, x, y, z) match { - case None => 0 case Some(subBlock) => subBlock.isProvidingWeakPower( world, x, y, z, toLocal(world, x, y, z, ForgeDirection.getOrientation(side).getOpposite)) + case _ => 0 } override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, side: Int, hitX: Float, hitY: Float, hitZ: Float): Boolean = { @@ -269,15 +281,14 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) { // No rotating tool in hand or can't rotate: activate the block. subBlock(world, x, y, z) match { - case None => false case Some(subBlock) => subBlock.onBlockActivated( world, x, y, z, player, ForgeDirection.getOrientation(side), hitX, hitY, hitZ) + case _ => false } } override def onBlockAdded(world: World, x: Int, y: Int, z: Int) = subBlock(world, x, y, z) match { - case None => // Invalid but avoid match error. case Some(subBlock) => { world.getBlockTileEntity(x, y, z) match { case _: Node => Network.joinOrCreateNetwork(world, x, y, z) @@ -285,24 +296,25 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) { } subBlock.onBlockAdded(world, x, y, z) } + case _ => // Invalid but avoid match error. } override def onBlockPlacedBy(world: World, x: Int, y: Int, z: Int, player: EntityLivingBase, item: ItemStack) = subBlock(world, x, y, z) match { - case None => // Invalid but avoid match error. case Some(subBlock) => subBlock.onBlockPlacedBy(world, x, y, z, player, item) + case _ => // Invalid but avoid match error. } override def onBlockPreDestroy(world: World, x: Int, y: Int, z: Int, metadata: Int) = subBlock(world, x, y, z) match { - case None => // Invalid but avoid match error. - case Some(subBlock) => subBlock.onBlockPreDestroy(world, x, y, z, metadata) + case Some(subBlock) => subBlock.onBlockPreDestroy(world, x, y, z) + case _ => // Invalid but avoid match error. } override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, blockId: Int) = subBlock(world, x, y, z) match { - case None => // Invalid but avoid match error. case Some(subBlock) => subBlock.onNeighborBlockChange(world, x, y, z, blockId) + case _ => // Invalid but avoid match error. } override def registerIcons(iconRegister: IconRegister) = { @@ -312,8 +324,8 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) { override def removeBlockByPlayer(world: World, player: EntityPlayer, x: Int, y: Int, z: Int) = (subBlock(world, x, y, z) match { - case None => true case Some(subBlock) => subBlock.onBlockRemovedBy(world, x, y, z, player) + case _ => true }) && super.removeBlockByPlayer(world, player, x, y, z) override def rotateBlock(world: World, x: Int, y: Int, z: Int, axis: ForgeDirection) = { @@ -329,14 +341,14 @@ class SimpleDelegator(id: Int) extends Delegator[SimpleDelegate](id) class SpecialDelegator(id: Int) extends Delegator[SpecialDelegate](id) { override def isBlockNormalCube(world: World, x: Int, y: Int, z: Int) = subBlock(world.getBlockMetadata(x, y, z)) match { - case None => false case Some(subBlock) => subBlock.isBlockNormalCube(world, x, y, z) + case _ => false } override def isBlockSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) = subBlock(world.getBlockMetadata(x, y, z)) match { - case None => true case Some(subBlock) => subBlock.isBlockSolid(world, x, y, z, ForgeDirection.getOrientation(side)) + case _ => true } override def isOpaqueCube = false @@ -345,7 +357,7 @@ class SpecialDelegator(id: Int) extends Delegator[SpecialDelegate](id) { override def shouldSideBeRendered(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) = subBlock(world.getBlockMetadata(x, y, z)) match { - case None => super.shouldSideBeRendered(world, x, y, z, side) case Some(subBlock) => subBlock.shouldSideBeRendered(world, x, y, z, ForgeDirection.getOrientation(side)) + case _ => super.shouldSideBeRendered(world, x, y, z, side) } } \ No newline at end of file diff --git a/li/cil/oc/common/block/DiskDrive.scala b/li/cil/oc/common/block/DiskDrive.scala index 430a360d8..4b0ffe2eb 100644 --- a/li/cil/oc/common/block/DiskDrive.scala +++ b/li/cil/oc/common/block/DiskDrive.scala @@ -34,16 +34,15 @@ class DiskDrive(val parent: SimpleDelegator) extends SimpleDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.DiskDrive) + override def createTileEntity(world: World) = Some(new tileentity.DiskDrive) // ----------------------------------------------------------------------- // - override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int, metadata: Int) = { + override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int) = { if (!world.isRemote) world.getBlockTileEntity(x, y, z) match { case drive: tileentity.DiskDrive => drive.dropContent(world, x, y, z) case _ => // Ignore. } - super.breakBlock(world, x, y, z, blockId, metadata) } override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, diff --git a/li/cil/oc/common/block/Keyboard.scala b/li/cil/oc/common/block/Keyboard.scala index 89e6e8884..93c53464c 100644 --- a/li/cil/oc/common/block/Keyboard.scala +++ b/li/cil/oc/common/block/Keyboard.scala @@ -11,5 +11,5 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.Keyboard) + override def createTileEntity(world: World) = Some(new tileentity.Keyboard) } \ No newline at end of file diff --git a/li/cil/oc/common/block/PowerDistributor.scala b/li/cil/oc/common/block/PowerDistributor.scala index 1cf010cc0..9b3b28bd9 100644 --- a/li/cil/oc/common/block/PowerDistributor.scala +++ b/li/cil/oc/common/block/PowerDistributor.scala @@ -37,6 +37,6 @@ class PowerDistributor(val parent: SimpleDelegator) extends SimpleDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.PowerDistributor) + override def createTileEntity(world: World) = Some(new tileentity.PowerDistributor) } diff --git a/li/cil/oc/common/block/PowerSupply.scala b/li/cil/oc/common/block/PowerSupply.scala index 18852e534..fea73ea29 100644 --- a/li/cil/oc/common/block/PowerSupply.scala +++ b/li/cil/oc/common/block/PowerSupply.scala @@ -12,9 +12,8 @@ class PowerSupply(val parent: SimpleDelegator) extends SimpleDelegate { GameRegistry.registerTileEntity(classOf[tileentity.PowerSupply], "oc.powersupply") val unlocalizedName = "PowerSupply" - override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int, metadata: Int) = { + override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int) = { world.getBlockTileEntity(x, y, z).asInstanceOf[tileentity.PowerSupply].onUnload() - super.breakBlock(world, x, y, z, blockId, metadata) } // ----------------------------------------------------------------------- // @@ -39,5 +38,5 @@ class PowerSupply(val parent: SimpleDelegator) extends SimpleDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.PowerSupply) + override def createTileEntity(world: World) = Some(new tileentity.PowerSupply) } diff --git a/li/cil/oc/common/block/Screen.scala b/li/cil/oc/common/block/Screen.scala index 97addc83b..b4e18c497 100644 --- a/li/cil/oc/common/block/Screen.scala +++ b/li/cil/oc/common/block/Screen.scala @@ -12,10 +12,37 @@ import net.minecraft.world.World import net.minecraftforge.common.ForgeDirection import sun.plugin.dom.exception.InvalidStateException -class Screen(val parent: SimpleDelegator) extends SimpleDelegate { - GameRegistry.registerTileEntity(classOf[tileentity.Screen], "oc.screen") +class ScreenTier1(parent: SimpleDelegator) extends Screen(parent) { + val unlocalizedName = "ScreenBasic" - val unlocalizedName = "Screen" + GameRegistry.registerTileEntity(classOf[tileentity.ScreenTier1], "oc.screen0") + + override def getRenderColor = 0x7F7F7F + + override def createTileEntity(world: World) = Some(new tileentity.ScreenTier1) +} + +class ScreenTier2(parent: SimpleDelegator) extends Screen(parent) { + val unlocalizedName = "ScreenAdvanced" + + GameRegistry.registerTileEntity(classOf[tileentity.ScreenTier2], "oc.screen1") + + override def getRenderColor = 0xFFFF66 + + override def createTileEntity(world: World) = Some(new tileentity.ScreenTier2) +} + +class ScreenTier3(parent: SimpleDelegator) extends Screen(parent) { + val unlocalizedName = "ScreenProfessional" + + GameRegistry.registerTileEntity(classOf[tileentity.ScreenTier3], "oc.screen2") + + override def getRenderColor = 0x66FFFF + + override def createTileEntity(world: World) = Some(new tileentity.ScreenTier3) +} + +abstract class Screen(val parent: SimpleDelegator) extends SimpleDelegate { // ----------------------------------------------------------------------- // // Rendering stuff @@ -278,8 +305,6 @@ class Screen(val parent: SimpleDelegator) extends SimpleDelegate { override def hasTileEntity = true - override def createTileEntity(world: World, metadata: Int) = Some(new tileentity.Screen) - // ----------------------------------------------------------------------- // // Interaction // ----------------------------------------------------------------------- // diff --git a/li/cil/oc/common/component/Screen.scala b/li/cil/oc/common/component/Screen.scala index bf686527d..e53a6c723 100644 --- a/li/cil/oc/common/component/Screen.scala +++ b/li/cil/oc/common/component/Screen.scala @@ -4,11 +4,10 @@ import li.cil.oc.api.Persistable import li.cil.oc.api.network.{Component, Message, Visibility} import li.cil.oc.util.TextBuffer import net.minecraft.nbt.NBTTagCompound +import li.cil.oc.common.component -class Screen(val owner: Screen.Environment) extends Persistable { - val supportedResolutions = List((40, 24), (80, 24)) - - private val buffer = new TextBuffer(80, 24) +class Screen(val owner: Screen.Environment, val resolutions: List[(Int, Int)]) extends Persistable { + private val buffer = new TextBuffer(resolutions.head._1, resolutions.head._2) // ----------------------------------------------------------------------- // @@ -19,7 +18,7 @@ class Screen(val owner: Screen.Environment) extends Persistable { def resolution = buffer.size def resolution_=(value: (Int, Int)) = - if (supportedResolutions.contains(value) && (buffer.size = value)) { + if (resolutions.contains(value) && (buffer.size = value)) { val (w, h) = value owner.onScreenResolutionChange(w, h) true @@ -60,30 +59,32 @@ class Screen(val owner: Screen.Environment) extends Persistable { object Screen { trait Environment extends Component { - final val screen = new Screen(this) + final val instance = new component.Screen(this, resolutions) override val name = "screen" override val visibility = Visibility.Network + protected def resolutions: List[(Int, Int)] + // ----------------------------------------------------------------------- // override def receive(message: Message): Option[Array[Any]] = super.receive(message).orElse { message.data match { case Array(w: Int, h: Int) if message.name == "screen.resolution=" => - result(screen.resolution = (w, h)) + result(instance.resolution = (w, h)) case Array() if message.name == "screen.resolution" => { - val (w, h) = screen.resolution + val (w, h) = instance.resolution result(w, h) } case Array() if message.name == "screen.resolutions" => - result(screen.supportedResolutions: _*) + result(instance.resolutions: _*) case Array(x: Int, y: Int, value: String) if message.name == "screen.set" => - screen.set(x, y, value); None + instance.set(x, y, value); None case Array(x: Int, y: Int, w: Int, h: Int, value: Char) if message.name == "screen.fill" => - screen.fill(x, y, w, h, value); None + instance.fill(x, y, w, h, value); None case Array(x: Int, y: Int, w: Int, h: Int, tx: Int, ty: Int) if message.name == "screen.copy" => - screen.copy(x, y, w, h, tx, ty); None + instance.copy(x, y, w, h, tx, ty); None case _ => None } } @@ -93,14 +94,14 @@ object Screen { override abstract def readFromNBT(nbt: NBTTagCompound) = { super.readFromNBT(nbt) - screen.readFromNBT(nbt.getCompoundTag("screen")) + instance.readFromNBT(nbt.getCompoundTag("screen")) } override abstract def writeToNBT(nbt: NBTTagCompound) = { super.writeToNBT(nbt) val screenNbt = new NBTTagCompound - screen.writeToNBT(screenNbt) + instance.writeToNBT(screenNbt) nbt.setCompoundTag("screen", screenNbt) } diff --git a/li/cil/oc/common/item/GraphicsCard.scala b/li/cil/oc/common/item/GraphicsCard.scala index 4892e63ff..c7b2742ac 100644 --- a/li/cil/oc/common/item/GraphicsCard.scala +++ b/li/cil/oc/common/item/GraphicsCard.scala @@ -3,12 +3,14 @@ package li.cil.oc.common.item import li.cil.oc.Config import net.minecraft.client.renderer.texture.IconRegister -class GraphicsCard(val parent: Delegator) extends Delegate { - val unlocalizedName = "GraphicsCard" +class GraphicsCard(val parent: Delegator, val tier: Int) extends Delegate { + val unlocalizedName = "GraphicsCard" + Array("Basic", "Advanced", "Professional").apply(tier) + + val resolutions = Config.screenResolutionsByTier(tier) override def registerIcons(iconRegister: IconRegister) { super.registerIcons(iconRegister) - icon = iconRegister.registerIcon(Config.resourceDomain + ":gpu") + icon = iconRegister.registerIcon(Config.resourceDomain + ":gpu" + tier) } } \ No newline at end of file diff --git a/li/cil/oc/common/tileentity/Screen.scala b/li/cil/oc/common/tileentity/Screen.scala index f73ce8107..19b0ae90c 100644 --- a/li/cil/oc/common/tileentity/Screen.scala +++ b/li/cil/oc/common/tileentity/Screen.scala @@ -12,7 +12,19 @@ import net.minecraft.util.AxisAlignedBB import net.minecraftforge.common.ForgeDirection import scala.collection.mutable -class Screen extends Rotatable with component.Screen.Environment with Receiver { +class ScreenTier1 extends Screen { + protected def resolutions = Config.screenResolutionsByTier(0) +} + +class ScreenTier2 extends Screen { + protected def resolutions = Config.screenResolutionsByTier(1) +} + +class ScreenTier3 extends Screen { + protected def resolutions = Config.screenResolutionsByTier(2) +} + +abstract class Screen extends Rotatable with component.Screen.Environment with Receiver { var guiScreen: Option[gui.Screen] = None /** @@ -29,6 +41,13 @@ class Screen extends Rotatable with component.Screen.Environment with Receiver { */ private var shouldCheckForMultiBlock = true + private val ordering = new Ordering[Screen] { + def compare(a: Screen, b: Screen) = + if (a.xCoord != b.xCoord) a.xCoord - b.xCoord + else if (a.yCoord != b.yCoord) a.yCoord - b.yCoord + else a.zCoord - b.zCoord + } + var width, height = 1 var origin = this @@ -90,7 +109,7 @@ class Screen extends Rotatable with component.Screen.Environment with Receiver { // any multi-block specific state information. // We use a very primitive hash for the coordinates, which should be // good enough for... "normal" screen sizes. - val pending = mutable.SortedSet(this)(Ordering[Int].on[Screen](s => (((23 + s.xCoord * 31) + s.yCoord) * 31) + s.zCoord)) + val pending = mutable.SortedSet(this)(ordering) val queue = mutable.Queue(this) while (queue.nonEmpty) { val current = queue.dequeue() @@ -127,7 +146,7 @@ class Screen extends Rotatable with component.Screen.Environment with Receiver { screen.componentVisibility = Visibility.Network else { screen.componentVisibility = Visibility.None - val s = screen.screen + val s = screen.instance val (w, h) = s.resolution s.fill(0, 0, w, h, ' ') } @@ -148,7 +167,7 @@ class Screen extends Rotatable with component.Screen.Environment with Receiver { def tryMergeTowards(dx: Int, dy: Int) = { val (nx, ny, nz) = unproject(x + dx, y + dy, z) worldObj.getBlockTileEntity(nx, ny, nz) match { - case s: Screen if s.pitch == pitch && s.yaw == yaw && !screens.contains(s) => + case s: Screen if s.resolutions == resolutions && s.pitch == pitch && s.yaw == yaw && !screens.contains(s) => val (sx, sy, _) = project(s.origin) val canMergeAlongX = sy == y && s.height == height && s.width + width <= Config.maxScreenWidth val canMergeAlongY = sx == x && s.width == width && s.height + height <= Config.maxScreenHeight diff --git a/li/cil/oc/server/PacketHandler.scala b/li/cil/oc/server/PacketHandler.scala index cb85fd566..e5e0c1c3c 100644 --- a/li/cil/oc/server/PacketHandler.scala +++ b/li/cil/oc/server/PacketHandler.scala @@ -2,7 +2,6 @@ package li.cil.oc.server import cpw.mods.fml.common.network.Player import li.cil.oc.api.network.Node -import li.cil.oc.common.PacketBuilder import li.cil.oc.common.PacketType import li.cil.oc.common.tileentity import li.cil.oc.common.{PacketHandler => CommonPacketHandler} @@ -28,64 +27,59 @@ class PacketHandler extends CommonPacketHandler { def onScreenBufferRequest(p: PacketParser) = p.readTileEntity[tileentity.Screen]() match { - case None => // Invalid packet. - case Some(t) => { - val pb = new PacketBuilder(PacketType.ScreenBufferResponse) - - pb.writeTileEntity(t) - pb.writeUTF(t.screen.text) - - pb.sendToPlayer(p.player) - } + case Some(t) => + val (w, h) = t.instance.resolution + PacketSender.sendScreenBufferState(t, w, h, t.instance.text, Option(p.player)) + case _ => // Invalid packet. } def onComputerStateRequest(p: PacketParser) = p.readTileEntity[tileentity.Computer]() match { - case None => // Invalid packet. - case Some(t) => PacketSender.sendComputerState(t, t.isOn) + case Some(t) => PacketSender.sendComputerState(t, t.isOn, Option(p.player)) + case _ => // Invalid packet. } def onRotatableStateRequest(p: PacketParser) = p.readTileEntity[tileentity.Rotatable]() match { - case None => // Invalid packet. - case Some(t) => PacketSender.sendRotatableState(t) + case Some(t) => PacketSender.sendRotatableState(t, Option(p.player)) + case _ => // Invalid packet. } def onRedstoneStateRequest(p: PacketParser) = p.readTileEntity[TileEntity with Redstone]() match { - case None => // Invalid packet. - case Some(t) => PacketSender.sendRedstoneState(t) + case Some(t) => PacketSender.sendRedstoneState(t, Option(p.player)) + case _ => // Invalid packet. } def onKeyDown(p: PacketParser) = p.readTileEntity[Node]() match { - case None => // Invalid packet. case Some(s: tileentity.Screen) => val char = p.readChar() val code = p.readInt() val network = s.origin.network s.screens.foreach(n => network.foreach(_.sendToNeighbors(n, "keyboard.keyDown", p.player, char, code))) case Some(n) => n.network.foreach(_.sendToNeighbors(n, "keyboard.keyDown", p.player, p.readChar(), p.readInt())) + case _ => // Invalid packet. } def onKeyUp(p: PacketParser) = p.readTileEntity[Node]() match { - case None => // Invalid packet. case Some(s: tileentity.Screen) => val char = p.readChar() val code = p.readInt() val network = s.origin.network s.screens.foreach(n => network.foreach(_.sendToNeighbors(n, "keyboard.keyUp", p.player, char, code))) case Some(n) => n.network.foreach(_.sendToNeighbors(n, "keyboard.keyUp", p.player, p.readChar(), p.readInt())) + case _ => // Invalid packet. } def onClipboard(p: PacketParser) = p.readTileEntity[Node]() match { - case None => // Invalid packet. case Some(s: tileentity.Screen) => val value = p.readUTF() val network = s.origin.network s.screens.foreach(n => network.foreach(_.sendToNeighbors(n, "keyboard.clipboard", p.player, value))) case Some(n) => n.network.foreach(_.sendToNeighbors(n, "keyboard.clipboard", p.player, p.readUTF())) + case _ => // Invalid packet. } } \ No newline at end of file diff --git a/li/cil/oc/server/PacketSender.scala b/li/cil/oc/server/PacketSender.scala index 7fa042d55..c676d4df0 100644 --- a/li/cil/oc/server/PacketSender.scala +++ b/li/cil/oc/server/PacketSender.scala @@ -1,5 +1,6 @@ package li.cil.oc.server +import cpw.mods.fml.common.network.Player import li.cil.oc.common.PacketBuilder import li.cil.oc.common.PacketType import li.cil.oc.common.tileentity.Rotatable @@ -9,6 +10,20 @@ import net.minecraftforge.common.ForgeDirection /** Centralized packet dispatcher for sending updates to the client. */ object PacketSender { + def sendScreenBufferState(t: TileEntity, w: Int, h: Int, text: String, player: Option[Player] = None) = { + val pb = new PacketBuilder(PacketType.ScreenBufferResponse) + + pb.writeTileEntity(t) + pb.writeInt(w) + pb.writeInt(h) + pb.writeUTF(text) + + player match { + case Some(p) => pb.sendToPlayer(p) + case _ => pb.sendToAllPlayers() + } + } + def sendScreenResolutionChange(t: TileEntity, w: Int, h: Int) = { val pb = new PacketBuilder(PacketType.ScreenResolutionChange) @@ -57,26 +72,32 @@ object PacketSender { pb.sendToAllPlayers() } - def sendComputerState(t: TileEntity, value: Boolean) = { + def sendComputerState(t: TileEntity, value: Boolean, player: Option[Player] = None) = { val pb = new PacketBuilder(PacketType.ComputerStateResponse) pb.writeTileEntity(t) pb.writeBoolean(value) - pb.sendToAllPlayers() + player match { + case Some(p) => pb.sendToPlayer(p) + case _ => pb.sendToAllPlayers() + } } - def sendRotatableState(t: Rotatable) = { + def sendRotatableState(t: Rotatable, player: Option[Player] = None) = { val pb = new PacketBuilder(PacketType.RotatableStateResponse) pb.writeTileEntity(t) pb.writeDirection(t.pitch) pb.writeDirection(t.yaw) - pb.sendToAllPlayers() + player match { + case Some(p) => pb.sendToPlayer(p) + case _ => pb.sendToAllPlayers() + } } - def sendRedstoneState(t: TileEntity with Redstone) = { + def sendRedstoneState(t: TileEntity with Redstone, player: Option[Player] = None) = { val pb = new PacketBuilder(PacketType.RedstoneStateResponse) pb.writeTileEntity(t) @@ -85,6 +106,9 @@ object PacketSender { pb.writeByte(t.output(d)) } - pb.sendToAllPlayers() + player match { + case Some(p) => pb.sendToPlayer(p) + case _ => pb.sendToAllPlayers() + } } } \ No newline at end of file diff --git a/li/cil/oc/server/component/Computer.scala b/li/cil/oc/server/component/Computer.scala index 81f6796ea..24644fb22 100644 --- a/li/cil/oc/server/component/Computer.scala +++ b/li/cil/oc/server/component/Computer.scala @@ -560,6 +560,20 @@ class Computer(val owner: Computer.Environment) extends Persistable with Runnabl def parseArguments(lua: LuaState, start: Int) = for (index <- start to lua.getTop) yield parseArgument(lua, index) + def pushList(value: Iterator[(Any, Int)]) { + lua.newTable() + var count = 0 + value.foreach { + case (entry, index) => + pushResult(lua, entry) + lua.rawSet(-2, index + 1) + count = count + 1 + } + lua.pushString("n") + lua.pushInteger(count) + lua.rawSet(-3) + } + def pushResult(lua: LuaState, value: Any): Unit = value match { case value: Boolean => lua.pushBoolean(value) case value: Byte => lua.pushNumber(value) @@ -570,15 +584,10 @@ class Computer(val owner: Computer.Environment) extends Persistable with Runnabl case value: Double => lua.pushNumber(value) case value: String => lua.pushString(value) case value: Array[Byte] => lua.pushByteArray(value) - case value: Array[_] => { - lua.newTable() - value.zipWithIndex.foreach { - case (entry, index) => - pushResult(lua, entry) - lua.rawSet(-2, index) - } - } - // TODO maps, tuples/seqs? + case value: Array[_] => pushList(value.zipWithIndex.iterator) + case value: Product => pushList(value.productIterator.zipWithIndex) + case value: Seq[_] => pushList(value.zipWithIndex.iterator) + // TODO maps? // TODO I fear they are, but check if the following are really necessary for Java interop. case value: java.lang.Byte => lua.pushNumber(value.byteValue) case value: java.lang.Short => lua.pushNumber(value.shortValue) diff --git a/li/cil/oc/server/component/GraphicsCard.scala b/li/cil/oc/server/component/GraphicsCard.scala index e01dc4e0b..ce2a622f8 100644 --- a/li/cil/oc/server/component/GraphicsCard.scala +++ b/li/cil/oc/server/component/GraphicsCard.scala @@ -4,9 +4,7 @@ import li.cil.oc.api.network.{Component, Visibility, Message} import li.cil.oc.common.component import net.minecraft.nbt.NBTTagCompound -class GraphicsCard extends Component { - val supportedResolutions = List(List(40, 24), List(80, 24)) - +class GraphicsCard(val resolutions: List[(Int, Int)]) extends Component { private var screen: Option[String] = None override val name = "gpu" @@ -31,14 +29,14 @@ class GraphicsCard extends Component { }) case Array() if message.name == "system.disconnect" && message.source.address == screen => screen = None; None case Array(w: Double, h: Double) if message.name == "gpu.resolution=" => - if (supportedResolutions.contains((w.toInt, h.toInt))) + if (resolutions.contains((w.toInt, h.toInt))) trySend("screen.resolution=", w.toInt, h.toInt) else result(Unit, "unsupported resolution") case Array() if message.name == "gpu.resolution" => trySend("screen.resolution") case Array() if message.name == "gpu.resolutions" => trySend("screen.resolutions") match { case Some(Array(resolutions@_*)) => - result(supportedResolutions.intersect(resolutions): _*) + result(resolutions.intersect(resolutions): _*) case _ => None } case Array(x: Double, y: Double, value: Array[Byte]) if message.name == "gpu.set" => diff --git a/li/cil/oc/server/driver/GraphicsCard.scala b/li/cil/oc/server/driver/GraphicsCard.scala index c48a8d590..860756206 100644 --- a/li/cil/oc/server/driver/GraphicsCard.scala +++ b/li/cil/oc/server/driver/GraphicsCard.scala @@ -2,6 +2,7 @@ package li.cil.oc.server.driver import li.cil.oc.api.driver import li.cil.oc.api.driver.Slot +import li.cil.oc.common import li.cil.oc.server.component import li.cil.oc.{Config, Items} import net.minecraft.item.ItemStack @@ -9,9 +10,14 @@ import net.minecraft.item.ItemStack object GraphicsCard extends driver.Item { override def api = Option(getClass.getResourceAsStream(Config.driverPath + "gpu.lua")) - override def worksWith(item: ItemStack) = WorksWith(Items.gpu)(item) + override def worksWith(item: ItemStack) = WorksWith(Items.gpu1, Items.gpu2, Items.gpu3)(item) override def slot(item: ItemStack) = Slot.Card - override def node(item: ItemStack) = Some(new component.GraphicsCard()) + override def node(item: ItemStack) = + Items.multi.subItem(item) match { + case Some(gpu: common.item.GraphicsCard) => + Some(new component.GraphicsCard(gpu.resolutions)) + case _ => throw new IllegalArgumentException() + } } \ No newline at end of file