From dc3df3edd5843bde0c1335d6a8e460b2c832aa48 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Sat, 17 Jun 2017 08:12:18 +0300 Subject: full project files --- .../.metadata/.plugins/org.eclipse.cdt.core/.log | 1 + .../.plugins/org.eclipse.cdt.make.core/specs.c | 1 + .../.plugins/org.eclipse.cdt.make.core/specs.cpp | 1 + .../.history/1e/4090a85b46a3001516ebc455efc032e5 | 112 + .../.history/22/d0d1122b11a000151fdfc2dacce472e3 | 109 + .../.history/23/200ef4dc19910015138fc97f11b3d08b | 303 +++ .../.history/29/0034395f7f8b0015134481ec712b17ae | 316 +++ .../.history/3/3087c516499b001510c7de20d4b3838c | 0 .../.history/30/90354db2158e00151544f45b8684d31e | 390 ++++ .../.history/4/50d57f047194001516739e804437c3f8 | 494 ++++ .../.history/40/e07bf28042b60015176c95ddaf2504ce | 578 +++++ .../.history/42/401f465e708b0015134481ec712b17ae | 207 ++ .../.history/43/2010220b148e00151544f45b8684d31e | 318 +++ .../.history/49/80b79e1a088e00151544f45b8684d31e | 370 +++ .../.history/4d/60b1517d5da3001518cde17cb509661c | 128 + .../.history/4f/a08480c30bb300151351fd9e9a996bbe | 162 ++ .../.history/53/7096612146a3001516ebc455efc032e5 | 101 + .../.history/54/e0c732e253a3001516ebc455efc032e5 | 120 + .../.history/5a/600afeecd8b20015115782a55d40af78 | 395 ++++ .../.history/63/b026503b5ea3001518cde17cb509661c | 141 ++ .../.history/65/a0f3e06d7d8b0015134481ec712b17ae | 315 +++ .../.history/67/2052af7b0b8e00151544f45b8684d31e | 371 +++ .../.history/6b/3026c575748b0015134481ec712b17ae | 307 +++ .../.history/6d/40b9d805088e00151544f45b8684d31e | 364 +++ .../.history/72/106e4eb2158e00151544f45b8684d31e | 321 +++ .../.history/8/7054990556b400151e8fcdb87a141443 | 567 +++++ .../.history/8/c064fb3543b60015176c95ddaf2504ce | 578 +++++ .../.history/85/0003ff6a758b0015134481ec712b17ae | 312 +++ .../.history/87/90232f55a7ca001510f7df4278c93a7e | 949 ++++++++ .../.history/89/b01bf4eb46a3001516ebc455efc032e5 | 112 + .../.history/9e/b0b1b07b0b8e00151544f45b8684d31e | 260 +++ .../.history/a/700d2b9561b500151fdb993ef9230294 | 572 +++++ .../.history/a0/00f7674b748b0015134481ec712b17ae | 274 +++ .../.history/a2/b0dbc47f07a50015138cc582c427ac91 | 66 + .../.history/a7/f042703fd8b20015115782a55d40af78 | 395 ++++ .../.history/a8/d037e47347a3001516ebc455efc032e5 | 113 + .../.history/b3/b025dae449a3001516ebc455efc032e5 | 116 + .../.history/b8/a00189f69cb4001510d7bdb0b1be77c9 | 934 ++++++++ .../.history/bf/907f1ce250b400151e8fcdb87a141443 | 564 +++++ .../.history/c6/10184eb91baa00151263eb9882e2ad67 | 86 + .../.history/c6/f0339bee53a3001516ebc455efc032e5 | 125 + .../.history/ca/e006f2ab27bc001514d3de1c0800049b | 269 +++ .../.history/d7/b0083d60a7ca001510f7df4278c93a7e | 935 ++++++++ .../.history/da/50f158a8d9e200151b3e8eaec212bcd4 | 878 +++++++ .../.history/dc/50374e2ca4e00015119a88e59fd033e2 | 146 ++ .../.history/e1/b02f8eb743a000151531bed9130b5444 | 391 ++++ .../.history/e2/5015a2ff41b60015176c95ddaf2504ce | 573 +++++ .../.history/e2/a0d7200b148e00151544f45b8684d31e | 376 +++ .../.history/e2/a0d88773a7ca001510f7df4278c93a7e | 934 ++++++++ .../.history/e3/b0676a5333b500151a77dabf7b9b4d77 | 526 +++++ .../.history/e4/40c790ca5da3001518cde17cb509661c | 141 ++ .../.history/fc/10871e5d49a3001516ebc455efc032e5 | 113 + .../.projects/Minecraft/.location | Bin 0 -> 97 bytes .../.projects/Minecraft/.markers | Bin 0 -> 5247 bytes .../.projects/Minecraft/3.tree | Bin 0 -> 575018 bytes .../Minecraft/org.eclipse.jdt.core/state.dat | Bin 0 -> 570376 bytes .../.root/.indexes/history.version | 1 + .../.root/.indexes/properties.index | Bin 0 -> 151 bytes .../.root/.indexes/properties.version | 1 + .../org.eclipse.core.resources/.root/113.tree | Bin 0 -> 410 bytes .../.safetable/org.eclipse.core.resources | Bin 0 -> 1430 bytes .../.settings/org.eclipse.cdt.ui.prefs | 4 + .../.settings/org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.debug.ui.prefs | 7 + .../org.eclipse.epp.logging.aeri.ide.prefs | 4 + .../org.eclipse.epp.logging.aeri.ui.prefs | 3 + .../org.eclipse.epp.usagedata.gathering.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 20 + .../.settings/org.eclipse.jdt.launching.prefs | 2 + .../.settings/org.eclipse.jdt.ui.prefs | 20 + .../.settings/org.eclipse.m2e.discovery.prefs | 2 + .../.settings/org.eclipse.mylyn.context.core.prefs | 2 + .../.settings/org.eclipse.mylyn.monitor.ui.prefs | 2 + .../.settings/org.eclipse.mylyn.tasks.ui.prefs | 5 + .../.settings/org.eclipse.pde.api.tools.prefs | 2 + .../.settings/org.eclipse.pde.core.prefs | 2 + .../.settings/org.eclipse.rse.core.prefs | 2 + .../.settings/org.eclipse.rse.ui.prefs | 2 + .../.settings/org.eclipse.search.prefs | 2 + .../.settings/org.eclipse.team.ui.prefs | 2 + .../.settings/org.eclipse.ui.browser.prefs | 2 + .../.settings/org.eclipse.ui.editors.prefs | 4 + .../.settings/org.eclipse.ui.ide.prefs | 10 + .../.settings/org.eclipse.ui.prefs | 2 + .../.settings/org.eclipse.ui.workbench.prefs | 3 + .../org.eclipse.debug.core/.launches/Client.launch | 13 + .../org.eclipse.debug.core/.launches/Main.launch | 11 + .../org.eclipse.debug.core/.launches/Server.launch | 13 + .../org.eclipse.debug.ui/dialog_settings.xml | 16 + .../launchConfigurationHistory.xml | 19 + .../org.eclipse.e4.workbench/workbench.xmi | 2444 ++++++++++++++++++++ .../org.eclipse.epp.logging.aeri.ui/history/_0.fdt | Bin 0 -> 11 bytes .../org.eclipse.epp.logging.aeri.ui/history/_0.fdx | Bin 0 -> 12 bytes .../org.eclipse.epp.logging.aeri.ui/history/_0.fnm | 1 + .../org.eclipse.epp.logging.aeri.ui/history/_0.frq | 0 .../org.eclipse.epp.logging.aeri.ui/history/_0.nrm | 1 + .../org.eclipse.epp.logging.aeri.ui/history/_0.tii | Bin 0 -> 24 bytes .../org.eclipse.epp.logging.aeri.ui/history/_0.tis | Bin 0 -> 24 bytes .../history/segments.gen | Bin 0 -> 20 bytes .../history/segments_1 | Bin 0 -> 248 bytes .../remote-index/_0.fdt | Bin 0 -> 11 bytes .../remote-index/_0.fdx | Bin 0 -> 12 bytes .../remote-index/_0.fnm | 1 + .../remote-index/_0.frq | 0 .../remote-index/_0.nrm | 1 + .../remote-index/_0.tii | Bin 0 -> 24 bytes .../remote-index/_0.tis | Bin 0 -> 24 bytes .../remote-index/segments.gen | Bin 0 -> 20 bytes .../remote-index/segments_1 | Bin 0 -> 248 bytes .../org.eclipse.equinox.p2.ui/dialog_settings.xml | 5 + .../org.eclipse.jdt.core/assumedExternalFilesCache | Bin 0 -> 4 bytes .../org.eclipse.jdt.core/externalFilesCache | Bin 0 -> 4 bytes .../org.eclipse.jdt.core/externalLibsTimeStamps | Bin 0 -> 8463 bytes .../org.eclipse.jdt.core/indexNamesMap.txt | 1 + .../org.eclipse.jdt.core/invalidArchivesCache | Bin 0 -> 4 bytes .../org.eclipse.jdt.core/javaLikeNames.txt | 1 + .../org.eclipse.jdt.core/nonChainingJarsCache | Bin 0 -> 7464 bytes .../org.eclipse.jdt.core/savedIndexNames.txt | 66 + .../variablesAndContainers.dat | Bin 0 -> 173 bytes .../org.eclipse.jdt.launching/.install.xml | 4 + .../org.eclipse.jdt.launching/libraryInfos.xml | 41 + .../org.eclipse.jdt.ui/OpenTypeHistory.xml | 2 + .../QualifiedTypeNameHistory.xml | 63 + .../org.eclipse.jdt.ui/dialog_settings.xml | 71 + .../C/devhelp.libhover | Bin 0 -> 39852 bytes .../C/glibc_library.libhover | Bin 0 -> 1041481 bytes .../Minecraft/2015/11/47/refactorings.history | 4 + .../Minecraft/2015/11/47/refactorings.index | 1 + .../Minecraft/2015/11/48/refactorings.history | 3 + .../Minecraft/2015/11/48/refactorings.index | 2 + .../Minecraft/2015/12/49/refactorings.history | 4 + .../Minecraft/2015/12/49/refactorings.index | 1 + .../Minecraft/2015/12/50/refactorings.history | 3 + .../Minecraft/2015/12/50/refactorings.index | 5 + .../Minecraft/2015/12/51/refactorings.history | 3 + .../Minecraft/2015/12/51/refactorings.index | 14 + .../Minecraft/2015/12/52/refactorings.history | 3 + .../Minecraft/2015/12/52/refactorings.index | 4 + .../Minecraft/2016/2/6/refactorings.history | 3 + .../Minecraft/2016/2/6/refactorings.index | 4 + .../Minecraft/2016/2/7/refactorings.history | 3 + .../Minecraft/2016/2/7/refactorings.index | 2 + .../Minecraft/2016/2/9/refactorings.history | 3 + .../Minecraft/2016/2/9/refactorings.index | 3 + .../Minecraft/2016/3/10/refactorings.history | 3 + .../Minecraft/2016/3/10/refactorings.index | 4 + .../Minecraft/2016/3/12/refactorings.history | 4 + .../Minecraft/2016/3/12/refactorings.index | 1 + .../dialog_settings.xml | 17 + .../org.eclipse.m2e.logback.configuration/0.log | 0 .../logback.1.6.0.20150526-2032.xml | 43 + .../org.eclipse.oomph.setup/workspace.setup | 6 + .../.cache/clean-cache.properties | 2 + .../.metadata/.plugins/org.eclipse.rse.core/.log | 0 ...nternal.core.RSELocalConnectionInitializer.mark | 0 .../FP.local.files_0/node.properties | 57 + .../H.local_16/node.properties | 25 + .../PRF.foghrye4-ga-a75-d3h_837/node.properties | 7 + eclipse/.metadata/.plugins/org.eclipse.rse.ui/.log | 0 .../org.eclipse.search/dialog_settings.xml | 169 ++ .../org.eclipse.team.ui/syncParticipants.xml | 2 + .../org.eclipse.ui.editors/dialog_settings.xml | 5 + .../dialog_settings.xml | 38 + .../org.eclipse.ui.workbench/dialog_settings.xml | 21 + .../org.eclipse.ui.workbench/workbench.xml | 165 ++ .../org.eclipse.ui.workbench/workingsets.xml | 5 + .../org.eclipse.wst.sse.core/task-tags.properties | 3 + 167 files changed, 20758 insertions(+) create mode 100644 eclipse/.metadata/.plugins/org.eclipse.cdt.core/.log create mode 100644 eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c create mode 100644 eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4090a85b46a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/22/d0d1122b11a000151fdfc2dacce472e3 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/23/200ef4dc19910015138fc97f11b3d08b create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/29/0034395f7f8b0015134481ec712b17ae create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/3/3087c516499b001510c7de20d4b3838c create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/30/90354db2158e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4/50d57f047194001516739e804437c3f8 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/40/e07bf28042b60015176c95ddaf2504ce create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/42/401f465e708b0015134481ec712b17ae create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/43/2010220b148e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/49/80b79e1a088e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4d/60b1517d5da3001518cde17cb509661c create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08480c30bb300151351fd9e9a996bbe create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/53/7096612146a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/54/e0c732e253a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/5a/600afeecd8b20015115782a55d40af78 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/63/b026503b5ea3001518cde17cb509661c create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/65/a0f3e06d7d8b0015134481ec712b17ae create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/67/2052af7b0b8e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6b/3026c575748b0015134481ec712b17ae create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40b9d805088e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/72/106e4eb2158e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/7054990556b400151e8fcdb87a141443 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb3543b60015176c95ddaf2504ce create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/85/0003ff6a758b0015134481ec712b17ae create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/87/90232f55a7ca001510f7df4278c93a7e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/89/b01bf4eb46a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/9e/b0b1b07b0b8e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a/700d2b9561b500151fdb993ef9230294 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a0/00f7674b748b0015134481ec712b17ae create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a2/b0dbc47f07a50015138cc582c427ac91 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a7/f042703fd8b20015115782a55d40af78 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a8/d037e47347a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b3/b025dae449a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b8/a00189f69cb4001510d7bdb0b1be77c9 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/bf/907f1ce250b400151e8fcdb87a141443 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10184eb91baa00151263eb9882e2ad67 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/f0339bee53a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/ca/e006f2ab27bc001514d3de1c0800049b create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/d7/b0083d60a7ca001510f7df4278c93a7e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/da/50f158a8d9e200151b3e8eaec212bcd4 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/dc/50374e2ca4e00015119a88e59fd033e2 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b02f8eb743a000151531bed9130b5444 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/5015a2ff41b60015176c95ddaf2504ce create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d7200b148e00151544f45b8684d31e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d88773a7ca001510f7df4278c93a7e create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e3/b0676a5333b500151a77dabf7b9b4d77 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e4/40c790ca5da3001518cde17cb509661c create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/fc/10871e5d49a3001516ebc455efc032e5 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.markers create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/3.tree create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/org.eclipse.jdt.core/state.dat create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/113.tree create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.api.tools.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.core.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.core.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.search.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Main.launch create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdt create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdx create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fnm create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.frq create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.nrm create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tii create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tis create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments.gen create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments_1 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdt create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdx create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fnm create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.frq create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.nrm create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tii create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tis create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments.gen create mode 100644 eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments_1 create mode 100644 eclipse/.metadata/.plugins/org.eclipse.equinox.p2.ui/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/indexNamesMap.txt create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/devhelp.libhover create mode 100644 eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/glibc_library.libhover create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.history create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.index create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log create mode 100644 eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.6.0.20150526-2032.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup create mode 100644 eclipse/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties create mode 100644 eclipse/.metadata/.plugins/org.eclipse.rse.core/.log create mode 100644 eclipse/.metadata/.plugins/org.eclipse.rse.core/initializerMarks/org.eclipse.rse.internal.core.RSELocalConnectionInitializer.mark create mode 100644 eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/FP.local.files_0/node.properties create mode 100644 eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/H.local_16/node.properties create mode 100644 eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/node.properties create mode 100644 eclipse/.metadata/.plugins/org.eclipse.rse.ui/.log create mode 100644 eclipse/.metadata/.plugins/org.eclipse.search/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.team.ui/syncParticipants.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ui.editors/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ui.workbench.texteditor/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml create mode 100644 eclipse/.metadata/.plugins/org.eclipse.wst.sse.core/task-tags.properties (limited to 'eclipse/.metadata/.plugins') diff --git a/eclipse/.metadata/.plugins/org.eclipse.cdt.core/.log b/eclipse/.metadata/.plugins/org.eclipse.cdt.core/.log new file mode 100644 index 0000000..57aacd0 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.cdt.core/.log @@ -0,0 +1 @@ +*** SESSION Apr 02, 2016 09:35:54.87 ------------------------------------------- diff --git a/eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c b/eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c @@ -0,0 +1 @@ + diff --git a/eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp b/eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp @@ -0,0 +1 @@ + diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4090a85b46a3001516ebc455efc032e5 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4090a85b46a3001516ebc455efc032e5 new file mode 100644 index 0000000..010c6aa --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4090a85b46a3001516ebc455efc032e5 @@ -0,0 +1,112 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + File fileFrom = new File(IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml").getFile()); + Files.copy(fileFrom, file); + } + return new File(folder, "ihl-guidebook.xml"); + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/22/d0d1122b11a000151fdfc2dacce472e3 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/22/d0d1122b11a000151fdfc2dacce472e3 new file mode 100644 index 0000000..51069ea --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/22/d0d1122b11a000151fdfc2dacce472e3 @@ -0,0 +1,109 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import net.minecraft.item.ItemStack; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + Set iss = new HashSet(4); + Set textBlocks = new HashSet(2); + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode.getNodeName().equals("section")) + { + if(i==sectionNumber) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(list.getLength()<=sectionNumber) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + if (node instanceof Element) + { + Element e = (Element) node; + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(e.getTextContent()); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = e.getTextContent().split(":"); + iss.add(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + textBlocks.add(e.getTextContent()); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(e.getTextContent(), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + } + if(!iss.isEmpty()) + { + ihlGuidebookGui.setItems(iss); + } + if(!textBlocks.isEmpty()) + { + ihlGuidebookGui.setContent(textBlocks); + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + return new File(folder, "ihl-guidebook.xml"); + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/23/200ef4dc19910015138fc97f11b3d08b b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/23/200ef4dc19910015138fc97f11b3d08b new file mode 100644 index 0000000..fa4e745 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/23/200ef4dc19910015138fc97f11b3d08b @@ -0,0 +1,303 @@ +package ihl.items_blocks; + +import ic2.api.tile.IWrenchable; +import ic2.core.IC2; +import ic2.core.IHasGui; +import ic2.core.Ic2Items; +import ic2.core.block.EntityDynamite; +import ic2.core.item.tool.ItemToolCutter; +import ic2.core.item.tool.ItemToolWrench; +import ihl.IHLCreativeTab; +import ihl.IHLMod; +import ihl.IHLModInfo; +import ihl.collector.GlassBoxTileEntity; +import ihl.datanet.RedstoneSignalConverterTileEntity; +import ihl.flexible_cable.BatterySwitchUnitTileEntity; +import ihl.flexible_cable.FrequencyGeneratorTileEntity; +import ihl.flexible_cable.GroundingTileEntity; +import ihl.flexible_cable.RectifierTransformerUnitTileEntity; +import ihl.interfaces.IEnergyNetNode; +import ihl.items_blocks.MachineBaseBlock.MachineType; +import ihl.model.ImpregnatingMachineBlockRender; +import ihl.processing.chemistry.ChemicalReactorTileEntity; +import ihl.processing.chemistry.CryogenicDistillerTileEntity; +import ihl.processing.chemistry.ElectrolysisBathTileEntity; +import ihl.processing.chemistry.ExplosiveTileEntity; +import ihl.processing.chemistry.FluidizedBedReactorTileEntity; +import ihl.processing.chemistry.FractionatorBottomTileEntity; +import ihl.processing.chemistry.FractionatorCoverTileEntity; +import ihl.processing.chemistry.FractionatorSectionTileEntity; +import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity; +import ihl.processing.chemistry.GoldChimneyKneeTileEntity; +import ihl.processing.chemistry.LabElectrolyzerTileEntity; +import ihl.processing.chemistry.LeadOvenTileEntity; +import ihl.processing.chemistry.LoomTileEntity; +import ihl.processing.chemistry.PaperMachineTileEntity; +import ihl.processing.chemistry.PrecipitatorCondenserTileEntity; +import ihl.processing.chemistry.RefluxCondenserTileEntity; +import ihl.processing.metallurgy.AchesonFurnanceTileEntity; +import ihl.processing.metallurgy.CoilerTileEntity; +import ihl.processing.metallurgy.DetonationSprayingMachineTileEntity; +import ihl.processing.metallurgy.ExtruderTileEntity; +import ihl.processing.metallurgy.GasWeldingStationTileEntity; +import ihl.processing.metallurgy.ImpregnatingMachineTileEntity; +import ihl.processing.metallurgy.LathePart1TileEntity; +import ihl.processing.metallurgy.LathePart2TileEntity; +import ihl.processing.metallurgy.MuffleFurnanceTileEntity; +import ihl.processing.metallurgy.RollingMachinePart1TileEntity; +import ihl.processing.metallurgy.RollingMachinePart2TileEntity; +import ihl.processing.metallurgy.VacuumInductionMeltingFurnaceTileEntity; +import ihl.processing.metallurgy.VulcanizationExtrudingMoldTileEntity; +import ihl.processing.metallurgy.WireMillTileEntity; +import ihl.processing.metallurgy.WoodenRollingMachinePart1TileEntity; +import ihl.processing.metallurgy.WoodenRollingMachinePart2TileEntity; +import ihl.tunneling_shield.HydrotransportPulpRegeneratorTileEntity; +import ihl.utils.IHLUtils; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ExplosiveBlock extends Block implements ITileEntityProvider{ + + @SideOnly(Side.CLIENT) + IIcon textureSide, + textureBack, + textureTop; + + public ExplosiveBlock() + { + super(Material.tnt); + this.setCreativeTab(IHLCreativeTab.tab); + this.setBlockName("ihlExplosive"); + this.setHardness(2F); + this.setResistance(1F); + } + + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) + { + if(IC2.platform.isSimulating()) + { + } + } + + @Override + public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) + { + ItemStack result = new ItemStack(item); + result.stackTagCompound=new NBTTagCompound(); + result.stackTagCompound.setInteger("explosionType", 0);//0 - IC2; 1- IHL + result.stackTagCompound.setInteger("explosionPower", 100000); + //itemList.add(result); + result = new ItemStack(item); + result.stackTagCompound=new NBTTagCompound(); + result.stackTagCompound.setInteger("explosionType", 1);//0 - IC2; 1- IHL + result.stackTagCompound.setInteger("explosionPower", 32000);//31000 + itemList.add(result); + } + + @Override + public void onBlockPreDestroy(World world, int x, int y, int z, int meta) + { + if(!world.isRemote) + { + TileEntity te = world.getTileEntity(x, y, z); + } + super.onBlockPreDestroy(world, x, y, z, meta); + } + + @Override + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.1F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.1F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.9F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.9F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBoundsForItemRender(); + } + + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) + { + int facing = 3; + TileEntity te = blockAccess.getTileEntity(x, y, z); + if(te!=null && te instanceof IWrenchable) + { + IWrenchable tebh = (IWrenchable) te; + facing=tebh.getFacing(); + } + super.setBlockBoundsBasedOnState(blockAccess, x, y, z); + } + + public static void init() + { + GameRegistry.registerBlock(new ExplosiveBlock(), IHLItemBlock.class,"ihlExplosive"); + GameRegistry.registerTileEntity(ExplosiveTileEntity.class, "explosiveTileEntity"); + ExplosiveType[] var1 = ExplosiveType.values(); + } + + @Override + public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag) + { + super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, flag); + } + + @Override + public TileEntity createNewTileEntity(World world, int var2) { + return new ExplosiveTileEntity(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":brickOvenSide"); + this.textureBack = par1IconRegister.registerIcon(IHLModInfo.MODID + ":brickOvenBack"); + this.textureSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":brickOvenSide"); + this.textureTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":brickOvenTop"); + } + + @Override + public boolean hasTileEntity(int metadata) + { + return true; + } + + @Override + public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int i,float pos_x,float pos_y,float pos_z){ + TileEntity te = world.getTileEntity(x,y,z); + if(IC2.platform.isSimulating() && te instanceof ExplosiveTileEntity) + { + ((ExplosiveTileEntity)te).createExplosion(player); + } + return false; + } + + + /** + * Called when the block is placed in the world. + */ + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) + { + TileEntity t = world.getTileEntity(x, y, z); + if(t!=null) + { + t.readFromNBT(itemStack.stackTagCompound); + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) + { + int facing=3; + int mask[] = { + 0,1,2,3,4,5, + 1,0,3,2,4,5, + 2,3,0,1,4,5, + 2,3,1,0,4,5, + 2,3,5,4,0,1, + 2,3,4,5,1,0 + }; + TileEntity te = world.getTileEntity(x, y, z); + if(te instanceof IWrenchable) + { + IWrenchable tebh = (IWrenchable) te; + facing=tebh.getFacing(); + } + return this.getIconFromFacing(facing, side); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) + { + return this.getIconFromFacing(3, side); + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromFacing(int facing, int side) + { + return this.textureSide; + } + + @Override + public boolean onBlockEventReceived(World world, int x, int y, int z, int metadata, int flag) + { + return true; + } + + public enum ExplosiveType + { + MuffleFurnace("muffleFurnance",MuffleFurnanceTileEntity.class, true, new ItemStack(Items.brick)); + ExplosiveType(String unlocalizedName1, Class teclass1, boolean isNormalBlock1,ItemStack itemDroppedOnBlockDestroy1) + { + unlocalizedName=unlocalizedName1; + teclass=teclass1; + isNormalBlock=isNormalBlock1; + itemDroppedOnBlockDestroy=itemDroppedOnBlockDestroy1; + } + String unlocalizedName; + Class teclass; + boolean isNormalBlock=true; + ItemStack itemDroppedOnBlockDestroy; + } + + public int getRenderType() + { + return 0; + } + + public boolean isOpaqueCube() + { + return true; + } + + public boolean renderAsNormalBlock() + { + return true; + } + + @SideOnly(Side.CLIENT) + public IIcon getInnerTextureForBlockRenderer() + { + return this.blockIcon; + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/29/0034395f7f8b0015134481ec712b17ae b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/29/0034395f7f8b0015134481ec712b17ae new file mode 100644 index 0000000..a891dbe --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/29/0034395f7f8b0015134481ec712b17ae @@ -0,0 +1,316 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public Map drops; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/4063232,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + for(int eay=0;eay ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(!this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + } + while(!this.explosionDone) + { + update(); + } + } + + private boolean isBlockConnectedWithBedrock(long longNumber) + { + if(this.blocksNotConnectedWithBedrock.contains(longNumber)) + { + return false; + } + Set path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/3/3087c516499b001510c7de20d4b3838c b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/3/3087c516499b001510c7de20d4b3838c new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/30/90354db2158e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/30/90354db2158e00151544f45b8684d31e new file mode 100644 index 0000000..483decd --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/30/90354db2158e00151544f45b8684d31e @@ -0,0 +1,390 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public Map drops; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + public ExtendedBlockStorage[][][] esbArray; + private int[][][] esbHardness; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + public int chunkX; + public int chunkZ; + public DamageSource damageSource; + public int areaSize; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.drops=new HashMap(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/16000,1)); + this.areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.esbArray = new ExtendedBlockStorage[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + this.esbArray[var11 - this.chunkX][var12 - this.chunkZ] = var13.getBlockStorageArray(); + for(int eay=0;eay>8, (i4>>4) & 4095, i4 & 4095) << 8; + } + this.esbHardness[x1][z2][y3]+=Math.round(Block.getBlockById(var4).getExplosionResistance(this, worldObj, (i4>>8)+(x1<<4), ((i4>>4) & 4095)+(y3<<4), (i4 & 4095)+(z2<<4), this.x, this.y, this.z)*10f); + } + } + } + } + } + } + + public void onUpdate() + { + if(!effectBorderBlocks.isEmpty()) + { + boolean hasSomeBlocksStickedToAir=false; + Iterator ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(!this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + Iterator bnctbi = this.blocksNotConnectedWithBedrock.iterator(); + while(bnctbi.hasNext()) + { + long longNumber5 = bnctbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber5); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + float bh = block.getBlockHardness(worldObj, x+xyz[0], y+xyz[1], z+xyz[2]); + if(bh>=0f && bh path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public List getEntityFromESB(int cax, int eay, int caz) + { + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + return var7.entityLists[eay]; + } + } + return null; + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + + public int getEBSResistance(int x2, int y2, int z2) + { + return this.esbHardness[x2][z2][y2]; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4/50d57f047194001516739e804437c3f8 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4/50d57f047194001516739e804437c3f8 new file mode 100644 index 0000000..a941ce6 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4/50d57f047194001516739e804437c3f8 @@ -0,0 +1,494 @@ +package ihl.utils; + +import java.nio.FloatBuffer; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.lwjgl.opengl.GL11; + +import ic2.core.util.DrawUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public class IHLRenderUtils +{ + private FloatBuffer colorBuffer; + private Map frameTooltipMap; + private int displayScaledWidth=-1; + private int displayScaledHeight=-1; + private int guiXPos=-1; + private int guiYPos=-1; + private int prevDisplayWidth=-1; + private int prevDisplayHeight=-1; + private final int guiContainerWidth = 166; + private final int guiContainerHeight = 176; + private float lastPlayerYaw; + private float lastPlayerPitch; + private double lastPlayerPosY; + private double lastPlayerPosZ; + private double lastPlayerPosX; + private double renderMinX=0d; + private double renderMaxX=1d; + private double renderMinY=0d; + private double renderMaxY=1d; + private double renderMinZ=0d; + private double renderMaxZ=1d; + public boolean renderFromInside=false; + public static IHLRenderUtils instance; + + public IHLRenderUtils() + { + instance=this; + colorBuffer = GLAllocation.createDirectFloatBuffer(16); + frameTooltipMap = new HashMap(); + } + + public void renderIHLFluidTank(IHLFluidTank fluidTank, int x1, int y1, int x2, int y2, float zLevel, int par1, int par2, int xOffset, int yOffset) + { + int liquidHeight = 0; + int prevLiquidHeight = 0; + int i = y2-y1; + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1f, 1f, 1f, 1f); + for(int i2 = 0;i2 fli = fluidTank.getFluidList(); + for(int i=fli.size()-1;i>=0;i--) + { + FluidStack fluidStack = fli.get(i); + fluidListNames+=StatCollector.translateToLocal(fluidStack.getUnlocalizedName())+": "+fluidStack.amount+"mB /n "; + } + drawTooltip(par1,par2,x2-x1,y2-y1,x1,y1,fluidListNames); + } + + public boolean drawTooltip(int cursorPosX, int cursorPosY, int width, int height, int xPos, int yPos, String text) + { + updateScreenSize(); + long key = xPos+yPos*1024; + Integer frame=0; + if(frameTooltipMap.containsKey(key)) + { + frame=frameTooltipMap.get(key); + } + boolean showString=true; + if(cursorPosXxPos+width|| + cursorPosYyPos+height) + { + if(frame>0) + { + frame-=20; + frameTooltipMap.put(key, frame); + } + showString=false; + } + else + { + frame+=10; + frameTooltipMap.put(key, frame); + } + if(frame>0) + { + int strokeHeight=15; + int i,x1,x2,y1,y2,tooltipWidth,tooltipHeight; + tooltipWidth=tooltipHeight=0; + String[] splittedText = StatCollector.translateToLocal(text).split(" /n "); + for(i=0;itooltipWidth) + { + tooltipWidth=Math.min(frame,Minecraft.getMinecraft().fontRenderer.getStringWidth(splittedText[i])+8); + } + } + tooltipHeight=Math.min(Math.max(frame-tooltipWidth,strokeHeight),strokeHeight*splittedText.length); + x1=cursorPosX-xPos; + x2=x1+tooltipWidth; + y1=cursorPosY-guiYPos+18; + y2=y1+tooltipHeight; + GL11.glPushAttrib(16704); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + if(showString) + { + drawRectangle(Tessellator.instance, x1,y1,x2,y2,128); + GL11.glEnable(GL11.GL_TEXTURE_2D); + for(i=0;i>> 24 & 255, color >>> 16 & 255, color >>> 8 & 255, color & 255); + tessellator.addVertex((double)x2, (double)y1, 300.0D); + tessellator.addVertex((double)x1, (double)y1, 300.0D); + tessellator.addVertex((double)x1, (double)y2, 300.0D); + tessellator.addVertex((double)x2, (double)y2, 300.0D); + tessellator.draw(); + } + + public void drawThermometerTemperature(long temperature, boolean show) + { + updateScreenSize(); + long key = 0; + int frame=0; + if(frameTooltipMap.containsKey(key)) + { + frame=frameTooltipMap.get(key); + } + if(frame<=0) + { + updatePlayerView(); + } + boolean showString=true; + if(show && frame<=122) + { + frame+=1; + frameTooltipMap.put(key, frame); + } + else + { + if(frame>0) + { + frame-=2; + frameTooltipMap.put(key, frame); + } + showString=false; + } + if(frame>0) + { + int width=Math.min(frame, 122); + int height=Math.min(frame, 48); + int xShift = Math.round(displayScaledWidth/100*(lastPlayerYaw - Minecraft.getMinecraft().renderViewEntity.prevRotationYaw)); + int yShift = Math.round(displayScaledHeight/64*(lastPlayerPitch - Minecraft.getMinecraft().renderViewEntity.prevRotationPitch)); + int xPos = displayScaledWidth/2+xShift; + int yPos = displayScaledHeight/2-48+yShift; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + drawTexturedModalRect(xPos,yPos,0,0,width,height); + GL11.glDisable(GL11.GL_DEPTH_TEST); + if(showString) + { + Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(temperature+"\u00B0K", xPos+35, yPos+3, 16768125); + } + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + } + + public void drawTexturedModalRect(int x1, int y1, int u, int v, int x2, int y2) { + float f = 0.00390625F; + float f1 = 0.00390625F; + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(1f, 1f, 1f, 0.5f); + tessellator.addVertexWithUV((double)(x1 + 0), (double)(y1 + y2), 300D, (double)((float)(u + 0) * f), (double)((float)(v + y2) * f1)); + tessellator.addVertexWithUV((double)(x1 + x2), (double)(y1 + y2), 300D, (double)((float)(u + x2) * f), (double)((float)(v + y2) * f1)); + tessellator.addVertexWithUV((double)(x1 + x2), (double)(y1 + 0), 300D, (double)((float)(u + x2) * f), (double)((float)(v + 0) * f1)); + tessellator.addVertexWithUV((double)(x1 + 0), (double)(y1 + 0), 300D, (double)((float)(u + 0) * f), (double)((float)(v + 0) * f1)); + tessellator.draw(); + } + + + private void updateScreenSize() + { + if(prevDisplayHeight!=Minecraft.getMinecraft().displayHeight || prevDisplayWidth!=Minecraft.getMinecraft().displayWidth) + { + ScaledResolution var2 = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); + displayScaledWidth = var2.getScaledWidth(); + displayScaledHeight = var2.getScaledHeight(); + guiXPos = (displayScaledWidth - guiContainerWidth)/2; + guiYPos = (displayScaledHeight - guiContainerHeight)/2; + prevDisplayWidth=Minecraft.getMinecraft().displayWidth; + prevDisplayHeight=Minecraft.getMinecraft().displayHeight; + } + } + + public void updatePlayerView() + { + lastPlayerYaw = Minecraft.getMinecraft().renderViewEntity.prevRotationYaw; + lastPlayerPitch = Minecraft.getMinecraft().renderViewEntity.prevRotationPitch; + lastPlayerPosX = Minecraft.getMinecraft().renderViewEntity.prevPosX; + lastPlayerPosY = Minecraft.getMinecraft().renderViewEntity.prevPosY; + lastPlayerPosZ = Minecraft.getMinecraft().renderViewEntity.prevPosZ; + } + + public void renderPipeOutside(double xPos, double yPos, double zPos, IIcon icon) + { + double minX = this.renderMinX; + double maxX = this.renderMaxX; + double minY = this.renderMinY; + double maxY = this.renderMaxY; + double minZ = this.renderMinZ; + double maxZ = this.renderMaxZ; + this.setRenderBounds(0d, 0d, 0d, 1/3d, 1/3d, 1/3d); + } + + public void renderFaceXpYmNeg(double xPos, double yPos, double zPos, IIcon icon) + { + Tessellator var9 = Tessellator.instance; + + double u1 = (double)icon.getInterpolatedU(this.renderMinZ * 16.0D); + double u2 = (double)icon.getInterpolatedU(this.renderMaxZ * 16.0D); + + double v2 = (double)icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double v1 = (double)icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + u1 = (double)icon.getMinU(); + u2 = (double)icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + v2 = (double)icon.getMinV(); + v1 = (double)icon.getMaxV(); + } + + double vertexX1 = xPos + this.renderMinX; + double vertexX2 = xPos + this.renderMaxX; + double vertexY1 = yPos + this.renderMinY; + double vertexY2 = yPos + this.renderMaxY; + double vertexZ1 = zPos + this.renderMinZ; + double vertexZ2 = zPos + this.renderMaxZ; + + if(this.renderFromInside) + { + vertexZ1 = zPos + this.renderMaxZ; + vertexZ2 = zPos + this.renderMinZ; + } + var9.addVertexWithUV(vertexX1, vertexY1, vertexZ2, u1, v1); + var9.addVertexWithUV(vertexX1, vertexY1, vertexZ1, u2, v1); + var9.addVertexWithUV(vertexX2, vertexY2, vertexZ1, u2, v2); + var9.addVertexWithUV(vertexX2, vertexY2, vertexZ2, u1, v2); + } + + public void renderFaceXmYpPos(double xPos, double yPos, double zPos, IIcon icon) + { + Tessellator var9 = Tessellator.instance; + + double u1 = (double)icon.getInterpolatedU(this.renderMinZ * 16.0D); + double u2 = (double)icon.getInterpolatedU(this.renderMaxZ * 16.0D); + + double v2 = (double)icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double v1 = (double)icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + u1 = (double)icon.getMinU(); + u2 = (double)icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + v2 = (double)icon.getMinV(); + v1 = (double)icon.getMaxV(); + } + + double vertexX1 = xPos + this.renderMinX; + double vertexX2 = xPos + this.renderMaxX; + double vertexY1 = yPos + this.renderMinY; + double vertexY2 = yPos + this.renderMaxY; + double vertexZ1 = zPos + this.renderMaxZ; + double vertexZ2 = zPos + this.renderMinZ; + + if(this.renderFromInside) + { + vertexZ1 = zPos + this.renderMinZ; + vertexZ2 = zPos + this.renderMaxZ; + } + var9.addVertexWithUV(vertexX1, vertexY1, vertexZ2, u1, v1); + var9.addVertexWithUV(vertexX1, vertexY1, vertexZ1, u2, v1); + var9.addVertexWithUV(vertexX2, vertexY2, vertexZ1, u2, v2); + var9.addVertexWithUV(vertexX2, vertexY2, vertexZ2, u1, v2); + } + + + public void renderFaceXmYmPos(double xPos, double yPos, double zPos, IIcon icon) + { + Tessellator var9 = Tessellator.instance; + + double u1 = (double)icon.getInterpolatedU(this.renderMinZ * 16.0D); + double u2 = (double)icon.getInterpolatedU(this.renderMaxZ * 16.0D); + + double v2 = (double)icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double v1 = (double)icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + u1 = (double)icon.getMinU(); + u2 = (double)icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + v2 = (double)icon.getMinV(); + v1 = (double)icon.getMaxV(); + } + + double vertexX1 = xPos + this.renderMinX; + double vertexX2 = xPos + this.renderMaxX; + double vertexY1 = yPos + this.renderMinY; + double vertexY2 = yPos + this.renderMaxY; + double vertexZ1 = zPos + this.renderMinZ; + double vertexZ2 = zPos + this.renderMaxZ; + + if(this.renderFromInside) + { + vertexZ1 = zPos + this.renderMaxZ; + vertexZ2 = zPos + this.renderMinZ; + } + var9.addVertexWithUV(vertexX2, vertexY1, vertexZ2, u1, v1); + var9.addVertexWithUV(vertexX2, vertexY1, vertexZ1, u2, v1); + var9.addVertexWithUV(vertexX1, vertexY2, vertexZ1, u2, v2); + var9.addVertexWithUV(vertexX1, vertexY2, vertexZ2, u1, v2); + } + + public void renderFaceXpYpNeg(double xPos, double yPos, double zPos, IIcon icon) + { + Tessellator var9 = Tessellator.instance; + + double u1 = (double)icon.getInterpolatedU(this.renderMinZ * 16.0D); + double u2 = (double)icon.getInterpolatedU(this.renderMaxZ * 16.0D); + + double v2 = (double)icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double v1 = (double)icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + u1 = (double)icon.getMinU(); + u2 = (double)icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + v2 = (double)icon.getMinV(); + v1 = (double)icon.getMaxV(); + } + + double vertexX1 = xPos + this.renderMinX; + double vertexX2 = xPos + this.renderMaxX; + double vertexY1 = yPos + this.renderMinY; + double vertexY2 = yPos + this.renderMaxY; + double vertexZ1 = zPos + this.renderMaxZ; + double vertexZ2 = zPos + this.renderMinZ; + + if(this.renderFromInside) + { + vertexZ1 = zPos + this.renderMinZ; + vertexZ2 = zPos + this.renderMaxZ; + } + var9.addVertexWithUV(vertexX2, vertexY1, vertexZ2, u1, v1); + var9.addVertexWithUV(vertexX2, vertexY1, vertexZ1, u2, v1); + var9.addVertexWithUV(vertexX1, vertexY2, vertexZ1, u2, v2); + var9.addVertexWithUV(vertexX1, vertexY2, vertexZ2, u1, v2); + } + + + + public void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) + { + this.renderMinX = minX; + this.renderMaxX = maxX; + this.renderMinY = minY; + this.renderMaxY = maxY; + this.renderMinZ = minZ; + this.renderMaxZ = maxZ; + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/40/e07bf28042b60015176c95ddaf2504ce b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/40/e07bf28042b60015176c95ddaf2504ce new file mode 100644 index 0000000..1aa15b0 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/40/e07bf28042b60015176c95ddaf2504ce @@ -0,0 +1,578 @@ +package ihl.flexible_cable; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import ihl.IHLMod; +import ihl.IHLModInfo; +import ihl.interfaces.ICableHolder; +import ihl.interfaces.IDataCableHolder; +import ihl.interfaces.IEnergyNetNode; +import ihl.interfaces.INetworkListener; +import ihl.utils.IHLUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class NodeEntity extends Entity implements INetworkListener{ + + public Entity prevAnchorEntity; + public Entity nextAnchorEntity; + private int anchorX; + private int anchorY; + private int anchorZ; + private short anchorFacing; + private int anchorDimensionId; + public ItemStack attachedItem; + protected int chainUniqueID=-2; + public int chainArrangeNumber=-2; + protected int checkTimer=201; + public int colorIndex=16777215; + public int type=1;//0 - uninsulated wire; 1 - insulated cable; 2 - data cable + public float dx0=0; + public float dy0=0; + public float dz0=0; + public final int n=64; + public final float[] rotationPitchArray = new float[n+1]; + public final float[] rotationYawArray = new float[n+1]; + public final float[] translationX = new float[n+1]; + public final float[] translationY = new float[n+1]; + public final float[] translationZ = new float[n+1]; + public float virtualNodePosX; + public float virtualNodePosY; + public float virtualNodePosZ; + public float renderPosX; + public float renderPosY; + public float renderPosZ; + private boolean alreadyRegistered=false; + + public NodeEntity(World world) + { + super(world); + if(world.isRemote) + { + IHLMod.proxy.addEntityToList(this); + this.setSize(2f, 0.2f); + } + else + { + IHLMod.proxy.addEntityToServerList(this); + this.setSize(0.5F, 0.1F); + } + this.renderDistanceWeight = 5.0D; + this.yOffset+=0.15F; + this.virtualNodePosX=(float) this.posX; + this.virtualNodePosY=(float) this.posY; + this.virtualNodePosZ=(float) this.posZ; + } + + @Override + public void setInPortal(){} + + @Override + public void travelToDimension(int dimensionId){} + + public void setSize(float width, float heigth) + { + super.setSize(width, heigth); + } + + public void setVirtualNodePos(float posX,float posY, float posZ) + { + virtualNodePosX=posX; + virtualNodePosY=posY; + virtualNodePosZ=posZ; + this.registerAndSendData(null); + } + + public void registerAndSendData(EntityPlayerMP player) + { + if(!worldObj.isRemote) + { + if(!alreadyRegistered) + { + Set nes; + if(IHLMod.proxy.nodeEntityRegistry.containsKey(this.getChainUniqueID())) + { + nes=IHLMod.proxy.nodeEntityRegistry.get(this.getChainUniqueID()); + } + else + { + nes=new HashSet(); + IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes); + } + nes.add(this); + alreadyRegistered=true; + } + ByteBuf bb = Unpooled.buffer(30); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(1); + byteBufOutputStream.writeInt(this.getEntityId()); + byteBufOutputStream.writeInt(this.getChainUniqueID()); + byteBufOutputStream.writeInt(this.chainArrangeNumber); + byteBufOutputStream.writeByte(this.type); + byteBufOutputStream.writeInt(this.colorIndex); + byteBufOutputStream.writeFloat(this.virtualNodePosX); + byteBufOutputStream.writeFloat(this.virtualNodePosY); + byteBufOutputStream.writeFloat(this.virtualNodePosZ); + if(player==null) + { + IHLMod.proxy.sendFromServerToAll(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID)); + } + else + { + IHLMod.proxy.sendFromServerToPlayer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID),player); + } + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + if(!noClip && !worldObj.isRemote) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + if(this.checkTimer==201) + { + if(worldObj.isRemote) + { + IHLMod.proxy.recieveDelayedDataPacket(this); + } + else + { + this.registerAndSendData(null); + } + } + if((prevAnchorEntity==null && !noClip)||(nextAnchorEntity==null || nextAnchorEntity instanceof EntityPlayer || nextAnchorEntity instanceof EntityItem)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + NodeEntity node=(NodeEntity) ei.next(); + if(node.getChainUniqueID()==this.getChainUniqueID()) + { + if(node.chainArrangeNumber==this.chainArrangeNumber-1) + { + this.prevAnchorEntity=node; + node.nextAnchorEntity=this; + } + else if(node.chainArrangeNumber==this.chainArrangeNumber+1) + { + this.nextAnchorEntity=node; + node.prevAnchorEntity=this; + } + } + if(prevAnchorEntity!=null && nextAnchorEntity!=null) + { + break; + } + } + } + } + if(this.attachedItem!=null && (this.nextAnchorEntity == null || this.nextAnchorEntity.isDead) && !this.noClip) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityPlayer player=(EntityPlayer) ei.next(); + if(this.playerHasItemStack(player)) + { + this.nextAnchorEntity=player; + } + + } + } + } + if(this.attachedItem!=null && this.nextAnchorEntity instanceof EntityPlayer && !noClip) + { + EntityPlayer player = (EntityPlayer) this.nextAnchorEntity; + if(!this.playerHasItemStack(player)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityItem eitem = ei.next(); + if(eitem.getEntityItem().isItemEqual(this.attachedItem)) + { + this.nextAnchorEntity=eitem; + break; + } + } + } + } + } + if(!worldObj.isRemote) + { + { + double x0,x2,y0,y2,z0,z2; + x2=x0=this.virtualNodePosX; + y2=y0=this.virtualNodePosY; + z2=z0=this.virtualNodePosZ; + if(nextAnchorEntity!=null) + { + x2=nextAnchorEntity.posX; + y2=nextAnchorEntity.posY; + z2=nextAnchorEntity.posZ; + } + if(prevAnchorEntity!=null) + { + x0=prevAnchorEntity.posX; + y0=prevAnchorEntity.posY; + z0=prevAnchorEntity.posZ; + } + + double d1 = (x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)+(z0-z2)*(z0-z2); + if(d1>4D) + { + this.motionX=(x0+x2)*0.5D-this.posX*1D; + this.motionY=(y0+y2)*0.5D-this.posY*1D; + this.motionZ=(z0+z2)*0.5D-this.posZ*1D; + if(nextAnchorEntity!=null && this.getDistanceSqToEntity(nextAnchorEntity)>4D) + { + this.nextAnchorEntity.addVelocity((this.posX-this.nextAnchorEntity.posX)*0.01D, (this.posY-this.nextAnchorEntity.posY)*0.01D, (this.posZ-this.nextAnchorEntity.posZ)*0.01D); + } + } + else + { + double d2 = this.getDistanceSq(x2,y2,z2); + if(d2>1D) + { + this.motionX+=(x2-this.posX)*0.1D; + this.motionY+=(y2-this.posY)*0.1D; + this.motionZ+=(z2-this.posZ)*0.1D; + } + double d3 = this.getDistanceSq(x0,y0,z0); + if(d3>1D) + { + this.motionX+=(x0-this.posX)*0.1D; + this.motionY+=(y0-this.posY)*0.1D; + this.motionZ+=(z0-this.posZ)*0.1D; + } + } + this.motionY-=0.005D; + } + } + if(this.onGround) + { + this.motionY *= -0.5D; + } + this.motionX*=0.9D; + this.motionY*=0.9D; + this.motionZ*=0.9D; + if(worldObj.isRemote) + { + float movvmentSpeed=0.05f; + this.renderPosX=this.renderPosX*(1f-movvmentSpeed)+(float) this.prevPosX*movvmentSpeed; + this.renderPosY=this.renderPosY*(1f-movvmentSpeed)+(float) this.prevPosY*movvmentSpeed; + this.renderPosZ=this.renderPosZ*(1f-movvmentSpeed)+(float) this.prevPosZ*movvmentSpeed; + float xi,yi,zi; + float x0=xi=(float)this.prevPosX; + float y0=yi=(float)this.prevPosY; + float z0=zi=(float)this.prevPosZ; + float dx0=this.dx0; + float dy0=this.dy0; + float dz0=this.dz0; + float dx1=this.virtualNodePosX-xi; + float dy1=this.virtualNodePosY-yi; + float dz1=this.virtualNodePosZ-zi; + if(this.nextAnchorEntity!=null) + { + dx1=(float) (this.nextAnchorEntity.prevPosX-xi); + dy1=(float) (this.nextAnchorEntity.prevPosY-yi); + dz1=(float) (this.nextAnchorEntity.prevPosZ-zi); + } + if(this.prevAnchorEntity==null) + { + this.renderPosX=x0=xi=this.virtualNodePosX; + this.renderPosY=y0=yi=this.virtualNodePosY; + this.renderPosZ=z0=zi=this.virtualNodePosZ; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + if(((NodeEntity)this.nextAnchorEntity).nextAnchorEntity!=null) + { + Entity nne = ((NodeEntity)this.nextAnchorEntity).nextAnchorEntity; + dx1=(float) (nne.prevPosX-xi); + dy1=(float) (nne.prevPosY-yi); + dz1=(float) (nne.prevPosZ-zi); + } + else + { + dx1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosX-xi); + dy1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosY-yi); + dz1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosZ-zi); + } + } + float x1=this.virtualNodePosX; + float y1=this.virtualNodePosY; + float z1=this.virtualNodePosZ; + if(this.nextAnchorEntity!=null) + { + x1=(float)this.nextAnchorEntity.prevPosX; + y1=(float)this.nextAnchorEntity.prevPosY; + z1=(float)this.nextAnchorEntity.prevPosZ; + } + int i1=0; + for(float i=1f/n;i<=1f+1f/n;i+=1f/n,i1++) + { + float dxi = xi; + float dyi = yi; + float dzi = zi; + xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0; + yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0; + zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0; + int blockX=(int)xi; + int blockY=(int)yi; + int blockZ=(int)zi; + dxi-=xi; + dyi-=yi; + dzi-=zi; + double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi); + float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI)); + float rotationPitch = (float) Math.atan2(dxi, dzi); + float rotationYaw = (float) (-Math.atan2(dyi, var7)); + rotationPitchArray[i1]=rotationPitch; + rotationYawArray[i1]=rotationYaw; + translationX[i1]=dxi; + translationY[i1]=dyi; + translationZ[i1]=dzi; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + NodeEntity next = (NodeEntity) this.nextAnchorEntity; + next.dx0=dx1; + next.dy0=dy1; + next.dz0=dz1; + } + } + if(--this.checkTimer<=0) + { + if(!worldObj.isRemote) + { + WorldServer world = MinecraftServer.getServer().worldServerForDimension(this.anchorDimensionId); + TileEntity te = world.getTileEntity(this.anchorX, this.anchorY, this.anchorZ); + if(te==null || !(te instanceof ICableHolder || te instanceof AnchorTileEntity)) + { + this.setDead(); + } + } + this.checkTimer=200; + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) + { + this.noClip=nbt.getBoolean("noClip"); + this.setChainUniqueID(nbt.getInteger("chainUniqueID")); + this.chainArrangeNumber=nbt.getInteger("chainArrangeNumber"); + this.anchorX=nbt.getInteger("anchorX"); + this.anchorY=nbt.getInteger("anchorY"); + this.anchorZ=nbt.getInteger("anchorZ"); + this.anchorFacing=nbt.getShort("anchorFacing"); + this.anchorDimensionId=nbt.getInteger("anchorDimensionId"); + this.type=nbt.getInteger("type"); + this.colorIndex=nbt.getInteger("colorIndex"); + if(nbt.hasKey("itemStack")) + { + NBTTagCompound stackTag = (NBTTagCompound) nbt.getTag("itemStack"); + this.attachedItem = ItemStack.loadItemStackFromNBT(stackTag); + } + if(nbt.hasKey("width")) + { + this.setSize(nbt.getFloat("width"), nbt.getFloat("height")); + } + this.virtualNodePosX=nbt.getFloat("virtualNodePosX"); + this.virtualNodePosY=nbt.getFloat("virtualNodePosY"); + this.virtualNodePosZ=nbt.getFloat("virtualNodePosZ"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) + { + nbt.setFloat("width", this.width); + nbt.setFloat("height", this.height); + nbt.setBoolean("noClip", noClip); + nbt.setInteger("chainUniqueID", this.getChainUniqueID()); + nbt.setInteger("chainArrangeNumber", this.chainArrangeNumber); + nbt.setInteger("anchorX", this.anchorX); + nbt.setInteger("anchorY", this.anchorY); + nbt.setInteger("anchorZ", this.anchorZ); + nbt.setShort("anchorFacing",this.anchorFacing); + nbt.setInteger("anchorDimensionId",this.anchorDimensionId); + nbt.setInteger("type", this.type); + nbt.setInteger("colorIndex", this.colorIndex); + if(this.attachedItem!=null) + { + NBTTagCompound stackTag = new NBTTagCompound(); + this.attachedItem.writeToNBT(stackTag); + nbt.setTag("itemStack",stackTag); + } + nbt.setFloat("virtualNodePosX",this.virtualNodePosX); + nbt.setFloat("virtualNodePosY",this.virtualNodePosY); + nbt.setFloat("virtualNodePosZ",this.virtualNodePosZ); + } + + public void setAnchor(int x, int y, int z, short facing, int dimensionId) + { + this.anchorX=x; + this.anchorY=y; + this.anchorZ=z; + this.anchorFacing=facing; + this.anchorDimensionId=dimensionId; + } + + public boolean playerHasItemStack(EntityPlayer player) + { + int var2; + + for (var2 = 0; var2 < player.inventory.armorInventory.length; ++var2) + { + if (player.inventory.armorInventory[var2] != null && player.inventory.armorInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.armorInventory[var2].stackTagCompound==null?false:player.inventory.armorInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + for (var2 = 0; var2 < player.inventory.mainInventory.length; ++var2) + { + if (player.inventory.mainInventory[var2] != null && player.inventory.mainInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.mainInventory[var2].stackTagCompound==null?false:player.inventory.mainInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + return false; + } + + public int getChainUniqueID() { + return chainUniqueID; + } + + public void setChainUniqueID(int chainUniqueID) { + this.chainUniqueID = chainUniqueID; + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) + { + if(this.noClip) + { + return null; + } + else + { + return super.getCollisionBox(entity); + } + } + + @Override + public int getId() + { + return this.getEntityId(); + } + + @Override + public void recieveData(ByteBufInputStream byteBufInputStream) + { + try + { + this.setChainUniqueID(byteBufInputStream.readInt()); + this.chainArrangeNumber=byteBufInputStream.readInt(); + this.type=byteBufInputStream.readByte(); + this.colorIndex=byteBufInputStream.readInt(); + this.virtualNodePosX=byteBufInputStream.readFloat(); + this.virtualNodePosY=byteBufInputStream.readFloat(); + this.virtualNodePosZ=byteBufInputStream.readFloat(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @Override + protected void entityInit() {} + + @Override + public boolean isInvalid() + { + return this.isDead; + } + + public void setVirtualNodePosToNearestPortal() + { + int x0 = (int)this.posX; + int y0 = (int)this.posY; + int z0 = (int)this.posZ; + for(int xi=x0-2;xi<=x0+2;xi++) + { + for(int yi=y0-2;yi<=y0+2;yi++) + { + for(int zi=z0-2;zi<=z0+2;zi++) + { + Block block = worldObj.getBlock(xi, yi, zi); + if(block==Blocks.portal||block==Blocks.end_portal) + { + this.setVirtualNodePos(xi+0.5f, yi+0.5f, zi+0.5f); + return; + } + } + } + } + + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/42/401f465e708b0015134481ec712b17ae b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/42/401f465e708b0015134481ec712b17ae new file mode 100644 index 0000000..691bc57 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/42/401f465e708b0015134481ec712b17ae @@ -0,0 +1,207 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/4063232,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + for(int eay=0;eay sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + this.setDead(); + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/43/2010220b148e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/43/2010220b148e00151544f45b8684d31e new file mode 100644 index 0000000..4f6f419 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/43/2010220b148e00151544f45b8684d31e @@ -0,0 +1,318 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class ExplosionVector +{ + public Set startVectors = new HashSet(); + public Map> vectors = new HashMap(); + public Map explosionPower = new HashMap(); + public Map explosionPowerDampingFactor = new HashMap(); + private Random random = new Random(); + + public ExplosionVector() + { + this.precalculateExplosion(); + } + + public void precalculateExplosion() + { + int maxExplosionRadius=32; + for(int levelRadius=1; levelRadiusMath.round(levelRadius*1.8f)) + { + prevX=reduceVariableByAbsoluteValue(prevX); + prevY=reduceVariableByAbsoluteValue(prevY); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(ix)<=Math.abs(iy) && Math.abs(ix)<=Math.abs(iz)) + { + prevY=reduceVariableByAbsoluteValue(prevY); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(iy)<=Math.abs(ix) && Math.abs(iy)<=Math.abs(iz)) + { + prevX=reduceVariableByAbsoluteValue(prevX); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(iz)<=Math.abs(ix) && Math.abs(iz)<=Math.abs(iy)) + { + prevY=reduceVariableByAbsoluteValue(prevY); + prevX=reduceVariableByAbsoluteValue(prevX); + } + long prevKey = IHLUtils.encodeXYZ(prevX,prevY,prevZ); + if(prevX==ix && prevY==iy && prevZ==iz && levelRadius>1) + { + IHLMod.log.error("Was:"+ix+"/" +iy+"/" +iz+"/"); + IHLMod.log.error("Now:"+prevX+"/" +prevY+"/" +prevZ+"/"); + throw new ArithmeticException("Variables are out of expected range. \n Expected are not equal: "+ix+"="+prevX+" "+iy+"="+prevY+" "+iz+"="+prevZ); + } + if(levelRadius==1) + { + startVectors.add(coordinateKey); + this.addElement(coordinateKey, prevX, prevY, prevZ, ix, iy, iz); + } + else if(vectors.containsKey(prevKey)) + { + prevKey=this.getParentWithLowestDescendantsRate(prevKey, prevX, prevY, prevZ, levelRadius); + vectors.get(prevKey).add(coordinateKey); + this.addElement(coordinateKey, prevX, prevY, prevZ, ix, iy, iz); + } + else + { + IHLMod.log.error("Was:"+ix+"/" +iy+"/" +iz+"/"); + IHLMod.log.error("Now:"+prevX+"/" +prevY+"/" +prevZ+"/"); + IHLMod.log.info("ExplosionVector is missing parent! Help him!"); + } + } + } + } + } + } + } + } + + private long getParentWithLowestDescendantsRate(long prevKey, int prevX, int prevY, int prevZ, int levelRadius) + { + long prevKey1 = prevKey; + int xyzi[] = {0,0,-1,0,0,1,0,0}; + int x2,y2,z2; + int descendantsRate=vectors.get(prevKey).size(); + for(int i=0;i<=5;i++) + { + x2=prevX+xyzi[i]; + y2=prevY+xyzi[i+2]; + z2=prevZ+xyzi[i+1]; + long newKey = IHLUtils.encodeXYZ(x2, y2, z2); + boolean atALevelRadius = (Math.abs(x2)==levelRadius-1||Math.abs(y2)==levelRadius-1||Math.abs(z2)==levelRadius-1)&&(Math.abs(x2) breakBlocksAndGetDescendants(World world, EntityIHLExplosion exploder, Explosion explosion, long longNumber) + { + int multiplier = exploder.multiplier; + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int power1 = explosionPower.get(longNumber); + int repeat=0; + //System.out.println("Power before " + power1); + if(Math.abs(xyz[0])>=Math.abs(xyz[1]) && Math.abs(xyz[0])>=Math.abs(xyz[2])) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + else if(Math.abs(xyz[1])>=Math.abs(xyz[0]) && Math.abs(xyz[1])>=Math.abs(xyz[2])) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + else + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + power1=Math.round(power1*explosionPowerDampingFactor.get(longNumber)-0.5f); + //System.out.println("Power after " + power1 + " \n repeats "+repeat); + if(power1<=1 || !vectors.containsKey(longNumber)|| vectors.get(longNumber).isEmpty()) + { + exploder.effectBorderBlocks.add(longNumber); + if(xyz[1]<0 || (exploder.y<=6 && xyz[1]<=6)) + { + exploder.effectBorderBlocksWithLowPosition.add(longNumber); + } + return null; + } + else + { + for(long d1:vectors.get(longNumber)) + { + explosionPower.put(d1, power1); + } + return vectors.get(longNumber); + } + } + + + public Set breakBlocksAndGetDescendantsForEBS(World world, EntityIHLExplosion exploder, Explosion explosion, long longNumber) + { + int multiplier = exploder.multiplier; + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int power1 = explosionPower.get(longNumber); + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + power1=Math.round(power1*explosionPowerDampingFactor.get(longNumber)-0.5f); + if(power1<=1 || !vectors.containsKey(longNumber)|| vectors.get(longNumber).isEmpty()) + { + exploder.effectBorderBlocks.add(longNumber); + if(xyz[1]<0 || (exploder.y<=6 && xyz[1]<=6)) + { + exploder.effectBorderBlocksWithLowPosition.add(longNumber); + } + return null; + } + else + { + for(long d1:vectors.get(longNumber)) + { + explosionPower.put(d1, power1); + } + return vectors.get(longNumber); + } + + } + + private int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + private int getNewPowerAndProcessBlocks(World world, EntityIHLExplosion exploder, Explosion explosion, int xyz[], int multiplier, int ix, int iy, int iz, int power2) + { + int power1=power2; + int x = exploder.x+xyz[0]*multiplier+ix; + int y = exploder.y+xyz[1]*multiplier+iy; + int z = exploder.z+xyz[2]*multiplier+iz; + if(y<=4 || y>256) + { + return 0; + } + Block block = exploder.getBlock(x, y, z); + int explosionResistance = Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + if(explosionResistance>=power1) + { + power1=0; + } + else + { + power1-=Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + Entity entity = exploder.getEntity(x, y, z); + if(entity!=null) + { + entity.attackEntityFrom(exploder.damageSource, power1/10f); + } + block.onBlockDestroyedByExplosion(world, x, y, z, explosion); + exploder.setBlockToAir(x, y, z); + } + return power1; + } + + private int getNewPowerAndProcessBlocksEBS(World world, EntityIHLExplosion exploder, Explosion explosion, int xyz[], int multiplier, int ix, int iy, int iz, int power2) + { + int power1=power2; + int x = exploder.x+xyz[0]*multiplier+ix; + int y = exploder.y+xyz[1]*multiplier+iy; + int z = exploder.z+xyz[2]*multiplier+iz; + if(y<=4 || y>256) + { + return 0; + } + int explosionResistance = exploder.getEBSResistance(x, y, z); + if(explosionResistance>=power1) + { + power1=0; + } + else + { + power1-=Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + Entity entity = exploder.getEntity(x, y, z); + if(entity!=null) + { + entity.attackEntityFrom(exploder.damageSource, power1/10f); + } + block.onBlockDestroyedByExplosion(world, x, y, z, explosion); + exploder.setBlockToAir(x, y, z); + } + return power1; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/49/80b79e1a088e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/49/80b79e1a088e00151544f45b8684d31e new file mode 100644 index 0000000..5697adc --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/49/80b79e1a088e00151544f45b8684d31e @@ -0,0 +1,370 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public Map drops; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private ExtendedBlockStorage[][][] esbArray; + private int[][][] esbHardness; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.drops=new HashMap(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/16000,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.esbArray = new ExtendedBlockStorage[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + this.esbArray[var11 - this.chunkX][var12 - this.chunkZ] = var13.getBlockStorageArray(); + for(int eay=0;eay>8, (i4>>4) & 4095, i4 & 4095) << 8; + } + this.esbHardness[x1][z2][y3]+=Math.round(Block.getBlockById(var4).getExplosionResistance(this, worldObj, (i4>>8)+(x1<<4), ((i4>>4) & 4095)+(y3<<4), (i4 & 4095)+(z2<<4), this.x, this.y, this.z)*10f); + } + } + } + } + } + } + + public void onUpdate() + { + if(!effectBorderBlocks.isEmpty()) + { + boolean hasSomeBlocksStickedToAir=false; + Iterator ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(!this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + Iterator bnctbi = this.blocksNotConnectedWithBedrock.iterator(); + while(bnctbi.hasNext()) + { + long longNumber5 = bnctbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber5); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + float bh = block.getBlockHardness(worldObj, x+xyz[0], y+xyz[1], z+xyz[2]); + if(bh>=0f && bh path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4d/60b1517d5da3001518cde17cb509661c b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4d/60b1517d5da3001518cde17cb509661c new file mode 100644 index 0000000..2a66c48 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4d/60b1517d5da3001518cde17cb509661c @@ -0,0 +1,128 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.LineNumberReader; +import java.io.OutputStreamWriter; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + InputStream in = IHLMod.class.getResourceAsStream("/assets/ihl/config/ihl-guidebook.xml"); + InputStreamReader isReader = new InputStreamReader(in, "UTF-8"); + LineNumberReader reader = new LineNumberReader(isReader); + OutputStreamWriter osWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + BufferedWriter writer = new BufferedWriter(osWriter); + String line; + while ((line = reader.readLine()) != null) + { + writer.append(line); + writer.newLine(); + } + writer.close(); + osWriter.close(); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08480c30bb300151351fd9e9a996bbe b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08480c30bb300151351fd9e9a996bbe new file mode 100644 index 0000000..6effb9d --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08480c30bb300151351fd9e9a996bbe @@ -0,0 +1,162 @@ +package ihl.flexible_cable; + +import ihl.IHLMod; +import ihl.interfaces.IEnergyNetNode; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import net.minecraft.nbt.NBTTagCompound; + +public class IHLENet { + + public Map grids = new HashMap(); + public Map> nodeEntityRegistry = new HashMap(); + public Map cablesToGrids = new HashMap(); + + private int griduid=0; + + public IHLENet() + { + } + + public int getNewUniqueGridID() + { + for(int i=0;i tei = grids.get(gridID2).telist.iterator(); + while(tei.hasNext()) + { + IEnergyNetNode te = tei.next(); + te.setGrid(gridID); + } + grids.remove(gridID2); + return gridID; + } + return gridID2; + } + + + public IHLGrid getGrid(int gridID) + { + if(this.grids.get(gridID)==null) + { + IHLGrid cgrid; + cgrid=new IHLGrid(); + grids.put(gridID, cgrid); + return cgrid; + } + else + { + return this.grids.get(gridID); + } + } + + public void splitGrids(int gridID, IEnergyNetNode exclude) + { + Set telist = this.grids.get(gridID).telist; + telist.remove(exclude); + Iterator atei = telist.iterator(); + while(atei.hasNext()) + { + IEnergyNetNode cte = atei.next(); + cte.getCableList().removeAll(exclude.getCableList()); + cte.setGrid(-1); + } + Iterator atei2 = telist.iterator(); + while(atei2.hasNext()) + { + IEnergyNetNode cte = atei2.next(); + if(cte.getGridID()==-1)//Warning! Potential future bugs are hidden here! + { + Iterator atei3 = telist.iterator(); + while(atei3.hasNext()) + { + IEnergyNetNode cte2 = atei3.next(); + if(cte2!=cte && hasSame(cte.getCableList(),cte2.getCableList())) + { + int result=this.mergeGrids(cte.getGridID(), cte2.getGridID()); + cte.setGrid(result); + cte2.setGrid(result); + break; + } + } + } + } + } + + public void removeCableAndSplitGrids(int gridID, NBTTagCompound cable) + { + this.grids.get(gridID).removeCableAndSplitGrids(cable); + } + + public boolean hasSame(Set set, Set set2) + { + Iterator i1 = set.iterator(); + while(i1.hasNext()) + { + NBTTagCompound num1=i1.next(); + if(set2.contains(num1)) + { + return true; + } + } + return false; + } + + public void setOnFire(NBTTagCompound cable) + { + Set cs = this.nodeEntityRegistry.get(cable.getInteger("chainUID")); + for(NodeEntity ne:cs) + { + ne.setFire(10); + } + } + + public void removeCableEntities(NBTTagCompound cable) + { + int uid = cable.getInteger("chainUID"); + Set cs = this.nodeEntityRegistry.get(uid); + if(cs!=null) + { + for(NodeEntity ne:cs) + { + if(ne!=null) + { + ne.setDead(); + } + } + } + cablesToGrids.remove(uid); + } +} \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/53/7096612146a3001516ebc455efc032e5 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/53/7096612146a3001516ebc455efc032e5 new file mode 100644 index 0000000..b89f929 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/53/7096612146a3001516ebc455efc032e5 @@ -0,0 +1,101 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.File; +import java.io.IOException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + return new File(folder, "ihl-guidebook.xml"); + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/54/e0c732e253a3001516ebc455efc032e5 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/54/e0c732e253a3001516ebc455efc032e5 new file mode 100644 index 0000000..9bdd6e9 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/54/e0c732e253a3001516ebc455efc032e5 @@ -0,0 +1,120 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { +// File fileFrom = new File(IHLMod.proxy.getMinecraftDir(),"/assets/ihl/config/ihl-guidebook.xml"); + File fileFrom = new File(IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml").getFile()); + if(!fileFrom.exists()) + { + fileFrom = new File(IHLMod.class.getResource("../src/main/java/assets/ihl/config/ihl-guidebook.xml").getFile()); + } + Files.copy(fileFrom, file); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/5a/600afeecd8b20015115782a55d40af78 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/5a/600afeecd8b20015115782a55d40af78 new file mode 100644 index 0000000..d0a51d7 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/5a/600afeecd8b20015115782a55d40af78 @@ -0,0 +1,395 @@ +package ihl.flexible_cable; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.core.ExplosionIC2; +import ic2.core.IC2; +import ic2.core.block.TileEntityBlock; +import ihl.IHLMod; +import ihl.interfaces.IEnergyNetNode; +import ihl.utils.IHLUtils; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; + +public class AnchorTileEntity extends TileEntityBlock implements IEnergySink, IEnergySource +{ + public boolean addedToEnergyNet=false; + private final Set sacrifices = new HashSet(); + public SubAnchorEnergyNetNode[] energyNetNodes = new SubAnchorEnergyNetNode[6]; + public boolean[] hasCableOnSide=new boolean [] {false,false,false,false,false,false}; + public int checksum=-1; + + public AnchorTileEntity() + { + super(); + for(short i=0;i<6;i++) + { + energyNetNodes[i] = new SubAnchorEnergyNetNode(this, i); + } + } + + @Override + public List getNetworkedFields() + { + List fields = super.getNetworkedFields(); + fields.add("hasCableOnSide"); + return fields; + } + + @Override + public void onLoaded() + { + super.onLoaded(); + if (IC2.platform.isSimulating()&&!this.addedToEnergyNet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + this.addedToEnergyNet = true; + } + for(short i=0;i<6;i++) + { + energyNetNodes[i].onLoaded(); + } + } + + @Override + public void onUnloaded() + { + if (IC2.platform.isSimulating()) + { + if(this.addedToEnergyNet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + this.addedToEnergyNet = false; + } + } + } + + @Override + public boolean wrenchCanRemove(EntityPlayer var1) + { + return false; + } + + public boolean enableUpdateEntity() + { + return IC2.platform.isSimulating(); + } + + @Override + public void updateEntityServer() + { + if(!sacrifices.isEmpty()) + { + Iterator victimIterator = sacrifices.iterator(); + while(victimIterator.hasNext()) + { + TileEntity sacrifice = victimIterator.next(); + ExplosionIC2 explosion = new ExplosionIC2(this.worldObj, null, sacrifice.xCoord+0.5D, sacrifice.yCoord+0.5D, sacrifice.zCoord+0.5D, 3F, 0.3F, ExplosionIC2.Type.Normal, null, 0); + explosion.doExplosion(); + sacrifices.remove(sacrifice); + } + + } + int newchecksum=0; + for(short i=0;i<6;i++) + { + if(this.hasCableOnSide[i]) + { + newchecksum++; + } + } + if(newchecksum!=checksum) + { + IC2.network.get().updateTileEntityField(this, "hasCableOnSide"); + checksum=newchecksum; + } + else if(newchecksum==0) + { + for(short i=0;i<6;i++) + { + if(!this.energyNetNodes[i].getCableList().isEmpty()) + { + newchecksum++; + } + } + //if(newchecksum==0)worldObj.setBlockToAir(xCoord, yCoord, zCoord); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + NBTTagList energyNetNodeNBTList = new NBTTagList(); + for(SubAnchorEnergyNetNode node:this.energyNetNodes) + { + energyNetNodeNBTList.appendTag(node.writeToNBT()); + } + nbt.setTag("energyNetNodes", energyNetNodeNBTList); + if(nbt.hasKey("facing")) + { + nbt.removeTag("facing"); + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + if(nbt.hasKey("facing")) + { + short facing = nbt.getShort("facing"); + int gridID=nbt.getInteger("gridID"); + this.energyNetNodes[facing].setGrid(gridID); + NBTTagList cableNBTList=nbt.getTagList("cableList", 10); + for(int i=0;i ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(IHLMod.class.getResourceAsStream("/assets/ihl/config/ihl-guidebook.xml")); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + InputStream in = IHLMod.class.getResourceAsStream("/assets/ihl/config/ihl-guidebook.xml"); + InputStreamReader isReader = new InputStreamReader(in, "UTF-8"); + LineNumberReader reader = new LineNumberReader(isReader); + OutputStreamWriter osWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + BufferedWriter writer = new BufferedWriter(osWriter); + String line; + while ((line = reader.readLine()) != null) + { + writer.append(line); + writer.newLine(); + } + writer.close(); + osWriter.close(); + in = IHLMod.class.getResourceAsStream("/assets/ihl/config/adress.xsd"); + isReader = new InputStreamReader(in, "UTF-8"); + reader = new LineNumberReader(isReader); + file = new File(folder, "adress.xsd"); + osWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + writer = new BufferedWriter(osWriter); + while ((line = reader.readLine()) != null) + { + writer.append(line); + writer.newLine(); + } + writer.close(); + osWriter.close(); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/65/a0f3e06d7d8b0015134481ec712b17ae b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/65/a0f3e06d7d8b0015134481ec712b17ae new file mode 100644 index 0000000..2777b01 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/65/a0f3e06d7d8b0015134481ec712b17ae @@ -0,0 +1,315 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/4063232,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + for(int eay=0;eay ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + } + while(!this.explosionDone) + { + update(); + } + } + + private boolean isBlockConnectedWithBedrock(long longNumber) + { + if(this.blocksNotConnectedWithBedrock.contains(longNumber)) + { + return false; + } + Set path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/67/2052af7b0b8e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/67/2052af7b0b8e00151544f45b8684d31e new file mode 100644 index 0000000..de861df --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/67/2052af7b0b8e00151544f45b8684d31e @@ -0,0 +1,371 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public Map drops; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private ExtendedBlockStorage[][][] esbArray; + private int[][][] esbHardness; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.drops=new HashMap(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/16000,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.esbArray = new ExtendedBlockStorage[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + this.esbArray[var11 - this.chunkX][var12 - this.chunkZ] = var13.getBlockStorageArray(); + for(int eay=0;eay>8, (i4>>4) & 4095, i4 & 4095) << 8; + } + this.esbHardness[x1][z2][y3]+=Math.round(Block.getBlockById(var4).getExplosionResistance(this, worldObj, (i4>>8)+(x1<<4), ((i4>>4) & 4095)+(y3<<4), (i4 & 4095)+(z2<<4), this.x, this.y, this.z)*10f); + } + } + } + } + } + } + + public void onUpdate() + { + if(!effectBorderBlocks.isEmpty()) + { + boolean hasSomeBlocksStickedToAir=false; + Iterator ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(!this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + Iterator bnctbi = this.blocksNotConnectedWithBedrock.iterator(); + while(bnctbi.hasNext()) + { + long longNumber5 = bnctbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber5); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + float bh = block.getBlockHardness(worldObj, x+xyz[0], y+xyz[1], z+xyz[2]); + if(bh>=0f && bh path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6b/3026c575748b0015134481ec712b17ae b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6b/3026c575748b0015134481ec712b17ae new file mode 100644 index 0000000..c88afeb --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6b/3026c575748b0015134481ec712b17ae @@ -0,0 +1,307 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/4063232,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + for(int eay=0;eay ebbi = effectBorderBlocks.iterator(); + long longNumber = ebbi.next(); + ebbi.remove(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(this.isBlockConnectedWithBedrock(longNumber)) + { + + } + } + } + while(!this.explosionDone) + { + update(); + } + } + + private boolean isBlockConnectedWithBedrock(long longNumber) + { + Set path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + } + } + return false; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40b9d805088e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40b9d805088e00151544f45b8684d31e new file mode 100644 index 0000000..deab651 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40b9d805088e00151544f45b8684d31e @@ -0,0 +1,364 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public Map drops; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private ExtendedBlockStorage[][][] esbArray; + private int[][][] esbHardness; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.drops=new HashMap(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/16000,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.esbArray = new ExtendedBlockStorage[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + this.esbArray[var11 - this.chunkX][var12 - this.chunkZ] = var13.getBlockStorageArray(); + for(int eay=0;eay ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(!this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + Iterator bnctbi = this.blocksNotConnectedWithBedrock.iterator(); + while(bnctbi.hasNext()) + { + long longNumber5 = bnctbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber5); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + float bh = block.getBlockHardness(worldObj, x+xyz[0], y+xyz[1], z+xyz[2]); + if(bh>=0f && bh path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/72/106e4eb2158e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/72/106e4eb2158e00151544f45b8684d31e new file mode 100644 index 0000000..3d4d821 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/72/106e4eb2158e00151544f45b8684d31e @@ -0,0 +1,321 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class ExplosionVector +{ + public Set startVectors = new HashSet(); + public Map> vectors = new HashMap(); + public Map explosionPower = new HashMap(); + public Map explosionPowerDampingFactor = new HashMap(); + private Random random = new Random(); + + public ExplosionVector() + { + this.precalculateExplosion(); + } + + public void precalculateExplosion() + { + int maxExplosionRadius=32; + for(int levelRadius=1; levelRadiusMath.round(levelRadius*1.8f)) + { + prevX=reduceVariableByAbsoluteValue(prevX); + prevY=reduceVariableByAbsoluteValue(prevY); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(ix)<=Math.abs(iy) && Math.abs(ix)<=Math.abs(iz)) + { + prevY=reduceVariableByAbsoluteValue(prevY); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(iy)<=Math.abs(ix) && Math.abs(iy)<=Math.abs(iz)) + { + prevX=reduceVariableByAbsoluteValue(prevX); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(iz)<=Math.abs(ix) && Math.abs(iz)<=Math.abs(iy)) + { + prevY=reduceVariableByAbsoluteValue(prevY); + prevX=reduceVariableByAbsoluteValue(prevX); + } + long prevKey = IHLUtils.encodeXYZ(prevX,prevY,prevZ); + if(prevX==ix && prevY==iy && prevZ==iz && levelRadius>1) + { + IHLMod.log.error("Was:"+ix+"/" +iy+"/" +iz+"/"); + IHLMod.log.error("Now:"+prevX+"/" +prevY+"/" +prevZ+"/"); + throw new ArithmeticException("Variables are out of expected range. \n Expected are not equal: "+ix+"="+prevX+" "+iy+"="+prevY+" "+iz+"="+prevZ); + } + if(levelRadius==1) + { + startVectors.add(coordinateKey); + this.addElement(coordinateKey, prevX, prevY, prevZ, ix, iy, iz); + } + else if(vectors.containsKey(prevKey)) + { + prevKey=this.getParentWithLowestDescendantsRate(prevKey, prevX, prevY, prevZ, levelRadius); + vectors.get(prevKey).add(coordinateKey); + this.addElement(coordinateKey, prevX, prevY, prevZ, ix, iy, iz); + } + else + { + IHLMod.log.error("Was:"+ix+"/" +iy+"/" +iz+"/"); + IHLMod.log.error("Now:"+prevX+"/" +prevY+"/" +prevZ+"/"); + IHLMod.log.info("ExplosionVector is missing parent! Help him!"); + } + } + } + } + } + } + } + } + + private long getParentWithLowestDescendantsRate(long prevKey, int prevX, int prevY, int prevZ, int levelRadius) + { + long prevKey1 = prevKey; + int xyzi[] = {0,0,-1,0,0,1,0,0}; + int x2,y2,z2; + int descendantsRate=vectors.get(prevKey).size(); + for(int i=0;i<=5;i++) + { + x2=prevX+xyzi[i]; + y2=prevY+xyzi[i+2]; + z2=prevZ+xyzi[i+1]; + long newKey = IHLUtils.encodeXYZ(x2, y2, z2); + boolean atALevelRadius = (Math.abs(x2)==levelRadius-1||Math.abs(y2)==levelRadius-1||Math.abs(z2)==levelRadius-1)&&(Math.abs(x2) breakBlocksAndGetDescendants(World world, EntityIHLExplosion exploder, Explosion explosion, long longNumber) + { + int multiplier = exploder.multiplier; + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int power1 = explosionPower.get(longNumber); + int repeat=0; + //System.out.println("Power before " + power1); + if(Math.abs(xyz[0])>=Math.abs(xyz[1]) && Math.abs(xyz[0])>=Math.abs(xyz[2])) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + else if(Math.abs(xyz[1])>=Math.abs(xyz[0]) && Math.abs(xyz[1])>=Math.abs(xyz[2])) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + else + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + power1=Math.round(power1*explosionPowerDampingFactor.get(longNumber)-0.5f); + //System.out.println("Power after " + power1 + " \n repeats "+repeat); + if(power1<=1 || !vectors.containsKey(longNumber)|| vectors.get(longNumber).isEmpty()) + { + exploder.effectBorderBlocks.add(longNumber); + if(xyz[1]<0 || (exploder.y<=6 && xyz[1]<=6)) + { + exploder.effectBorderBlocksWithLowPosition.add(longNumber); + } + return null; + } + else + { + for(long d1:vectors.get(longNumber)) + { + explosionPower.put(d1, power1); + } + return vectors.get(longNumber); + } + } + + + public Set breakBlocksAndGetDescendantsForEBS(World world, EntityIHLExplosion exploder, Explosion explosion, long longNumber) + { + int multiplier = exploder.multiplier; + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int power1 = explosionPower.get(longNumber); + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + power1=Math.round(power1*explosionPowerDampingFactor.get(longNumber)-0.5f); + if(power1<=1 || !vectors.containsKey(longNumber)|| vectors.get(longNumber).isEmpty()) + { + exploder.effectBorderBlocks.add(longNumber); + if(xyz[1]<0 || (exploder.y<=6 && xyz[1]<=6)) + { + exploder.effectBorderBlocksWithLowPosition.add(longNumber); + } + return null; + } + else + { + for(long d1:vectors.get(longNumber)) + { + explosionPower.put(d1, power1); + } + return vectors.get(longNumber); + } + + } + + private int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + private int getNewPowerAndProcessBlocks(World world, EntityIHLExplosion exploder, Explosion explosion, int xyz[], int multiplier, int ix, int iy, int iz, int power2) + { + int power1=power2; + int x = exploder.x+xyz[0]*multiplier+ix; + int y = exploder.y+xyz[1]*multiplier+iy; + int z = exploder.z+xyz[2]*multiplier+iz; + if(y<=4 || y>256) + { + return 0; + } + Block block = exploder.getBlock(x, y, z); + int explosionResistance = Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + if(explosionResistance>=power1) + { + power1=0; + } + else + { + power1-=Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + Entity entity = exploder.getEntity(x, y, z); + if(entity!=null) + { + entity.attackEntityFrom(exploder.damageSource, power1/10f); + } + block.onBlockDestroyedByExplosion(world, x, y, z, explosion); + exploder.setBlockToAir(x, y, z); + } + return power1; + } + + private int getNewPowerAndProcessBlocksEBS(World world, EntityIHLExplosion exploder, Explosion explosion, int xyz[],int power2) + { + int power1=power2; + int x = xyz[0] + (exploder.areaSize>>4); + int y = xyz[1]; + int z = xyz[2] + (exploder.areaSize>>4); + if(y<0 || y>16) + { + return 0; + } + int explosionResistance = exploder.getEBSResistance(x, y, z); + if(explosionResistance>=power1) + { + power1=0; + } + else + { + power1-=explosionResistance; + exploder.esbArray[x][z][y].; + Entity entity = exploder.getEntity(x, y, z); + if(entity!=null) + { + entity.attackEntityFrom(exploder.damageSource, power1/10f); + } + block.onBlockDestroyedByExplosion(world, x, y, z, explosion); + exploder.setBlockToAir(x, y, z); + } + return power1; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/7054990556b400151e8fcdb87a141443 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/7054990556b400151e8fcdb87a141443 new file mode 100644 index 0000000..aec8b3e --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/7054990556b400151e8fcdb87a141443 @@ -0,0 +1,567 @@ +package ihl.flexible_cable; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import ihl.IHLMod; +import ihl.IHLModInfo; +import ihl.interfaces.ICableHolder; +import ihl.interfaces.IDataCableHolder; +import ihl.interfaces.IEnergyNetNode; +import ihl.interfaces.INetworkListener; +import ihl.utils.IHLUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class NodeEntity extends Entity implements INetworkListener{ + + public Entity prevAnchorEntity; + public Entity nextAnchorEntity; + private int anchorX; + private int anchorY; + private int anchorZ; + private short anchorFacing; + private int anchorDimensionId; + public ItemStack attachedItem; + protected int chainUniqueID=-2; + public int chainArrangeNumber=-2; + protected int checkTimer=201; + public int colorIndex=16777215; + public int type=1;//0 - uninsulated wire; 1 - insulated cable; 2 - data cable + public float dx0=0; + public float dy0=0; + public float dz0=0; + public final int n=32; + public final float[] rotationPitchArray = new float[n+1]; + public final float[] rotationYawArray = new float[n+1]; + public final float[] translationX = new float[n+1]; + public final float[] translationY = new float[n+1]; + public final float[] translationZ = new float[n+1]; + public float virtualNodePosX; + public float virtualNodePosY; + public float virtualNodePosZ; + public float renderPosX; + public float renderPosY; + public float renderPosZ; + + public NodeEntity(World world) + { + super(world); + if(world.isRemote) + { + IHLMod.proxy.addEntityToList(this); + this.setSize(2f, 0.2f); + } + else + { + IHLMod.proxy.addEntityToServerList(this); + this.setSize(0.5F, 0.1F); + } + this.renderDistanceWeight = 5.0D; + this.yOffset+=0.15F; + this.virtualNodePosX=(float) this.posX; + this.virtualNodePosY=(float) this.posY; + this.virtualNodePosZ=(float) this.posZ; + } + + @Override + public void setInPortal(){} + + public void setSize(float width, float heigth) + { + super.setSize(width, heigth); + } + + public void setVirtualNodePos(float posX,float posY, float posZ) + { + virtualNodePosX=posX; + virtualNodePosY=posY; + virtualNodePosZ=posZ; + this.registerAndSendData(null); + } + + public void registerAndSendData(EntityPlayerMP player) + { + if(!worldObj.isRemote) + { + Set nes; + if(IHLMod.proxy.nodeEntityRegistry.containsKey(this.getChainUniqueID())) + { + nes=IHLMod.proxy.nodeEntityRegistry.get(this.getChainUniqueID()); + } + else + { + nes=new HashSet(); + IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes); + } + nes.add(this); + ByteBuf bb = Unpooled.buffer(30); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(1); + byteBufOutputStream.writeInt(this.getEntityId()); + byteBufOutputStream.writeInt(this.getChainUniqueID()); + byteBufOutputStream.writeInt(this.chainArrangeNumber); + byteBufOutputStream.writeByte(this.type); + byteBufOutputStream.writeInt(this.colorIndex); + byteBufOutputStream.writeFloat(this.virtualNodePosX); + byteBufOutputStream.writeFloat(this.virtualNodePosY); + byteBufOutputStream.writeFloat(this.virtualNodePosZ); + if(player==null) + { + IHLMod.proxy.sendFromServerToAll(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID)); + } + else + { + IHLMod.proxy.sendFromServerToPlayer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID),player); + } + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + if(!noClip && !worldObj.isRemote) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + if(this.checkTimer==201) + { + if(worldObj.isRemote) + { + IHLMod.proxy.recieveDelayedDataPacket(this); + } + else + { + this.registerAndSendData(null); + } + } + if((prevAnchorEntity==null && !noClip)||(nextAnchorEntity==null || nextAnchorEntity instanceof EntityPlayer || nextAnchorEntity instanceof EntityItem)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + NodeEntity node=(NodeEntity) ei.next(); + if(node.getChainUniqueID()==this.getChainUniqueID()) + { + if(node.chainArrangeNumber==this.chainArrangeNumber-1) + { + this.prevAnchorEntity=node; + node.nextAnchorEntity=this; + } + else if(node.chainArrangeNumber==this.chainArrangeNumber+1) + { + this.nextAnchorEntity=node; + node.prevAnchorEntity=this; + } + } + if(prevAnchorEntity!=null && nextAnchorEntity!=null) + { + break; + } + } + } + } + if(this.attachedItem!=null && (this.nextAnchorEntity == null || this.nextAnchorEntity.isDead) && !this.noClip) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityPlayer player=(EntityPlayer) ei.next(); + if(this.playerHasItemStack(player)) + { + this.nextAnchorEntity=player; + } + + } + } + } + if(this.attachedItem!=null && this.nextAnchorEntity instanceof EntityPlayer && !noClip) + { + EntityPlayer player = (EntityPlayer) this.nextAnchorEntity; + if(!this.playerHasItemStack(player)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityItem eitem = ei.next(); + if(eitem.getEntityItem().isItemEqual(this.attachedItem)) + { + this.nextAnchorEntity=eitem; + break; + } + } + } + } + } + if(!worldObj.isRemote) + { + { + double x0,x2,y0,y2,z0,z2; + x2=x0=this.virtualNodePosX; + y2=y0=this.virtualNodePosY; + z2=z0=this.virtualNodePosZ; + if(nextAnchorEntity!=null) + { + x2=nextAnchorEntity.posX; + y2=nextAnchorEntity.posY; + z2=nextAnchorEntity.posZ; + } + if(prevAnchorEntity!=null) + { + x0=prevAnchorEntity.posX; + y0=prevAnchorEntity.posY; + z0=prevAnchorEntity.posZ; + } + + double d1 = (x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)+(z0-z2)*(z0-z2); + if(d1>4D) + { + this.motionX=(x0+x2)*0.05D-this.posX*0.1D; + this.motionY=(y0+y2)*0.05D-this.posY*0.1D; + this.motionZ=(z0+z2)*0.05D-this.posZ*0.1D; + if(nextAnchorEntity!=null && this.getDistanceSqToEntity(nextAnchorEntity)>4D) + { + this.nextAnchorEntity.addVelocity((this.posX-this.nextAnchorEntity.posX)*0.01D, (this.posY-this.nextAnchorEntity.posY)*0.01D, (this.posZ-this.nextAnchorEntity.posZ)*0.01D); + } + } + else + { + double d2 = this.getDistanceSq(x2,y2,z2); + if(d2>1D) + { + this.motionX+=(x2-this.posX)*0.01D; + this.motionY+=(y2-this.posY)*0.01D; + this.motionZ+=(z2-this.posZ)*0.01D; + } + double d3 = this.getDistanceSq(x0,y0,z0); + if(d3>1D) + { + this.motionX+=(x0-this.posX)*0.01D; + this.motionY+=(y0-this.posY)*0.01D; + this.motionZ+=(z0-this.posZ)*0.01D; + } + } + this.motionY-=0.005D; + } + } + if(this.onGround) + { + this.motionY *= -0.5D; + } + this.motionX*=0.9D; + this.motionY*=0.9D; + this.motionZ*=0.9D; + if(worldObj.isRemote) + { + this.renderPosX=(float) this.prevPosX; + this.renderPosY=(float) this.prevPosY; + this.renderPosZ=(float) this.prevPosZ; + float xi,yi,zi; + float x0=xi=(float)this.prevPosX; + float y0=yi=(float)this.prevPosY; + float z0=zi=(float)this.prevPosZ; + float dx0=this.dx0; + float dy0=this.dy0; + float dz0=this.dz0; + float dx1=this.virtualNodePosX-xi; + float dy1=this.virtualNodePosY-yi; + float dz1=this.virtualNodePosZ-zi; + if(this.nextAnchorEntity!=null) + { + dx1=(float) (this.nextAnchorEntity.prevPosX-xi); + dy1=(float) (this.nextAnchorEntity.prevPosY-yi); + dz1=(float) (this.nextAnchorEntity.prevPosZ-zi); + } + if(this.prevAnchorEntity==null) + { + this.renderPosX=x0=xi=this.virtualNodePosX; + this.renderPosY=y0=yi=this.virtualNodePosY; + this.renderPosZ=z0=zi=this.virtualNodePosZ; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + if(((NodeEntity)this.nextAnchorEntity).nextAnchorEntity!=null) + { + Entity nne = ((NodeEntity)this.nextAnchorEntity).nextAnchorEntity; + dx1=(float) (nne.prevPosX-xi); + dy1=(float) (nne.prevPosY-yi); + dz1=(float) (nne.prevPosZ-zi); + } + else + { + dx1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosX-xi); + dy1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosY-yi); + dz1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosZ-zi); + } + } + float x1=this.virtualNodePosX; + float y1=this.virtualNodePosY; + float z1=this.virtualNodePosZ; + if(this.nextAnchorEntity!=null) + { + x1=(float)this.nextAnchorEntity.prevPosX; + y1=(float)this.nextAnchorEntity.prevPosY; + z1=(float)this.nextAnchorEntity.prevPosZ; + } + int i1=0; + for(float i=1f/n;i<=1f+1f/n;i+=1f/n,i1++) + { + float dxi = xi; + float dyi = yi; + float dzi = zi; + xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0; + yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0; + zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0; + int blockX=(int)xi; + int blockY=(int)yi; + int blockZ=(int)zi; + dxi-=xi; + dyi-=yi; + dzi-=zi; + double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi); + float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI)); + float rotationPitch = (float) Math.atan2(dxi, dzi); + float rotationYaw = (float) (-Math.atan2(dyi, var7)); + rotationPitchArray[i1]=rotationPitch; + rotationYawArray[i1]=rotationYaw; + translationX[i1]=dxi; + translationY[i1]=dyi; + translationZ[i1]=dzi; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + NodeEntity next = (NodeEntity) this.nextAnchorEntity; + next.dx0=dx1; + next.dy0=dy1; + next.dz0=dz1; + } + } + if(--this.checkTimer<=0) + { + if(!worldObj.isRemote) + { + TileEntity te = MinecraftServer.getServer().worldServerForDimension(this.anchorDimensionId).getTileEntity(this.anchorX, this.anchorY, this.anchorZ); + if(te==null || !(te instanceof ICableHolder || te instanceof AnchorTileEntity)) + { + this.setDead(); + } + } + this.checkTimer=200; + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) + { + this.noClip=nbt.getBoolean("noClip"); + this.setChainUniqueID(nbt.getInteger("chainUniqueID")); + this.chainArrangeNumber=nbt.getInteger("chainArrangeNumber"); + this.anchorX=nbt.getInteger("anchorX"); + this.anchorY=nbt.getInteger("anchorY"); + this.anchorZ=nbt.getInteger("anchorZ"); + this.anchorFacing=nbt.getShort("anchorFacing"); + this.anchorDimensionId=nbt.getInteger("anchorDimensionId"); + this.type=nbt.getInteger("type"); + this.colorIndex=nbt.getInteger("colorIndex"); + if(nbt.hasKey("itemStack")) + { + NBTTagCompound stackTag = (NBTTagCompound) nbt.getTag("itemStack"); + this.attachedItem = ItemStack.loadItemStackFromNBT(stackTag); + } + if(nbt.hasKey("width")) + { + this.setSize(nbt.getFloat("width"), nbt.getFloat("height")); + } + this.virtualNodePosX=nbt.getFloat("virtualNodePosX"); + this.virtualNodePosY=nbt.getFloat("virtualNodePosY"); + this.virtualNodePosZ=nbt.getFloat("virtualNodePosZ"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) + { + nbt.setFloat("width", this.width); + nbt.setFloat("height", this.height); + nbt.setBoolean("noClip", noClip); + nbt.setInteger("chainUniqueID", this.getChainUniqueID()); + nbt.setInteger("chainArrangeNumber", this.chainArrangeNumber); + nbt.setInteger("anchorX", this.anchorX); + nbt.setInteger("anchorY", this.anchorY); + nbt.setInteger("anchorZ", this.anchorZ); + nbt.setShort("anchorFacing",this.anchorFacing); + nbt.setInteger("anchorDimensionId",this.anchorDimensionId); + nbt.setInteger("type", this.type); + nbt.setInteger("colorIndex", this.colorIndex); + if(this.attachedItem!=null) + { + NBTTagCompound stackTag = new NBTTagCompound(); + this.attachedItem.writeToNBT(stackTag); + nbt.setTag("itemStack",stackTag); + } + nbt.setFloat("virtualNodePosX",this.virtualNodePosX); + nbt.setFloat("virtualNodePosY",this.virtualNodePosY); + nbt.setFloat("virtualNodePosZ",this.virtualNodePosZ); + } + + public void setAnchor(int x, int y, int z, short facing, int dimensionId) + { + this.anchorX=x; + this.anchorY=y; + this.anchorZ=z; + this.anchorFacing=facing; + this.anchorDimensionId=dimensionId; + } + + public boolean playerHasItemStack(EntityPlayer player) + { + int var2; + + for (var2 = 0; var2 < player.inventory.armorInventory.length; ++var2) + { + if (player.inventory.armorInventory[var2] != null && player.inventory.armorInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.armorInventory[var2].stackTagCompound==null?false:player.inventory.armorInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + for (var2 = 0; var2 < player.inventory.mainInventory.length; ++var2) + { + if (player.inventory.mainInventory[var2] != null && player.inventory.mainInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.mainInventory[var2].stackTagCompound==null?false:player.inventory.mainInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + return false; + } + + public int getChainUniqueID() { + return chainUniqueID; + } + + public void setChainUniqueID(int chainUniqueID) { + this.chainUniqueID = chainUniqueID; + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) + { + if(this.noClip) + { + return null; + } + else + { + return super.getCollisionBox(entity); + } + } + + @Override + public int getId() + { + return this.getEntityId(); + } + + @Override + public void recieveData(ByteBufInputStream byteBufInputStream) + { + try + { + this.setChainUniqueID(byteBufInputStream.readInt()); + this.chainArrangeNumber=byteBufInputStream.readInt(); + this.type=byteBufInputStream.readByte(); + this.colorIndex=byteBufInputStream.readInt(); + this.virtualNodePosX=byteBufInputStream.readFloat(); + this.virtualNodePosY=byteBufInputStream.readFloat(); + this.virtualNodePosZ=byteBufInputStream.readFloat(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @Override + protected void entityInit() {} + + @Override + public boolean isInvalid() + { + return this.isDead; + } + + public void setVirtualNodePosToNearestPortal() + { + int x0 = (int)this.posX; + int y0 = (int)this.posY; + int z0 = (int)this.posZ; + for(int xi=x0-2;xi<=x0+2;xi++) + { + for(int yi=y0-2;yi<=y0+2;yi++) + { + for(int zi=z0-2;zi<=z0+2;zi++) + { + Block block = worldObj.getBlock(xi, yi, zi); + if(block==Blocks.portal||block==Blocks.end_portal) + { + this.setVirtualNodePos(xi+0.5f, yi+0.5f, zi+0.5f); + return; + } + } + } + } + + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb3543b60015176c95ddaf2504ce b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb3543b60015176c95ddaf2504ce new file mode 100644 index 0000000..68987b9 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/8/c064fb3543b60015176c95ddaf2504ce @@ -0,0 +1,578 @@ +package ihl.flexible_cable; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import ihl.IHLMod; +import ihl.IHLModInfo; +import ihl.interfaces.ICableHolder; +import ihl.interfaces.IDataCableHolder; +import ihl.interfaces.IEnergyNetNode; +import ihl.interfaces.INetworkListener; +import ihl.utils.IHLUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class NodeEntity extends Entity implements INetworkListener{ + + public NodeEntity prevAnchorEntity; + public Entity nextAnchorEntity; + private int anchorX; + private int anchorY; + private int anchorZ; + private short anchorFacing; + private int anchorDimensionId; + public ItemStack attachedItem; + protected int chainUniqueID=-2; + public int chainArrangeNumber=-2; + protected int checkTimer=201; + public int colorIndex=16777215; + public int type=1;//0 - uninsulated wire; 1 - insulated cable; 2 - data cable + public float dx0=0; + public float dy0=0; + public float dz0=0; + public final int n=64; + public final float[] rotationPitchArray = new float[n+1]; + public final float[] rotationYawArray = new float[n+1]; + public final float[] translationX = new float[n+1]; + public final float[] translationY = new float[n+1]; + public final float[] translationZ = new float[n+1]; + public float virtualNodePosX; + public float virtualNodePosY; + public float virtualNodePosZ; + public float renderPosX; + public float renderPosY; + public float renderPosZ; + private boolean alreadyRegistered=false; + + public NodeEntity(World world) + { + super(world); + if(world.isRemote) + { + IHLMod.proxy.addEntityToList(this); + this.setSize(2f, 0.2f); + } + else + { + IHLMod.proxy.addEntityToServerList(this); + this.setSize(0.5F, 0.1F); + } + this.renderDistanceWeight = 5.0D; + this.yOffset+=0.15F; + this.virtualNodePosX=(float) this.posX; + this.virtualNodePosY=(float) this.posY; + this.virtualNodePosZ=(float) this.posZ; + } + + @Override + public void setInPortal(){} + + @Override + public void travelToDimension(int dimensionId){} + + public void setSize(float width, float heigth) + { + super.setSize(width, heigth); + } + + public void setVirtualNodePos(float posX,float posY, float posZ) + { + virtualNodePosX=posX; + virtualNodePosY=posY; + virtualNodePosZ=posZ; + this.registerAndSendData(null); + } + + public void registerAndSendData(EntityPlayerMP player) + { + if(!worldObj.isRemote) + { + if(!alreadyRegistered) + { + Set nes; + if(IHLMod.proxy.nodeEntityRegistry.containsKey(this.getChainUniqueID())) + { + nes=IHLMod.proxy.nodeEntityRegistry.get(this.getChainUniqueID()); + } + else + { + nes=new HashSet(); + IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes); + } + nes.add(this); + alreadyRegistered=true; + } + ByteBuf bb = Unpooled.buffer(30); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(1); + byteBufOutputStream.writeInt(this.getEntityId()); + byteBufOutputStream.writeInt(this.getChainUniqueID()); + byteBufOutputStream.writeInt(this.chainArrangeNumber); + byteBufOutputStream.writeByte(this.type); + byteBufOutputStream.writeInt(this.colorIndex); + byteBufOutputStream.writeFloat(this.virtualNodePosX); + byteBufOutputStream.writeFloat(this.virtualNodePosY); + byteBufOutputStream.writeFloat(this.virtualNodePosZ); + if(player==null) + { + IHLMod.proxy.sendFromServerToAll(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID)); + } + else + { + IHLMod.proxy.sendFromServerToPlayer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID),player); + } + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + if(!noClip && !worldObj.isRemote) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + if(this.checkTimer==201) + { + if(worldObj.isRemote) + { + IHLMod.proxy.recieveDelayedDataPacket(this); + } + else + { + this.registerAndSendData(null); + } + } + if((prevAnchorEntity==null && !noClip)||(nextAnchorEntity==null || nextAnchorEntity instanceof EntityPlayer || nextAnchorEntity instanceof EntityItem)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + NodeEntity node=(NodeEntity) ei.next(); + if(node.getChainUniqueID()==this.getChainUniqueID()) + { + if(node.chainArrangeNumber==this.chainArrangeNumber-1) + { + this.prevAnchorEntity=node; + node.nextAnchorEntity=this; + } + else if(node.chainArrangeNumber==this.chainArrangeNumber+1) + { + this.nextAnchorEntity=node; + node.prevAnchorEntity=this; + } + } + if(prevAnchorEntity!=null && nextAnchorEntity!=null) + { + break; + } + } + } + } + if(this.attachedItem!=null && (this.nextAnchorEntity == null || this.nextAnchorEntity.isDead) && !this.noClip) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityPlayer player=(EntityPlayer) ei.next(); + if(this.playerHasItemStack(player)) + { + this.nextAnchorEntity=player; + } + + } + } + } + if(this.attachedItem!=null && this.nextAnchorEntity instanceof EntityPlayer && !noClip) + { + EntityPlayer player = (EntityPlayer) this.nextAnchorEntity; + if(!this.playerHasItemStack(player)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityItem eitem = ei.next(); + if(eitem.getEntityItem().isItemEqual(this.attachedItem)) + { + this.nextAnchorEntity=eitem; + break; + } + } + } + } + } + if(!worldObj.isRemote) + { + { + double x0,x2,y0,y2,z0,z2; + x2=x0=this.virtualNodePosX; + y2=y0=this.virtualNodePosY; + z2=z0=this.virtualNodePosZ; + if(nextAnchorEntity!=null) + { + x2=nextAnchorEntity.posX; + y2=nextAnchorEntity.posY; + z2=nextAnchorEntity.posZ; + } + if(prevAnchorEntity!=null) + { + x0=prevAnchorEntity.posX; + y0=prevAnchorEntity.posY; + z0=prevAnchorEntity.posZ; + } + + double d1 = (x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)+(z0-z2)*(z0-z2); + if(d1>4D) + { + this.motionX=(x0+x2)*0.5D-this.posX*1D; + this.motionY=(y0+y2)*0.5D-this.posY*1D; + this.motionZ=(z0+z2)*0.5D-this.posZ*1D; + if(nextAnchorEntity!=null && this.getDistanceSqToEntity(nextAnchorEntity)>4D) + { + this.nextAnchorEntity.addVelocity((this.posX-this.nextAnchorEntity.posX)*0.01D, (this.posY-this.nextAnchorEntity.posY)*0.01D, (this.posZ-this.nextAnchorEntity.posZ)*0.01D); + } + } + else + { + double d2 = this.getDistanceSq(x2,y2,z2); + if(d2>1D) + { + this.motionX+=(x2-this.posX)*0.1D; + this.motionY+=(y2-this.posY)*0.1D; + this.motionZ+=(z2-this.posZ)*0.1D; + } + double d3 = this.getDistanceSq(x0,y0,z0); + if(d3>1D) + { + this.motionX+=(x0-this.posX)*0.1D; + this.motionY+=(y0-this.posY)*0.1D; + this.motionZ+=(z0-this.posZ)*0.1D; + } + } + this.motionY-=0.005D; + } + } + if(this.onGround) + { + this.motionY *= -0.5D; + } + this.motionX*=0.9D; + this.motionY*=0.9D; + this.motionZ*=0.9D; + if(worldObj.isRemote) + { + float movvmentSpeed=0.05f; + this.renderPosX=this.renderPosX*(1f-movvmentSpeed)+(float) this.prevPosX*movvmentSpeed; + this.renderPosY=this.renderPosY*(1f-movvmentSpeed)+(float) this.prevPosY*movvmentSpeed; + this.renderPosZ=this.renderPosZ*(1f-movvmentSpeed)+(float) this.prevPosZ*movvmentSpeed; + float xi,yi,zi; + float x0=xi=(float)this.prevPosX; + float y0=yi=(float)this.prevPosY; + float z0=zi=(float)this.prevPosZ; + float dx0=this.dx0; + float dy0=this.dy0; + float dz0=this.dz0; + float dx1=this.virtualNodePosX-xi; + float dy1=this.virtualNodePosY-yi; + float dz1=this.virtualNodePosZ-zi; + if(this.nextAnchorEntity!=null) + { + dx1=(float) (this.nextAnchorEntity.prevPosX-xi); + dy1=(float) (this.nextAnchorEntity.prevPosY-yi); + dz1=(float) (this.nextAnchorEntity.prevPosZ-zi); + } + if(this.prevAnchorEntity==null) + { + this.renderPosX=x0=xi=this.virtualNodePosX; + this.renderPosY=y0=yi=this.virtualNodePosY; + this.renderPosZ=z0=zi=this.virtualNodePosZ; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + if(((NodeEntity)this.nextAnchorEntity).nextAnchorEntity!=null) + { + Entity nne = ((NodeEntity)this.nextAnchorEntity).nextAnchorEntity; + dx1=(float) (nne.prevPosX-xi); + dy1=(float) (nne.prevPosY-yi); + dz1=(float) (nne.prevPosZ-zi); + } + else + { + dx1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosX-xi); + dy1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosY-yi); + dz1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosZ-zi); + } + } + float x1=this.virtualNodePosX; + float y1=this.virtualNodePosY; + float z1=this.virtualNodePosZ; + if(this.nextAnchorEntity!=null) + { + x1=(float)this.nextAnchorEntity.prevPosX; + y1=(float)this.nextAnchorEntity.prevPosY; + z1=(float)this.nextAnchorEntity.prevPosZ; + } + int i1=0; + for(float i=1f/n;i<=1f+1f/n;i+=1f/n,i1++) + { + float dxi = xi; + float dyi = yi; + float dzi = zi; + xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0; + yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0; + zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0; + int blockX=(int)xi; + int blockY=(int)yi; + int blockZ=(int)zi; + dxi-=xi; + dyi-=yi; + dzi-=zi; + double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi); + float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI)); + float rotationPitch = (float) Math.atan2(dxi, dzi); + float rotationYaw = (float) (-Math.atan2(dyi, var7)); + rotationPitchArray[i1]=rotationPitch; + rotationYawArray[i1]=rotationYaw; + translationX[i1]=dxi; + translationY[i1]=dyi; + translationZ[i1]=dzi; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + NodeEntity next = (NodeEntity) this.nextAnchorEntity; + next.dx0=dx1; + next.dy0=dy1; + next.dz0=dz1; + } + } + if(--this.checkTimer<=0) + { + if(!worldObj.isRemote) + { + WorldServer world = MinecraftServer.getServer().worldServerForDimension(this.anchorDimensionId); + TileEntity te = world.getTileEntity(this.anchorX, this.anchorY, this.anchorZ); + if(te==null || !(te instanceof ICableHolder || te instanceof AnchorTileEntity)) + { + this.setDead(); + } + } + this.checkTimer=200; + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) + { + this.noClip=nbt.getBoolean("noClip"); + this.setChainUniqueID(nbt.getInteger("chainUniqueID")); + this.chainArrangeNumber=nbt.getInteger("chainArrangeNumber"); + this.anchorX=nbt.getInteger("anchorX"); + this.anchorY=nbt.getInteger("anchorY"); + this.anchorZ=nbt.getInteger("anchorZ"); + this.anchorFacing=nbt.getShort("anchorFacing"); + this.anchorDimensionId=nbt.getInteger("anchorDimensionId"); + this.type=nbt.getInteger("type"); + this.colorIndex=nbt.getInteger("colorIndex"); + if(nbt.hasKey("itemStack")) + { + NBTTagCompound stackTag = (NBTTagCompound) nbt.getTag("itemStack"); + this.attachedItem = ItemStack.loadItemStackFromNBT(stackTag); + } + if(nbt.hasKey("width")) + { + this.setSize(nbt.getFloat("width"), nbt.getFloat("height")); + } + this.virtualNodePosX=nbt.getFloat("virtualNodePosX"); + this.virtualNodePosY=nbt.getFloat("virtualNodePosY"); + this.virtualNodePosZ=nbt.getFloat("virtualNodePosZ"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) + { + nbt.setFloat("width", this.width); + nbt.setFloat("height", this.height); + nbt.setBoolean("noClip", noClip); + nbt.setInteger("chainUniqueID", this.getChainUniqueID()); + nbt.setInteger("chainArrangeNumber", this.chainArrangeNumber); + nbt.setInteger("anchorX", this.anchorX); + nbt.setInteger("anchorY", this.anchorY); + nbt.setInteger("anchorZ", this.anchorZ); + nbt.setShort("anchorFacing",this.anchorFacing); + nbt.setInteger("anchorDimensionId",this.anchorDimensionId); + nbt.setInteger("type", this.type); + nbt.setInteger("colorIndex", this.colorIndex); + if(this.attachedItem!=null) + { + NBTTagCompound stackTag = new NBTTagCompound(); + this.attachedItem.writeToNBT(stackTag); + nbt.setTag("itemStack",stackTag); + } + nbt.setFloat("virtualNodePosX",this.virtualNodePosX); + nbt.setFloat("virtualNodePosY",this.virtualNodePosY); + nbt.setFloat("virtualNodePosZ",this.virtualNodePosZ); + } + + public void setAnchor(int x, int y, int z, short facing, int dimensionId) + { + this.anchorX=x; + this.anchorY=y; + this.anchorZ=z; + this.anchorFacing=facing; + this.anchorDimensionId=dimensionId; + } + + public boolean playerHasItemStack(EntityPlayer player) + { + int var2; + + for (var2 = 0; var2 < player.inventory.armorInventory.length; ++var2) + { + if (player.inventory.armorInventory[var2] != null && player.inventory.armorInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.armorInventory[var2].stackTagCompound==null?false:player.inventory.armorInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + for (var2 = 0; var2 < player.inventory.mainInventory.length; ++var2) + { + if (player.inventory.mainInventory[var2] != null && player.inventory.mainInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.mainInventory[var2].stackTagCompound==null?false:player.inventory.mainInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + return false; + } + + public int getChainUniqueID() { + return chainUniqueID; + } + + public void setChainUniqueID(int chainUniqueID) { + this.chainUniqueID = chainUniqueID; + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) + { + if(this.noClip) + { + return null; + } + else + { + return super.getCollisionBox(entity); + } + } + + @Override + public int getId() + { + return this.getEntityId(); + } + + @Override + public void recieveData(ByteBufInputStream byteBufInputStream) + { + try + { + this.setChainUniqueID(byteBufInputStream.readInt()); + this.chainArrangeNumber=byteBufInputStream.readInt(); + this.type=byteBufInputStream.readByte(); + this.colorIndex=byteBufInputStream.readInt(); + this.virtualNodePosX=byteBufInputStream.readFloat(); + this.virtualNodePosY=byteBufInputStream.readFloat(); + this.virtualNodePosZ=byteBufInputStream.readFloat(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @Override + protected void entityInit() {} + + @Override + public boolean isInvalid() + { + return this.isDead; + } + + public void setVirtualNodePosToNearestPortal() + { + int x0 = (int)this.posX; + int y0 = (int)this.posY; + int z0 = (int)this.posZ; + for(int xi=x0-2;xi<=x0+2;xi++) + { + for(int yi=y0-2;yi<=y0+2;yi++) + { + for(int zi=z0-2;zi<=z0+2;zi++) + { + Block block = worldObj.getBlock(xi, yi, zi); + if(block==Blocks.portal||block==Blocks.end_portal) + { + this.setVirtualNodePos(xi+0.5f, yi+0.5f, zi+0.5f); + return; + } + } + } + } + + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/85/0003ff6a758b0015134481ec712b17ae b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/85/0003ff6a758b0015134481ec712b17ae new file mode 100644 index 0000000..dc1e53c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/85/0003ff6a758b0015134481ec712b17ae @@ -0,0 +1,312 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/4063232,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + for(int eay=0;eay ebbi = effectBorderBlocks.iterator(); + long longNumber = ebbi.next(); + ebbi.remove(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(this.isBlockConnectedWithBedrock(longNumber)) + { + + } + } + } + while(!this.explosionDone) + { + update(); + } + } + + private boolean isBlockConnectedWithBedrock(long longNumber) + { + if(this.blocksNotConnectedWithBedrock.contains(longNumber)) + { + return false; + } + Set path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + } + } + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/87/90232f55a7ca001510f7df4278c93a7e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/87/90232f55a7ca001510f7df4278c93a7e new file mode 100644 index 0000000..6fb4677 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/87/90232f55a7ca001510f7df4278c93a7e @@ -0,0 +1,949 @@ +package ihl.utils; + +import ic2.api.recipe.IMachineRecipeManager; +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.Recipes; +import ic2.core.block.invslot.InvSlotOutput; +import ihl.IHLMod; +import ihl.interfaces.IWire; +import ihl.metallurgy.constants.*; +import ihl.processing.invslots.InvSlotConsumableLiquidIHL; +import ihl.recipes.IRecipeInputFluid; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.mutable.MutableObject; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.oredict.OreDictionary; + +public class IHLUtils +{ + private static Map ihlItemStackRegistry = new HashMap(); + + public static void registerLocally(String name, ItemStack stack) + { + ihlItemStackRegistry.put(name, stack); + } + + public static ItemStack getOreDictItemStack(String name) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=1; + return orecopy; + } + + public static boolean hasOreDictionaryEntry(String name) + { + return !OreDictionary.getOres(name).isEmpty(); + } + + public static Item getOreDictItem(String name) + { + return OreDictionary.getOres(name).get(0).getItem(); + } + + public static Block getOreDictBlock(String name) + { + return Block.getBlockFromItem(OreDictionary.getOres(name).get(0).getItem()); + } + + public static ItemStack getOreDictItemStackWithSize(String name, int size) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=size; + return orecopy; + } + + public static String getFirstOreDictName(ItemStack stack) + { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + if(arrayIDs.length>0) + { + return OreDictionary.getOreName(arrayIDs[0]); + } + return ""; + } + + public static ItemStack getThisModItemStack(String name) + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + + public static ItemStack getThisModItemStackWithSize(String name, int i) { + if(ihlItemStackRegistry.get(name)!=null) + { + ItemStack stack = ihlItemStackRegistry.get(name).copy(); + stack.stackSize=i; + return stack; + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name),i); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name),i); + } + } + + public static ItemStack getOtherModItemStackWithDamage(String modname, String name,int damage) { + if(GameRegistry.findItem(modname, name)!=null) + { + return new ItemStack(GameRegistry.findItem(modname, name),1,damage); + } + else if(GameRegistry.findBlock(modname, name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock(modname, name),1,damage); + } + } + + public static Item getThisModItem(String name) + { + if(GameRegistry.findItem("ihl", name)!=null) + { + return GameRegistry.findItem("ihl", name); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return Item.getItemFromBlock(GameRegistry.findBlock("ihl", name)); + } + } + + public static FluidStack getFluidStackWithSize(String name, int i) { + if(FluidRegistry.isFluidRegistered(name)) + { + return FluidRegistry.getFluidStack(name, i); + } + else + { + throw new IllegalArgumentException("No such fluid: "+name); + } + } + + public static Block getThisModBlock(String name) + { + if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such block in item registry: ihl:"+name); + } + else + { + return GameRegistry.findBlock("ihl", name); + } + } + + public static ItemStack getThisModItemStackWithDamage(String name, + int value) + { + ItemStack stack = getThisModItemStack(name); + stack.setItemDamage(value); + return stack; + } + + public static boolean adjustWireLength(ItemStack stack, int adjustBy) + { + int length = getWireLength(stack); + if(length<=0) + { + return true; + } + else + { + int newLength = Math.max(length+adjustBy,0); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),newLength); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),newLength); + if(newLength==0) + { + return true; + } + return false; + } + } + + public static int getWireLength(ItemStack itemStack) + { + return itemStack.stackTagCompound.getInteger(((IWire)itemStack.getItem()).getTag()); + } + + public static ItemStack getThisModWireItemStackWithLength(String name, int i) { + if(getThisModItemStack(name)!=null) + { + ItemStack stack = getThisModItemStack(name); + if(stack.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException("ihl:"+name + " is not an instance of IWire."); + } + } + else + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + } + + public static ItemStack getThisModWireItemStackWithLength(ItemStack stack1, int i) { + ItemStack stack = stack1.copy(); + if(stack1.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException(stack1.getUnlocalizedName() + " is not an instance of IWire."); + } + } + + public static boolean isItemsHaveSameOreDictionaryEntry(ItemStack is, ItemStack is1) + { + int[] odids1 = OreDictionary.getOreIDs(is); + int[] odids2 = OreDictionary.getOreIDs(is1); + if(odids1!=null && odids1.length>0 && odids2!=null && odids2.length>0) + { + for(int i1=0;i1 getEntryListForOre(String name) + { + ArrayList outputList = new ArrayList(); + ArrayList oreList = OreDictionary.getOres(name); + Iterator oreListIterator = oreList.iterator(); + while(oreListIterator.hasNext()) + { + outputList.add(oreListIterator.next().copy()); + } + return outputList; + } + + public static ItemStack getItemStackIfExist(String name) + { + if(hasOreDictionaryEntry(name)) + { + return getOreDictItemStack(name); + } + else + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + } + + public static FluidStack getFluidStackIfExist(String string, int meltingFluidAmount) + { + if(FluidRegistry.isFluidRegistered(string)) + { + return getFluidStackWithSize(string,meltingFluidAmount); + } + return null; + } + + public static boolean addItemStackToInventory(EntityPlayer player, ItemStack stack) + { + ItemStack[] inv = player.inventory.mainInventory; + for (int i=0;i<=35;i++) + { + if(inv[i]!=null) + { + if(inv[i].getItem()==stack.getItem()) + { + if(inv[i].getItemDamage()==stack.getItemDamage() && inv[i].stackSizeinv[i].getMaxStackSize()) + { + stack.stackSize=inv[i].stackSize-inv[i].getMaxStackSize(); + } + else + { + return true; + } + } + } + } + else + { + inv[i]=stack; + return true; + } + } + return false; + } + + public static FluidStack getFluidStackWithSizeChemicallyPure(String name, int amount) + { + FluidStack fstack = getFluidStackWithSize(name, amount); + fstack.tag=new NBTTagCompound(); + fstack.tag.setBoolean("chemicallyPure", true); + return fstack; + } + + public static void removeItemStackFromOreDictionaryEntry(String orename, ItemStack itemStack) + { + ArrayList orelist = OreDictionary.getOres(orename); + Iterator oreListIterator = orelist.iterator(); + ItemStack odstack = null; + while(oreListIterator.hasNext()) + { + odstack = oreListIterator.next(); + if(odstack.getItem()==itemStack.getItem()) + { + break; + } + else + { + odstack = null; + } + } + if(odstack != null) + { + orelist.remove(odstack); + IHLMod.log.debug("Stack "+odstack.getDisplayName()+" ("+odstack.toString()+")"+" removed from ore entry '"+orename+"'"); + } + } + + public static boolean isRecipeInputExist(IMachineRecipeManager iMachineRecipeManager, ItemStack stack) + { + Iterator keyI = iMachineRecipeManager.getRecipes().keySet().iterator(); + while(keyI.hasNext()) + { + IRecipeInput iri = keyI.next(); + if(iri.matches(stack)) + { + return true; + } + } + return false; + } + + public static void addIC2MaceratorRecipe(String input, ItemStack output) + { + if(!isRecipeInputExist(Recipes.macerator,getOreDictItemStack(input))) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputOreDict(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(String input, int stacksize, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStackWithSize(input,stacksize), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputOreDict(input,stacksize), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(ItemStack input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(ItemStack input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(String input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(getThisModItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputOreDict(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2CentrifugeRecipe(String input, ItemStack output, ItemStack output2) + { + if(Recipes.centrifuge.getOutputFor(getOreDictItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("minHeat", 2000); + Recipes.centrifuge.addRecipe(new RecipeInputOreDict(input), tag, new ItemStack[] {output,output2}); + } + else + { + //IHLMod.log.info("IC2 centrifuge recipe for "+input+" already exist. Skipped."); + } + } + + public static void damageItemViaNBTTag(ItemStack stack, int amount) + { + NBTTagCompound gtTagCompound; + if(stack.stackTagCompound.hasKey("GT.ToolStats")) + { + gtTagCompound = stack.stackTagCompound.getCompoundTag("GT.ToolStats"); + } + else + { + stack.stackSize--; + return; + } + int damage = 0; + int maxDamage = 0; + if(gtTagCompound.hasKey("MaxDamage")) + { + maxDamage = gtTagCompound.getInteger("MaxDamage"); + } + else + { + stack.stackSize--; + return; + } + + if(gtTagCompound.hasKey("Damage")) + { + damage = gtTagCompound.getInteger("Damage"); + } + if(damage=input.getAmount(); + } + else + { + return stack.stackSize>=input.getAmount(); + } + } + return false; + } + + public static boolean reduceItemStackAmountUsingIRecipeInput(IRecipeInput input, ItemStack stack) { + if(stack.getItem() instanceof IWire) + { + return adjustWireLength(stack,-input.getAmount()); + } + else + { + stack.stackSize-=input.getAmount(); + return stack.stackSize<=0; + } + } + + public static String getFirstOreDictNameExcludingTagAny(ItemStack stack) { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + for(int i=0;i0 && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fluidTank.fill(drainInputSlot.drain(null, fluidTank.getCapacity()-fluidTank.getFluidAmount(), output, false),true); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + if (fillInputSlot!=null && !fillInputSlot.isEmpty()) + { + output = new MutableObject(); + if (fillInputSlot.transferFromTank(fluidTank, output, true) && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fillInputSlot.transferFromTank(fluidTank, output, false); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + } + public static double[] tracePlayerView(EntityPlayer entityplayer) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + if (entityplayer.worldObj!=null && entityplayer.worldObj.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + double z = entityplayer.posZ; + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 1.0D; + return new double[] {x+f7 * d3, y+f6 * d3, z+f9 * d3}; + } + + public static MovingObjectPosition returnMOPFromPlayer(EntityPlayer entityplayer, World world) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + + if (world.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + + double z = entityplayer.posZ; + Vec3 vec3d = Vec3.createVectorHelper(x, y, z); + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 5.0D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f6 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks(vec3d, vec3d1, true); + + if (movingobjectposition == null) + { + return null; + } + + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + return movingobjectposition; + } + return null; + } + + public static short getFacingFromPlayerView(EntityLivingBase player, boolean ignoreSneaking) + { + int var6 = MathHelper.floor_double(player.rotationPitch * 4.0F / 360.0F + 0.5D) & 3; + int var7 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + { + if(var6==1) + { + return 1; + } + else if(var6==3) + { + return 0; + } + else + { + if(player.isSneaking() && !ignoreSneaking) + { + switch(var7) + { + case 0: + return 3; + case 1: + return 4; + case 2: + return 2; + case 3: + return 5; + default: + break; + } + } + else + { + switch(var7) + { + case 0: + return 2; + case 1: + return 5; + case 2: + return 3; + case 3: + return 4; + default: + break; + } + } + } + } + return 3; + } + + public static int getChainID(ItemStack itemStack) + { + if(itemStack!=null && itemStack.stackTagCompound!=null && itemStack.stackTagCompound.hasKey("chainUID")) + { + return itemStack.stackTagCompound.getInteger("chainUID"); + } + return -1; + } + + public static List convertRecipeInputToItemStackList(List input) + { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInput iri = irii.next(); + ItemStack stack = iri.getInputs().get(0); + stack.stackSize=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static List convertRecipeInputToFluidStackList(List input) { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInputFluid iri = irii.next(); + FluidStack stack = iri.getInputs().get(0); + stack.amount=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static int[] decodeXYZ(long longNumber) + { + return new int[] {(int) ((longNumber>>30) & 0xfff)-256,(int) ((longNumber>>15) & 0xfff)-256,(int) (longNumber & 0xfff)-256}; + } + + public static long encodeXYZ(int x,int y,int z) + { + return (x+256L)<<30|((y+256L)<<15)|(z+256L); + } + + public static int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + public static long getXYZHash(int x,int y,int z) + { + return ((x&0x1FFFFF)<<42)|((y&0x1FFFFF)<<21)|(z&0x1FFFFF); + } + + public static String trim(String str) + { + int len = str.length(); + int start; + char c; + for (start = 0; start < len; ++start) + { + c = str.charAt(start); + if (c > 32 && c != 65279) + { + break; + } + } + int end; + for (end = len - 1; end >= start; --end) + { + c = str.charAt(end); + if (c > 32 && c != 65279) + { + break; + } + } + return start <= 0 && end >= len - 1 ? str : str.substring(start, end + 1); + } + + public static int getAmountOf(ItemStack is) + { + if(is.getItem() instanceof IWire) + { + return getWireLength(is); + } + else + { + return is.stackSize; + } + } + + public static ItemStack getWireItemStackCopyWithLengthMultiplied(ItemStack stack, int multiplier) + { + ItemStack out = stack.copy(); + adjustWireLength(out,getWireLength(stack)*(multiplier-1)); + return out; + } + + public static ItemStack getUninsulatedWire(String material, int length, int transverseSection) { + ItemStack is = getThisModItemStack("copperWire"); + is.stackTagCompound=new NBTTagCompound(); + is.stackTagCompound.setBoolean("firstConnection",false); + is.stackTagCompound.setInteger("fullLength", length); + is.stackTagCompound.setInteger("length", length); + is.stackTagCompound.setBoolean("firstConnection", false); + is.stackTagCompound.setString("material", material); + is.stackTagCompound.setInteger("transverseSection",transverseSection); + is.stackTagCompound.setInteger("resistance", ElectricConductor.getResistivity(material)*100/transverseSection); + return is; + } + + public static ItemStack getInsulatedWire(String material, int length, int transverseSection, String insulationMaterial, int insulationThickness) { + ItemStack is = getUninsulatedWire(material, length, transverseSection); + is.stackTagCompound.setString("insulationMaterial",insulationMaterial); + is.stackTagCompound.setInteger("insulationThickness",insulationThickness); + is.stackTagCompound.setInteger("maxVoltage", getInsulationMaxVoltage(insulationMaterial, insulationThickness)); + return is; + } + + public static int getInsulationMaxVoltage(String insulationMaterial, int insulationThickness) + { + return Math.min(Insulation.getMaxVoltagePermm(insulationMaterial)*insulationThickness/10,Insulation.getMaxVoltageCap(insulationMaterial)); + } + + public static ItemStack getItemStackWithTag(String unLocalizedName, String tag, int tagValue) { + ItemStack stack = IHLUtils.getThisModItemStack(unLocalizedName); + if(stack.stackTagCompound==null) + { + stack.stackTagCompound=new NBTTagCompound(); + } + stack.stackTagCompound.setInteger(tag, tagValue); + return stack; + } + + public static boolean isSegmentInsideAABB(AxisAlignedBB collisionBox, double posX, double posY, double posZ, double posX2, double posY2, double posZ2) + { + if(isInsideofBoundingBox(collisionBox,(float)posX,(float)posY,(float)posZ)||isInsideofBoundingBox(collisionBox,(float)posX2,(float)posY2,(float)posZ2)) + { + return true; + } + else + { + double minX=Math.min(posX, posX2); + double maxX=Math.max(posX, posX2); + double minY=Math.min(posY, posY2); + double maxY=Math.max(posY, posY2); + double minZ=Math.min(posZ, posZ2); + double maxZ=Math.max(posZ, posZ2); + return !(maxXcollisionBox.maxX || + maxYcollisionBox.maxY || + maxZcollisionBox.maxZ); + } + } + + public static boolean isInsideofBoundingBox(AxisAlignedBB bb, float xi, float yi, float zi) + { + return bb.maxX>xi && bb.minXyi && bb.minYzi && bb.minZ ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + File fileFrom = new File(IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml").getFile()); + Files.copy(fileFrom, file); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/9e/b0b1b07b0b8e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/9e/b0b1b07b0b8e00151544f45b8684d31e new file mode 100644 index 0000000..64fb284 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/9e/b0b1b07b0b8e00151544f45b8684d31e @@ -0,0 +1,260 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class ExplosionVector +{ + public Set startVectors = new HashSet(); + public Map> vectors = new HashMap(); + public Map explosionPower = new HashMap(); + public Map explosionPowerDampingFactor = new HashMap(); + private Random random = new Random(); + + public ExplosionVector() + { + this.precalculateExplosion(); + } + + public void precalculateExplosion() + { + int maxExplosionRadius=32; + for(int levelRadius=1; levelRadiusMath.round(levelRadius*1.8f)) + { + prevX=reduceVariableByAbsoluteValue(prevX); + prevY=reduceVariableByAbsoluteValue(prevY); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(ix)<=Math.abs(iy) && Math.abs(ix)<=Math.abs(iz)) + { + prevY=reduceVariableByAbsoluteValue(prevY); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(iy)<=Math.abs(ix) && Math.abs(iy)<=Math.abs(iz)) + { + prevX=reduceVariableByAbsoluteValue(prevX); + prevZ=reduceVariableByAbsoluteValue(prevZ); + } + else if(Math.abs(iz)<=Math.abs(ix) && Math.abs(iz)<=Math.abs(iy)) + { + prevY=reduceVariableByAbsoluteValue(prevY); + prevX=reduceVariableByAbsoluteValue(prevX); + } + long prevKey = IHLUtils.encodeXYZ(prevX,prevY,prevZ); + if(prevX==ix && prevY==iy && prevZ==iz && levelRadius>1) + { + IHLMod.log.error("Was:"+ix+"/" +iy+"/" +iz+"/"); + IHLMod.log.error("Now:"+prevX+"/" +prevY+"/" +prevZ+"/"); + throw new ArithmeticException("Variables are out of expected range. \n Expected are not equal: "+ix+"="+prevX+" "+iy+"="+prevY+" "+iz+"="+prevZ); + } + if(levelRadius==1) + { + startVectors.add(coordinateKey); + this.addElement(coordinateKey, prevX, prevY, prevZ, ix, iy, iz); + } + else if(vectors.containsKey(prevKey)) + { + prevKey=this.getParentWithLowestDescendantsRate(prevKey, prevX, prevY, prevZ, levelRadius); + vectors.get(prevKey).add(coordinateKey); + this.addElement(coordinateKey, prevX, prevY, prevZ, ix, iy, iz); + } + else + { + IHLMod.log.error("Was:"+ix+"/" +iy+"/" +iz+"/"); + IHLMod.log.error("Now:"+prevX+"/" +prevY+"/" +prevZ+"/"); + IHLMod.log.info("ExplosionVector is missing parent! Help him!"); + } + } + } + } + } + } + } + } + + private long getParentWithLowestDescendantsRate(long prevKey, int prevX, int prevY, int prevZ, int levelRadius) + { + long prevKey1 = prevKey; + int xyzi[] = {0,0,-1,0,0,1,0,0}; + int x2,y2,z2; + int descendantsRate=vectors.get(prevKey).size(); + for(int i=0;i<=5;i++) + { + x2=prevX+xyzi[i]; + y2=prevY+xyzi[i+2]; + z2=prevZ+xyzi[i+1]; + long newKey = IHLUtils.encodeXYZ(x2, y2, z2); + boolean atALevelRadius = (Math.abs(x2)==levelRadius-1||Math.abs(y2)==levelRadius-1||Math.abs(z2)==levelRadius-1)&&(Math.abs(x2) breakBlocksAndGetDescendants(World world, EntityIHLExplosion exploder, Explosion explosion, long longNumber) + { + int multiplier = exploder.multiplier; + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int power1 = explosionPower.get(longNumber); + int repeat=0; + //System.out.println("Power before " + power1); + if(Math.abs(xyz[0])>=Math.abs(xyz[1]) && Math.abs(xyz[0])>=Math.abs(xyz[2])) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + else if(Math.abs(xyz[1])>=Math.abs(xyz[0]) && Math.abs(xyz[1])>=Math.abs(xyz[2])) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + else + { + for(int iz=xyz[2]>0?0:multiplier-1;iz=0;iz=xyz[2]>0?iz+1:iz-1) + { + for(int ix=xyz[0]>0?0:multiplier-1;ix=0;ix=xyz[0]>0?ix+1:ix-1) + { + for(int iy=xyz[1]>0?0:multiplier-1;iy=0;iy=xyz[1]>0?iy+1:iy-1) + { + power1 = this.getNewPowerAndProcessBlocks(world, exploder, explosion, xyz, multiplier, ix, iy, iz, power1); + } + } + } + } + power1=Math.round(power1*explosionPowerDampingFactor.get(longNumber)-0.5f); + //System.out.println("Power after " + power1 + " \n repeats "+repeat); + if(power1<=1 || !vectors.containsKey(longNumber)|| vectors.get(longNumber).isEmpty()) + { + exploder.effectBorderBlocks.add(longNumber); + if(xyz[1]<0 || (exploder.y<=6 && xyz[1]<=6)) + { + exploder.effectBorderBlocksWithLowPosition.add(longNumber); + } + return null; + } + else + { + for(long d1:vectors.get(longNumber)) + { + explosionPower.put(d1, power1); + } + return vectors.get(longNumber); + } + } + + private int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + private int getNewPowerAndProcessBlocks(World world, EntityIHLExplosion exploder, Explosion explosion, int xyz[], int multiplier, int ix, int iy, int iz, int power2) + { + int power1=power2; + int x = exploder.x+xyz[0]*multiplier+ix; + int y = exploder.y+xyz[1]*multiplier+iy; + int z = exploder.z+xyz[2]*multiplier+iz; + if(y<=4 || y>256) + { + return 0; + } + Block block = exploder.getBlock(x, y, z); + int explosionResistance = Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + if(explosionResistance>=power1) + { + power1=0; + } + else + { + power1-=Math.round(block.getExplosionResistance(exploder, world, x, y, z, exploder.x, exploder.y, exploder.z)*10f); + Entity entity = exploder.getEntity(x, y, z); + if(entity!=null) + { + entity.attackEntityFrom(exploder.damageSource, power1/10f); + } + block.onBlockDestroyedByExplosion(world, x, y, z, explosion); + exploder.setBlockToAir(x, y, z); + } + return power1; + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a/700d2b9561b500151fdb993ef9230294 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a/700d2b9561b500151fdb993ef9230294 new file mode 100644 index 0000000..735124b --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a/700d2b9561b500151fdb993ef9230294 @@ -0,0 +1,572 @@ +package ihl.flexible_cable; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import ihl.IHLMod; +import ihl.IHLModInfo; +import ihl.interfaces.ICableHolder; +import ihl.interfaces.IDataCableHolder; +import ihl.interfaces.IEnergyNetNode; +import ihl.interfaces.INetworkListener; +import ihl.utils.IHLUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class NodeEntity extends Entity implements INetworkListener{ + + public Entity prevAnchorEntity; + public Entity nextAnchorEntity; + private int anchorX; + private int anchorY; + private int anchorZ; + private short anchorFacing; + private int anchorDimensionId; + public ItemStack attachedItem; + protected int chainUniqueID=-2; + public int chainArrangeNumber=-2; + protected int checkTimer=201; + public int colorIndex=16777215; + public int type=1;//0 - uninsulated wire; 1 - insulated cable; 2 - data cable + public float dx0=0; + public float dy0=0; + public float dz0=0; + public final int n=64; + public final float[] rotationPitchArray = new float[n+1]; + public final float[] rotationYawArray = new float[n+1]; + public final float[] translationX = new float[n+1]; + public final float[] translationY = new float[n+1]; + public final float[] translationZ = new float[n+1]; + public float virtualNodePosX; + public float virtualNodePosY; + public float virtualNodePosZ; + public float renderPosX; + public float renderPosY; + public float renderPosZ; + + public NodeEntity(World world) + { + super(world); + if(world.isRemote) + { + IHLMod.proxy.addEntityToList(this); + this.setSize(2f, 0.2f); + } + else + { + IHLMod.proxy.addEntityToServerList(this); + this.setSize(0.5F, 0.1F); + } + this.renderDistanceWeight = 5.0D; + this.yOffset+=0.15F; + this.virtualNodePosX=(float) this.posX; + this.virtualNodePosY=(float) this.posY; + this.virtualNodePosZ=(float) this.posZ; + } + + @Override + public void setInPortal(){} + + @Override + public void travelToDimension(int dimensionId){} + + public void setSize(float width, float heigth) + { + super.setSize(width, heigth); + } + + public void setVirtualNodePos(float posX,float posY, float posZ) + { + virtualNodePosX=posX; + virtualNodePosY=posY; + virtualNodePosZ=posZ; + this.registerAndSendData(null); + } + + public void registerAndSendData(EntityPlayerMP player) + { + if(!worldObj.isRemote) + { + Set nes; + if(IHLMod.proxy.nodeEntityRegistry.containsKey(this.getChainUniqueID())) + { + nes=IHLMod.proxy.nodeEntityRegistry.get(this.getChainUniqueID()); + } + else + { + nes=new HashSet(); + IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes); + } + nes.add(this); + ByteBuf bb = Unpooled.buffer(30); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(1); + byteBufOutputStream.writeInt(this.getEntityId()); + byteBufOutputStream.writeInt(this.getChainUniqueID()); + byteBufOutputStream.writeInt(this.chainArrangeNumber); + byteBufOutputStream.writeByte(this.type); + byteBufOutputStream.writeInt(this.colorIndex); + byteBufOutputStream.writeFloat(this.virtualNodePosX); + byteBufOutputStream.writeFloat(this.virtualNodePosY); + byteBufOutputStream.writeFloat(this.virtualNodePosZ); + if(player==null) + { + IHLMod.proxy.sendFromServerToAll(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID)); + } + else + { + IHLMod.proxy.sendFromServerToPlayer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID),player); + } + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + if(!noClip && !worldObj.isRemote) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + if(this.checkTimer==201) + { + if(worldObj.isRemote) + { + IHLMod.proxy.recieveDelayedDataPacket(this); + } + else + { + this.registerAndSendData(null); + } + } + if((prevAnchorEntity==null && !noClip)||(nextAnchorEntity==null || nextAnchorEntity instanceof EntityPlayer || nextAnchorEntity instanceof EntityItem)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + NodeEntity node=(NodeEntity) ei.next(); + if(node.getChainUniqueID()==this.getChainUniqueID()) + { + if(node.chainArrangeNumber==this.chainArrangeNumber-1) + { + this.prevAnchorEntity=node; + node.nextAnchorEntity=this; + } + else if(node.chainArrangeNumber==this.chainArrangeNumber+1) + { + this.nextAnchorEntity=node; + node.prevAnchorEntity=this; + } + } + if(prevAnchorEntity!=null && nextAnchorEntity!=null) + { + break; + } + } + } + } + if(this.attachedItem!=null && (this.nextAnchorEntity == null || this.nextAnchorEntity.isDead) && !this.noClip) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityPlayer player=(EntityPlayer) ei.next(); + if(this.playerHasItemStack(player)) + { + this.nextAnchorEntity=player; + } + + } + } + } + if(this.attachedItem!=null && this.nextAnchorEntity instanceof EntityPlayer && !noClip) + { + EntityPlayer player = (EntityPlayer) this.nextAnchorEntity; + if(!this.playerHasItemStack(player)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityItem eitem = ei.next(); + if(eitem.getEntityItem().isItemEqual(this.attachedItem)) + { + this.nextAnchorEntity=eitem; + break; + } + } + } + } + } + if(!worldObj.isRemote) + { + { + double x0,x2,y0,y2,z0,z2; + x2=x0=this.virtualNodePosX; + y2=y0=this.virtualNodePosY; + z2=z0=this.virtualNodePosZ; + if(nextAnchorEntity!=null) + { + x2=nextAnchorEntity.posX; + y2=nextAnchorEntity.posY; + z2=nextAnchorEntity.posZ; + } + if(prevAnchorEntity!=null) + { + x0=prevAnchorEntity.posX; + y0=prevAnchorEntity.posY; + z0=prevAnchorEntity.posZ; + } + + double d1 = (x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)+(z0-z2)*(z0-z2); + if(d1>4D) + { + this.motionX=(x0+x2)*0.05D-this.posX*0.1D; + this.motionY=(y0+y2)*0.05D-this.posY*0.1D; + this.motionZ=(z0+z2)*0.05D-this.posZ*0.1D; + if(nextAnchorEntity!=null && this.getDistanceSqToEntity(nextAnchorEntity)>4D) + { + this.nextAnchorEntity.addVelocity((this.posX-this.nextAnchorEntity.posX)*0.01D, (this.posY-this.nextAnchorEntity.posY)*0.01D, (this.posZ-this.nextAnchorEntity.posZ)*0.01D); + } + } + else + { + double d2 = this.getDistanceSq(x2,y2,z2); + if(d2>1D) + { + this.motionX+=(x2-this.posX)*0.01D; + this.motionY+=(y2-this.posY)*0.01D; + this.motionZ+=(z2-this.posZ)*0.01D; + } + double d3 = this.getDistanceSq(x0,y0,z0); + if(d3>1D) + { + this.motionX+=(x0-this.posX)*0.01D; + this.motionY+=(y0-this.posY)*0.01D; + this.motionZ+=(z0-this.posZ)*0.01D; + } + } + this.motionY-=0.005D; + } + } + if(this.onGround) + { + this.motionY *= -0.5D; + } + this.motionX*=0.9D; + this.motionY*=0.9D; + this.motionZ*=0.9D; + if(worldObj.isRemote) + { + this.renderPosX=(float) this.prevPosX; + this.renderPosY=(float) this.prevPosY; + this.renderPosZ=(float) this.prevPosZ; + float xi,yi,zi; + float x0=xi=(float)this.prevPosX; + float y0=yi=(float)this.prevPosY; + float z0=zi=(float)this.prevPosZ; + float dx0=this.dx0; + float dy0=this.dy0; + float dz0=this.dz0; + float dx1=this.virtualNodePosX-xi; + float dy1=this.virtualNodePosY-yi; + float dz1=this.virtualNodePosZ-zi; + if(this.nextAnchorEntity!=null) + { + dx1=(float) (this.nextAnchorEntity.prevPosX-xi); + dy1=(float) (this.nextAnchorEntity.prevPosY-yi); + dz1=(float) (this.nextAnchorEntity.prevPosZ-zi); + } + if(this.prevAnchorEntity==null) + { + this.renderPosX=x0=xi=this.virtualNodePosX; + this.renderPosY=y0=yi=this.virtualNodePosY; + this.renderPosZ=z0=zi=this.virtualNodePosZ; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + if(((NodeEntity)this.nextAnchorEntity).nextAnchorEntity!=null) + { + Entity nne = ((NodeEntity)this.nextAnchorEntity).nextAnchorEntity; + dx1=(float) (nne.prevPosX-xi); + dy1=(float) (nne.prevPosY-yi); + dz1=(float) (nne.prevPosZ-zi); + } + else + { + dx1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosX-xi); + dy1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosY-yi); + dz1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosZ-zi); + } + } + float x1=this.virtualNodePosX; + float y1=this.virtualNodePosY; + float z1=this.virtualNodePosZ; + if(this.nextAnchorEntity!=null) + { + x1=(float)this.nextAnchorEntity.prevPosX; + y1=(float)this.nextAnchorEntity.prevPosY; + z1=(float)this.nextAnchorEntity.prevPosZ; + } + int i1=0; + for(float i=1f/n;i<=1f+1f/n;i+=1f/n,i1++) + { + float dxi = xi; + float dyi = yi; + float dzi = zi; + xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0; + yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0; + zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0; + int blockX=(int)xi; + int blockY=(int)yi; + int blockZ=(int)zi; + dxi-=xi; + dyi-=yi; + dzi-=zi; + double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi); + float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI)); + float rotationPitch = (float) Math.atan2(dxi, dzi); + float rotationYaw = (float) (-Math.atan2(dyi, var7)); + rotationPitchArray[i1]=rotationPitch; + rotationYawArray[i1]=rotationYaw; + translationX[i1]=dxi; + translationY[i1]=dyi; + translationZ[i1]=dzi; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + NodeEntity next = (NodeEntity) this.nextAnchorEntity; + next.dx0=dx1; + next.dy0=dy1; + next.dz0=dz1; + } + } + if(--this.checkTimer<=0) + { + if(!worldObj.isRemote) + { + WorldServer world = MinecraftServer.getServer().worldServerForDimension(this.anchorDimensionId); + TileEntity te = world.getTileEntity(this.anchorX, this.anchorY, this.anchorZ); + if(te==null || !(te instanceof ICableHolder || te instanceof AnchorTileEntity)) + { + this.setDead(); + } + } + this.checkTimer=200; + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) + { + this.noClip=nbt.getBoolean("noClip"); + this.setChainUniqueID(nbt.getInteger("chainUniqueID")); + this.chainArrangeNumber=nbt.getInteger("chainArrangeNumber"); + this.anchorX=nbt.getInteger("anchorX"); + this.anchorY=nbt.getInteger("anchorY"); + this.anchorZ=nbt.getInteger("anchorZ"); + this.anchorFacing=nbt.getShort("anchorFacing"); + this.anchorDimensionId=nbt.getInteger("anchorDimensionId"); + this.type=nbt.getInteger("type"); + this.colorIndex=nbt.getInteger("colorIndex"); + if(nbt.hasKey("itemStack")) + { + NBTTagCompound stackTag = (NBTTagCompound) nbt.getTag("itemStack"); + this.attachedItem = ItemStack.loadItemStackFromNBT(stackTag); + } + if(nbt.hasKey("width")) + { + this.setSize(nbt.getFloat("width"), nbt.getFloat("height")); + } + this.virtualNodePosX=nbt.getFloat("virtualNodePosX"); + this.virtualNodePosY=nbt.getFloat("virtualNodePosY"); + this.virtualNodePosZ=nbt.getFloat("virtualNodePosZ"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) + { + nbt.setFloat("width", this.width); + nbt.setFloat("height", this.height); + nbt.setBoolean("noClip", noClip); + nbt.setInteger("chainUniqueID", this.getChainUniqueID()); + nbt.setInteger("chainArrangeNumber", this.chainArrangeNumber); + nbt.setInteger("anchorX", this.anchorX); + nbt.setInteger("anchorY", this.anchorY); + nbt.setInteger("anchorZ", this.anchorZ); + nbt.setShort("anchorFacing",this.anchorFacing); + nbt.setInteger("anchorDimensionId",this.anchorDimensionId); + nbt.setInteger("type", this.type); + nbt.setInteger("colorIndex", this.colorIndex); + if(this.attachedItem!=null) + { + NBTTagCompound stackTag = new NBTTagCompound(); + this.attachedItem.writeToNBT(stackTag); + nbt.setTag("itemStack",stackTag); + } + nbt.setFloat("virtualNodePosX",this.virtualNodePosX); + nbt.setFloat("virtualNodePosY",this.virtualNodePosY); + nbt.setFloat("virtualNodePosZ",this.virtualNodePosZ); + } + + public void setAnchor(int x, int y, int z, short facing, int dimensionId) + { + this.anchorX=x; + this.anchorY=y; + this.anchorZ=z; + this.anchorFacing=facing; + this.anchorDimensionId=dimensionId; + } + + public boolean playerHasItemStack(EntityPlayer player) + { + int var2; + + for (var2 = 0; var2 < player.inventory.armorInventory.length; ++var2) + { + if (player.inventory.armorInventory[var2] != null && player.inventory.armorInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.armorInventory[var2].stackTagCompound==null?false:player.inventory.armorInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + for (var2 = 0; var2 < player.inventory.mainInventory.length; ++var2) + { + if (player.inventory.mainInventory[var2] != null && player.inventory.mainInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.mainInventory[var2].stackTagCompound==null?false:player.inventory.mainInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + return false; + } + + public int getChainUniqueID() { + return chainUniqueID; + } + + public void setChainUniqueID(int chainUniqueID) { + this.chainUniqueID = chainUniqueID; + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) + { + if(this.noClip) + { + return null; + } + else + { + return super.getCollisionBox(entity); + } + } + + @Override + public int getId() + { + return this.getEntityId(); + } + + @Override + public void recieveData(ByteBufInputStream byteBufInputStream) + { + try + { + this.setChainUniqueID(byteBufInputStream.readInt()); + this.chainArrangeNumber=byteBufInputStream.readInt(); + this.type=byteBufInputStream.readByte(); + this.colorIndex=byteBufInputStream.readInt(); + this.virtualNodePosX=byteBufInputStream.readFloat(); + this.virtualNodePosY=byteBufInputStream.readFloat(); + this.virtualNodePosZ=byteBufInputStream.readFloat(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @Override + protected void entityInit() {} + + @Override + public boolean isInvalid() + { + return this.isDead; + } + + public void setVirtualNodePosToNearestPortal() + { + int x0 = (int)this.posX; + int y0 = (int)this.posY; + int z0 = (int)this.posZ; + for(int xi=x0-2;xi<=x0+2;xi++) + { + for(int yi=y0-2;yi<=y0+2;yi++) + { + for(int zi=z0-2;zi<=z0+2;zi++) + { + Block block = worldObj.getBlock(xi, yi, zi); + if(block==Blocks.portal||block==Blocks.end_portal) + { + this.setVirtualNodePos(xi+0.5f, yi+0.5f, zi+0.5f); + return; + } + } + } + } + + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a0/00f7674b748b0015134481ec712b17ae b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a0/00f7674b748b0015134481ec712b17ae new file mode 100644 index 0000000..bbc52ab --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a0/00f7674b748b0015134481ec712b17ae @@ -0,0 +1,274 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/4063232,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + for(int eay=0;eay ebbi = effectBorderBlocks.iterator(); + long longNumber = ebbi.next(); + ebbi.remove(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(this.isBlockConnectedWithBedrock(longNumber)) + { + + } + } + } + while(!this.explosionDone) + { + update(); + } + } + + private boolean isBlockConnectedWithBedrock(long longNumber) + { + Set path = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + break; + } + } + } + } + return false; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a2/b0dbc47f07a50015138cc582c427ac91 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a2/b0dbc47f07a50015138cc582c427ac91 new file mode 100644 index 0000000..4b8e182 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a2/b0dbc47f07a50015138cc582c427ac91 @@ -0,0 +1,66 @@ +package ihl.processing.chemistry; + +import ic2.core.ContainerBase; +import ic2.core.slot.SlotInvSlot; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; + +public class LoomContainer extends ContainerBase { + + public LoomTileEntity tileEntity; + public int lastProgress = -1; + private final static int height=166; + + public LoomContainer(EntityPlayer entityPlayer, + LoomTileEntity lathePart1TileEntity) { + super(lathePart1TileEntity); + tileEntity=lathePart1TileEntity; + int col; + + for (col = 0; col < 3; ++col) + { + for (int col1 = 0; col1 < 9; ++col1) + { + this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18)); + } + } + + for (col = 0; col < 9; ++col) + { + this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24)); + } + this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 0, 8, 44)); + this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.output, 0, 127, 44)); + } + + @Override + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + for (int i = 0; i < this.crafters.size(); ++i) + { + ICrafting icrafting = (ICrafting)this.crafters.get(i); + if (this.tileEntity.progress != this.lastProgress) + { + icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress); + } + } + this.lastProgress = this.tileEntity.progress; + } + + @Override + public void updateProgressBar(int index, int value) + { + super.updateProgressBar(index, value); + + switch (index) + { + case 0: + this.tileEntity.progress=(short) value; + break; + + } + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a7/f042703fd8b20015115782a55d40af78 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a7/f042703fd8b20015115782a55d40af78 new file mode 100644 index 0000000..084b4c0 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/a7/f042703fd8b20015115782a55d40af78 @@ -0,0 +1,395 @@ +package ihl.flexible_cable; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.core.ExplosionIC2; +import ic2.core.IC2; +import ic2.core.block.TileEntityBlock; +import ihl.IHLMod; +import ihl.interfaces.IEnergyNetNode; +import ihl.utils.IHLUtils; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; + +public class AnchorTileEntity extends TileEntityBlock implements IEnergySink, IEnergySource +{ + public boolean addedToEnergyNet=false; + private final Set sacrifices = new HashSet(); + public SubAnchorEnergyNetNode[] energyNetNodes = new SubAnchorEnergyNetNode[6]; + public boolean[] hasCableOnSide=new boolean [] {false,false,false,false,false,false}; + public int checksum=-1; + + public AnchorTileEntity() + { + super(); + for(short i=0;i<6;i++) + { + energyNetNodes[i] = new SubAnchorEnergyNetNode(this, i); + } + } + + @Override + public List getNetworkedFields() + { + List fields = super.getNetworkedFields(); + fields.add("hasCableOnSide"); + return fields; + } + + @Override + public void onLoaded() + { + super.onLoaded(); + if (IC2.platform.isSimulating()&&!this.addedToEnergyNet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + this.addedToEnergyNet = true; + } + for(short i=0;i<6;i++) + { + energyNetNodes[i].onLoaded(); + } + } + + @Override + public void onUnloaded() + { + if (IC2.platform.isSimulating()) + { + if(this.addedToEnergyNet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + this.addedToEnergyNet = false; + } + } + } + + @Override + public boolean wrenchCanRemove(EntityPlayer var1) + { + return false; + } + + public boolean enableUpdateEntity() + { + return IC2.platform.isSimulating(); + } + + @Override + public void updateEntityServer() + { + if(!sacrifices.isEmpty()) + { + Iterator victimIterator = sacrifices.iterator(); + while(victimIterator.hasNext()) + { + TileEntity sacrifice = victimIterator.next(); + ExplosionIC2 explosion = new ExplosionIC2(this.worldObj, null, sacrifice.xCoord+0.5D, sacrifice.yCoord+0.5D, sacrifice.zCoord+0.5D, 3F, 0.3F, ExplosionIC2.Type.Normal, null, 0); + explosion.doExplosion(); + sacrifices.remove(sacrifice); + } + + } + int newchecksum=0; + for(short i=0;i<6;i++) + { + if(this.hasCableOnSide[i]) + { + newchecksum++; + } + } + if(newchecksum!=checksum) + { + IC2.network.get().updateTileEntityField(this, "hasCableOnSide"); + checksum=newchecksum; + } + else if(newchecksum==0) + { + for(short i=0;i<6;i++) + { + if(!this.energyNetNodes[i].getCableList().isEmpty()) + { + newchecksum++; + } + } + //if(newchecksum==0)worldObj.setBlockToAir(xCoord, yCoord, zCoord); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + NBTTagList energyNetNodeNBTList = new NBTTagList(); + for(SubAnchorEnergyNetNode node:this.energyNetNodes) + { + energyNetNodeNBTList.appendTag(node.writeToNBT()); + } + nbt.setTag("energyNetNodes", energyNetNodeNBTList); + if(nbt.hasKey("facing")) + { + nbt.removeTag("facing"); + } + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + if(nbt.hasKey("facing")) + { + short facing = nbt.getShort("facing"); + int gridID=nbt.getInteger("gridID"); + this.energyNetNodes[facing].setGrid(gridID); + NBTTagList cableNBTList=nbt.getTagList("cableList", 10); + for(int i=0;i ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + File fileFrom = new File(IHLMod.proxy.getMinecraftDir(),"/assets/ihl/config/ihl-guidebook.xml"); + //File fileFrom = new File(IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml").getFile()); + Files.copy(fileFrom, file); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b3/b025dae449a3001516ebc455efc032e5 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b3/b025dae449a3001516ebc455efc032e5 new file mode 100644 index 0000000..97c05f6 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b3/b025dae449a3001516ebc455efc032e5 @@ -0,0 +1,116 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { +// File fileFrom = new File(IHLMod.proxy.getMinecraftDir(),"/assets/ihl/config/ihl-guidebook.xml"); + File fileFrom = new File(IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml").getFile()); + Files.copy(fileFrom, file); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b8/a00189f69cb4001510d7bdb0b1be77c9 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b8/a00189f69cb4001510d7bdb0b1be77c9 new file mode 100644 index 0000000..227d0c1 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/b8/a00189f69cb4001510d7bdb0b1be77c9 @@ -0,0 +1,934 @@ +package ihl.utils; + +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.Recipes; +import ic2.core.block.invslot.InvSlotOutput; +import ihl.IHLMod; +import ihl.interfaces.IWire; +import ihl.metallurgy.constants.*; +import ihl.processing.invslots.InvSlotConsumableLiquidIHL; +import ihl.recipes.IRecipeInputFluid; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.mutable.MutableObject; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.oredict.OreDictionary; + +public class IHLUtils +{ + private static Map ihlItemStackRegistry = new HashMap(); + + public static void registerLocally(String name, ItemStack stack) + { + ihlItemStackRegistry.put(name, stack); + } + + public static ItemStack getOreDictItemStack(String name) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=1; + return orecopy; + } + + public static boolean hasOreDictionaryEntry(String name) + { + return !OreDictionary.getOres(name).isEmpty(); + } + + public static Item getOreDictItem(String name) + { + return OreDictionary.getOres(name).get(0).getItem(); + } + + public static Block getOreDictBlock(String name) + { + return Block.getBlockFromItem(OreDictionary.getOres(name).get(0).getItem()); + } + + public static ItemStack getOreDictItemStackWithSize(String name, int size) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=size; + return orecopy; + } + + public static String getFirstOreDictName(ItemStack stack) + { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + if(arrayIDs.length>0) + { + return OreDictionary.getOreName(arrayIDs[0]); + } + return ""; + } + + public static ItemStack getThisModItemStack(String name) + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + + public static ItemStack getThisModItemStackWithSize(String name, int i) { + if(ihlItemStackRegistry.get(name)!=null) + { + ItemStack stack = ihlItemStackRegistry.get(name).copy(); + stack.stackSize=i; + return stack; + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name),i); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name),i); + } + } + + public static ItemStack getOtherModItemStackWithDamage(String modname, String name,int damage) { + if(GameRegistry.findItem(modname, name)!=null) + { + return new ItemStack(GameRegistry.findItem(modname, name),1,damage); + } + else if(GameRegistry.findBlock(modname, name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock(modname, name),1,damage); + } + } + + public static Item getThisModItem(String name) + { + if(GameRegistry.findItem("ihl", name)!=null) + { + return GameRegistry.findItem("ihl", name); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return Item.getItemFromBlock(GameRegistry.findBlock("ihl", name)); + } + } + + public static FluidStack getFluidStackWithSize(String name, int i) { + if(FluidRegistry.isFluidRegistered(name)) + { + return FluidRegistry.getFluidStack(name, i); + } + else + { + throw new IllegalArgumentException("No such fluid: "+name); + } + } + + public static Block getThisModBlock(String name) + { + if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such block in item registry: ihl:"+name); + } + else + { + return GameRegistry.findBlock("ihl", name); + } + } + + public static ItemStack getThisModItemStackWithDamage(String name, + int value) + { + ItemStack stack = getThisModItemStack(name); + stack.setItemDamage(value); + return stack; + } + + public static boolean adjustWireLength(ItemStack stack, int adjustBy) + { + int length = getWireLength(stack); + if(length<=0) + { + return true; + } + else + { + int newLength = Math.max(length+adjustBy,0); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),newLength); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),newLength); + if(newLength==0) + { + return true; + } + return false; + } + } + + public static int getWireLength(ItemStack itemStack) + { + return itemStack.stackTagCompound.getInteger(((IWire)itemStack.getItem()).getTag()); + } + + public static ItemStack getThisModWireItemStackWithLength(String name, int i) { + if(getThisModItemStack(name)!=null) + { + ItemStack stack = getThisModItemStack(name); + if(stack.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException("ihl:"+name + " is not an instance of IWire."); + } + } + else + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + } + + public static ItemStack getThisModWireItemStackWithLength(ItemStack stack1, int i) { + ItemStack stack = stack1.copy(); + if(stack1.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException(stack1.getUnlocalizedName() + " is not an instance of IWire."); + } + } + + public static boolean isItemsHaveSameOreDictionaryEntry(ItemStack is, ItemStack is1) + { + int[] odids1 = OreDictionary.getOreIDs(is); + int[] odids2 = OreDictionary.getOreIDs(is1); + if(odids1!=null && odids1.length>0 && odids2!=null && odids2.length>0) + { + for(int i1=0;i1 getEntryListForOre(String name) + { + ArrayList outputList = new ArrayList(); + ArrayList oreList = OreDictionary.getOres(name); + Iterator oreListIterator = oreList.iterator(); + while(oreListIterator.hasNext()) + { + outputList.add(oreListIterator.next().copy()); + } + return outputList; + } + + public static ItemStack getItemStackIfExist(String name) + { + if(hasOreDictionaryEntry(name)) + { + return getOreDictItemStack(name); + } + else + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + } + + public static FluidStack getFluidStackIfExist(String string, int meltingFluidAmount) + { + if(FluidRegistry.isFluidRegistered(string)) + { + return getFluidStackWithSize(string,meltingFluidAmount); + } + return null; + } + + public static boolean addItemStackToInventory(EntityPlayer player, ItemStack stack) + { + ItemStack[] inv = player.inventory.mainInventory; + for (int i=0;i<=35;i++) + { + if(inv[i]!=null) + { + if(inv[i].getItem()==stack.getItem()) + { + if(inv[i].getItemDamage()==stack.getItemDamage() && inv[i].stackSizeinv[i].getMaxStackSize()) + { + stack.stackSize=inv[i].stackSize-inv[i].getMaxStackSize(); + } + else + { + return true; + } + } + } + } + else + { + inv[i]=stack; + return true; + } + } + return false; + } + + public static FluidStack getFluidStackWithSizeChemicallyPure(String name, int amount) + { + FluidStack fstack = getFluidStackWithSize(name, amount); + fstack.tag=new NBTTagCompound(); + fstack.tag.setBoolean("chemicallyPure", true); + return fstack; + } + + public static void removeItemStackFromOreDictionaryEntry(String orename, ItemStack itemStack) + { + ArrayList orelist = OreDictionary.getOres(orename); + Iterator oreListIterator = orelist.iterator(); + ItemStack odstack = null; + while(oreListIterator.hasNext()) + { + odstack = oreListIterator.next(); + if(odstack.getItem()==itemStack.getItem()) + { + break; + } + else + { + odstack = null; + } + } + if(odstack != null) + { + orelist.remove(odstack); + IHLMod.log.debug("Stack "+odstack.getDisplayName()+" ("+odstack.toString()+")"+" removed from ore entry '"+orename+"'"); + } + } + + public static void addIC2MaceratorRecipe(String input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputOreDict(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(String input, int stacksize, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStackWithSize(input,stacksize), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputOreDict(input,stacksize), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(ItemStack input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(ItemStack input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(String input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(getThisModItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputOreDict(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2CentrifugeRecipe(String input, ItemStack output, ItemStack output2) + { + if(Recipes.centrifuge.getOutputFor(getOreDictItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("minHeat", 2000); + Recipes.centrifuge.addRecipe(new RecipeInputOreDict(input), tag, new ItemStack[] {output,output2}); + } + else + { + //IHLMod.log.info("IC2 centrifuge recipe for "+input+" already exist. Skipped."); + } + } + + public static void damageItemViaNBTTag(ItemStack stack, int amount) + { + NBTTagCompound gtTagCompound; + if(stack.stackTagCompound.hasKey("GT.ToolStats")) + { + gtTagCompound = stack.stackTagCompound.getCompoundTag("GT.ToolStats"); + } + else + { + stack.stackSize--; + return; + } + int damage = 0; + int maxDamage = 0; + if(gtTagCompound.hasKey("MaxDamage")) + { + maxDamage = gtTagCompound.getInteger("MaxDamage"); + } + else + { + stack.stackSize--; + return; + } + + if(gtTagCompound.hasKey("Damage")) + { + damage = gtTagCompound.getInteger("Damage"); + } + if(damage=input.getAmount(); + } + else + { + return stack.stackSize>=input.getAmount(); + } + } + return false; + } + + public static boolean reduceItemStackAmountUsingIRecipeInput(IRecipeInput input, ItemStack stack) { + if(stack.getItem() instanceof IWire) + { + return adjustWireLength(stack,-input.getAmount()); + } + else + { + stack.stackSize-=input.getAmount(); + return stack.stackSize<=0; + } + } + + public static String getFirstOreDictNameExcludingTagAny(ItemStack stack) { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + for(int i=0;i0 && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fluidTank.fill(drainInputSlot.drain(null, fluidTank.getCapacity()-fluidTank.getFluidAmount(), output, false),true); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + if (fillInputSlot!=null && !fillInputSlot.isEmpty()) + { + output = new MutableObject(); + if (fillInputSlot.transferFromTank(fluidTank, output, true) && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fillInputSlot.transferFromTank(fluidTank, output, false); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + } + public static double[] tracePlayerView(EntityPlayer entityplayer) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + if (entityplayer.worldObj!=null && entityplayer.worldObj.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + double z = entityplayer.posZ; + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 1.0D; + return new double[] {x+f7 * d3, y+f6 * d3, z+f9 * d3}; + } + + public static MovingObjectPosition returnMOPFromPlayer(EntityPlayer entityplayer, World world) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + + if (world.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + + double z = entityplayer.posZ; + Vec3 vec3d = Vec3.createVectorHelper(x, y, z); + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 5.0D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f6 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks(vec3d, vec3d1, true); + + if (movingobjectposition == null) + { + return null; + } + + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + return movingobjectposition; + } + return null; + } + + public static short getFacingFromPlayerView(EntityLivingBase player, boolean ignoreSneaking) + { + int var6 = MathHelper.floor_double(player.rotationPitch * 4.0F / 360.0F + 0.5D) & 3; + int var7 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + { + if(var6==1) + { + return 1; + } + else if(var6==3) + { + return 0; + } + else + { + if(player.isSneaking() && !ignoreSneaking) + { + switch(var7) + { + case 0: + return 3; + case 1: + return 4; + case 2: + return 2; + case 3: + return 5; + default: + break; + } + } + else + { + switch(var7) + { + case 0: + return 2; + case 1: + return 5; + case 2: + return 3; + case 3: + return 4; + default: + break; + } + } + } + } + return 3; + } + + public static int getChainID(ItemStack itemStack) + { + if(itemStack!=null && itemStack.stackTagCompound!=null && itemStack.stackTagCompound.hasKey("chainUID")) + { + return itemStack.stackTagCompound.getInteger("chainUID"); + } + return -1; + } + + public static List convertRecipeInputToItemStackList(List input) + { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInput iri = irii.next(); + ItemStack stack = iri.getInputs().get(0); + stack.stackSize=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static List convertRecipeInputToFluidStackList(List input) { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInputFluid iri = irii.next(); + FluidStack stack = iri.getInputs().get(0); + stack.amount=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static int[] decodeXYZ(long longNumber) + { + return new int[] {(int) ((longNumber>>30) & 0xfff)-256,(int) ((longNumber>>15) & 0xfff)-256,(int) (longNumber & 0xfff)-256}; + } + + public static long encodeXYZ(int x,int y,int z) + { + return (x+256L)<<30|((y+256L)<<15)|(z+256L); + } + + public static int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + public static long getXYZHash(int x,int y,int z) + { + return ((x&0x1FFFFF)<<42)|((y&0x1FFFFF)<<21)|(z&0x1FFFFF); + } + + public static String trim(String str) + { + int len = str.length(); + int start; + char c; + for (start = 0; start < len; ++start) + { + c = str.charAt(start); + if (c > 32 && c != 65279) + { + break; + } + } + int end; + for (end = len - 1; end >= start; --end) + { + c = str.charAt(end); + if (c > 32 && c != 65279) + { + break; + } + } + return start <= 0 && end >= len - 1 ? str : str.substring(start, end + 1); + } + + public static int getAmountOf(ItemStack is) + { + if(is.getItem() instanceof IWire) + { + return getWireLength(is); + } + else + { + return is.stackSize; + } + } + + public static ItemStack getWireItemStackCopyWithLengthMultiplied(ItemStack stack, int multiplier) + { + ItemStack out = stack.copy(); + adjustWireLength(out,getWireLength(stack)*(multiplier-1)); + return out; + } + + public static ItemStack getUninsulatedWire(String material, int length, int transverseSection) { + ItemStack is = getThisModItemStack("copperWire"); + is.stackTagCompound=new NBTTagCompound(); + is.stackTagCompound.setBoolean("firstConnection",false); + is.stackTagCompound.setInteger("fullLength", length); + is.stackTagCompound.setInteger("length", length); + is.stackTagCompound.setBoolean("firstConnection", false); + is.stackTagCompound.setString("material", material); + is.stackTagCompound.setInteger("transverseSection",transverseSection); + is.stackTagCompound.setInteger("resistance", ElectricConductor.getResistivity(material)*100/transverseSection); + return is; + } + + public static ItemStack getInsulatedWire(String material, int length, int transverseSection, String insulationMaterial, int insulationThickness) { + ItemStack is = getUninsulatedWire(material, length, transverseSection); + is.stackTagCompound.setString("insulationMaterial",insulationMaterial); + is.stackTagCompound.setInteger("insulationThickness",insulationThickness); + is.stackTagCompound.setInteger("maxVoltage", getInsulationMaxVoltage(insulationMaterial, insulationThickness)); + return is; + } + + public static int getInsulationMaxVoltage(String insulationMaterial, int insulationThickness) + { + return Math.min(Insulation.getMaxVoltagePermm(insulationMaterial)*insulationThickness/10,Insulation.getMaxVoltageCap(insulationMaterial)); + } + + public static ItemStack getItemStackWithTag(String unLocalizedName, String tag, int tagValue) { + ItemStack stack = IHLUtils.getThisModItemStack(unLocalizedName); + if(stack.stackTagCompound==null) + { + stack.stackTagCompound=new NBTTagCompound(); + } + stack.stackTagCompound.setInteger(tag, tagValue); + return stack; + } + + public static boolean isSegmentInsideAABB(AxisAlignedBB collisionBox, double posX, double posY, double posZ, double posX2, double posY2, double posZ2) + { + if(isInsideofBoundingBox(collisionBox,(float)posX,(float)posY,(float)posZ)||isInsideofBoundingBox(collisionBox,(float)posX2,(float)posY2,(float)posZ2)) + { + return true; + } + else + { + double minX=Math.min(posX, posX2); + double maxX=Math.max(posX, posX2); + double minY=Math.min(posY, posY2); + double maxY=Math.max(posY, posY2); + double minZ=Math.min(posZ, posZ2); + double maxZ=Math.max(posZ, posZ2); + return !(maxXcollisionBox.maxX || + maxYcollisionBox.maxY || + maxZcollisionBox.maxZ); + } + } + + public static boolean isInsideofBoundingBox(AxisAlignedBB bb, float xi, float yi, float zi) + { + return bb.maxX>xi && bb.minXyi && bb.minYzi && bb.minZ nes; + if(IHLMod.proxy.nodeEntityRegistry.containsKey(this.getChainUniqueID())) + { + nes=IHLMod.proxy.nodeEntityRegistry.get(this.getChainUniqueID()); + } + else + { + nes=new HashSet(); + IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes); + } + nes.add(this); + ByteBuf bb = Unpooled.buffer(30); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(1); + byteBufOutputStream.writeInt(this.getEntityId()); + byteBufOutputStream.writeInt(this.getChainUniqueID()); + byteBufOutputStream.writeInt(this.chainArrangeNumber); + byteBufOutputStream.writeByte(this.type); + byteBufOutputStream.writeInt(this.colorIndex); + byteBufOutputStream.writeFloat(this.virtualNodePosX); + byteBufOutputStream.writeFloat(this.virtualNodePosY); + byteBufOutputStream.writeFloat(this.virtualNodePosZ); + if(player==null) + { + IHLMod.proxy.sendFromServerToAll(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID)); + } + else + { + IHLMod.proxy.sendFromServerToPlayer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID),player); + } + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + if(!noClip && !worldObj.isRemote) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + if(this.checkTimer==201) + { + if(worldObj.isRemote) + { + IHLMod.proxy.recieveDelayedDataPacket(this); + } + else + { + this.registerAndSendData(null); + } + } + if((prevAnchorEntity==null && !noClip)||(nextAnchorEntity==null || nextAnchorEntity instanceof EntityPlayer || nextAnchorEntity instanceof EntityItem)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + NodeEntity node=(NodeEntity) ei.next(); + if(node.getChainUniqueID()==this.getChainUniqueID()) + { + if(node.chainArrangeNumber==this.chainArrangeNumber-1) + { + this.prevAnchorEntity=node; + node.nextAnchorEntity=this; + } + else if(node.chainArrangeNumber==this.chainArrangeNumber+1) + { + this.nextAnchorEntity=node; + node.prevAnchorEntity=this; + } + } + if(prevAnchorEntity!=null && nextAnchorEntity!=null) + { + break; + } + } + } + } + if(this.attachedItem!=null && (this.nextAnchorEntity == null || this.nextAnchorEntity.isDead) && !this.noClip) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityPlayer player=(EntityPlayer) ei.next(); + if(this.playerHasItemStack(player)) + { + this.nextAnchorEntity=player; + } + + } + } + } + if(this.attachedItem!=null && this.nextAnchorEntity instanceof EntityPlayer && !noClip) + { + EntityPlayer player = (EntityPlayer) this.nextAnchorEntity; + if(!this.playerHasItemStack(player)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityItem eitem = ei.next(); + if(eitem.getEntityItem().isItemEqual(this.attachedItem)) + { + this.nextAnchorEntity=eitem; + break; + } + } + } + } + } + if(!worldObj.isRemote) + { + { + double x0,x2,y0,y2,z0,z2; + x2=x0=this.virtualNodePosX; + y2=y0=this.virtualNodePosY; + z2=z0=this.virtualNodePosZ; + if(nextAnchorEntity!=null) + { + x2=nextAnchorEntity.posX; + y2=nextAnchorEntity.posY; + z2=nextAnchorEntity.posZ; + } + if(prevAnchorEntity!=null) + { + x0=prevAnchorEntity.posX; + y0=prevAnchorEntity.posY; + z0=prevAnchorEntity.posZ; + } + + double d1 = (x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)+(z0-z2)*(z0-z2); + if(d1>4D) + { + this.motionX=(x0+x2)*0.05D-this.posX*0.1D; + this.motionY=(y0+y2)*0.05D-this.posY*0.1D; + this.motionZ=(z0+z2)*0.05D-this.posZ*0.1D; + if(nextAnchorEntity!=null && this.getDistanceSqToEntity(nextAnchorEntity)>4D) + { + this.nextAnchorEntity.addVelocity((this.posX-this.nextAnchorEntity.posX)*0.01D, (this.posY-this.nextAnchorEntity.posY)*0.01D, (this.posZ-this.nextAnchorEntity.posZ)*0.01D); + } + } + else + { + double d2 = this.getDistanceSq(x2,y2,z2); + if(d2>1D) + { + this.motionX+=(x2-this.posX)*0.01D; + this.motionY+=(y2-this.posY)*0.01D; + this.motionZ+=(z2-this.posZ)*0.01D; + } + double d3 = this.getDistanceSq(x0,y0,z0); + if(d3>1D) + { + this.motionX+=(x0-this.posX)*0.01D; + this.motionY+=(y0-this.posY)*0.01D; + this.motionZ+=(z0-this.posZ)*0.01D; + } + } + this.motionY-=0.005D; + } + } + if(this.onGround) + { + this.motionY *= -0.5D; + } + this.motionX*=0.9D; + this.motionY*=0.9D; + this.motionZ*=0.9D; + if(worldObj.isRemote) + { + this.renderPosX=(float) this.prevPosX; + this.renderPosY=(float) this.prevPosY; + this.renderPosZ=(float) this.prevPosZ; + float xi,yi,zi; + float x0=xi=(float)this.prevPosX; + float y0=yi=(float)this.prevPosY; + float z0=zi=(float)this.prevPosZ; + float dx0=this.dx0; + float dy0=this.dy0; + float dz0=this.dz0; + float dx1=this.virtualNodePosX-xi; + float dy1=this.virtualNodePosY-yi; + float dz1=this.virtualNodePosZ-zi; + if(this.nextAnchorEntity!=null) + { + dx1=(float) (this.nextAnchorEntity.prevPosX-xi); + dy1=(float) (this.nextAnchorEntity.prevPosY-yi); + dz1=(float) (this.nextAnchorEntity.prevPosZ-zi); + } + if(this.prevAnchorEntity==null) + { + this.renderPosX=x0=xi=this.virtualNodePosX; + this.renderPosY=y0=yi=this.virtualNodePosY; + this.renderPosZ=z0=zi=this.virtualNodePosZ; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + if(((NodeEntity)this.nextAnchorEntity).nextAnchorEntity!=null) + { + Entity nne = ((NodeEntity)this.nextAnchorEntity).nextAnchorEntity; + dx1=(float) (nne.prevPosX-xi); + dy1=(float) (nne.prevPosY-yi); + dz1=(float) (nne.prevPosZ-zi); + } + else + { + dx1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosX-xi); + dy1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosY-yi); + dz1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosZ-zi); + } + } + float x1=this.virtualNodePosX; + float y1=this.virtualNodePosY; + float z1=this.virtualNodePosZ; + if(this.nextAnchorEntity!=null) + { + x1=(float)this.nextAnchorEntity.prevPosX; + y1=(float)this.nextAnchorEntity.prevPosY; + z1=(float)this.nextAnchorEntity.prevPosZ; + } + int i1=0; + for(float i=1f/n;i<=1f+1f/n;i+=1f/n,i1++) + { + float dxi = xi; + float dyi = yi; + float dzi = zi; + xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0; + yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0; + zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0; + int blockX=(int)xi; + int blockY=(int)yi; + int blockZ=(int)zi; + dxi-=xi; + dyi-=yi; + dzi-=zi; + double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi); + float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI)); + float rotationPitch = (float) Math.atan2(dxi, dzi); + float rotationYaw = (float) (-Math.atan2(dyi, var7)); + rotationPitchArray[i1]=rotationPitch; + rotationYawArray[i1]=rotationYaw; + translationX[i1]=dxi; + translationY[i1]=dyi; + translationZ[i1]=dzi; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + NodeEntity next = (NodeEntity) this.nextAnchorEntity; + next.dx0=dx1; + next.dy0=dy1; + next.dz0=dz1; + } + } + if(--this.checkTimer<=0) + { + if(!worldObj.isRemote) + { + TileEntity te = MinecraftServer.getServer().worldServerForDimension(this.anchorDimensionId).getTileEntity(this.anchorX, this.anchorY, this.anchorZ); + if(te==null || !(te instanceof ICableHolder || te instanceof AnchorTileEntity)) + { + this.setDead(); + } + } + this.checkTimer=200; + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) + { + this.noClip=nbt.getBoolean("noClip"); + this.setChainUniqueID(nbt.getInteger("chainUniqueID")); + this.chainArrangeNumber=nbt.getInteger("chainArrangeNumber"); + this.anchorX=nbt.getInteger("anchorX"); + this.anchorY=nbt.getInteger("anchorY"); + this.anchorZ=nbt.getInteger("anchorZ"); + this.anchorFacing=nbt.getShort("anchorFacing"); + this.anchorDimensionId=nbt.getInteger("anchorDimensionId"); + this.type=nbt.getInteger("type"); + this.colorIndex=nbt.getInteger("colorIndex"); + if(nbt.hasKey("itemStack")) + { + NBTTagCompound stackTag = (NBTTagCompound) nbt.getTag("itemStack"); + this.attachedItem = ItemStack.loadItemStackFromNBT(stackTag); + } + if(nbt.hasKey("width")) + { + this.setSize(nbt.getFloat("width"), nbt.getFloat("height")); + } + this.virtualNodePosX=nbt.getFloat("virtualNodePosX"); + this.virtualNodePosY=nbt.getFloat("virtualNodePosY"); + this.virtualNodePosZ=nbt.getFloat("virtualNodePosZ"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) + { + nbt.setFloat("width", this.width); + nbt.setFloat("height", this.height); + nbt.setBoolean("noClip", noClip); + nbt.setInteger("chainUniqueID", this.getChainUniqueID()); + nbt.setInteger("chainArrangeNumber", this.chainArrangeNumber); + nbt.setInteger("anchorX", this.anchorX); + nbt.setInteger("anchorY", this.anchorY); + nbt.setInteger("anchorZ", this.anchorZ); + nbt.setShort("anchorFacing",this.anchorFacing); + nbt.setInteger("anchorDimensionId",this.anchorDimensionId); + nbt.setInteger("type", this.type); + nbt.setInteger("colorIndex", this.colorIndex); + if(this.attachedItem!=null) + { + NBTTagCompound stackTag = new NBTTagCompound(); + this.attachedItem.writeToNBT(stackTag); + nbt.setTag("itemStack",stackTag); + } + nbt.setFloat("virtualNodePosX",this.virtualNodePosX); + nbt.setFloat("virtualNodePosY",this.virtualNodePosY); + nbt.setFloat("virtualNodePosZ",this.virtualNodePosZ); + } + + public void setAnchor(int x, int y, int z, short facing, int dimensionId) + { + this.anchorX=x; + this.anchorY=y; + this.anchorZ=z; + this.anchorFacing=facing; + this.anchorDimensionId=dimensionId; + } + + public boolean playerHasItemStack(EntityPlayer player) + { + int var2; + + for (var2 = 0; var2 < player.inventory.armorInventory.length; ++var2) + { + if (player.inventory.armorInventory[var2] != null && player.inventory.armorInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.armorInventory[var2].stackTagCompound==null?false:player.inventory.armorInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + for (var2 = 0; var2 < player.inventory.mainInventory.length; ++var2) + { + if (player.inventory.mainInventory[var2] != null && player.inventory.mainInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.mainInventory[var2].stackTagCompound==null?false:player.inventory.mainInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + return false; + } + + public int getChainUniqueID() { + return chainUniqueID; + } + + public void setChainUniqueID(int chainUniqueID) { + this.chainUniqueID = chainUniqueID; + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) + { + if(this.noClip) + { + return null; + } + else + { + return super.getCollisionBox(entity); + } + } + + @Override + public int getId() + { + return this.getEntityId(); + } + + @Override + public void recieveData(ByteBufInputStream byteBufInputStream) + { + try + { + this.setChainUniqueID(byteBufInputStream.readInt()); + this.chainArrangeNumber=byteBufInputStream.readInt(); + this.type=byteBufInputStream.readByte(); + this.colorIndex=byteBufInputStream.readInt(); + this.virtualNodePosX=byteBufInputStream.readFloat(); + this.virtualNodePosY=byteBufInputStream.readFloat(); + this.virtualNodePosZ=byteBufInputStream.readFloat(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @Override + protected void entityInit() {} + + @Override + public boolean isInvalid() + { + return this.isDead; + } + + public void setVirtualNodePosToNearestPortal() + { + int x0 = (int)this.posX; + int y0 = (int)this.posY; + int z0 = (int)this.posZ; + for(int xi=x0-2;xi<=x0+2;xi++) + { + for(int yi=y0-2;yi<=y0+2;yi++) + { + for(int zi=z0-2;zi<=z0+2;zi++) + { + Block block = worldObj.getBlock(xi, yi, zi); + if(block==Blocks.portal||block==Blocks.end_portal) + { + this.setVirtualNodePos(xi+0.5f, yi+0.5f, zi+0.5f); + return; + } + } + } + } + + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10184eb91baa00151263eb9882e2ad67 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10184eb91baa00151263eb9882e2ad67 new file mode 100644 index 0000000..e5e9501 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10184eb91baa00151263eb9882e2ad67 @@ -0,0 +1,86 @@ +package ihl.flexible_cable; + +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.World; + +public class BlastEntityFX extends EntityFX { + + public BlastEntityFX(World world, double x, double y, double z) + { + super(world, x, y, z); + this.renderDistanceWeight = 5.0D; + } + + public BlastEntityFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8; + this.motionY += par10; + this.motionZ += par12; + this.particleScale *= par14; + this.particleMaxAge = 3; + this.noClip = false; + this.renderDistanceWeight = 6.0D; + } + + @Override + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = this.particleTextureIndexX / 2.0F; + float var9 = var8 + 0.5f; + float var10 = this.particleTextureIndexY / 2.0F; + float var11 = var10 + 0.5f; + float var12 = 0.1F * this.particleScale; + + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ); + par1Tessellator.addVertexWithUV(var13 - par3 * var12 - par6 * var12, var14 - par4 * var12, var15 - par5 * var12 - par7 * var12, var9, var11); + par1Tessellator.addVertexWithUV(var13 - par3 * var12 + par6 * var12, var14 + par4 * var12, var15 - par5 * var12 + par7 * var12, var9, var10); + par1Tessellator.addVertexWithUV(var13 + par3 * var12 + par6 * var12, var14 + par4 * var12, var15 + par5 * var12 + par7 * var12, var8, var10); + par1Tessellator.addVertexWithUV(var13 + par3 * var12 - par6 * var12, var14 - par4 * var12, var15 + par5 * var12 - par7 * var12, var8, var11); + } + + @Override + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + this.setParticleTextureIndex(this.particleAge * 3 / this.particleMaxAge); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.95D; + this.motionY *= 0.95D; + this.motionZ *= 0.95D; + + if (this.onGround) + { + this.motionX *= 0.7D; + this.motionZ *= 0.7D; + } + } + + @Override + public void setParticleTextureIndex(int par1) + { + this.particleTextureIndexX = par1 % 2; + this.particleTextureIndexY = par1 / 2; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/f0339bee53a3001516ebc455efc032e5 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/f0339bee53a3001516ebc455efc032e5 new file mode 100644 index 0000000..152efac --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/c6/f0339bee53a3001516ebc455efc032e5 @@ -0,0 +1,125 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + URL gburl = IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml"); + System.out.println(gburl.getAuthority()); + System.out.println(gburl.getFile()); + System.out.println(gburl.getHost()); + System.out.println(gburl.getPath()); + System.out.println(gburl.getQuery()); + System.out.println(gburl.getRef()); + System.out.println(gburl.toExternalForm()); + System.out.println(gburl.toURI().getPath()); +// File fileFrom = new File(IHLMod.proxy.getMinecraftDir(),"/assets/ihl/config/ihl-guidebook.xml"); + //File fileFrom = new File(.getFile()); + //Files.copy(fileFrom, file); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/ca/e006f2ab27bc001514d3de1c0800049b b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/ca/e006f2ab27bc001514d3de1c0800049b new file mode 100644 index 0000000..be4cbb7 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/ca/e006f2ab27bc001514d3de1c0800049b @@ -0,0 +1,269 @@ +package ihl.flexible_cable; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.common.MinecraftForge; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.core.IC2; +import ihl.IHLMod; +import ihl.interfaces.IEnergyNetNode; +import ihl.utils.IHLUtils; + +public class SubAnchorEnergyNetNode implements IEnergyNetNode{ + + private AnchorTileEntity base; + private short facing; + private int gridID=-1; + private Set cableList = new HashSet(); + + public SubAnchorEnergyNetNode(AnchorTileEntity base1, short facing1) + { + base=base1; + facing=facing1; + } + + @Override + public double[] getPortPos(EntityLivingBase player) + { + double d=0.5D; + double f=-0.1D; + switch(facing) + { + case 0: + return new double[]{ + (base.xCoord+d), + (base.yCoord+1D-f), + (base.zCoord+0.5D)}; + case 1: + return new double[]{ + (base.xCoord+d), + (base.yCoord+f), + (base.zCoord+0.5D)}; + case 2: + return new double[]{ + (base.xCoord+0.5D), + (base.yCoord+d), + (base.zCoord+1D-f)}; + case 3: + return new double[]{ + (base.xCoord+0.5D), + (base.yCoord+d), + (base.zCoord+f)}; + case 4: + return new double[]{ + (base.xCoord+1D-f), + (base.yCoord+d), + (base.zCoord+0.5D)}; + case 5: + return new double[]{ + (base.xCoord+f), + (base.yCoord+d), + (base.zCoord+0.5D)}; + default: + return new double[]{ + (base.xCoord+f), + (base.yCoord+d), + (base.zCoord+0.5D)}; + } + } + + @Override + public IHLGrid getGrid() + { + if(gridID!=-1) + { + return IHLMod.enet.getGrid(gridID); + } + else + { + return null; + } + } + + @Override + public int getGridID() + { + return gridID; + } + + @Override + public void setGrid(int newgridID) + { + if(IC2.platform.isSimulating()&& base.addedToEnergyNet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(base)); + base.addedToEnergyNet = false; + } + if(newgridID!=-1) + { + this.gridID=newgridID; + IHLMod.enet.getGrid(newgridID).add(this); + } + else + { + this.gridID=-1; + } + if (IC2.platform.isSimulating()&& !base.addedToEnergyNet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(base)); + base.addedToEnergyNet = true; + } + } + + @Override + public double getMaxAllowableVoltage() + { + return 64000d; + } + + @Override + public boolean addCable(NBTTagCompound cable) + { + base.hasCableOnSide[this.facing]=true; + return this.cableList.add(cable); + } + + @Override + public Set getCableList() { + return cableList; + } + + @Override + public void removeAttachedChains() + { + Iterator cli = this.getCableList().iterator(); + while(cli.hasNext()) + { + NBTTagCompound c = cli.next(); + IHLMod.enet.removeCableEntities(c); + ItemStack is = IHLUtils.getThisModItemStack("copperWire"); + is.stackTagCompound=c; + EntityItem eitem = new EntityItem(base.getWorldObj(), base.xCoord+0.5D, base.yCoord+0.5D, base.zCoord+0.5D, is); + base.getWorldObj().spawnEntityInWorld(eitem); + } + if(gridID!=-1) + { + IHLMod.enet.splitGrids(gridID, this); + } + this.getCableList().clear(); + base.hasCableOnSide[this.facing]=false; + } + + public void onLoaded() + { + if(gridID!=-1) + { + IHLGrid grid = IHLMod.enet.getGrid(gridID); + grid.add(this); + } + } + + public NBTTagCompound writeToNBT() + { + NBTTagCompound nbt = new NBTTagCompound(); + NBTTagList cableNBTList = new NBTTagList(); + for(NBTTagCompound cable:this.cableList) + { + cableNBTList.appendTag(cable); + } + nbt.setTag("cableList", cableNBTList); + nbt.setInteger("gridID", this.gridID); + return nbt; + } + + public void readFromNBT(NBTTagCompound nbt) { + NBTTagList cableNBTList=nbt.getTagList("cableList", 10); + for(int i=0;i1d) + { + return 0D; + } + else + { + return this.getGrid().getDemandedEnergy(); + } + } + + public double drawEnergy(double amount) + { + if(this.gridID==-1) + { + return 0D; + } + else + { + double dEnergy = Math.min(this.getGrid().energy, amount); + this.getGrid().energy-=dEnergy; + return dEnergy; + } + } + + public double getVoltage() + { + if(this.gridID==-1) + { + return 0D; + } + else + { + return this.getGrid().getSinkVoltage(this); + } + } + + @Override + public void remove(NBTTagCompound cable) + { + this.cableList.remove(cable); + if(this.cableList.isEmpty()) + { + base.hasCableOnSide[this.facing]=false; + } + } + + public double injectEnergy(double amount) + { + if(this.gridID==-1) + { + return amount; + } + else + { + this.getGrid().injectEnergy(amount, 400d, this); + return 0d; + } + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/d7/b0083d60a7ca001510f7df4278c93a7e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/d7/b0083d60a7ca001510f7df4278c93a7e new file mode 100644 index 0000000..b15e16c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/d7/b0083d60a7ca001510f7df4278c93a7e @@ -0,0 +1,935 @@ +package ihl.utils; + +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.Recipes; +import ic2.core.BasicMachineRecipeManager; +import ic2.core.block.invslot.InvSlotOutput; +import ihl.IHLMod; +import ihl.interfaces.IWire; +import ihl.metallurgy.constants.*; +import ihl.processing.invslots.InvSlotConsumableLiquidIHL; +import ihl.recipes.IRecipeInputFluid; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.mutable.MutableObject; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.oredict.OreDictionary; + +public class IHLUtils +{ + private static Map ihlItemStackRegistry = new HashMap(); + + public static void registerLocally(String name, ItemStack stack) + { + ihlItemStackRegistry.put(name, stack); + } + + public static ItemStack getOreDictItemStack(String name) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=1; + return orecopy; + } + + public static boolean hasOreDictionaryEntry(String name) + { + return !OreDictionary.getOres(name).isEmpty(); + } + + public static Item getOreDictItem(String name) + { + return OreDictionary.getOres(name).get(0).getItem(); + } + + public static Block getOreDictBlock(String name) + { + return Block.getBlockFromItem(OreDictionary.getOres(name).get(0).getItem()); + } + + public static ItemStack getOreDictItemStackWithSize(String name, int size) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=size; + return orecopy; + } + + public static String getFirstOreDictName(ItemStack stack) + { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + if(arrayIDs.length>0) + { + return OreDictionary.getOreName(arrayIDs[0]); + } + return ""; + } + + public static ItemStack getThisModItemStack(String name) + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + + public static ItemStack getThisModItemStackWithSize(String name, int i) { + if(ihlItemStackRegistry.get(name)!=null) + { + ItemStack stack = ihlItemStackRegistry.get(name).copy(); + stack.stackSize=i; + return stack; + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name),i); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name),i); + } + } + + public static ItemStack getOtherModItemStackWithDamage(String modname, String name,int damage) { + if(GameRegistry.findItem(modname, name)!=null) + { + return new ItemStack(GameRegistry.findItem(modname, name),1,damage); + } + else if(GameRegistry.findBlock(modname, name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock(modname, name),1,damage); + } + } + + public static Item getThisModItem(String name) + { + if(GameRegistry.findItem("ihl", name)!=null) + { + return GameRegistry.findItem("ihl", name); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return Item.getItemFromBlock(GameRegistry.findBlock("ihl", name)); + } + } + + public static FluidStack getFluidStackWithSize(String name, int i) { + if(FluidRegistry.isFluidRegistered(name)) + { + return FluidRegistry.getFluidStack(name, i); + } + else + { + throw new IllegalArgumentException("No such fluid: "+name); + } + } + + public static Block getThisModBlock(String name) + { + if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such block in item registry: ihl:"+name); + } + else + { + return GameRegistry.findBlock("ihl", name); + } + } + + public static ItemStack getThisModItemStackWithDamage(String name, + int value) + { + ItemStack stack = getThisModItemStack(name); + stack.setItemDamage(value); + return stack; + } + + public static boolean adjustWireLength(ItemStack stack, int adjustBy) + { + int length = getWireLength(stack); + if(length<=0) + { + return true; + } + else + { + int newLength = Math.max(length+adjustBy,0); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),newLength); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),newLength); + if(newLength==0) + { + return true; + } + return false; + } + } + + public static int getWireLength(ItemStack itemStack) + { + return itemStack.stackTagCompound.getInteger(((IWire)itemStack.getItem()).getTag()); + } + + public static ItemStack getThisModWireItemStackWithLength(String name, int i) { + if(getThisModItemStack(name)!=null) + { + ItemStack stack = getThisModItemStack(name); + if(stack.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException("ihl:"+name + " is not an instance of IWire."); + } + } + else + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + } + + public static ItemStack getThisModWireItemStackWithLength(ItemStack stack1, int i) { + ItemStack stack = stack1.copy(); + if(stack1.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException(stack1.getUnlocalizedName() + " is not an instance of IWire."); + } + } + + public static boolean isItemsHaveSameOreDictionaryEntry(ItemStack is, ItemStack is1) + { + int[] odids1 = OreDictionary.getOreIDs(is); + int[] odids2 = OreDictionary.getOreIDs(is1); + if(odids1!=null && odids1.length>0 && odids2!=null && odids2.length>0) + { + for(int i1=0;i1 getEntryListForOre(String name) + { + ArrayList outputList = new ArrayList(); + ArrayList oreList = OreDictionary.getOres(name); + Iterator oreListIterator = oreList.iterator(); + while(oreListIterator.hasNext()) + { + outputList.add(oreListIterator.next().copy()); + } + return outputList; + } + + public static ItemStack getItemStackIfExist(String name) + { + if(hasOreDictionaryEntry(name)) + { + return getOreDictItemStack(name); + } + else + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + } + + public static FluidStack getFluidStackIfExist(String string, int meltingFluidAmount) + { + if(FluidRegistry.isFluidRegistered(string)) + { + return getFluidStackWithSize(string,meltingFluidAmount); + } + return null; + } + + public static boolean addItemStackToInventory(EntityPlayer player, ItemStack stack) + { + ItemStack[] inv = player.inventory.mainInventory; + for (int i=0;i<=35;i++) + { + if(inv[i]!=null) + { + if(inv[i].getItem()==stack.getItem()) + { + if(inv[i].getItemDamage()==stack.getItemDamage() && inv[i].stackSizeinv[i].getMaxStackSize()) + { + stack.stackSize=inv[i].stackSize-inv[i].getMaxStackSize(); + } + else + { + return true; + } + } + } + } + else + { + inv[i]=stack; + return true; + } + } + return false; + } + + public static FluidStack getFluidStackWithSizeChemicallyPure(String name, int amount) + { + FluidStack fstack = getFluidStackWithSize(name, amount); + fstack.tag=new NBTTagCompound(); + fstack.tag.setBoolean("chemicallyPure", true); + return fstack; + } + + public static void removeItemStackFromOreDictionaryEntry(String orename, ItemStack itemStack) + { + ArrayList orelist = OreDictionary.getOres(orename); + Iterator oreListIterator = orelist.iterator(); + ItemStack odstack = null; + while(oreListIterator.hasNext()) + { + odstack = oreListIterator.next(); + if(odstack.getItem()==itemStack.getItem()) + { + break; + } + else + { + odstack = null; + } + } + if(odstack != null) + { + orelist.remove(odstack); + IHLMod.log.debug("Stack "+odstack.getDisplayName()+" ("+odstack.toString()+")"+" removed from ore entry '"+orename+"'"); + } + } + + public static void addIC2MaceratorRecipe(String input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + ((BasicMachineRecipeManager)Recipes.macerator).addRecipe(new RecipeInputOreDict(input), tag, true, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(String input, int stacksize, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStackWithSize(input,stacksize), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputOreDict(input,stacksize), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(ItemStack input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(ItemStack input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(String input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(getThisModItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputOreDict(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2CentrifugeRecipe(String input, ItemStack output, ItemStack output2) + { + if(Recipes.centrifuge.getOutputFor(getOreDictItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("minHeat", 2000); + Recipes.centrifuge.addRecipe(new RecipeInputOreDict(input), tag, new ItemStack[] {output,output2}); + } + else + { + //IHLMod.log.info("IC2 centrifuge recipe for "+input+" already exist. Skipped."); + } + } + + public static void damageItemViaNBTTag(ItemStack stack, int amount) + { + NBTTagCompound gtTagCompound; + if(stack.stackTagCompound.hasKey("GT.ToolStats")) + { + gtTagCompound = stack.stackTagCompound.getCompoundTag("GT.ToolStats"); + } + else + { + stack.stackSize--; + return; + } + int damage = 0; + int maxDamage = 0; + if(gtTagCompound.hasKey("MaxDamage")) + { + maxDamage = gtTagCompound.getInteger("MaxDamage"); + } + else + { + stack.stackSize--; + return; + } + + if(gtTagCompound.hasKey("Damage")) + { + damage = gtTagCompound.getInteger("Damage"); + } + if(damage=input.getAmount(); + } + else + { + return stack.stackSize>=input.getAmount(); + } + } + return false; + } + + public static boolean reduceItemStackAmountUsingIRecipeInput(IRecipeInput input, ItemStack stack) { + if(stack.getItem() instanceof IWire) + { + return adjustWireLength(stack,-input.getAmount()); + } + else + { + stack.stackSize-=input.getAmount(); + return stack.stackSize<=0; + } + } + + public static String getFirstOreDictNameExcludingTagAny(ItemStack stack) { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + for(int i=0;i0 && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fluidTank.fill(drainInputSlot.drain(null, fluidTank.getCapacity()-fluidTank.getFluidAmount(), output, false),true); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + if (fillInputSlot!=null && !fillInputSlot.isEmpty()) + { + output = new MutableObject(); + if (fillInputSlot.transferFromTank(fluidTank, output, true) && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fillInputSlot.transferFromTank(fluidTank, output, false); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + } + public static double[] tracePlayerView(EntityPlayer entityplayer) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + if (entityplayer.worldObj!=null && entityplayer.worldObj.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + double z = entityplayer.posZ; + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 1.0D; + return new double[] {x+f7 * d3, y+f6 * d3, z+f9 * d3}; + } + + public static MovingObjectPosition returnMOPFromPlayer(EntityPlayer entityplayer, World world) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + + if (world.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + + double z = entityplayer.posZ; + Vec3 vec3d = Vec3.createVectorHelper(x, y, z); + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 5.0D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f6 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks(vec3d, vec3d1, true); + + if (movingobjectposition == null) + { + return null; + } + + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + return movingobjectposition; + } + return null; + } + + public static short getFacingFromPlayerView(EntityLivingBase player, boolean ignoreSneaking) + { + int var6 = MathHelper.floor_double(player.rotationPitch * 4.0F / 360.0F + 0.5D) & 3; + int var7 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + { + if(var6==1) + { + return 1; + } + else if(var6==3) + { + return 0; + } + else + { + if(player.isSneaking() && !ignoreSneaking) + { + switch(var7) + { + case 0: + return 3; + case 1: + return 4; + case 2: + return 2; + case 3: + return 5; + default: + break; + } + } + else + { + switch(var7) + { + case 0: + return 2; + case 1: + return 5; + case 2: + return 3; + case 3: + return 4; + default: + break; + } + } + } + } + return 3; + } + + public static int getChainID(ItemStack itemStack) + { + if(itemStack!=null && itemStack.stackTagCompound!=null && itemStack.stackTagCompound.hasKey("chainUID")) + { + return itemStack.stackTagCompound.getInteger("chainUID"); + } + return -1; + } + + public static List convertRecipeInputToItemStackList(List input) + { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInput iri = irii.next(); + ItemStack stack = iri.getInputs().get(0); + stack.stackSize=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static List convertRecipeInputToFluidStackList(List input) { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInputFluid iri = irii.next(); + FluidStack stack = iri.getInputs().get(0); + stack.amount=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static int[] decodeXYZ(long longNumber) + { + return new int[] {(int) ((longNumber>>30) & 0xfff)-256,(int) ((longNumber>>15) & 0xfff)-256,(int) (longNumber & 0xfff)-256}; + } + + public static long encodeXYZ(int x,int y,int z) + { + return (x+256L)<<30|((y+256L)<<15)|(z+256L); + } + + public static int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + public static long getXYZHash(int x,int y,int z) + { + return ((x&0x1FFFFF)<<42)|((y&0x1FFFFF)<<21)|(z&0x1FFFFF); + } + + public static String trim(String str) + { + int len = str.length(); + int start; + char c; + for (start = 0; start < len; ++start) + { + c = str.charAt(start); + if (c > 32 && c != 65279) + { + break; + } + } + int end; + for (end = len - 1; end >= start; --end) + { + c = str.charAt(end); + if (c > 32 && c != 65279) + { + break; + } + } + return start <= 0 && end >= len - 1 ? str : str.substring(start, end + 1); + } + + public static int getAmountOf(ItemStack is) + { + if(is.getItem() instanceof IWire) + { + return getWireLength(is); + } + else + { + return is.stackSize; + } + } + + public static ItemStack getWireItemStackCopyWithLengthMultiplied(ItemStack stack, int multiplier) + { + ItemStack out = stack.copy(); + adjustWireLength(out,getWireLength(stack)*(multiplier-1)); + return out; + } + + public static ItemStack getUninsulatedWire(String material, int length, int transverseSection) { + ItemStack is = getThisModItemStack("copperWire"); + is.stackTagCompound=new NBTTagCompound(); + is.stackTagCompound.setBoolean("firstConnection",false); + is.stackTagCompound.setInteger("fullLength", length); + is.stackTagCompound.setInteger("length", length); + is.stackTagCompound.setBoolean("firstConnection", false); + is.stackTagCompound.setString("material", material); + is.stackTagCompound.setInteger("transverseSection",transverseSection); + is.stackTagCompound.setInteger("resistance", ElectricConductor.getResistivity(material)*100/transverseSection); + return is; + } + + public static ItemStack getInsulatedWire(String material, int length, int transverseSection, String insulationMaterial, int insulationThickness) { + ItemStack is = getUninsulatedWire(material, length, transverseSection); + is.stackTagCompound.setString("insulationMaterial",insulationMaterial); + is.stackTagCompound.setInteger("insulationThickness",insulationThickness); + is.stackTagCompound.setInteger("maxVoltage", getInsulationMaxVoltage(insulationMaterial, insulationThickness)); + return is; + } + + public static int getInsulationMaxVoltage(String insulationMaterial, int insulationThickness) + { + return Math.min(Insulation.getMaxVoltagePermm(insulationMaterial)*insulationThickness/10,Insulation.getMaxVoltageCap(insulationMaterial)); + } + + public static ItemStack getItemStackWithTag(String unLocalizedName, String tag, int tagValue) { + ItemStack stack = IHLUtils.getThisModItemStack(unLocalizedName); + if(stack.stackTagCompound==null) + { + stack.stackTagCompound=new NBTTagCompound(); + } + stack.stackTagCompound.setInteger(tag, tagValue); + return stack; + } + + public static boolean isSegmentInsideAABB(AxisAlignedBB collisionBox, double posX, double posY, double posZ, double posX2, double posY2, double posZ2) + { + if(isInsideofBoundingBox(collisionBox,(float)posX,(float)posY,(float)posZ)||isInsideofBoundingBox(collisionBox,(float)posX2,(float)posY2,(float)posZ2)) + { + return true; + } + else + { + double minX=Math.min(posX, posX2); + double maxX=Math.max(posX, posX2); + double minY=Math.min(posY, posY2); + double maxY=Math.max(posY, posY2); + double minZ=Math.min(posZ, posZ2); + double maxZ=Math.max(posZ, posZ2); + return !(maxXcollisionBox.maxX || + maxYcollisionBox.maxY || + maxZcollisionBox.maxZ); + } + } + + public static boolean isInsideofBoundingBox(AxisAlignedBB bb, float xi, float yi, float zi) + { + return bb.maxX>xi && bb.minXyi && bb.minYzi && bb.minZ instances = new ArrayList(); + + @SideOnly(Side.CLIENT) + IIcon textureSide, + textureBack, + textureFrontMuffleFurnance, + textureTop, + textureTopAchesonFurnance, + textureTopGoldFurnace, + textureFrontGoldFurnace, + textureSideGoldFurnace, + textureFrontCryogenicDistiller, + textureTopCryogenicDistiller, + textureBackCryogenicDistiller, + textureFrontChemicalReactor, + textureLeftMachineCasing, + textureTopMachineCasing, + textureRightMachineCasing, + textureFrontMachineCasing, + textureFrontPaperMachine, + textureBackMachineCasing, + frequencyGeneratorBack, + frequencyGeneratorBottom, + frequencyGeneratorFront, + frequencyGeneratorLeft, + frequencyGeneratorRight, + frequencyGeneratorTop, + bronzeTubTop, + bronzeTubSide, + glassBoxTop, + glassBoxSide, + glassBoxBottom, + glassBoxInnerSide, + glassBoxInnerBottom, + vacuumInductionMeltingFurnaceFront, + vacuumInductionMeltingFurnaceBack, + vacuumInductionMeltingFurnaceLeft, + vacuumInductionMeltingFurnaceRight, + hydrotransportPulpRegeneratorFront, + hydrotransportPulpRegeneratorBack, + redstoneSignalConverterEmitterSide, + redstoneSignalConverterEmptySide, + redstoneSignalConverterSensorSide, + steel, + redPaint, + greenPaint, + rubberInsulatedCase, + powerPort; + + public MachineBaseBlock(MachineType type1) + { + super(Material.iron); + this.type=type1; + this.setCreativeTab(IHLCreativeTab.tab); + this.setBlockName(type.unlocalizedName); + this.setHardness(2F); + this.setResistance(1F); + instances.add(this); + } + + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) + { + if(IC2.platform.isSimulating()) + { + TileEntity te = world.getTileEntity(x,y,z); + if(world.getBlock(x, y+1, z)==Blocks.fire) + { + if(te instanceof DetonationSprayingMachineTileEntity) + { + ((DetonationSprayingMachineTileEntity)te).operate(); + world.setBlockToAir(x, y+1, z); + } + } + if(te instanceof RedstoneSignalConverterTileEntity) + { + RedstoneSignalConverterTileEntity rscte = (RedstoneSignalConverterTileEntity) te; + rscte.linksOrInventoryChanged=true; + } + } + } + + + @Override + public void onBlockPreDestroy(World world, int x, int y, int z, int meta) + { + if(!world.isRemote) + { + TileEntity te = world.getTileEntity(x, y, z); + if(te!=null) + { + if(te instanceof IEnergyNetNode) + { + IEnergyNetNode ate = (IEnergyNetNode) te; + ate.removeAttachedChains(); + } + if(te instanceof IMultiPowerCableHolder) + { + IMultiPowerCableHolder ate = (IMultiPowerCableHolder) te; + ate.removeAttachedChains(); + } + if(te instanceof IronWorkbenchTileEntity) + { + IronWorkbenchTileEntity iwb=(IronWorkbenchTileEntity) te; + iwb.dropContents(); + } + else if(te instanceof IInventory) + { + IInventory inventory = (IInventory)te; + for(int i = 0; i< inventory.getSizeInventory();i++) + { + if(inventory.getStackInSlot(i)!=null)world.spawnEntityInWorld(new EntityItem(world, x, y+1, z, inventory.getStackInSlot(i))); + } + } + if(te instanceof RedstoneSignalConverterTileEntity) + { + RedstoneSignalConverterTileEntity rsce = (RedstoneSignalConverterTileEntity)te; + rsce.removeAttachedChains(); + } + } + } + super.onBlockPreDestroy(world, x, y, z, meta); + } + + @Override + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) + { + switch(this.type) + { + case BronzeTub: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.1F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.1F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.9F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.9F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBoundsForItemRender(); + break; + case GlassBox: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.1F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.1F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.9F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBounds(0.0F, 0.0F, 0.9F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + this.setBlockBoundsForItemRender(); + break; + case RedstoneSignalConverter: + this.setBlockBounds(0.2F, 0.2F, 0.2F, 0.8F, 0.8F, 0.8F); + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + break; + default: + super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity); + break; + } + } + + @Override + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) + { + int facing = 3; + TileEntity te = blockAccess.getTileEntity(x, y, z); + if(te!=null && te instanceof IWrenchable) + { + IWrenchable tebh = (IWrenchable) te; + facing=tebh.getFacing(); + } + switch(this.type) + { + case VacuumInductionMeltingFurnace: + switch(facing) + { + case 0: + this.setBlockBounds(-1.0F, -2.0F, 0.0F, 2.0F, 1.0F, 3.0F); + break; + case 1: + this.setBlockBounds(-1.0F, 0.0F, 0.0F, 2.0F, 3.0F, 3.0F); + break; + case 2: + this.setBlockBounds(-1.0F, 0.0F, -2.0F, 2.0F, 3.0F, 1.0F); + break; + case 3: + this.setBlockBounds(-1.0F, 0.0F, 0.0F, 2.0F, 3.0F, 3.0F); + break; + case 4: + this.setBlockBounds(-2.0F, 0.0F, -1.0F, 1.0F, 3.0F, 2.0F); + break; + case 5: + this.setBlockBounds(0.0F, 0.0F, -1.0F, 3.0F, 3.0F, 2.0F); + break; + default: + break; + } + break; + default: + super.setBlockBoundsBasedOnState(blockAccess, x, y, z); + break; + } + } + + public static void init() + { + MachineType[] var1 = MachineType.values(); + for(int i=0;i 0) + { + int progressLevel=Math.min(Math.round(this.container.tileEntity.progress*16.0F/this.container.tileEntity.maxProgress),16); + int frameNum=0; + short slotRecipeNum=this.container.tileEntity.output.slotRecipe[0]; + for(int row = 0;row<6;row++) + { + for (int col = 0; col<3; ++col) + { + if(slotRecipeNum!=this.container.tileEntity.output.slotRecipe[col+row*3]) + { + frameNum++; + slotRecipeNum=this.container.tileEntity.output.slotRecipe[col+row*3]; + } + if(this.container.tileEntity.currentSlot==slotRecipeNum) + { + int i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18),18); + this.drawTexturedModalRect(115+x+col*18, 7+y+row*18, 176, 72,i1,18); + this.drawTexturedModalRect(115+x+col*18, 7+y+row*18, 176+getFrameX(frameNum), getFrameY(frameNum),18,18); + } + } + } + } + else + { + int frameNum=0; + short slotRecipeNum=this.container.tileEntity.output.slotRecipe[0]; + for(int row = 0;row<6;row++) + { + for (int col = 0;col<3; ++col) + { + if(slotRecipeNum!=this.container.tileEntity.output.slotRecipe[col+row*3]) + { + frameNum++; + slotRecipeNum=this.container.tileEntity.output.slotRecipe[col+row*3]; + } + if(this.container.tileEntity.output.get(col+row*3)!=null) + { + this.drawTexturedModalRect(115+x+col*18, 7+y+row*18, 176+getFrameX(frameNum), getFrameY(frameNum),18,18); + } + } + } + } + for(int row = 1;row<6;row++) + { + if(!this.container.tileEntity.workspaceElements.ready[row]) + { + this.drawTexturedModalRect(20+x, 9+y+row*18, 194, 74,3,14); + } + } + } + + @Override + public void onGuiClosed() + { + super.onGuiClosed(); + this.container.tileEntity.isGuiScreenOpened=false; + IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, 16); + } + + @Override + public void handleMouseClick(Slot slot,int slotNumber,int mouseButton/*0=left 1=right*/,int arg3) + { + if(slot!=null && slot.slotNumber>=outputslotoffset && slot.slotNumber>2) & 3)*18; + } + +} \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b02f8eb743a000151531bed9130b5444 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b02f8eb743a000151531bed9130b5444 new file mode 100644 index 0000000..155824a --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e1/b02f8eb743a000151531bed9130b5444 @@ -0,0 +1,391 @@ +package ihl; + +import java.io.File; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; + +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.Pbuffer; +import org.lwjgl.opengl.PixelFormat; + +import ic2.core.IC2; +import ihl.collector.ChargerEjectorModel; +import ihl.collector.ChargerEjectorRender; +import ihl.collector.ChargerEjectorTileEntity; +import ihl.collector.CollectorEntity; +import ihl.collector.CollectorHeavyEntity; +import ihl.collector.CollectorItemRender; +import ihl.collector.CollectorRender; +import ihl.collector.GlassBoxRender; +import ihl.collector.GlassBoxTileEntity; +import ihl.crop_harvestors.BlobEntityFX; +import ihl.crop_harvestors.BlobEntityFX.FluidType; +import ihl.crop_harvestors.BlobRenderFX; +import ihl.crop_harvestors.SackRender; +import ihl.crop_harvestors.SackTileEntity; +import ihl.enviroment.LightBulbModel; +import ihl.enviroment.LightBulbRender; +import ihl.enviroment.LightBulbTileEntity; +import ihl.enviroment.MirrorRender; +import ihl.enviroment.MirrorTileEntity; +import ihl.enviroment.SpotlightModel; +import ihl.enviroment.SpotlightRender; +import ihl.enviroment.SpotlightTileEntity; +import ihl.flexible_cable.BatterySwitchUnitModel; +import ihl.flexible_cable.BatterySwitchUnitTileEntity; +import ihl.flexible_cable.GroundingModel; +import ihl.flexible_cable.GroundingTileEntity; +import ihl.flexible_cable.IronWorkbenchModel; +import ihl.flexible_cable.IronWorkbenchTileEntity; +import ihl.flexible_cable.NodeEntity; +import ihl.flexible_cable.NodeRender; +import ihl.flexible_cable.RectifierTransformerUnitModel; +import ihl.flexible_cable.RectifierTransformerUnitTileEntity; +import ihl.i_hate_liquids.IHLEventHandler; +import ihl.i_hate_liquids.InvisibleMagicanEntity; +import ihl.items_blocks.IHLTool; +import ihl.items_blocks.ItemSubstance; +import ihl.items_blocks.MachineBaseBlock; +import ihl.items_blocks.MachineBaseBlock.MachineType; +import ihl.metallurgy.constants.Details; +import ihl.model.*; +import ihl.nei_integration.InjectionMoldRecipeHandler; +import ihl.processing.chemistry.ElectrolysisBathModel; +import ihl.processing.chemistry.ElectrolysisBathTileEntity; +import ihl.processing.chemistry.FractionatorBottomModel; +import ihl.processing.chemistry.FractionatorBottomTileEntity; +import ihl.processing.chemistry.FractionatorCoverModel; +import ihl.processing.chemistry.FractionatorCoverTileEntity; +import ihl.processing.chemistry.FractionatorSectionModel; +import ihl.processing.chemistry.FractionatorSectionTileEntity; +import ihl.processing.chemistry.GaedesMercuryRotaryPumpModel; +import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity; +import ihl.processing.chemistry.GoldChimneyKneeModel; +import ihl.processing.chemistry.GoldChimneyKneeRender; +import ihl.processing.chemistry.GoldChimneyKneeTileEntity; +import ihl.processing.chemistry.LoomModel; +import ihl.processing.chemistry.LoomTileEntity; +import ihl.processing.chemistry.PrecipitatorCondenserModel; +import ihl.processing.chemistry.PrecipitatorCondenserRender; +import ihl.processing.chemistry.PrecipitatorCondenserTileEntity; +import ihl.processing.chemistry.RefluxCondenserModel; +import ihl.processing.chemistry.RefluxCondenserTileEntity; +import ihl.processing.metallurgy.CoilerModel; +import ihl.processing.metallurgy.CoilerRender; +import ihl.processing.metallurgy.CoilerTileEntity; +import ihl.processing.metallurgy.DetonationSprayingMachineModel; +import ihl.processing.metallurgy.DetonationSprayingMachineRender; +import ihl.processing.metallurgy.DetonationSprayingMachineTileEntity; +import ihl.processing.metallurgy.ExtruderModel; +import ihl.processing.metallurgy.ExtruderTileEntity; +import ihl.processing.metallurgy.GasWeldingStationModel; +import ihl.processing.metallurgy.GasWeldingStationTileEntity; +import ihl.processing.metallurgy.ImpregnatingMachineRender; +import ihl.processing.metallurgy.ImpregnatingMachineTileEntity; +import ihl.processing.metallurgy.InjectionMoldBlock; +import ihl.processing.metallurgy.LathePart1Model; +import ihl.processing.metallurgy.LathePart1TileEntity; +import ihl.processing.metallurgy.LathePart2Model; +import ihl.processing.metallurgy.LathePart2TileEntity; +import ihl.processing.metallurgy.RollingMachinePart1Model; +import ihl.processing.metallurgy.RollingMachinePart1TileEntity; +import ihl.processing.metallurgy.RollingMachinePart2Model; +import ihl.processing.metallurgy.RollingMachinePart2TileEntity; +import ihl.processing.metallurgy.RollingMachineRender; +import ihl.processing.metallurgy.VulcanizationExtrudingMoldModel; +import ihl.processing.metallurgy.VulcanizationExtrudingMoldTileEntity; +import ihl.processing.metallurgy.WoodenRollingMachinePart1TileEntity; +import ihl.processing.metallurgy.WoodenRollingMachinePart2Model; +import ihl.processing.metallurgy.WoodenRollingMachinePart2TileEntity; +import ihl.processing.metallurgy.WoodenRollingMachineRender; +import ihl.servitor.FlameEntityFX; +import ihl.servitor.FlameRenderFX; +import ihl.servitor.LostHeadEntity; +import ihl.servitor.LostHeadRender; +import ihl.servitor.SkullItemRender; +import ihl.tunneling_shield.BlockItemRender; +import ihl.tunneling_shield.DriverEntity; +import ihl.tunneling_shield.DriverModel; +import ihl.tunneling_shield.DriverRender; +import ihl.tunneling_shield.DriverRenderEntity; +import ihl.tunneling_shield.DriverTileEntity; +import ihl.utils.IHLRenderUtils; +import ihl.utils.IHLUtils; +import ihl.utils.IHLXMLParser; +import ihl.worldgen.ores.IHLFluid; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fluids.FluidStack; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ClientProxy extends ServerProxy { + + public int fboId=-1; + public int renderBufferId=-1; + public int defaultMinecraftFBOId=1; + public boolean loadMirrorRender=true; + public IHLRenderUtils renderUtils; + public Map sharedBlockRenders = new HashMap(); + + public ClientProxy() {} + + @Override + public void loadClient() throws ParserConfigurationException + { + this.renderUtils=new IHLRenderUtils(); + for(int i=0;i<4;i++) + { + try + { + boolean isframebuffer = EXTFramebufferObject.glIsFramebufferEXT(i); + if(isframebuffer) + { + defaultMinecraftFBOId=i; + } + } + catch (Throwable e) + { + IHLMod.log.error("IHL: EXTFramebufferObject cause exception to be casted, no IHL mirror render is possible in current enviroment."); + loadMirrorRender=false; + } + } + if(loadMirrorRender && fboId==-1) + { + fboId = EXTFramebufferObject.glGenFramebuffersEXT(); + renderBufferId = EXTFramebufferObject.glGenRenderbuffersEXT(); + } + registerBlockHandler(new ImpregnatingMachineBlockRender(), MachineType.BronzeTub, MachineType.GlassBox); + registerBlockHandler(new RefluxCondenserBlockRender(), MachineType.RefluxCondenser); + registerBlockHandler(new SwitchBoxBlockRender(), MachineType.RedstoneSignalConverter); + RenderingRegistry.registerEntityRenderingHandler(CollectorEntity.class, new CollectorRender(false)); + MinecraftForgeClient.registerItemRenderer(IHLMod.collectorItem, new CollectorItemRender(false)); + RenderingRegistry.registerEntityRenderingHandler(CollectorHeavyEntity.class, new CollectorRender(true)); + MinecraftForgeClient.registerItemRenderer(IHLMod.collectorHeavyItem, new CollectorItemRender(true)); + RenderingRegistry.registerEntityRenderingHandler(DriverEntity.class, new DriverRenderEntity()); + ClientRegistry.bindTileEntitySpecialRenderer(ChargerEjectorTileEntity.class, new ChargerEjectorRender()); + ClientRegistry.bindTileEntitySpecialRenderer(DriverTileEntity.class, new DriverRender()); + ClientRegistry.bindTileEntitySpecialRenderer(SackTileEntity.class, new SackRender()); + ClientRegistry.bindTileEntitySpecialRenderer(GlassBoxTileEntity.class, new GlassBoxRender()); + ClientRegistry.bindTileEntitySpecialRenderer(IronWorkbenchTileEntity.class, new UniversalTileRender(new IronWorkbenchModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/ironWorkbench.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(LathePart1TileEntity.class, new UniversalTileRender(new LathePart1Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(LathePart2TileEntity.class, new UniversalTileRender(new LathePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(LoomTileEntity.class, new UniversalTileRender(new LoomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(ImpregnatingMachineTileEntity.class, new ImpregnatingMachineRender()); + ClientRegistry.bindTileEntitySpecialRenderer(DetonationSprayingMachineTileEntity.class, new DetonationSprayingMachineRender()); + ClientRegistry.bindTileEntitySpecialRenderer(GoldChimneyKneeTileEntity.class, new GoldChimneyKneeRender()); + ClientRegistry.bindTileEntitySpecialRenderer(PrecipitatorCondenserTileEntity.class, new PrecipitatorCondenserRender()); + ClientRegistry.bindTileEntitySpecialRenderer(CoilerTileEntity.class, new CoilerRender()); + ClientRegistry.bindTileEntitySpecialRenderer(RollingMachinePart1TileEntity.class, new RollingMachineRender()); + ClientRegistry.bindTileEntitySpecialRenderer(RollingMachinePart2TileEntity.class, new UniversalTileRender(new RollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(VulcanizationExtrudingMoldTileEntity.class, new UniversalTileRender(new VulcanizationExtrudingMoldModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(ExtruderTileEntity.class, new UniversalTileRender(new ExtruderModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(WoodenRollingMachinePart1TileEntity.class, new WoodenRollingMachineRender()); + ClientRegistry.bindTileEntitySpecialRenderer(WoodenRollingMachinePart2TileEntity.class, new UniversalTileRender(new WoodenRollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(GasWeldingStationTileEntity.class, new UniversalTileRender(new GasWeldingStationModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/gasWeldingStation.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(GaedesMercuryRotaryPumpTileEntity.class, new UniversalTileRender(new GaedesMercuryRotaryPumpModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/extruder.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(FractionatorBottomTileEntity.class, new UniversalTileRender(new FractionatorBottomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(FractionatorSectionTileEntity.class, new UniversalTileRender(new FractionatorSectionModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(FractionatorCoverTileEntity.class, new UniversalTileRender(new FractionatorCoverModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(RefluxCondenserTileEntity.class, new UniversalTileRender(new RefluxCondenserModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(BatterySwitchUnitTileEntity.class, new UniversalTileRender(new BatterySwitchUnitModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/batterySwitchUnit.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(GroundingTileEntity.class, new UniversalTileRender(new GroundingModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/goldChimneyKnee.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(RectifierTransformerUnitTileEntity.class, new UniversalTileRender(new RectifierTransformerUnitModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(ElectrolysisBathTileEntity.class, new UniversalTileRender(new ElectrolysisBathModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/electrolysisBath.png"))); + if(loadMirrorRender && IHLMod.config.mirrorReflectionRange>0) + { + ClientRegistry.bindTileEntitySpecialRenderer(MirrorTileEntity.class, new MirrorRender()); + } + ClientRegistry.bindTileEntitySpecialRenderer(LightBulbTileEntity.class, new LightBulbRender()); + ClientRegistry.bindTileEntitySpecialRenderer(SpotlightTileEntity.class, new SpotlightRender()); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(IHLMod.driverBlock), new BlockItemRender(new DriverModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/shield.png"), 5, 2, 0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(IHLMod.chargerEjectorBlock), new BlockItemRender(new ChargerEjectorModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/chargerEjector.png"), 0, 6, 0.5F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(IHLMod.ironWorkbench), new BlockItemRender(new IronWorkbenchModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/ironWorkbench.png"), 0, 0, 0.0F, 0.1F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("goldPrecipitatorCondenser"), new BlockItemRender(new PrecipitatorCondenserModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("goldChimneyKnee"), new BlockItemRender(new GoldChimneyKneeModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("cannonBronze"), new BlockItemRender(new DetonationSprayingMachineModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lathePart1"), new BlockItemRender(new LathePart1Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lathePart2"), new BlockItemRender(new LathePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rollingMachinePart1"), new BlockItemRender(new RollingMachinePart1Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 5, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rollingMachinePart2"), new BlockItemRender(new RollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("coiler"), new BlockItemRender(new CoilerModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 6, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("loom"), new BlockItemRender(new LoomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("vulcanizationExtrudingMold"), new BlockItemRender(new VulcanizationExtrudingMoldModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("extruder"), new BlockItemRender(new ExtruderModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("woodenRollingMachinePart1"), new BlockItemRender(new WoodenRollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("woodenRollingMachinePart2"), new BlockItemRender(new WoodenRollingMachinePart2Model(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("gasWeldingStation"), new BlockItemRender(new GasWeldingStationModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/gasWeldingStation.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("gaedesMercuryRotaryPump"), new BlockItemRender(new GaedesMercuryRotaryPumpModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/extruder.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLMod.ihlSkull, new SkullItemRender()); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorBottom"), new BlockItemRender(new FractionatorBottomModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorSection"), new BlockItemRender(new FractionatorSectionModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("fractionatorCover"), new BlockItemRender(new FractionatorCoverModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("refluxCondenser"), new BlockItemRender(new RefluxCondenserModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/splitInjectionMold.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("batterySwitchUnit"), new BlockItemRender(new BatterySwitchUnitModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/batterySwitchUnit.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("grounding"), new BlockItemRender(new GroundingModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/goldChimneyKnee.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("rectifierTransformerUnit"), new BlockItemRender(new RectifierTransformerUnitModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/porcelainBox.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("electrolysisBath"), new BlockItemRender(new ElectrolysisBathModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/electrolysisBath.png"), 0, 0, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("lightBulb"), new BlockItemRender(new LightBulbModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/lightBulb.png"), 0, 1, 0.0F, 0.0F, true)); + MinecraftForgeClient.registerItemRenderer(IHLUtils.getThisModItem("spotlight"), new BlockItemRender(new SpotlightModel(), new ResourceLocation(IHLModInfo.MODID+":textures/blocks/spotlight.png"), 0, 1, 0.0F, 0.0F)); + MinecraftForgeClient.registerItemRenderer(IHLTool.instance, new IHLToolRenderer()); + RenderingRegistry.registerEntityRenderingHandler(LostHeadEntity.class, new LostHeadRender()); + RenderingRegistry.registerEntityRenderingHandler(FlameEntityFX.class, new FlameRenderFX()); + RenderingRegistry.registerEntityRenderingHandler(BlobEntityFX.class, new BlobRenderFX()); + RenderingRegistry.registerEntityRenderingHandler(NodeEntity.class, new NodeRender()); + MinecraftForge.EVENT_BUS.register(new RenderGameOverlayEventHandler()); + + } + + public void spawnParticle(int particle, World world, double x, double y, double z, double mx, double my, double mz, float var) + { + switch(particle) + { + case 0: + FlameEntityFX flamePEFX1 = new FlameEntityFX(world,x,y,z,mx,my,mz,var); + world.spawnEntityInWorld(flamePEFX1); + break; + case 1: + BlobEntityFX blob = new BlobEntityFX(world,x,y,z,mx,my,mz,var, FluidType.RESIN); + world.spawnEntityInWorld(blob); + break; + case 2: + BlobEntityFX blob2 = new BlobEntityFX(world,x,y,z,mx,my,mz,var, FluidType.SAP); + world.spawnEntityInWorld(blob2); + break; + default: + FlameEntityFX flamePEFX2 = new FlameEntityFX(world,x,y,z,mx,my,mz,var); + world.spawnEntityInWorld(flamePEFX2); + break; + } + } + + @Override + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void registerIcons(TextureStitchEvent.Pre event) + { + if (event.map.getTextureType() == 0) + { + IHLFluid.registerIcons(); + } + } + + @Override + public int getFBOID() {return fboId;} + + @Override + public int getRenderBufferID() {return renderBufferId;} + + @Override + public int getDefaultMinecraftFBOID() {return defaultMinecraftFBOId;} + + @Override + public Render getRenderForEntityClass(Class entityClass) + { + return (Render) RenderManager.instance.entityRenderMap.get(entityClass); + } + + @Override + public void checkFramebuffer(int fboId) + { + int framebuffer = EXTFramebufferObject.glCheckFramebufferStatusEXT( EXTFramebufferObject.GL_FRAMEBUFFER_EXT ); + switch ( framebuffer ) { + case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT: + //IHLMod.log.info("EXTFramebufferObject wiwh number "+fboId+" return GL_FRAMEBUFFER_COMPLETE_EXT. Everything is seems fine."); + break; + case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: + throw new RuntimeException( "FrameBuffer: " + fboId + + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception" ); + case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: + throw new RuntimeException( "FrameBuffer: " + fboId + + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception" ); + case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: + throw new RuntimeException( "FrameBuffer: " + fboId + + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception" ); + case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: + throw new RuntimeException( "FrameBuffer: " + fboId + + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception" ); + case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: + throw new RuntimeException( "FrameBuffer: " + fboId + + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception" ); + case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: + throw new RuntimeException( "FrameBuffer: " + fboId + + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception" ); + default: + throw new RuntimeException( "Unexpected reply from glCheckFramebufferStatusEXT: " + framebuffer ); + } + } + + @Override + public void initBlockRenderer() + { + new IHLBlockRenderer(); + } + + @Override + public int getGLDisplayList() + { + return GLAllocation.generateDisplayLists(1); + } + + @Override + public void deleteFramebuffers() + { + if(fboId!=-1) + { + EXTFramebufferObject.glDeleteFramebuffersEXT(fboId); + } + if(renderBufferId!=-1) + { + EXTFramebufferObject.glDeleteRenderbuffersEXT(renderBufferId); + } + } + + @Override + public File getMinecraftDir() + { + return Minecraft.getMinecraft().mcDataDir; + } + + @Override + public int shareBlockRendererByMachineType(MachineType type) + { + return sharedBlockRenders.get(type); + } + + public void registerBlockHandler(ISimpleBlockRenderingHandler handler, MachineType... types) + { + RenderingRegistry.registerBlockHandler(handler); + for(MachineType type:types) + { + sharedBlockRenders.put(type, handler.getRenderId()); + } + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/5015a2ff41b60015176c95ddaf2504ce b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/5015a2ff41b60015176c95ddaf2504ce new file mode 100644 index 0000000..a96ee72 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/5015a2ff41b60015176c95ddaf2504ce @@ -0,0 +1,573 @@ +package ihl.flexible_cable; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import ihl.IHLMod; +import ihl.IHLModInfo; +import ihl.interfaces.ICableHolder; +import ihl.interfaces.IDataCableHolder; +import ihl.interfaces.IEnergyNetNode; +import ihl.interfaces.INetworkListener; +import ihl.utils.IHLUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class NodeEntity extends Entity implements INetworkListener{ + + public Entity prevAnchorEntity; + public Entity nextAnchorEntity; + private int anchorX; + private int anchorY; + private int anchorZ; + private short anchorFacing; + private int anchorDimensionId; + public ItemStack attachedItem; + protected int chainUniqueID=-2; + public int chainArrangeNumber=-2; + protected int checkTimer=201; + public int colorIndex=16777215; + public int type=1;//0 - uninsulated wire; 1 - insulated cable; 2 - data cable + public float dx0=0; + public float dy0=0; + public float dz0=0; + public final int n=64; + public final float[] rotationPitchArray = new float[n+1]; + public final float[] rotationYawArray = new float[n+1]; + public final float[] translationX = new float[n+1]; + public final float[] translationY = new float[n+1]; + public final float[] translationZ = new float[n+1]; + public float virtualNodePosX; + public float virtualNodePosY; + public float virtualNodePosZ; + public float renderPosX; + public float renderPosY; + public float renderPosZ; + + public NodeEntity(World world) + { + super(world); + if(world.isRemote) + { + IHLMod.proxy.addEntityToList(this); + this.setSize(2f, 0.2f); + } + else + { + IHLMod.proxy.addEntityToServerList(this); + this.setSize(0.5F, 0.1F); + } + this.renderDistanceWeight = 5.0D; + this.yOffset+=0.15F; + this.virtualNodePosX=(float) this.posX; + this.virtualNodePosY=(float) this.posY; + this.virtualNodePosZ=(float) this.posZ; + } + + @Override + public void setInPortal(){} + + @Override + public void travelToDimension(int dimensionId){} + + public void setSize(float width, float heigth) + { + super.setSize(width, heigth); + } + + public void setVirtualNodePos(float posX,float posY, float posZ) + { + virtualNodePosX=posX; + virtualNodePosY=posY; + virtualNodePosZ=posZ; + this.registerAndSendData(null); + } + + public void registerAndSendData(EntityPlayerMP player) + { + if(!worldObj.isRemote) + { + Set nes; + if(IHLMod.proxy.nodeEntityRegistry.containsKey(this.getChainUniqueID())) + { + nes=IHLMod.proxy.nodeEntityRegistry.get(this.getChainUniqueID()); + } + else + { + nes=new HashSet(); + IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes); + } + nes.add(this); + ByteBuf bb = Unpooled.buffer(30); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(1); + byteBufOutputStream.writeInt(this.getEntityId()); + byteBufOutputStream.writeInt(this.getChainUniqueID()); + byteBufOutputStream.writeInt(this.chainArrangeNumber); + byteBufOutputStream.writeByte(this.type); + byteBufOutputStream.writeInt(this.colorIndex); + byteBufOutputStream.writeFloat(this.virtualNodePosX); + byteBufOutputStream.writeFloat(this.virtualNodePosY); + byteBufOutputStream.writeFloat(this.virtualNodePosZ); + if(player==null) + { + IHLMod.proxy.sendFromServerToAll(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID)); + } + else + { + IHLMod.proxy.sendFromServerToPlayer(new FMLProxyPacket(byteBufOutputStream.buffer(), IHLModInfo.MODID),player); + } + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + if(!noClip && !worldObj.isRemote) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + if(this.checkTimer==201) + { + if(worldObj.isRemote) + { + IHLMod.proxy.recieveDelayedDataPacket(this); + } + else + { + this.registerAndSendData(null); + } + } + if((prevAnchorEntity==null && !noClip)||(nextAnchorEntity==null || nextAnchorEntity instanceof EntityPlayer || nextAnchorEntity instanceof EntityItem)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + NodeEntity node=(NodeEntity) ei.next(); + if(node.getChainUniqueID()==this.getChainUniqueID()) + { + if(node.chainArrangeNumber==this.chainArrangeNumber-1) + { + this.prevAnchorEntity=node; + node.nextAnchorEntity=this; + } + else if(node.chainArrangeNumber==this.chainArrangeNumber+1) + { + this.nextAnchorEntity=node; + node.prevAnchorEntity=this; + } + } + if(prevAnchorEntity!=null && nextAnchorEntity!=null) + { + break; + } + } + } + } + if(this.attachedItem!=null && (this.nextAnchorEntity == null || this.nextAnchorEntity.isDead) && !this.noClip) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityPlayer player=(EntityPlayer) ei.next(); + if(this.playerHasItemStack(player)) + { + this.nextAnchorEntity=player; + } + + } + } + } + if(this.attachedItem!=null && this.nextAnchorEntity instanceof EntityPlayer && !noClip) + { + EntityPlayer player = (EntityPlayer) this.nextAnchorEntity; + if(!this.playerHasItemStack(player)) + { + double range = 16D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range); + List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); + if(!eItemsList.isEmpty()) + { + Iterator ei = eItemsList.iterator(); + while(ei.hasNext()) + { + EntityItem eitem = ei.next(); + if(eitem.getEntityItem().isItemEqual(this.attachedItem)) + { + this.nextAnchorEntity=eitem; + break; + } + } + } + } + } + if(!worldObj.isRemote) + { + { + double x0,x2,y0,y2,z0,z2; + x2=x0=this.virtualNodePosX; + y2=y0=this.virtualNodePosY; + z2=z0=this.virtualNodePosZ; + if(nextAnchorEntity!=null) + { + x2=nextAnchorEntity.posX; + y2=nextAnchorEntity.posY; + z2=nextAnchorEntity.posZ; + } + if(prevAnchorEntity!=null) + { + x0=prevAnchorEntity.posX; + y0=prevAnchorEntity.posY; + z0=prevAnchorEntity.posZ; + } + + double d1 = (x0-x2)*(x0-x2)+(y0-y2)*(y0-y2)+(z0-z2)*(z0-z2); + if(d1>4D) + { + this.motionX=(x0+x2)*0.5D-this.posX*1D; + this.motionY=(y0+y2)*0.5D-this.posY*1D; + this.motionZ=(z0+z2)*0.5D-this.posZ*1D; + if(nextAnchorEntity!=null && this.getDistanceSqToEntity(nextAnchorEntity)>4D) + { + this.nextAnchorEntity.addVelocity((this.posX-this.nextAnchorEntity.posX)*0.01D, (this.posY-this.nextAnchorEntity.posY)*0.01D, (this.posZ-this.nextAnchorEntity.posZ)*0.01D); + } + } + else + { + double d2 = this.getDistanceSq(x2,y2,z2); + if(d2>1D) + { + this.motionX+=(x2-this.posX)*0.1D; + this.motionY+=(y2-this.posY)*0.1D; + this.motionZ+=(z2-this.posZ)*0.1D; + } + double d3 = this.getDistanceSq(x0,y0,z0); + if(d3>1D) + { + this.motionX+=(x0-this.posX)*0.1D; + this.motionY+=(y0-this.posY)*0.1D; + this.motionZ+=(z0-this.posZ)*0.1D; + } + } + this.motionY-=0.005D; + } + } + if(this.onGround) + { + this.motionY *= -0.5D; + } + this.motionX*=0.9D; + this.motionY*=0.9D; + this.motionZ*=0.9D; + if(worldObj.isRemote) + { + float movvmentSpeed=0.05f; + this.renderPosX=this.renderPosX*(1f-movvmentSpeed)+(float) this.prevPosX*movvmentSpeed; + this.renderPosY=this.renderPosY*(1f-movvmentSpeed)+(float) this.prevPosY*movvmentSpeed; + this.renderPosZ=this.renderPosZ*(1f-movvmentSpeed)+(float) this.prevPosZ*movvmentSpeed; + float xi,yi,zi; + float x0=xi=(float)this.prevPosX; + float y0=yi=(float)this.prevPosY; + float z0=zi=(float)this.prevPosZ; + float dx0=this.dx0; + float dy0=this.dy0; + float dz0=this.dz0; + float dx1=this.virtualNodePosX-xi; + float dy1=this.virtualNodePosY-yi; + float dz1=this.virtualNodePosZ-zi; + if(this.nextAnchorEntity!=null) + { + dx1=(float) (this.nextAnchorEntity.prevPosX-xi); + dy1=(float) (this.nextAnchorEntity.prevPosY-yi); + dz1=(float) (this.nextAnchorEntity.prevPosZ-zi); + } + if(this.prevAnchorEntity==null) + { + this.renderPosX=x0=xi=this.virtualNodePosX; + this.renderPosY=y0=yi=this.virtualNodePosY; + this.renderPosZ=z0=zi=this.virtualNodePosZ; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + if(((NodeEntity)this.nextAnchorEntity).nextAnchorEntity!=null) + { + Entity nne = ((NodeEntity)this.nextAnchorEntity).nextAnchorEntity; + dx1=(float) (nne.prevPosX-xi); + dy1=(float) (nne.prevPosY-yi); + dz1=(float) (nne.prevPosZ-zi); + } + else + { + dx1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosX-xi); + dy1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosY-yi); + dz1=(float) (((NodeEntity) this.nextAnchorEntity).virtualNodePosZ-zi); + } + } + float x1=this.virtualNodePosX; + float y1=this.virtualNodePosY; + float z1=this.virtualNodePosZ; + if(this.nextAnchorEntity!=null) + { + x1=(float)this.nextAnchorEntity.prevPosX; + y1=(float)this.nextAnchorEntity.prevPosY; + z1=(float)this.nextAnchorEntity.prevPosZ; + } + int i1=0; + for(float i=1f/n;i<=1f+1f/n;i+=1f/n,i1++) + { + float dxi = xi; + float dyi = yi; + float dzi = zi; + xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0; + yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0; + zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0; + int blockX=(int)xi; + int blockY=(int)yi; + int blockZ=(int)zi; + dxi-=xi; + dyi-=yi; + dzi-=zi; + double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi); + float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI)); + float rotationPitch = (float) Math.atan2(dxi, dzi); + float rotationYaw = (float) (-Math.atan2(dyi, var7)); + rotationPitchArray[i1]=rotationPitch; + rotationYawArray[i1]=rotationYaw; + translationX[i1]=dxi; + translationY[i1]=dyi; + translationZ[i1]=dzi; + } + if(this.nextAnchorEntity instanceof NodeEntity) + { + NodeEntity next = (NodeEntity) this.nextAnchorEntity; + next.dx0=dx1; + next.dy0=dy1; + next.dz0=dz1; + } + } + if(--this.checkTimer<=0) + { + if(!worldObj.isRemote) + { + WorldServer world = MinecraftServer.getServer().worldServerForDimension(this.anchorDimensionId); + TileEntity te = world.getTileEntity(this.anchorX, this.anchorY, this.anchorZ); + if(te==null || !(te instanceof ICableHolder || te instanceof AnchorTileEntity)) + { + this.setDead(); + } + } + this.checkTimer=200; + } + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) + { + this.noClip=nbt.getBoolean("noClip"); + this.setChainUniqueID(nbt.getInteger("chainUniqueID")); + this.chainArrangeNumber=nbt.getInteger("chainArrangeNumber"); + this.anchorX=nbt.getInteger("anchorX"); + this.anchorY=nbt.getInteger("anchorY"); + this.anchorZ=nbt.getInteger("anchorZ"); + this.anchorFacing=nbt.getShort("anchorFacing"); + this.anchorDimensionId=nbt.getInteger("anchorDimensionId"); + this.type=nbt.getInteger("type"); + this.colorIndex=nbt.getInteger("colorIndex"); + if(nbt.hasKey("itemStack")) + { + NBTTagCompound stackTag = (NBTTagCompound) nbt.getTag("itemStack"); + this.attachedItem = ItemStack.loadItemStackFromNBT(stackTag); + } + if(nbt.hasKey("width")) + { + this.setSize(nbt.getFloat("width"), nbt.getFloat("height")); + } + this.virtualNodePosX=nbt.getFloat("virtualNodePosX"); + this.virtualNodePosY=nbt.getFloat("virtualNodePosY"); + this.virtualNodePosZ=nbt.getFloat("virtualNodePosZ"); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) + { + nbt.setFloat("width", this.width); + nbt.setFloat("height", this.height); + nbt.setBoolean("noClip", noClip); + nbt.setInteger("chainUniqueID", this.getChainUniqueID()); + nbt.setInteger("chainArrangeNumber", this.chainArrangeNumber); + nbt.setInteger("anchorX", this.anchorX); + nbt.setInteger("anchorY", this.anchorY); + nbt.setInteger("anchorZ", this.anchorZ); + nbt.setShort("anchorFacing",this.anchorFacing); + nbt.setInteger("anchorDimensionId",this.anchorDimensionId); + nbt.setInteger("type", this.type); + nbt.setInteger("colorIndex", this.colorIndex); + if(this.attachedItem!=null) + { + NBTTagCompound stackTag = new NBTTagCompound(); + this.attachedItem.writeToNBT(stackTag); + nbt.setTag("itemStack",stackTag); + } + nbt.setFloat("virtualNodePosX",this.virtualNodePosX); + nbt.setFloat("virtualNodePosY",this.virtualNodePosY); + nbt.setFloat("virtualNodePosZ",this.virtualNodePosZ); + } + + public void setAnchor(int x, int y, int z, short facing, int dimensionId) + { + this.anchorX=x; + this.anchorY=y; + this.anchorZ=z; + this.anchorFacing=facing; + this.anchorDimensionId=dimensionId; + } + + public boolean playerHasItemStack(EntityPlayer player) + { + int var2; + + for (var2 = 0; var2 < player.inventory.armorInventory.length; ++var2) + { + if (player.inventory.armorInventory[var2] != null && player.inventory.armorInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.armorInventory[var2].stackTagCompound==null?false:player.inventory.armorInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + for (var2 = 0; var2 < player.inventory.mainInventory.length; ++var2) + { + if (player.inventory.mainInventory[var2] != null && player.inventory.mainInventory[var2].isItemEqual(this.attachedItem)) + { + return player.inventory.mainInventory[var2].stackTagCompound==null?false:player.inventory.mainInventory[var2].stackTagCompound.getInteger("chainUID")==this.attachedItem.stackTagCompound.getInteger("chainUID"); + } + } + + return false; + } + + public int getChainUniqueID() { + return chainUniqueID; + } + + public void setChainUniqueID(int chainUniqueID) { + this.chainUniqueID = chainUniqueID; + } + + @Override + public AxisAlignedBB getCollisionBox(Entity entity) + { + if(this.noClip) + { + return null; + } + else + { + return super.getCollisionBox(entity); + } + } + + @Override + public int getId() + { + return this.getEntityId(); + } + + @Override + public void recieveData(ByteBufInputStream byteBufInputStream) + { + try + { + this.setChainUniqueID(byteBufInputStream.readInt()); + this.chainArrangeNumber=byteBufInputStream.readInt(); + this.type=byteBufInputStream.readByte(); + this.colorIndex=byteBufInputStream.readInt(); + this.virtualNodePosX=byteBufInputStream.readFloat(); + this.virtualNodePosY=byteBufInputStream.readFloat(); + this.virtualNodePosZ=byteBufInputStream.readFloat(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @Override + protected void entityInit() {} + + @Override + public boolean isInvalid() + { + return this.isDead; + } + + public void setVirtualNodePosToNearestPortal() + { + int x0 = (int)this.posX; + int y0 = (int)this.posY; + int z0 = (int)this.posZ; + for(int xi=x0-2;xi<=x0+2;xi++) + { + for(int yi=y0-2;yi<=y0+2;yi++) + { + for(int zi=z0-2;zi<=z0+2;zi++) + { + Block block = worldObj.getBlock(xi, yi, zi); + if(block==Blocks.portal||block==Blocks.end_portal) + { + this.setVirtualNodePos(xi+0.5f, yi+0.5f, zi+0.5f); + return; + } + } + } + } + + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d7200b148e00151544f45b8684d31e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d7200b148e00151544f45b8684d31e new file mode 100644 index 0000000..7193215 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d7200b148e00151544f45b8684d31e @@ -0,0 +1,376 @@ +package ihl.utils; + +import ihl.IHLMod; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class EntityIHLExplosion extends Entity { + private Explosion explosion; + private boolean explosionDone=false; + private Set sv; + public Set effectBorderBlocks; + public Set effectBorderBlocksWithLowPosition; + public Set blocksConnectedWithBedrock; + public Set blocksNotConnectedWithBedrock; + public Map drops; + public int explosionPower; + public int x; + public int y; + public int z; + private Chunk[][] chunkArray; + private ExtendedBlockStorage[][][] esbArray; + private int[][][] esbHardness; + private boolean[][][] entityCached; + private Map entityCache = new HashMap(); + public int multiplier; + private int chunkX; + private int chunkZ; + public DamageSource damageSource; + + public EntityIHLExplosion(World world,int x1,int y1,int z1, int explosionPower1) { + super(world); + this.effectBorderBlocks=new HashSet(); + this.effectBorderBlocksWithLowPosition=new HashSet(); + this.blocksConnectedWithBedrock=new HashSet(); + this.blocksNotConnectedWithBedrock=new HashSet(); + this.drops=new HashMap(); + this.isImmuneToFire=true; + this.noClip=true; + this.setSize(0F, 0F); + this.x=x1; + this.y=y1; + this.z=z1; + this.setPosition(x+0.5d, y+0.5d, z+0.5d); + this.explosionPower = explosionPower1; + this.multiplier = Math.min(4,Math.max(this.explosionPower/16000,1)); + int areaSize = 32*multiplier; + this.explosion=new Explosion(world, this, this.posX, this.posY, this.posZ, 4.0f); + chunkX = x-areaSize >> 4; + chunkZ = z-areaSize >> 4; + int var9 = x+areaSize >> 4; + int var10 = z+areaSize >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.esbArray = new ExtendedBlockStorage[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + this.entityCached = new boolean[var9 - this.chunkX + 1][var10 - this.chunkZ + 1][16]; + int var11; + int var12; + Chunk var13; + for (var11 = chunkX; var11 <= var9; ++var11) + { + for (var12 = chunkZ; var12 <= var10; ++var12) + { + var13 =this.worldObj.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + this.esbArray[var11 - this.chunkX][var12 - this.chunkZ] = var13.getBlockStorageArray(); + for(int eay=0;eay>8, (i4>>4) & 4095, i4 & 4095) << 8; + } + this.esbHardness[x1][z2][y3]+=Math.round(Block.getBlockById(var4).getExplosionResistance(this, worldObj, (i4>>8)+(x1<<4), ((i4>>4) & 4095)+(y3<<4), (i4 & 4095)+(z2<<4), this.x, this.y, this.z)*10f); + } + } + } + } + } + } + + public void onUpdate() + { + if(!effectBorderBlocks.isEmpty()) + { + boolean hasSomeBlocksStickedToAir=false; + Iterator ebbi = effectBorderBlocks.iterator(); + while(ebbi.hasNext()) + { + long longNumber = ebbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + if(block!=Blocks.air && !block.isAir(worldObj, x+xyz[0], y+xyz[1], z+xyz[2])) + { + if(block.getMaterial().isLiquid()) + { + block.onNeighborBlockChange(worldObj, x+xyz[0], y+xyz[1], z+xyz[2], block); + } + else if(!this.isBlockConnectedWithBedrock(longNumber)) + { + hasSomeBlocksStickedToAir=true; + } + } + } + Iterator bnctbi = this.blocksNotConnectedWithBedrock.iterator(); + while(bnctbi.hasNext()) + { + long longNumber5 = bnctbi.next(); + int[] xyz = IHLUtils.decodeXYZ(longNumber5); + Block block = worldObj.getBlock(x+xyz[0], y+xyz[1], z+xyz[2]); + float bh = block.getBlockHardness(worldObj, x+xyz[0], y+xyz[1], z+xyz[2]); + if(bh>=0f && bh path = new HashSet(); + Iterator pathi = path.iterator(); + Set deadlockBlocks = new HashSet(); + int[] xyz = IHLUtils.decodeXYZ(longNumber); + int absX=x+xyz[0]; + int absY=y+xyz[1]; + int absZ=z+xyz[2]; + path.add(longNumber); + while(absY>4) + { + int xyzi[] = {0,0,-1,0,0,1,0,0}; + Block block; + int x2,y2,z2; + boolean deadlock = true; + for(int i=0;i<=5;i++) + { + x2=absX+xyzi[i]; + y2=absY+xyzi[i+2]; + z2=absZ+xyzi[i+1]; + long longNumber2 = IHLUtils.encodeXYZ(x2-x, y2-y, z2-z); + if(this.blocksConnectedWithBedrock.contains(longNumber2)) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + if(!path.contains(longNumber2)) + { + block = worldObj.getBlock(x2,y2,z2); + if(block!=Blocks.air && !block.isAir(worldObj, x2,y2,z2) && !block.getMaterial().isLiquid()) + { + absX=x2; + absY=y2; + absZ=z2; + path.add(longNumber2); + if(absY<=4) + { + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + deadlock = false; + break; + } + } + } + if(deadlock) + { + long longNumber3 = IHLUtils.encodeXYZ(absX-x, absY-y, absZ-z); + deadlockBlocks.add(longNumber3); + boolean deadEnd=true; + while(pathi.hasNext()) + { + long longNumber4 = pathi.next(); + if(!deadlockBlocks.contains(longNumber4)) + { + int[] xyz2 = IHLUtils.decodeXYZ(longNumber4); + absX=x+xyz2[0]; + absY=y+xyz2[1]; + absZ=z+xyz2[2]; + deadEnd=false; + break; + } + } + if(deadEnd) + { + this.blocksNotConnectedWithBedrock.addAll(path); + return false; + } + } + } + this.blocksConnectedWithBedrock.addAll(path); + return true; + } + + public void update() + { + Set sv2=new HashSet(); + if(sv==null) + { + sv = IHLMod.explosionHandler.startVectors; + IHLMod.explosionHandler.setPower(explosionPower); + System.out.println("Start"); + } + for(long ev:sv) + { + Set sv3 = IHLMod.explosionHandler.breakBlocksAndGetDescendants(this.worldObj, this, this.explosion, ev); + if(sv3!=null) + { + sv2.addAll(sv3); + } + } + if(sv2.isEmpty()) + { + explosionDone=true; + System.out.println("End"); + } + else + { + sv=sv2; + } + } + + @Override + protected void entityInit() {} + + @Override + protected void readEntityFromNBT(NBTTagCompound arg0) {} + + @Override + protected void writeEntityToNBT(NBTTagCompound arg0) {} + + public Block getBlock(int x1, int y1, int z1) + { + Block var4 = Blocks.air; + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var4 = var7.getBlock(x1 & 15, y1, z1 & 15); + } + } + } + return var4; + } + + public void setBlockToAir(int x1, int y1, int z1) + { + if (y1 >= 0 && y1 < 256) + { + int var5 = (x1 >> 4) - this.chunkX; + int var6 = (z1 >> 4) - this.chunkZ; + if (var5 >= 0 && var5 < this.chunkArray.length && var6 >= 0 && var6 < this.chunkArray[var5].length) + { + Chunk var7 = this.chunkArray[var5][var6]; + if (var7 != null) + { + var7.func_150807_a(x1 & 15, y1, z1 & 15, Blocks.air, 0); + this.worldObj.markBlockForUpdate(x1, y1, z1); + } + } + } + } + + public Entity getEntity(int x1, int y1, int z1) + { + int x2 = x1-x; + int y2 = y1-y; + int z2 = z1-z; + if (y1 >= 0 && y1 < 256) + { + int cax = (x1 >> 4) - this.chunkX; + int caz = (z1 >> 4) - this.chunkZ; + int eay = (y1 >> 4); + if (cax >= 0 && cax < this.entityCached.length && caz >= 0 && caz < this.entityCached[cax].length && eay<=16) + { + if(this.entityCached[cax][caz][eay]) + { + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + else + { + Chunk var7 = this.chunkArray[cax][caz]; + if (var7 != null) + { + for(Object entityo:var7.entityLists[eay]) + { + Entity entity=(Entity) entityo; + int x3 = (int)entity.posX-x; + int y3 = (int)entity.posY-y; + int z3 = (int)entity.posZ-z; + long key = IHLUtils.encodeXYZ(x3, y3, z3); + this.entityCache.put(key, entity); + if(entity.height>1f && y3<254) + { + long key2 = IHLUtils.encodeXYZ(x3, y3+1, z3); + this.entityCache.put(key2, entity); + } + } + } + this.entityCached[cax][caz][eay]=true; + return this.entityCache.get(IHLUtils.encodeXYZ(x2, y2, z2)); + } + } + } + return null; + } + + public int getEBSResistance(int x2, int y2, int z2) + { + return this.esbHardness[x2][z2][y2]; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d88773a7ca001510f7df4278c93a7e b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d88773a7ca001510f7df4278c93a7e new file mode 100644 index 0000000..4324a89 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e2/a0d88773a7ca001510f7df4278c93a7e @@ -0,0 +1,934 @@ +package ihl.utils; + +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeInputItemStack; +import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.Recipes; +import ic2.core.BasicMachineRecipeManager; +import ic2.core.block.invslot.InvSlotOutput; +import ihl.IHLMod; +import ihl.interfaces.IWire; +import ihl.metallurgy.constants.*; +import ihl.processing.invslots.InvSlotConsumableLiquidIHL; +import ihl.recipes.IRecipeInputFluid; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.mutable.MutableObject; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.oredict.OreDictionary; + +public class IHLUtils +{ + private static Map ihlItemStackRegistry = new HashMap(); + + public static void registerLocally(String name, ItemStack stack) + { + ihlItemStackRegistry.put(name, stack); + } + + public static ItemStack getOreDictItemStack(String name) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=1; + return orecopy; + } + + public static boolean hasOreDictionaryEntry(String name) + { + return !OreDictionary.getOres(name).isEmpty(); + } + + public static Item getOreDictItem(String name) + { + return OreDictionary.getOres(name).get(0).getItem(); + } + + public static Block getOreDictBlock(String name) + { + return Block.getBlockFromItem(OreDictionary.getOres(name).get(0).getItem()); + } + + public static ItemStack getOreDictItemStackWithSize(String name, int size) + { + ItemStack ore = OreDictionary.getOres(name).get(0); + if(ore==null)return null; + ItemStack orecopy = ore.copy(); + orecopy.stackSize=size; + return orecopy; + } + + public static String getFirstOreDictName(ItemStack stack) + { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + if(arrayIDs.length>0) + { + return OreDictionary.getOreName(arrayIDs[0]); + } + return ""; + } + + public static ItemStack getThisModItemStack(String name) + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + + public static ItemStack getThisModItemStackWithSize(String name, int i) { + if(ihlItemStackRegistry.get(name)!=null) + { + ItemStack stack = ihlItemStackRegistry.get(name).copy(); + stack.stackSize=i; + return stack; + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name),i); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name),i); + } + } + + public static ItemStack getOtherModItemStackWithDamage(String modname, String name,int damage) { + if(GameRegistry.findItem(modname, name)!=null) + { + return new ItemStack(GameRegistry.findItem(modname, name),1,damage); + } + else if(GameRegistry.findBlock(modname, name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock(modname, name),1,damage); + } + } + + public static Item getThisModItem(String name) + { + if(GameRegistry.findItem("ihl", name)!=null) + { + return GameRegistry.findItem("ihl", name); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + else + { + return Item.getItemFromBlock(GameRegistry.findBlock("ihl", name)); + } + } + + public static FluidStack getFluidStackWithSize(String name, int i) { + if(FluidRegistry.isFluidRegistered(name)) + { + return FluidRegistry.getFluidStack(name, i); + } + else + { + throw new IllegalArgumentException("No such fluid: "+name); + } + } + + public static Block getThisModBlock(String name) + { + if(GameRegistry.findBlock("ihl", name)==null) + { + throw new IllegalArgumentException("No such block in item registry: ihl:"+name); + } + else + { + return GameRegistry.findBlock("ihl", name); + } + } + + public static ItemStack getThisModItemStackWithDamage(String name, + int value) + { + ItemStack stack = getThisModItemStack(name); + stack.setItemDamage(value); + return stack; + } + + public static boolean adjustWireLength(ItemStack stack, int adjustBy) + { + int length = getWireLength(stack); + if(length<=0) + { + return true; + } + else + { + int newLength = Math.max(length+adjustBy,0); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),newLength); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),newLength); + if(newLength==0) + { + return true; + } + return false; + } + } + + public static int getWireLength(ItemStack itemStack) + { + return itemStack.stackTagCompound.getInteger(((IWire)itemStack.getItem()).getTag()); + } + + public static ItemStack getThisModWireItemStackWithLength(String name, int i) { + if(getThisModItemStack(name)!=null) + { + ItemStack stack = getThisModItemStack(name); + if(stack.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException("ihl:"+name + " is not an instance of IWire."); + } + } + else + { + throw new IllegalArgumentException("No such item in item registry: ihl:"+name); + } + } + + public static ItemStack getThisModWireItemStackWithLength(ItemStack stack1, int i) { + ItemStack stack = stack1.copy(); + if(stack1.getItem() instanceof IWire) + { + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTag(),i); + stack.stackTagCompound.setInteger(((IWire)stack.getItem()).getTagSecondary(),i); + return stack; + } + else + { + throw new IllegalArgumentException(stack1.getUnlocalizedName() + " is not an instance of IWire."); + } + } + + public static boolean isItemsHaveSameOreDictionaryEntry(ItemStack is, ItemStack is1) + { + int[] odids1 = OreDictionary.getOreIDs(is); + int[] odids2 = OreDictionary.getOreIDs(is1); + if(odids1!=null && odids1.length>0 && odids2!=null && odids2.length>0) + { + for(int i1=0;i1 getEntryListForOre(String name) + { + ArrayList outputList = new ArrayList(); + ArrayList oreList = OreDictionary.getOres(name); + Iterator oreListIterator = oreList.iterator(); + while(oreListIterator.hasNext()) + { + outputList.add(oreListIterator.next().copy()); + } + return outputList; + } + + public static ItemStack getItemStackIfExist(String name) + { + if(hasOreDictionaryEntry(name)) + { + return getOreDictItemStack(name); + } + else + { + if(ihlItemStackRegistry.get(name)!=null) + { + return ihlItemStackRegistry.get(name).copy(); + } + if(GameRegistry.findItem("ihl", name)!=null) + { + return new ItemStack(GameRegistry.findItem("ihl", name)); + } + else if(GameRegistry.findBlock("ihl", name)==null) + { + return null; + } + else + { + return new ItemStack(GameRegistry.findBlock("ihl", name)); + } + } + } + + public static FluidStack getFluidStackIfExist(String string, int meltingFluidAmount) + { + if(FluidRegistry.isFluidRegistered(string)) + { + return getFluidStackWithSize(string,meltingFluidAmount); + } + return null; + } + + public static boolean addItemStackToInventory(EntityPlayer player, ItemStack stack) + { + ItemStack[] inv = player.inventory.mainInventory; + for (int i=0;i<=35;i++) + { + if(inv[i]!=null) + { + if(inv[i].getItem()==stack.getItem()) + { + if(inv[i].getItemDamage()==stack.getItemDamage() && inv[i].stackSizeinv[i].getMaxStackSize()) + { + stack.stackSize=inv[i].stackSize-inv[i].getMaxStackSize(); + } + else + { + return true; + } + } + } + } + else + { + inv[i]=stack; + return true; + } + } + return false; + } + + public static FluidStack getFluidStackWithSizeChemicallyPure(String name, int amount) + { + FluidStack fstack = getFluidStackWithSize(name, amount); + fstack.tag=new NBTTagCompound(); + fstack.tag.setBoolean("chemicallyPure", true); + return fstack; + } + + public static void removeItemStackFromOreDictionaryEntry(String orename, ItemStack itemStack) + { + ArrayList orelist = OreDictionary.getOres(orename); + Iterator oreListIterator = orelist.iterator(); + ItemStack odstack = null; + while(oreListIterator.hasNext()) + { + odstack = oreListIterator.next(); + if(odstack.getItem()==itemStack.getItem()) + { + break; + } + else + { + odstack = null; + } + } + if(odstack != null) + { + orelist.remove(odstack); + IHLMod.log.debug("Stack "+odstack.getDisplayName()+" ("+odstack.toString()+")"+" removed from ore entry '"+orename+"'"); + } + } + + public static void addIC2MaceratorRecipe(String input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStack(input), false)==null) + { + ((BasicMachineRecipeManager)Recipes.macerator).addRecipe(new RecipeInputOreDict(input), new NBTTagCompound(), true, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(String input, int stacksize, ItemStack output) + { + if(Recipes.macerator.getOutputFor(getOreDictItemStackWithSize(input,stacksize), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputOreDict(input,stacksize), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2MaceratorRecipe(ItemStack input, ItemStack output) + { + if(Recipes.macerator.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.macerator.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 macerator recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(ItemStack input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(input, false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputItemStack(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input.getDisplayName()+" already exist. Skipped."); + } + } + + public static void addIC2RollingRecipe(String input, ItemStack output) + { + if(Recipes.metalformerRolling.getOutputFor(getThisModItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + Recipes.metalformerRolling.addRecipe(new RecipeInputOreDict(input), tag, output); + } + else + { + //IHLMod.log.info("IC2 metal former (rolling) recipe for "+input+" already exist. Skipped."); + } + } + + public static void addIC2CentrifugeRecipe(String input, ItemStack output, ItemStack output2) + { + if(Recipes.centrifuge.getOutputFor(getOreDictItemStack(input), false)==null) + { + NBTTagCompound tag = new NBTTagCompound(); + tag.setInteger("minHeat", 2000); + Recipes.centrifuge.addRecipe(new RecipeInputOreDict(input), tag, new ItemStack[] {output,output2}); + } + else + { + //IHLMod.log.info("IC2 centrifuge recipe for "+input+" already exist. Skipped."); + } + } + + public static void damageItemViaNBTTag(ItemStack stack, int amount) + { + NBTTagCompound gtTagCompound; + if(stack.stackTagCompound.hasKey("GT.ToolStats")) + { + gtTagCompound = stack.stackTagCompound.getCompoundTag("GT.ToolStats"); + } + else + { + stack.stackSize--; + return; + } + int damage = 0; + int maxDamage = 0; + if(gtTagCompound.hasKey("MaxDamage")) + { + maxDamage = gtTagCompound.getInteger("MaxDamage"); + } + else + { + stack.stackSize--; + return; + } + + if(gtTagCompound.hasKey("Damage")) + { + damage = gtTagCompound.getInteger("Damage"); + } + if(damage=input.getAmount(); + } + else + { + return stack.stackSize>=input.getAmount(); + } + } + return false; + } + + public static boolean reduceItemStackAmountUsingIRecipeInput(IRecipeInput input, ItemStack stack) { + if(stack.getItem() instanceof IWire) + { + return adjustWireLength(stack,-input.getAmount()); + } + else + { + stack.stackSize-=input.getAmount(); + return stack.stackSize<=0; + } + } + + public static String getFirstOreDictNameExcludingTagAny(ItemStack stack) { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + for(int i=0;i0 && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fluidTank.fill(drainInputSlot.drain(null, fluidTank.getCapacity()-fluidTank.getFluidAmount(), output, false),true); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + if (fillInputSlot!=null && !fillInputSlot.isEmpty()) + { + output = new MutableObject(); + if (fillInputSlot.transferFromTank(fluidTank, output, true) && (output.getValue() == null || emptyFluidItemsSlot.canAdd((ItemStack)output.getValue()))) + { + fillInputSlot.transferFromTank(fluidTank, output, false); + if(output.getValue()!=null) + { + emptyFluidItemsSlot.add((ItemStack)output.getValue()); + } + } + } + } + public static double[] tracePlayerView(EntityPlayer entityplayer) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + if (entityplayer.worldObj!=null && entityplayer.worldObj.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + double z = entityplayer.posZ; + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 1.0D; + return new double[] {x+f7 * d3, y+f6 * d3, z+f9 * d3}; + } + + public static MovingObjectPosition returnMOPFromPlayer(EntityPlayer entityplayer, World world) + { + float f1 = entityplayer.rotationPitch; + float f2 = entityplayer.rotationYaw; + double x = entityplayer.posX; + double y =entityplayer.posY + entityplayer.getEyeHeight(); + + if (world.isRemote) + { + y -= entityplayer.getDefaultEyeHeight(); + } + + double z = entityplayer.posZ; + Vec3 vec3d = Vec3.createVectorHelper(x, y, z); + float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f9 = f3 * f5; + double d3 = 5.0D; + Vec3 vec3d1 = vec3d.addVector(f7 * d3, f6 * d3, f9 * d3); + MovingObjectPosition movingobjectposition = world.rayTraceBlocks(vec3d, vec3d1, true); + + if (movingobjectposition == null) + { + return null; + } + + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + return movingobjectposition; + } + return null; + } + + public static short getFacingFromPlayerView(EntityLivingBase player, boolean ignoreSneaking) + { + int var6 = MathHelper.floor_double(player.rotationPitch * 4.0F / 360.0F + 0.5D) & 3; + int var7 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + { + if(var6==1) + { + return 1; + } + else if(var6==3) + { + return 0; + } + else + { + if(player.isSneaking() && !ignoreSneaking) + { + switch(var7) + { + case 0: + return 3; + case 1: + return 4; + case 2: + return 2; + case 3: + return 5; + default: + break; + } + } + else + { + switch(var7) + { + case 0: + return 2; + case 1: + return 5; + case 2: + return 3; + case 3: + return 4; + default: + break; + } + } + } + } + return 3; + } + + public static int getChainID(ItemStack itemStack) + { + if(itemStack!=null && itemStack.stackTagCompound!=null && itemStack.stackTagCompound.hasKey("chainUID")) + { + return itemStack.stackTagCompound.getInteger("chainUID"); + } + return -1; + } + + public static List convertRecipeInputToItemStackList(List input) + { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInput iri = irii.next(); + ItemStack stack = iri.getInputs().get(0); + stack.stackSize=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static List convertRecipeInputToFluidStackList(List input) { + Iterator irii=input.iterator(); + List output = new ArrayList(); + while(irii.hasNext()) + { + IRecipeInputFluid iri = irii.next(); + FluidStack stack = iri.getInputs().get(0); + stack.amount=iri.getAmount(); + output.add(stack); + } + return output; + } + + public static int[] decodeXYZ(long longNumber) + { + return new int[] {(int) ((longNumber>>30) & 0xfff)-256,(int) ((longNumber>>15) & 0xfff)-256,(int) (longNumber & 0xfff)-256}; + } + + public static long encodeXYZ(int x,int y,int z) + { + return (x+256L)<<30|((y+256L)<<15)|(z+256L); + } + + public static int reduceVariableByAbsoluteValue(int variable) + { + if(variable==0) + { + return 0; + } + else if(variable<0) + { + return variable+1; + } + else + { + return variable-1; + } + } + + public static long getXYZHash(int x,int y,int z) + { + return ((x&0x1FFFFF)<<42)|((y&0x1FFFFF)<<21)|(z&0x1FFFFF); + } + + public static String trim(String str) + { + int len = str.length(); + int start; + char c; + for (start = 0; start < len; ++start) + { + c = str.charAt(start); + if (c > 32 && c != 65279) + { + break; + } + } + int end; + for (end = len - 1; end >= start; --end) + { + c = str.charAt(end); + if (c > 32 && c != 65279) + { + break; + } + } + return start <= 0 && end >= len - 1 ? str : str.substring(start, end + 1); + } + + public static int getAmountOf(ItemStack is) + { + if(is.getItem() instanceof IWire) + { + return getWireLength(is); + } + else + { + return is.stackSize; + } + } + + public static ItemStack getWireItemStackCopyWithLengthMultiplied(ItemStack stack, int multiplier) + { + ItemStack out = stack.copy(); + adjustWireLength(out,getWireLength(stack)*(multiplier-1)); + return out; + } + + public static ItemStack getUninsulatedWire(String material, int length, int transverseSection) { + ItemStack is = getThisModItemStack("copperWire"); + is.stackTagCompound=new NBTTagCompound(); + is.stackTagCompound.setBoolean("firstConnection",false); + is.stackTagCompound.setInteger("fullLength", length); + is.stackTagCompound.setInteger("length", length); + is.stackTagCompound.setBoolean("firstConnection", false); + is.stackTagCompound.setString("material", material); + is.stackTagCompound.setInteger("transverseSection",transverseSection); + is.stackTagCompound.setInteger("resistance", ElectricConductor.getResistivity(material)*100/transverseSection); + return is; + } + + public static ItemStack getInsulatedWire(String material, int length, int transverseSection, String insulationMaterial, int insulationThickness) { + ItemStack is = getUninsulatedWire(material, length, transverseSection); + is.stackTagCompound.setString("insulationMaterial",insulationMaterial); + is.stackTagCompound.setInteger("insulationThickness",insulationThickness); + is.stackTagCompound.setInteger("maxVoltage", getInsulationMaxVoltage(insulationMaterial, insulationThickness)); + return is; + } + + public static int getInsulationMaxVoltage(String insulationMaterial, int insulationThickness) + { + return Math.min(Insulation.getMaxVoltagePermm(insulationMaterial)*insulationThickness/10,Insulation.getMaxVoltageCap(insulationMaterial)); + } + + public static ItemStack getItemStackWithTag(String unLocalizedName, String tag, int tagValue) { + ItemStack stack = IHLUtils.getThisModItemStack(unLocalizedName); + if(stack.stackTagCompound==null) + { + stack.stackTagCompound=new NBTTagCompound(); + } + stack.stackTagCompound.setInteger(tag, tagValue); + return stack; + } + + public static boolean isSegmentInsideAABB(AxisAlignedBB collisionBox, double posX, double posY, double posZ, double posX2, double posY2, double posZ2) + { + if(isInsideofBoundingBox(collisionBox,(float)posX,(float)posY,(float)posZ)||isInsideofBoundingBox(collisionBox,(float)posX2,(float)posY2,(float)posZ2)) + { + return true; + } + else + { + double minX=Math.min(posX, posX2); + double maxX=Math.max(posX, posX2); + double minY=Math.min(posY, posY2); + double maxY=Math.max(posY, posY2); + double minZ=Math.min(posZ, posZ2); + double maxZ=Math.max(posZ, posZ2); + return !(maxXcollisionBox.maxX || + maxYcollisionBox.maxY || + maxZcollisionBox.maxZ); + } + } + + public static boolean isInsideofBoundingBox(AxisAlignedBB bb, float xi, float yi, float zi) + { + return bb.maxX>xi && bb.minXyi && bb.minYzi && bb.minZ yellowColoredWires = new HashSet(3); + protected boolean isDataCable=false; + + public FlexibleCableItem() + { + super(); + yellowColoredWires.add("Gold"); + yellowColoredWires.add("Copper"); + yellowColoredWires.add("Bronze"); + this.setCreativeTab(IHLCreativeTab.tab); + this.setMaxStackSize(1); + instance=this; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List itemList) + { + itemList.add(IHLUtils.getUninsulatedWire("Copper", 160, 15)); + itemList.add(IHLUtils.getUninsulatedWire("Copper", 160, 240)); + itemList.add(IHLUtils.getUninsulatedWire("Steel", 160, 15)); + itemList.add(IHLUtils.getUninsulatedWire("Steel", 160, 240)); + itemList.add(IHLUtils.getInsulatedWire("Copper", 160, 15,"RawRubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Copper", 160, 240,"RawRubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Steel", 160, 15,"RawRubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Steel", 160, 240,"RawRubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Copper", 160, 15,"Rubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Copper", 160, 240,"Rubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Steel", 160, 15,"Rubber",100)); + itemList.add(IHLUtils.getInsulatedWire("Steel", 160, 240,"Rubber",100)); + } + + public static void init() + { + GameRegistry.registerItem(new FlexibleCableItem(),"copperWire"); + } + + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) + { + TileEntity t = world.getTileEntity(x, y, z); + short facing = IHLUtils.getFacingFromPlayerView(player, true); + if(!world.isRemote && t instanceof IEnergyTile && !(t instanceof AnchorTileEntity) && !(t instanceof ICableHolder)) + { + ForgeDirection direction = ForgeDirection.getOrientation(facing); + x+=direction.offsetX; + y+=direction.offsetY; + z+=direction.offsetZ; + t=world.getTileEntity(x, y, z); + if(IHLUtils.isBlockCanBeReplaced(world, x,y,z)) + { + world.setBlock(x, y, z, IHLMod.cableAnchorBlock); + } + else if(!(t instanceof AnchorTileEntity)) + { + return false; + } + t=world.getTileEntity(x, y, z); + } + if(world.isRemote)world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, "step.stone", 1.0F, 0.8F); + if(!world.isRemote && t!=null && + ((t instanceof IEnergyNetNode && !isDataCable) || + (t instanceof AnchorTileEntity && !isDataCable) || + (t instanceof IDataCableHolder && isDataCable)) && + stack.stackTagCompound.getInteger("fullLength")>=1) + { + float ppx,ppy,ppz; + ICableHolder te; + if(t instanceof AnchorTileEntity) + { + te = ((AnchorTileEntity)t).energyNetNodes[facing]; + } + else + { + te = (ICableHolder)t; + } + ppx=(float)te.getPortPos(player)[0]; + ppy=(float)te.getPortPos(player)[1]; + ppz=(float)te.getPortPos(player)[2]; + if(stack.stackTagCompound.getBoolean("firstConnection")) + { + int x1 = stack.stackTagCompound.getInteger("connectorX"); + int y1 = stack.stackTagCompound.getInteger("connectorY"); + int z1 = stack.stackTagCompound.getInteger("connectorZ"); + int l1=stack.stackTagCompound.getInteger("fullLength"); + int l2=stack.stackTagCompound.getInteger("length"); + //if(((x-x1)*(x-x1)+(y-y1)*(y-y1)+(z-z1)*(z-z1))>l1*l1) + if(l2<=0) + { + return false; + } + if(x==x1 && y==y1 && z==z1) + { + this.cleanUp(world, x, y, z, stack.stackTagCompound.getInteger("chainUID")); + stack.stackTagCompound.setBoolean("firstConnection", false); + stack.stackTagCompound.setInteger("length", l1); + return true; + } + int t2DimensionId = stack.stackTagCompound.getInteger("connectorDimensionId"); + short facing2 = stack.stackTagCompound.getShort("connectorFacing"); + TileEntity t2 = MinecraftServer.getServer().worldServerForDimension(t2DimensionId).getTileEntity(x1, y1, z1); + if(t2==null) + { + stack.stackTagCompound.setBoolean("firstConnection", false); + return false; + } + this.connect(t,facing, t2, facing2, stack); + stack.stackTagCompound.setInteger("fullLength", l2); + if(l2<=0) + { + stack.stackSize--; + } + stack.stackTagCompound.setBoolean("firstConnection", false); + stack.stackTagCompound.setInteger("chainArrangeNumber",stack.stackTagCompound.getInteger("chainArrangeNumber")+1); + } + else + { + stack.stackTagCompound.setBoolean("firstConnection", true); + stack.stackTagCompound.setInteger("connectorX", x); + stack.stackTagCompound.setInteger("connectorY", y); + stack.stackTagCompound.setInteger("connectorZ", z); + stack.stackTagCompound.setShort("connectorFacing", facing); + stack.stackTagCompound.setInteger("connectorDimensionId", world.provider.dimensionId); + stack.stackTagCompound.setInteger("prevDimensionId", world.provider.dimensionId); + stack.stackTagCompound.setInteger("chainUID",world.rand.nextInt()); + stack.stackTagCompound.setInteger("chainArrangeNumber",0); + stack.stackTagCompound.setDouble("prevNodePosX",ppx); + stack.stackTagCompound.setDouble("prevNodePosY",ppy); + stack.stackTagCompound.setDouble("prevNodePosZ",ppz); + } + NodeEntity node = newNode(world, player.posX, player.posY, player.posZ, stack, stack.stackTagCompound.getInteger("chainArrangeNumber"),x,y,z); + node.virtualNodePosX=ppx; + node.virtualNodePosY=ppy; + node.virtualNodePosZ=ppz; + return true; + } + else + { + return false; + } + } + + protected void connect(TileEntity t1,short facing, TileEntity t2, short facing2, ItemStack stack) + { + IEnergyNetNode te; + IEnergyNetNode te1; + if(t1 instanceof IEnergyNetNode) + { + te = (IEnergyNetNode)t1; + } + else + { + te = ((AnchorTileEntity)t1).energyNetNodes[facing]; + } + if(t2 instanceof IEnergyNetNode) + { + te1 = (IEnergyNetNode)t2; + } + else + { + te1 = ((AnchorTileEntity)t2).energyNetNodes[facing2]; + } + int newGridID=IHLMod.enet.mergeGrids(te.getGridID(),te1.getGridID()); + int l1=stack.stackTagCompound.getInteger("fullLength"); + int l2=stack.stackTagCompound.getInteger("length"); + NBTTagCompound cable = (NBTTagCompound) stack.stackTagCompound.copy(); + cable.setInteger("length", l1-l2); + cable.setBoolean("firstConnection", false); + if(te.addCable(cable) && te1.addCable(cable)) + { + te.setGrid(newGridID); + te1.setGrid(newGridID); + } + } + + private int getTransverseSection(ItemStack stack) { + return stack.stackTagCompound.getInteger("transverseSection"); + } + + public String getMaterial(ItemStack stack) + { + return stack.stackTagCompound.getString("material"); + } + + public int getVoltageLimit(ItemStack stack) + { + if(stack.stackTagCompound.hasKey("maxVoltage")) + { + return stack.stackTagCompound.getInteger("maxVoltage"); + } + return 0; + } + + private int getResistance(ItemStack stack) + { + return stack.stackTagCompound.getInteger("resistance"); + } + + private void cleanUp(World worldObj, int xCoord, int yCoord, int zCoord, int chainUID) { + double range = 128D; + AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(xCoord-range,yCoord-range,zCoord-range,xCoord+range,yCoord+range,zCoord+range); + List nodeList = worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea); + if(!nodeList.isEmpty()) + { + Iterator ei = nodeList.iterator(); + while(ei.hasNext()) + { + NodeEntity ne=(NodeEntity) ei.next(); + if(ne.getChainUniqueID()==chainUID) + { + ne.setDead(); + } + } + } + } + + @Override + public void onUpdate(ItemStack stack, World world, Entity entity, int slotIndex, boolean isCurrentItem) + { + if(!world.isRemote && stack.stackTagCompound!=null) + { + if(stack.stackTagCompound.getBoolean("firstConnection")) + { + int leight = stack.stackTagCompound.getInteger("length"); + if(leight>0) + { + double pnpx = stack.stackTagCompound.getDouble("prevNodePosX"); + double pnpy = stack.stackTagCompound.getDouble("prevNodePosY"); + double pnpz = stack.stackTagCompound.getDouble("prevNodePosZ"); + double ppx=entity.posX; + double ppy=entity.posY; + double ppz=entity.posZ; + + if(pnpx!=0D && pnpy!=0D && pnpz!=0D) + { + double sqd = (ppx - pnpx)*(ppx - pnpx) + (ppy - pnpy)*(ppy - pnpy) + (ppz - pnpz)*(ppz - pnpz); + if(sqd>2D) + { + int can = stack.stackTagCompound.getInteger("chainArrangeNumber")+1; + int cx = stack.stackTagCompound.getInteger("connectorX"); + int cy = stack.stackTagCompound.getInteger("connectorY"); + int cz = stack.stackTagCompound.getInteger("connectorZ"); + NodeEntity node = newNode(world, ppx, ppy, ppz, stack, can,cx,cy,cz); + node.attachedItem=stack; + node.virtualNodePosX=(float) (ppx+(ppx - pnpx)*2); + node.virtualNodePosY=(float) (ppy+(ppy - pnpy)*2); + node.virtualNodePosZ=(float) (ppz+(ppz - pnpz)*2); + stack.stackTagCompound.setInteger("chainArrangeNumber",can); + stack.stackTagCompound.setDouble("prevNodePosX",ppx); + stack.stackTagCompound.setDouble("prevNodePosY",ppy); + stack.stackTagCompound.setDouble("prevNodePosZ",ppz); + stack.stackTagCompound.setInteger("length",--leight); + stack.stackTagCompound.setInteger("prevDimensionId", world.provider.dimensionId); + } + } + } + } + } + } + + protected NodeEntity newNode(World world, double ppx, double ppy, double ppz, ItemStack stack, int can, int x, int y, int z) + { + PowerCableNodeEntity node = new PowerCableNodeEntity(world); + node.setPosition(ppx, ppy, ppz); + node.setChainUniqueID(stack.stackTagCompound.getInteger("chainUID")); + short facing = stack.stackTagCompound.getShort("connectorFacing"); + int dimensionId = stack.stackTagCompound.getInteger("connectorDimensionId"); + node.setAnchor(x, y, z,facing,dimensionId); + node.chainArrangeNumber=can; + node.colorIndex = this.getColor(stack); + if(stack.stackTagCompound.hasKey("insulationMaterial")) + { + node.type=1; + } + else + { + node.type=0; + } + world.spawnEntityInWorld(node); + return node; + } + + private int getColor(ItemStack stack) + { + if(!stack.stackTagCompound.hasKey("insulationMaterial")) + { + if(yellowColoredWires.contains(this.getMaterial(stack))) + { + return 0xFF9900; + } + else + { + return 0xAAAABB; + } + } + return 0xFFFFFF; + } + + @Override + public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean flag) + { + if(itemStack.stackTagCompound!=null) + { + info.add("Length: " + itemStack.stackTagCompound.getInteger("length") +" m"); + info.add("Wire material: " + this.getMaterial(itemStack)); + info.add("Resistivity: " + this.getResistance(itemStack)/1000F + " V^2/(EU*m)"); + info.add("Transverse section: " + this.getTransverseSection(itemStack)/10F + " sq. mm."); + if(itemStack.stackTagCompound.hasKey("insulationMaterial")) + { + info.add("Insulation material: "+this.getInsulationMaterial(itemStack)); + info.add("Insulation thickness: " + this.getInsulationThickness(itemStack)/10f+" mm"); + info.add("Insulation breakdown voltage: "+ this.getVoltageLimit(itemStack)/1000 + " kV"); + } + + } + } + + @Override + public String getTag() + { + return "length"; + } + + @Override + public String getTagSecondary() + { + return "fullLength"; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":copperWire"); + this.thickCopper = par1IconRegister.registerIcon(IHLModInfo.MODID + ":copperWire16x"); + this.thinIron = par1IconRegister.registerIcon(IHLModInfo.MODID + ":steelWire"); + this.thickIron = par1IconRegister.registerIcon(IHLModInfo.MODID + ":steelWire16x"); + this.insulatedIronRawruber = par1IconRegister.registerIcon(IHLModInfo.MODID + ":flexibleCableSteel2"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int i) + { + if(stack.stackTagCompound!=null) + { + if(this.getInsulationMaterial(stack).equals("null")) + { + if(this.getTransverseSection(stack)>=240) + { + if(yellowColoredWires.contains(this.getMaterial(stack))) + { + return this.thickCopper; + } + else + { + return this.thickIron; + } + } + else + { + if(yellowColoredWires.contains(this.getMaterial(stack))) + { + return this.itemIcon; + } + else + { + return this.thinIron; + } + } + } + else + { + return this.insulatedIronRawruber; + } + } + return this.itemIcon; + } + + @Override + public String getUnlocalizedName(ItemStack stack) + { + if(stack.stackTagCompound!=null && !this.getInsulationMaterial(stack).equals("null")) + { + return "cable"; + } + return "wire"; + } + + @Override + public boolean isSameWire(ItemStack stack1,ItemStack stack2) + { + return this.getMaterial(stack1).equals(this.getMaterial(stack2)) && + this.getTransverseSection(stack1)==(this.getTransverseSection(stack2)) && + this.getInsulationMaterial(stack1).equals(this.getInsulationMaterial(stack2)) && + this.getInsulationThickness(stack1)==this.getInsulationThickness(stack2); + } + + public String getInsulationMaterial(ItemStack stack) + { + if(stack.stackTagCompound.hasKey("insulationMaterial")) + { + return stack.stackTagCompound.getString("insulationMaterial"); + } + return "null"; + } + + public int getInsulationThickness(ItemStack stack) + { + if(stack.stackTagCompound.hasKey("insulationThickness")) + { + return stack.stackTagCompound.getInteger("insulationThickness"); + } + return 0; + } + + public void onPlayerTeleport(PlayerChangedDimensionEvent event) + { + EntityPlayer player = event.player; + for(ItemStack stack:player.inventory.mainInventory) + { + if(stack!=null && stack.getItem() instanceof FlexibleCableItem) + { + if(stack.stackTagCompound.getBoolean("firstConnection")) + { + int can = -1; + Set ns = IHLMod.proxy.nodeEntityRegistry.get(stack.stackTagCompound.getInteger("chainUID")); + if(ns!=null) + { + NodeEntity lastNode = null; + for(NodeEntity node:ns) + { + if(node.chainArrangeNumber>can) + { + lastNode=node; + can=node.chainArrangeNumber; + } + } + if(lastNode!=null) + { + lastNode.attachedItem=null; + lastNode.setVirtualNodePosToNearestPortal(); + } + } + double[] cc = IHLUtils.tracePlayerView(player); + int cx = stack.stackTagCompound.getInteger("connectorX"); + int cy = stack.stackTagCompound.getInteger("connectorY"); + int cz = stack.stackTagCompound.getInteger("connectorZ"); + int leight = stack.stackTagCompound.getInteger("length"); + NodeEntity node = newNode(MinecraftServer.getServer().worldServerForDimension(event.toDim), cc[0], cc[1], cc[2], stack, can++,cx,cy,cz); + node.attachedItem=null; + node.virtualNodePosX=(float) (player.posX); + node.virtualNodePosY=(float) (player.posY); + node.virtualNodePosZ=(float) (player.posZ); + stack.stackTagCompound.setInteger("chainArrangeNumber",can); + stack.stackTagCompound.setDouble("prevNodePosX",cc[0]); + stack.stackTagCompound.setDouble("prevNodePosY",cc[1]); + stack.stackTagCompound.setDouble("prevNodePosZ",cc[2]); + stack.stackTagCompound.setInteger("length",--leight); + stack.stackTagCompound.setInteger("prevDimensionId", event.toDim); + } + } + } +// System.out.println(player.posX+"/"+player.posY+"/"+player.posZ);//Destination coordinates + } +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e4/40c790ca5da3001518cde17cb509661c b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e4/40c790ca5da3001518cde17cb509661c new file mode 100644 index 0000000..84a0ddb --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/e4/40c790ca5da3001518cde17cb509661c @@ -0,0 +1,141 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.LineNumberReader; +import java.io.OutputStreamWriter; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { + InputStream in = IHLMod.class.getResourceAsStream("/assets/ihl/config/ihl-guidebook.xml"); + InputStreamReader isReader = new InputStreamReader(in, "UTF-8"); + LineNumberReader reader = new LineNumberReader(isReader); + OutputStreamWriter osWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + BufferedWriter writer = new BufferedWriter(osWriter); + String line; + while ((line = reader.readLine()) != null) + { + writer.append(line); + writer.newLine(); + } + writer.close(); + osWriter.close(); + in = IHLMod.class.getResourceAsStream("/assets/ihl/config/adress.xsd"); + isReader = new InputStreamReader(in, "UTF-8"); + reader = new LineNumberReader(isReader); + file = new File(folder, "adress.xsd"); + osWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); + writer = new BufferedWriter(osWriter); + while ((line = reader.readLine()) != null) + { + writer.append(line); + writer.newLine(); + } + writer.close(); + osWriter.close(); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/fc/10871e5d49a3001516ebc455efc032e5 b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/fc/10871e5d49a3001516ebc455efc032e5 new file mode 100644 index 0000000..973aec1 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/fc/10871e5d49a3001516ebc455efc032e5 @@ -0,0 +1,113 @@ +package ihl.utils; + +import ihl.IHLMod; +import ihl.guidebook.IHLGuidebookGui; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.*; +import org.xml.sax.SAXException; + +import com.google.common.io.Files; + + +public class IHLXMLParser { + + public DocumentBuilderFactory dbf; + public DocumentBuilder db; + + public IHLXMLParser() throws ParserConfigurationException + { + dbf = DocumentBuilderFactory.newInstance(); + db = dbf.newDocumentBuilder(); + } + + public void visit(Node node, int level, int sectionNumber1, IHLGuidebookGui ihlGuidebookGui) + { + IHLMod.log.debug("Visiting node."); + IHLMod.log.debug("Current section="+sectionNumber1); + IHLMod.log.debug("Node name="+node.getNodeName()); + int sectionNumber = sectionNumber1; + NodeList list = node.getChildNodes(); + IHLMod.log.debug("child size="+list.getLength()); + if (node instanceof Element) + { + IHLMod.log.debug("node instance of Element."); + Element e = (Element) node; + IHLMod.log.debug("Node tagname="+e.getTagName()); + IHLMod.log.debug("Node text content="+e.getTextContent()); + if(e.getTagName().equals("title")) + { + ihlGuidebookGui.setTitle(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("itemstack")) + { + String[] innername = IHLUtils.trim(e.getTextContent()).split(":"); + ihlGuidebookGui.addItemStack(IHLUtils.getOtherModItemStackWithDamage(innername[0], innername[1], Integer.parseInt(e.getAttribute("damage")))); + } + else if(e.getTagName().equals("text")) + { + ihlGuidebookGui.addTextBlock(IHLUtils.trim(e.getTextContent())); + } + else if(e.getTagName().equals("image")) + { + ihlGuidebookGui.setPicture(IHLUtils.trim(e.getTextContent()).replace(" ", ""), Integer.parseInt(e.getAttribute("width")),Integer.parseInt(e.getAttribute("height"))); + } + } + for (int i = 0; i < list.getLength(); i++) + { + Node childNode = list.item(i); + if(childNode instanceof Element && ((Element) childNode).getTagName().equals("section")) + { + Element e = (Element) childNode; + int id = Integer.parseInt(e.getAttribute("id")); + ihlGuidebookGui.setMaxSectionNumber(id); + if(sectionNumber==id) + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + else + { + if(sectionNumber > ihlGuidebookGui.getMaxSectionNumber()) + { + sectionNumber=0; + ihlGuidebookGui.setSectionNumber(0); + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + else + { + visit(childNode, level + 1, sectionNumber, ihlGuidebookGui); + } + } + } + + public void setupGuidebookGUI(IHLGuidebookGui ihlGuidebookGui, int sectionNumber) throws SAXException, IOException + { + Document doc = db.parse(getGuidebookFile()); + visit(doc, 0, sectionNumber, ihlGuidebookGui); + } + + private File getGuidebookFile() throws IOException + { + File folder = new File(IHLMod.proxy.getMinecraftDir(), "config"); + folder.mkdirs(); + File file = new File(folder, "ihl-guidebook.xml"); + if(!file.exists()) + { +// File fileFrom = new File(IHLMod.proxy.getMinecraftDir(),"/assets/ihl/config/ihl-guidebook.xml"); + File fileFrom = new File(IHLMod.class.getResource("/assets/ihl/config/ihl-guidebook.xml").getFile()); + Files.copy(fileFrom, file); + } + return file; + } + +} diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location new file mode 100644 index 0000000..07ca694 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.location differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.markers b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.markers new file mode 100644 index 0000000..774a341 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/.markers differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/3.tree b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/3.tree new file mode 100644 index 0000000..fd61945 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/3.tree differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/org.eclipse.jdt.core/state.dat b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/org.eclipse.jdt.core/state.dat new file mode 100644 index 0000000..7e92901 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Minecraft/org.eclipse.jdt.core/state.dat differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version new file mode 100644 index 0000000..25cb955 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index new file mode 100644 index 0000000..a283d92 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version new file mode 100644 index 0000000..6b2aaa7 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/113.tree b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/113.tree new file mode 100644 index 0000000..e78819c Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/113.tree differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources new file mode 100644 index 0000000..c5e6f77 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs new file mode 100644 index 0000000..5e2da66 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +spelling_locale_initialized=true +useAnnotationsPrefPage=true +useQuickDiffPrefPage=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a469f5d --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +refresh.enabled=true +version=1 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs new file mode 100644 index 0000000..b94a4cb --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs @@ -0,0 +1,7 @@ +Console.highWaterMark=88000 +StringVariablePreferencePage=130,107,107,86, +eclipse.preferences.version=1 +org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\n\n +org.eclipse.debug.ui.UseContextualLaunch=false +org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n +preferredTargets=default\:default| diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs new file mode 100644 index 0000000..c186df8 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ide.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +resetSendMode=KEEP +resetSendModeOn=0 +sendMode=NOTIFY diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ui.prefs new file mode 100644 index 0000000..5188891 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.logging.aeri.ui.prefs @@ -0,0 +1,3 @@ +action=ASK +eclipse.preferences.version=1 +rememberSendAction=NONE diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs new file mode 100644 index 0000000..333b991 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs @@ -0,0 +1,3 @@ +#Sun Jun 05 18:58:07 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.epp.usagedata.gathering.enabled=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..12464e1 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,20 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.classpathVariable.ECLIPSE_HOME=/home/foghrye4/Programs/Eclipse Kepler +org.eclipse.jdt.core.classpathVariable.JRE_LIB=/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar +org.eclipse.jdt.core.classpathVariable.JRE_SRC=/usr/lib/jvm/java-7-oracle/src.zip +org.eclipse.jdt.core.classpathVariable.JRE_SRCROOT= +org.eclipse.jdt.core.classpathVariable.JUNIT_HOME=/home/foghrye4/Programs/Eclipse Kepler/plugins/org.junit_4.11.0.v201303080030/ +org.eclipse.jdt.core.classpathVariable.JUNIT_SRC_HOME=/home/foghrye4/Programs/Eclipse Kepler/plugins/org.junit.source_4.11.0.v201303080030.jar +org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.deprecation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=ignore +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs new file mode 100644 index 0000000..de49def --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.launching.PREF_VM_XML=\n\n\n\n\n\n diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..13b7905 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,20 @@ +content_assist_lru_history= +content_assist_number_of_computers=19 +content_assist_proposals_background=255,255,255 +content_assist_proposals_foreground=60,60,60 +eclipse.preferences.version=1 +fontPropagated=true +org.eclipse.jdt.internal.ui.navigator.layout=2 +org.eclipse.jdt.ui.editor.tab.width= +org.eclipse.jdt.ui.formatterprofiles.version=12 +org.eclipse.jdt.ui.javadoclocations.migrated=true +org.eclipse.jdt.ui.text.code_templates_migrated=true +org.eclipse.jdt.ui.text.custom_code_templates= +org.eclipse.jdt.ui.text.custom_templates= +org.eclipse.jdt.ui.text.templates_migrated=true +org.eclipse.jface.textfont=1|Monospace|10.0|0|GTK|1|; +proposalOrderMigrated=true +spelling_locale_initialized=true +tabWidthPropagated=true +useAnnotationsPrefPage=true +useQuickDiffPrefPage=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs new file mode 100644 index 0000000..67b1d96 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.m2e.discovery.pref.projects= diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs new file mode 100644 index 0000000..43e97e4 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +mylyn.attention.migrated=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs new file mode 100644 index 0000000..8d462a6 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.monitor.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs new file mode 100644 index 0000000..e672db7 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.tasks.ui.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +migrated.task.repositories.keyring=true +migrated.task.repositories.secure.store=true +org.eclipse.mylyn.tasks.ui.filters.nonmatching=true +org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.api.tools.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.api.tools.prefs new file mode 100644 index 0000000..d2ed603 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.api.tools.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +knownEEFragments= diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.core.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000..1f92455 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +platform_path=/home/foghrye4/Programs/Eclipse Kepler diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.core.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.core.prefs new file mode 100644 index 0000000..93878dd --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.rse.systemtype.local.systemType.defaultUserId=foghrye4 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.ui.prefs new file mode 100644 index 0000000..e24d63a --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.rse.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.rse.preferences.order.connections=foghrye4-GA-A75-D3H.Local diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.search.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.search.prefs new file mode 100644 index 0000000..cec65c4 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.search.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.search.defaultPerspective=org.eclipse.search.defaultPerspective.none diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs new file mode 100644 index 0000000..56cd496 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.team.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.team.ui.first_time=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs new file mode 100644 index 0000000..8fc247c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +internalWebBrowserHistory=http\://web.archive.org/web/20051219043731/http\://archive.ncsa.uiuc.edu/SDG/Software/Mosaic/Demo/url-primer.html|*|http\://download.oracle.com/javase/7/docs/api/java/util/Map.html|*| diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs new file mode 100644 index 0000000..316ef6f --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs @@ -0,0 +1,4 @@ +#Sun Jun 05 18:58:05 CEST 2011 +spacesForTabs=true +eclipse.preferences.version=1 +overviewRuler_migration=migrated_3.1 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs new file mode 100644 index 0000000..d49006e --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -0,0 +1,10 @@ +EXIT_PROMPT_ON_CLOSE_LAST_WINDOW=false +IMPORT_FILES_AND_FOLDERS_MODE=prompt +IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt +PROBLEMS_FILTERS_MIGRATE=true +SAVE_ALL_BEFORE_BUILD=true +TASKS_FILTERS_MIGRATE=true +eclipse.preferences.version=1 +platformState=1478335949481 +quickStart=false +tipsAndTricks=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs new file mode 100644 index 0000000..08076f2 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +showIntro=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs new file mode 100644 index 0000000..dd77496 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs @@ -0,0 +1,3 @@ +//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false +PLUGINS_NOT_ACTIVATED_ON_STARTUP=org.eclipse.m2e.discovery; +eclipse.preferences.version=1 diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch new file mode 100644 index 0000000..53c64e4 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Main.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Main.launch new file mode 100644 index 0000000..e1a66bf --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Main.launch @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch new file mode 100644 index 0000000..395f317 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml new file mode 100644 index 0000000..40e820e --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/dialog_settings.xml @@ -0,0 +1,16 @@ + +
+
+ + + +
+
+ + + + + + +
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml new file mode 100644 index 0000000..da5aef1 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/eclipse/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi new file mode 100644 index 0000000..d65addd --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -0,0 +1,2444 @@ + + + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration + ModelMigrationProcessor.001 + + + + + + + + topLevel + shellMaximized + + + + + persp.actionSet:org.eclipse.ui.cheatsheets.actionSet + persp.actionSet:org.eclipse.search.searchActionSet + persp.actionSet:org.eclipse.ui.edit.text.actionSet.annotationNavigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.navigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo + persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet + persp.actionSet:org.eclipse.ui.actionSet.keyBindings + persp.actionSet:org.eclipse.ui.actionSet.openFiles + persp.actionSet:org.eclipse.debug.ui.launchActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaElementCreationActionSet + persp.actionSet:org.eclipse.ui.NavigateActionSet + persp.viewSC:org.eclipse.jdt.ui.PackageExplorer + persp.viewSC:org.eclipse.jdt.ui.TypeHierarchy + persp.viewSC:org.eclipse.jdt.ui.SourceView + persp.viewSC:org.eclipse.jdt.ui.JavadocView + persp.viewSC:org.eclipse.search.ui.views.SearchView + persp.viewSC:org.eclipse.ui.console.ConsoleView + persp.viewSC:org.eclipse.ui.views.ContentOutline + persp.viewSC:org.eclipse.ui.views.ProblemView + persp.viewSC:org.eclipse.ui.views.ResourceNavigator + persp.viewSC:org.eclipse.ui.views.TaskList + persp.viewSC:org.eclipse.ui.views.ProgressView + persp.viewSC:org.eclipse.ui.navigator.ProjectExplorer + persp.viewSC:org.eclipse.ui.texteditor.TemplatesView + persp.viewSC:org.eclipse.pde.runtime.LogView + persp.newWizSC:org.eclipse.jdt.ui.wizards.JavaProjectWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewPackageCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewClassCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewEnumCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard + persp.newWizSC:org.eclipse.ui.wizards.new.folder + persp.newWizSC:org.eclipse.ui.wizards.new.file + persp.newWizSC:org.eclipse.ui.editors.wizards.UntitledTextFileWizard + persp.perspSC:org.eclipse.jdt.ui.JavaBrowsingPerspective + persp.perspSC:org.eclipse.debug.ui.DebugPerspective + persp.viewSC:org.eclipse.ant.ui.views.AntView + persp.showIn:org.eclipse.egit.ui.RepositoriesView + persp.actionSet:org.eclipse.debug.ui.breakpointActionSet + persp.actionSet:org.eclipse.jdt.debug.ui.JDTDebugActionSet + persp.newWizSC:org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard + persp.actionSet:org.eclipse.jdt.junit.JUnitActionSet + persp.showIn:org.eclipse.jdt.ui.PackageExplorer + persp.showIn:org.eclipse.team.ui.GenericHistoryView + persp.showIn:org.eclipse.ui.views.ResourceNavigator + persp.showIn:org.eclipse.ui.navigator.ProjectExplorer + persp.actionSet:org.eclipse.mylyn.doc.actionSet + persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation + persp.actionSet:org.eclipse.wb.core.ui.actionset + + + + newtablook + org.eclipse.e4.primaryNavigationStack + active + + + + + + + + newtablook + + + + + + + + newtablook + org.eclipse.e4.secondaryDataStack + + + + + + + + + + + newtablook + org.eclipse.e4.secondaryNavigationStack + + + + + + + + + + + + + + + + View + categoryTag:Help + + + View + categoryTag:General + + + View + categoryTag:Help + + + + newtablook + org.eclipse.e4.primaryDataStack + EditorStack + + + + + + View + categoryTag:Java + active + activeOnClose + + ViewMenu + menuContribution:menu + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + menuContribution:popup + popup:org.eclipse.jdt.ui.PackageExplorer + + + + + View + categoryTag:Java + + + View + categoryTag:General + + + View + categoryTag:General + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + menuContribution:popup + popup:org.eclipse.ui.views.ProblemView + popup:org.eclipse.ui.ide.MarkersView + + + + + View + categoryTag:Java + + + + View + categoryTag:Java + + ViewMenu + menuContribution:menu + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + menuContribution:popup + popup:org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu + + + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + View + categoryTag:General + + + View + categoryTag:Ant + + + View + categoryTag:Git + + + View + categoryTag:Java + + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + Draggable + + + Draggable + + + Draggable + + + Draggable + + + Draggable + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + toolbarSeparator + + + + Draggable + + + stretch + SHOW_RESTORE_MENU + + + Draggable + HIDEABLE + SHOW_RESTORE_MENU + + + + + stretch + + + + Draggable + + + + + TrimStack + + + + + + + TrimStack + + + + + TrimStack + + + + + + + + + + + + + platform:gtk + + + + platform:gtk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + platform:gtk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor + + + View + categoryTag:Ant + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + View + categoryTag:Git + + + View + categoryTag:Git + + + View + categoryTag:Git + + + View + categoryTag:Git + + + View + categoryTag:Git + + + View + categoryTag:Help + + + View + categoryTag:Debug + + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:Java Browsing + + + View + categoryTag:Java Browsing + + + View + categoryTag:Java Browsing + + + View + categoryTag:Java Browsing + + + View + categoryTag:Java + + + View + categoryTag:General + + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:API Tools + + + View + categoryTag:Plug-in Development + + + View + categoryTag:Plug-in Development + + + View + categoryTag:Plug-in Development + + + View + categoryTag:Plug-in Development + + + View + categoryTag:Plug-in Development + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:CVS + + + View + categoryTag:CVS + + + View + categoryTag:Team + + + View + categoryTag:Team + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:Help + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:Maven + + + View + categoryTag:Maven + + + View + categoryTag:Mylyn + + + View + categoryTag:Mylyn + + + View + categoryTag:Mylyn + + + View + categoryTag:Mylyn + + + View + categoryTag:Oomph + + + View + categoryTag:Code Recommenders + + + View + categoryTag:Code Recommenders + + + View + categoryTag:Code Recommenders + + + View + categoryTag:Code Recommenders + + + View + categoryTag:Code Recommenders + + + View + categoryTag:WindowBuilder + + + View + categoryTag:WindowBuilder + + + View + categoryTag:General + + + View + categoryTag:XML + + + View + categoryTag:XML + + + + glue + move_after:PerspectiveSpacer + SHOW_RESTORE_MENU + + + move_after:Spacer Glue + HIDEABLE + SHOW_RESTORE_MENU + + + glue + move_after:SearchField + SHOW_RESTORE_MENU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdt b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdt new file mode 100644 index 0000000..d5abf41 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdt differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdx b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdx new file mode 100644 index 0000000..b8ee809 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fdx differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fnm b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fnm new file mode 100644 index 0000000..523c92e --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.fnm @@ -0,0 +1 @@ +ýÿÿÿversion \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.frq b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.frq new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.nrm b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.nrm new file mode 100644 index 0000000..cf8dc75 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.nrm @@ -0,0 +1 @@ +NRMÿ \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tii b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tii new file mode 100644 index 0000000..ebd518d Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tii differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tis b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tis new file mode 100644 index 0000000..ebd518d Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/_0.tis differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments.gen b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments.gen new file mode 100644 index 0000000..63a7ec9 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments.gen differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments_1 b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments_1 new file mode 100644 index 0000000..0ffed7b Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/history/segments_1 differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdt b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdt new file mode 100644 index 0000000..d5abf41 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdt differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdx b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdx new file mode 100644 index 0000000..b8ee809 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fdx differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fnm b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fnm new file mode 100644 index 0000000..523c92e --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.fnm @@ -0,0 +1 @@ +ýÿÿÿversion \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.frq b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.frq new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.nrm b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.nrm new file mode 100644 index 0000000..cf8dc75 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.nrm @@ -0,0 +1 @@ +NRMÿ \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tii b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tii new file mode 100644 index 0000000..ebd518d Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tii differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tis b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tis new file mode 100644 index 0000000..ebd518d Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/_0.tis differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments.gen b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments.gen new file mode 100644 index 0000000..63a7ec9 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments.gen differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments_1 b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments_1 new file mode 100644 index 0000000..0c498e0 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.epp.logging.aeri.ui/remote-index/segments_1 differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.equinox.p2.ui/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.equinox.p2.ui/dialog_settings.xml new file mode 100644 index 0000000..89a9784 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.equinox.p2.ui/dialog_settings.xml @@ -0,0 +1,5 @@ + +
+
+
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps new file mode 100644 index 0000000..10e105f Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/indexNamesMap.txt b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/indexNamesMap.txt new file mode 100644 index 0000000..68a85ef --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/indexNamesMap.txt @@ -0,0 +1 @@ +INDEX VERSION 1.126 diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/invalidArchivesCache differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt new file mode 100644 index 0000000..8586397 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt @@ -0,0 +1 @@ +java \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache new file mode 100644 index 0000000..917db33 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt new file mode 100644 index 0000000..e2e8d79 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt @@ -0,0 +1,66 @@ +INDEX VERSION 1.126+/home/foghrye4/Programs/Forge 1.7.10/eclipse/.metadata/.plugins/org.eclipse.jdt.core +3046902022.index +4120319570.index +281449128.index +866804943.index +1378081998.index +3957341899.index +1070717376.index +3157227259.index +3875248338.index +1198206356.index +2303258084.index +1359712097.index +1769112742.index +1734602489.index +1189007535.index +2424439981.index +3119809884.index +1721267593.index +3634299467.index +1611075087.index +2350366299.index +365746132.index +89072084.index +1928036885.index +2305881512.index +718386263.index +3829351191.index +1022003584.index +3188207552.index +1847729490.index +664202523.index +2264959299.index +3998409534.index +1568666669.index +208370467.index +4267884898.index +4217538243.index +1791498496.index +1877060153.index +149203752.index +2896310024.index +2281424657.index +2501865248.index +1514218975.index +1714592054.index +2454880698.index +3673728484.index +3657879174.index +2409005450.index +936311843.index +1199027344.index +1729742098.index +1737441395.index +1468360981.index +2119276847.index +1989682271.index +2691718362.index +2241609340.index +1207630805.index +686465974.index +3803692344.index +2159999914.index +2095122793.index +2464122576.index +3765020915.index diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat new file mode 100644 index 0000000..7a4faa6 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml b/eclipse/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml new file mode 100644 index 0000000..423694d --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml @@ -0,0 +1,4 @@ + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml b/eclipse/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml new file mode 100644 index 0000000..013f6aa --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml b/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml new file mode 100644 index 0000000..a4ee3cb --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml b/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml new file mode 100644 index 0000000..3faedf1 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml new file mode 100644 index 0000000..41c8d27 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -0,0 +1,71 @@ + +
+ +
+ + + + + +
+
+ + +
+ + + + + +
+
+
+ + +
+
+ +
+
+ + + + +
+
+ + + +
+ + + + + +
+
+
+ + + + + +
+
+ +
+
+ +
+
+
+
+ +
+
+ + +
+
+
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/devhelp.libhover b/eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/devhelp.libhover new file mode 100644 index 0000000..62434b4 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/devhelp.libhover differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/glibc_library.libhover b/eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/glibc_library.libhover new file mode 100644 index 0000000..c7dd073 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.linuxtools.cdt.libhover/C/glibc_library.libhover differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.history new file mode 100644 index 0000000..7c1281c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.history @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.index new file mode 100644 index 0000000..b3ed11b --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/47/refactorings.index @@ -0,0 +1 @@ +1448204447895 Delete element diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.history new file mode 100644 index 0000000..e27cba4 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.index new file mode 100644 index 0000000..f493475 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/11/48/refactorings.index @@ -0,0 +1,2 @@ +1448783302497 Copy compilation unit +1448812448612 Copy compilation unit diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.history new file mode 100644 index 0000000..cb52d08 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.history @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.index new file mode 100644 index 0000000..f581331 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/49/refactorings.index @@ -0,0 +1 @@ +1449317466925 Delete element diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.history new file mode 100644 index 0000000..2652cca --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.index new file mode 100644 index 0000000..451e649 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/50/refactorings.index @@ -0,0 +1,5 @@ +1449902899827 Copy compilation unit +1449904995458 Move compilation unit +1449907814319 Copy compilation units +1449909203262 Delete element +1449910163426 Delete elements diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.history new file mode 100644 index 0000000..9ce171f --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.index new file mode 100644 index 0000000..cd92db1 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/51/refactorings.index @@ -0,0 +1,14 @@ +1450089654434 Delete elements +1450174627972 Copy compilation unit +1450270525061 Copy compilation unit +1450294261175 Delete element +1450295155109 Delete element +1450295891020 Delete element +1450345641065 Copy compilation unit +1450347077852 Copy compilation unit +1450376384778 Delete element +1450388733267 Copy compilation units +1450434282814 Copy compilation unit +1450440067213 Copy compilation unit +1450558419236 Delete element +1450612747529 Delete element diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.history new file mode 100644 index 0000000..f9ae7f4 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.index new file mode 100644 index 0000000..986a905 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2015/12/52/refactorings.index @@ -0,0 +1,4 @@ +1450729504655 Copy compilation unit +1450813916101 Copy compilation unit +1450911766204 Delete element +1450913996903 Delete element diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.history new file mode 100644 index 0000000..56f2b18 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.index new file mode 100644 index 0000000..40c1fd8 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/6/refactorings.index @@ -0,0 +1,4 @@ +1454794641320 Copy compilation unit +1454839182853 Delete elements +1454839307200 Move compilation unit +1454839499885 Delete elements diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.history new file mode 100644 index 0000000..5e64637 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.index new file mode 100644 index 0000000..b59744c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/7/refactorings.index @@ -0,0 +1,2 @@ +1455451728915 Copy compilation unit +1455467158802 Copy compilation unit diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.history new file mode 100644 index 0000000..11c233d --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.index new file mode 100644 index 0000000..d18072c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/2/9/refactorings.index @@ -0,0 +1,3 @@ +1456166941479 Delete element +1456166946635 Delete element +1456410677609 Copy compilation unit diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.history new file mode 100644 index 0000000..33aa95b --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.history @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.index new file mode 100644 index 0000000..8196144 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/10/refactorings.index @@ -0,0 +1,4 @@ +1456923738044 Copy compilation unit +1457183209471 Copy compilation unit +1457184376264 Delete element +1457201899287 Copy compilation units diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.history b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.history new file mode 100644 index 0000000..beaab63 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.history @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.index b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.index new file mode 100644 index 0000000..e1296c8 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/Minecraft/2016/3/12/refactorings.index @@ -0,0 +1 @@ +1457973342866 Delete elements diff --git a/eclipse/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml new file mode 100644 index 0000000..8534ef6 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml @@ -0,0 +1,17 @@ + +
+
+ + +
+
+ + + +
+
+ + + +
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log b/eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.6.0.20150526-2032.xml b/eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.6.0.20150526-2032.xml new file mode 100644 index 0000000..e33758c --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.6.0.20150526-2032.xml @@ -0,0 +1,43 @@ + + + + %date [%thread] %-5level %logger{35} - %msg%n + + + OFF + + + + + ${org.eclipse.m2e.log.dir}/0.log + + ${org.eclipse.m2e.log.dir}/%i.log + 1 + 10 + + + 100MB + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + WARN + + + + + + + + + + + + + + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup b/eclipse/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup new file mode 100644 index 0000000..1f73e14 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup @@ -0,0 +1,6 @@ + + diff --git a/eclipse/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties b/eclipse/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties new file mode 100644 index 0000000..a4be163 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties @@ -0,0 +1,2 @@ +#Cached timestamps +#Sat Mar 05 22:55:54 MSK 2016 diff --git a/eclipse/.metadata/.plugins/org.eclipse.rse.core/.log b/eclipse/.metadata/.plugins/org.eclipse.rse.core/.log new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.rse.core/initializerMarks/org.eclipse.rse.internal.core.RSELocalConnectionInitializer.mark b/eclipse/.metadata/.plugins/org.eclipse.rse.core/initializerMarks/org.eclipse.rse.internal.core.RSELocalConnectionInitializer.mark new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/FP.local.files_0/node.properties b/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/FP.local.files_0/node.properties new file mode 100644 index 0000000..b0ccf2e --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/FP.local.files_0/node.properties @@ -0,0 +1,57 @@ +# RSE DOM Node +00-name=foghrye4-GA-A75-D3H\:local.files +01-type=FilterPool +03-attr.default=true +03-attr.deletable=true +03-attr.id=local.files +03-attr.nonRenamable=false +03-attr.owningParentName=null +03-attr.release=200 +03-attr.singleFilterStringOnly=false +03-attr.singleFilterStringOnlyESet=false +03-attr.stringsCaseSensitive=true +03-attr.supportsDuplicateFilterStrings=false +03-attr.supportsNestedFilters=true +03-attr.type=default +06-child.00000.00-name=My Home +06-child.00000.01-type=Filter +06-child.00000.03-attr.default=false +06-child.00000.03-attr.filterType=default +06-child.00000.03-attr.id=My Home +06-child.00000.03-attr.nonChangable=false +06-child.00000.03-attr.nonDeletable=false +06-child.00000.03-attr.nonRenamable=false +06-child.00000.03-attr.promptable=false +06-child.00000.03-attr.relativeOrder=0 +06-child.00000.03-attr.release=200 +06-child.00000.03-attr.singleFilterStringOnly=false +06-child.00000.03-attr.stringsCaseSensitive=true +06-child.00000.03-attr.stringsNonChangable=false +06-child.00000.03-attr.supportsDuplicateFilterStrings=false +06-child.00000.03-attr.supportsNestedFilters=true +06-child.00000.06-child.00000.00-name=/home/foghrye4/* +06-child.00000.06-child.00000.01-type=FilterString +06-child.00000.06-child.00000.03-attr.default=false +06-child.00000.06-child.00000.03-attr.string=/home/foghrye4/* +06-child.00000.06-child.00000.03-attr.type=default +06-child.00001.00-name=Root +06-child.00001.01-type=Filter +06-child.00001.03-attr.default=false +06-child.00001.03-attr.filterType=default +06-child.00001.03-attr.id=Root +06-child.00001.03-attr.nonChangable=false +06-child.00001.03-attr.nonDeletable=false +06-child.00001.03-attr.nonRenamable=false +06-child.00001.03-attr.promptable=false +06-child.00001.03-attr.relativeOrder=0 +06-child.00001.03-attr.release=200 +06-child.00001.03-attr.singleFilterStringOnly=false +06-child.00001.03-attr.stringsCaseSensitive=true +06-child.00001.03-attr.stringsNonChangable=false +06-child.00001.03-attr.supportsDuplicateFilterStrings=false +06-child.00001.03-attr.supportsNestedFilters=true +06-child.00001.06-child.00000.00-name=/* +06-child.00001.06-child.00000.01-type=FilterString +06-child.00001.06-child.00000.03-attr.default=false +06-child.00001.06-child.00000.03-attr.string=/* +06-child.00001.06-child.00000.03-attr.type=default diff --git a/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/H.local_16/node.properties b/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/H.local_16/node.properties new file mode 100644 index 0000000..b12a67f --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/H.local_16/node.properties @@ -0,0 +1,25 @@ +# RSE DOM Node +00-name=Local +01-type=Host +03-attr.description= +03-attr.hostname=LOCALHOST +03-attr.offline=false +03-attr.promptable=false +03-attr.systemType=org.eclipse.rse.systemtype.local +03-attr.type=Local +06-child.00000.00-name=Local Connector Service +06-child.00000.01-type=ConnectorService +06-child.00000.03-attr.group=Local Connector Service +06-child.00000.03-attr.port=0 +06-child.00000.03-attr.useSSL=false +06-child.00000.06-child.00000.00-name=Local Files +06-child.00000.06-child.00000.01-type=SubSystem +06-child.00000.06-child.00000.03-attr.hidden=false +06-child.00000.06-child.00000.03-attr.type=local.files +06-child.00000.06-child.00000.06-child.00000.00-name=foghrye4-GA-A75-D3H___foghrye4-GA-A75-D3H\:local.files +06-child.00000.06-child.00000.06-child.00000.01-type=FilterPoolReference +06-child.00000.06-child.00000.06-child.00000.03-attr.refID=local.files +06-child.00000.06-child.00001.00-name=Local Shells +06-child.00000.06-child.00001.01-type=SubSystem +06-child.00000.06-child.00001.03-attr.hidden=false +06-child.00000.06-child.00001.03-attr.type=local.shells diff --git a/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/node.properties b/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/node.properties new file mode 100644 index 0000000..7194ec7 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.rse.core/profiles/PRF.foghrye4-ga-a75-d3h_837/node.properties @@ -0,0 +1,7 @@ +# RSE DOM Node +00-name=foghrye4-GA-A75-D3H +01-type=Profile +03-attr.defaultPrivate=true +03-attr.isActive=true +05-ref.00000=FP.local.files_0 +05-ref.00001=H.local_16 diff --git a/eclipse/.metadata/.plugins/org.eclipse.rse.ui/.log b/eclipse/.metadata/.plugins/org.eclipse.rse.ui/.log new file mode 100644 index 0000000..e69de29 diff --git a/eclipse/.metadata/.plugins/org.eclipse.search/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.search/dialog_settings.xml new file mode 100644 index 0000000..8675219 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.search/dialog_settings.xml @@ -0,0 +1,169 @@ + +
+
+ +
+
+ +
+
+ + + + + +
+
+ + + + + + + + + + + + +
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + +
+
+ +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+ + + + + + + + + + +
+
+
+ +
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.team.ui/syncParticipants.xml b/eclipse/.metadata/.plugins/org.eclipse.team.ui/syncParticipants.xml new file mode 100644 index 0000000..f7e3799 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.team.ui/syncParticipants.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ui.editors/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.ui.editors/dialog_settings.xml new file mode 100644 index 0000000..50f1edb --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ui.editors/dialog_settings.xml @@ -0,0 +1,5 @@ + +
+
+
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.ui.workbench.texteditor/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench.texteditor/dialog_settings.xml new file mode 100644 index 0000000..93fbe49 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench.texteditor/dialog_settings.xml @@ -0,0 +1,38 @@ + +
+
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml new file mode 100644 index 0000000..144e476 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml @@ -0,0 +1,21 @@ + +
+
+ + +
+
+ + + + + + + + + + +
+
+
+
diff --git a/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml new file mode 100644 index 0000000..20e3e05 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml new file mode 100644 index 0000000..b04ab55 --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse/.metadata/.plugins/org.eclipse.wst.sse.core/task-tags.properties b/eclipse/.metadata/.plugins/org.eclipse.wst.sse.core/task-tags.properties new file mode 100644 index 0000000..1ddeeab --- /dev/null +++ b/eclipse/.metadata/.plugins/org.eclipse.wst.sse.core/task-tags.properties @@ -0,0 +1,3 @@ +# +#Tue Nov 29 20:02:33 MSK 2016 +task-tag-projects-already-scanned=RemoteSystemsTempFiles -- cgit v1.2.3