├── .editorconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug-report-en.yml │ ├── bug-report-ja.yml │ ├── config.yml │ ├── feature-request-en.yml │ ├── feature-request-ja.yml │ └── porting-request.yml ├── dependabot.yml ├── license-check │ ├── header-check.json │ ├── header-hash.txt │ └── header-triple-slash.txt └── workflows │ ├── build.yml │ ├── changelog-check.yml │ ├── check-license.yml │ ├── comment-link-to-nightly-link.yml │ ├── commitlint.yml │ ├── no-add-import.yml │ ├── release.yml │ └── sh │ ├── get-unreleased-release-note.sh │ ├── prepare-changelog.sh │ └── update-changelog.sh ├── .gitignore ├── .patching-mods ├── .gitattributes └── main.yaml ├── .something-releaser.json ├── CHANGELOG-SNAPSHOTS.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── LICENSE-FOR-ORIGINAL-AUTHOR.txt ├── README.en.md ├── README.md ├── README.zh.md ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts └── src │ └── main │ └── kotlin │ ├── PrintFieldStructure.kt │ ├── PrintMethodCode.kt │ ├── PrintStaticFields.kt │ └── com │ └── anatawa12 │ └── fixrtm │ └── gradle │ ├── Walker.kt │ └── classHierarchy │ ├── ClassHierarchy.kt │ ├── HClass.kt │ ├── HField.kt │ └── HMethod.kt ├── doc ├── script-cache.md └── somethings-have-to-do-when-upgrade-RTM-or-NGTLib.md ├── eclipse └── .metadata │ └── .plugins │ ├── org.eclipse.core.resources │ ├── .projects │ │ └── MDKExample │ │ │ └── .location │ └── .root │ │ └── 0.tree │ ├── org.eclipse.core.runtime │ └── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.debug.ui.prefs │ │ ├── org.eclipse.epp.usagedata.gathering.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ ├── org.eclipse.ui.editors.prefs │ │ ├── org.eclipse.ui.ide.prefs │ │ └── org.eclipse.ui.prefs │ ├── org.eclipse.debug.core │ └── .launches │ │ ├── Client.launch │ │ └── Server.launch │ └── org.eclipse.debug.ui │ └── launchConfigurationHistory.xml ├── githooks ├── commit-msg ├── install.sh └── pre-commit ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── important-structure ├── fields-ModelPackLoadMethodCode.txt ├── fields-RTMResource.txt ├── fields-ResourceConfig │ ├── java │ │ └── lang │ │ │ ├── Object.txt │ │ │ └── String.txt │ └── jp │ │ └── ngt │ │ └── rtm │ │ ├── block │ │ └── tileentity │ │ │ └── MechanismType.txt │ │ └── modelpack │ │ └── cfg │ │ ├── ConnectorConfig.txt │ │ ├── ContainerConfig.txt │ │ ├── FirearmConfig.txt │ │ ├── FlagConfig.txt │ │ ├── MachineConfig.txt │ │ ├── MechanismConfig.txt │ │ ├── ModelConfig$ModelSource.txt │ │ ├── ModelConfig$Parts.txt │ │ ├── ModelConfig.txt │ │ ├── NPCConfig.txt │ │ ├── OrnamentConfig.txt │ │ ├── RRSConfig.txt │ │ ├── RailConfig$BallastSet.txt │ │ ├── RailConfig.txt │ │ ├── ResourceConfig$DMInitValue.txt │ │ ├── ResourceConfig.txt │ │ ├── SignalConfig.txt │ │ ├── SignboardConfig.txt │ │ ├── TextureConfig.txt │ │ ├── TrainConfig.txt │ │ ├── VehicleBaseConfig$Light.txt │ │ ├── VehicleBaseConfig$Rollsign.txt │ │ ├── VehicleBaseConfig$VehicleParts.txt │ │ ├── VehicleBaseConfig.txt │ │ ├── VehicleConfig.txt │ │ └── WireConfig.txt └── fields-ResourceSet │ ├── javax │ └── script │ │ └── ScriptEngine.txt │ ├── jp │ └── ngt │ │ └── rtm │ │ ├── entity │ │ └── util │ │ │ └── CollisionObj.txt │ │ ├── modelpack │ │ ├── cfg │ │ │ └── ResourceConfig.txt │ │ ├── modelset │ │ │ ├── ModelSetBase.txt │ │ │ ├── ModelSetConnector.txt │ │ │ ├── ModelSetContainer.txt │ │ │ ├── ModelSetFirearm.txt │ │ │ ├── ModelSetMachine.txt │ │ │ ├── ModelSetMechanism.txt │ │ │ ├── ModelSetNPC.txt │ │ │ ├── ModelSetOrnament.txt │ │ │ ├── ModelSetRail.txt │ │ │ ├── ModelSetSignal.txt │ │ │ ├── ModelSetTrain.txt │ │ │ ├── ModelSetVehicle.txt │ │ │ ├── ModelSetVehicleBase.txt │ │ │ ├── ModelSetWire.txt │ │ │ ├── ResourceSet.txt │ │ │ ├── TextureSetBase.txt │ │ │ ├── TextureSetFlag.txt │ │ │ ├── TextureSetRRS.txt │ │ │ └── TextureSetSignboard.txt │ │ └── state │ │ │ └── DataFormatter.txt │ │ └── render │ │ └── ModelObject.txt │ └── net │ └── minecraft │ └── util │ └── ResourceLocation.txt ├── logo.png ├── processMods.gradle ├── settings.gradle.kts ├── src ├── main │ ├── distResources │ │ └── META-INF │ │ │ └── services │ │ │ ├── javax.imageio.spi.ImageReaderSpi │ │ │ └── javax.imageio.spi.ImageWriterSpi │ ├── java │ │ └── com │ │ │ └── anatawa12 │ │ │ └── fixRtm │ │ │ ├── ApiBridgeImpl.kt │ │ │ ├── DeflateByteBuf.kt │ │ │ ├── Deprecation.kt │ │ │ ├── DummyModelPackManager.kt │ │ │ ├── FixHooks.kt │ │ │ ├── FixRtm.kt │ │ │ ├── Loggers.kt │ │ │ ├── PermissionManager.kt │ │ │ ├── TestBlock.kt │ │ │ ├── ThreadUtil.kt │ │ │ ├── Utils.kt │ │ │ ├── api │ │ │ ├── ApiBridge.java │ │ │ └── IPermissionManager.java │ │ │ ├── asm │ │ │ ├── FixRtmCorePlugin.kt │ │ │ ├── FixRtmDevEnvironmentOnlyCorePlugin.kt │ │ │ ├── MultiModelObject.kt │ │ │ ├── config │ │ │ │ └── MainConfig.kt │ │ │ ├── hooking │ │ │ │ ├── HookingFixRtmCorePlugin.kt │ │ │ │ └── HookingTransformer.kt │ │ │ └── patching │ │ │ │ ├── PatchApplier.kt │ │ │ │ └── PatchingFixRtmCorePlugin.kt │ │ │ ├── caching │ │ │ ├── FileCache.kt │ │ │ ├── ModelPackBasedCache.kt │ │ │ └── TaggedFileManager.kt │ │ │ ├── crash │ │ │ ├── RTMAllModelPackInfoCrashCallable.kt │ │ │ ├── RTMModelPackInfoCrashUtil.kt │ │ │ └── RTMSmallModelPackInfoCrashCallable.kt │ │ │ ├── gui │ │ │ ├── GuiChangeOffset.kt │ │ │ ├── GuiHandler.kt │ │ │ └── GuiId.kt │ │ │ ├── io │ │ │ ├── FIXFileLoader.kt │ │ │ ├── FIXModelPack.kt │ │ │ └── FIXResource.kt │ │ │ ├── network │ │ │ ├── NetworkHandler.kt │ │ │ ├── NotifyUntracked.kt │ │ │ ├── RequestFormation.kt │ │ │ └── SentAllModels.kt │ │ │ ├── ngtlib │ │ │ ├── command │ │ │ │ └── CommandPermit.kt │ │ │ ├── gui │ │ │ │ └── GUINumberFieldCustom.kt │ │ │ ├── io │ │ │ │ └── ScriptUtil.kt │ │ │ ├── item │ │ │ │ └── craft │ │ │ │ │ └── OreDictionaryUtil.kt │ │ │ └── renderer │ │ │ │ └── model │ │ │ │ ├── CachedPolygonModel.kt │ │ │ │ ├── CachedPolygonModelFormat.txt │ │ │ │ ├── ModelLoader.kt │ │ │ │ └── PolygonModelCharsetDetector.kt │ │ │ ├── rtm │ │ │ ├── Hooks.kt │ │ │ ├── RTMResourceManager.kt │ │ │ ├── block │ │ │ │ ├── BlockDecoration.kt │ │ │ │ ├── BlockOrnamentBase.kt │ │ │ │ └── tileentity │ │ │ │ │ ├── TileEntityMachineBase.kt │ │ │ │ │ ├── TileEntityMechanism.kt │ │ │ │ │ └── TileEntityOrnament.kt │ │ │ ├── electric │ │ │ │ ├── TileEntityConnectorBase.kt │ │ │ │ └── TileEntitySignal.kt │ │ │ ├── entity │ │ │ │ ├── EntityInstalledObject.kt │ │ │ │ ├── RenderEntityElectricalWiring.kt │ │ │ │ ├── npc │ │ │ │ │ └── EntityNPC.kt │ │ │ │ ├── train │ │ │ │ │ ├── EntityBogie.kt │ │ │ │ │ └── parts │ │ │ │ │ │ └── EntityCargoWithModel.kt │ │ │ │ └── vehicle │ │ │ │ │ ├── EntityTrolley.kt │ │ │ │ │ ├── EntityVehicleBase.kt │ │ │ │ │ └── VehicleTrackerEntry.kt │ │ │ ├── item │ │ │ │ └── ItemWithModelEx.kt │ │ │ ├── modelpack │ │ │ │ ├── ModelState.kt │ │ │ │ ├── init │ │ │ │ │ ├── ExModelPackConstructThread.kt │ │ │ │ │ ├── ModelConstructingException.kt │ │ │ │ │ └── UnconstructSetsQueue.kt │ │ │ │ └── modelset │ │ │ │ │ └── dummies │ │ │ │ │ ├── DummyModelObject.kt │ │ │ │ │ ├── DummyModelSets.kt │ │ │ │ │ └── GeneratedResourcePack.kt │ │ │ ├── rail │ │ │ │ ├── BlockMarker.kt │ │ │ │ └── util │ │ │ │ │ └── SwitchType.kt │ │ │ └── world │ │ │ │ └── RTMChunkManager.kt │ │ │ ├── scripting │ │ │ ├── ExecutedScript.kt │ │ │ ├── FIXScriptUtil.kt │ │ │ ├── IScriptRuntime.kt │ │ │ ├── ScriptImporter.kt │ │ │ ├── nashorn │ │ │ │ ├── CompiledImportedScriptCache.kt │ │ │ │ ├── FIXNashornScriptEngine.kt │ │ │ │ ├── ImportScriptNashornFunctionImpl.kt │ │ │ │ └── NashornScriptRuntimeImpl.kt │ │ │ └── sai │ │ │ │ ├── FIXSaiScriptEngine.kt │ │ │ │ ├── ImportScriptSaiFunctionImpl.kt │ │ │ │ ├── SaiScriptRuntimeImpl.kt │ │ │ │ ├── ScriptCompiledClassCache.kt │ │ │ │ └── Util.kt │ │ │ ├── utils │ │ │ ├── ArrayPool.kt │ │ │ ├── Base64OutputStream.kt │ │ │ ├── DigestUtils.kt │ │ │ ├── Geometric.kt │ │ │ ├── MultiCloseScope.kt │ │ │ ├── SortedFileTreeWalk.kt │ │ │ ├── SortedSetListView.kt │ │ │ ├── ThreadLocalProperties.kt │ │ │ └── ToStringOutputStream.kt │ │ │ └── versionCheck │ │ │ └── VersionCheck.kt │ ├── kotlin │ │ └── jp │ │ │ └── ngt │ │ │ └── rtm │ │ │ └── command │ │ │ └── CommandRTM.kt │ ├── ngtlib-patches │ │ ├── .gitattributes │ │ └── jp │ │ │ └── ngt │ │ │ └── ngtlib │ │ │ ├── NGTCore.java.patch │ │ │ ├── block │ │ │ ├── TileEntityCustom.java.patch │ │ │ └── TileEntityPlaceable.java.patch │ │ │ ├── command │ │ │ └── CommandPermit.java.patch │ │ │ ├── gui │ │ │ ├── GuiContainerCustom.java.patch │ │ │ ├── GuiScreenCustom.java.patch │ │ │ └── GuiTextFieldCustom.java.patch │ │ │ ├── io │ │ │ ├── NGTFileLoader.java.patch │ │ │ ├── NGTLog.java.patch │ │ │ ├── NGTText.java.patch │ │ │ └── ScriptUtil.java.patch │ │ │ ├── item │ │ │ └── craft │ │ │ │ ├── RecipeManager.java.patch │ │ │ │ └── ShapedRecipes55.java.patch │ │ │ ├── math │ │ │ └── BezierCurve.java.patch │ │ │ ├── network │ │ │ ├── PacketNBT.java.patch │ │ │ └── PacketNBTHandlerServer.java.patch │ │ │ ├── protection │ │ │ └── ProtectionManager.java.patch │ │ │ ├── renderer │ │ │ ├── GLHelper.java.patch │ │ │ └── model │ │ │ │ ├── ModelLoader.java.patch │ │ │ │ ├── ObjModel.java.patch │ │ │ │ └── PolygonModel.java.patch │ │ │ └── util │ │ │ ├── NGTUtil.java.patch │ │ │ ├── PermissionManager.java.patch │ │ │ └── VersionChecker.java.patch │ ├── resources │ │ ├── LICENSE.txt │ │ ├── META-INF │ │ │ └── fix-rtm_at.cfg │ │ ├── README.txt │ │ ├── assets │ │ │ ├── fix-rtm │ │ │ │ ├── lang │ │ │ │ │ ├── en_us.lang │ │ │ │ │ └── ja_jp.lang │ │ │ │ └── textures │ │ │ │ │ ├── ajwm5.png │ │ │ │ │ ├── blocks │ │ │ │ │ └── marker_merged.png │ │ │ │ │ └── template │ │ │ │ │ └── test_train_text.png │ │ │ ├── minecraft │ │ │ │ └── fix-rtm │ │ │ │ │ └── scripts │ │ │ │ │ └── render-gear.js │ │ │ └── rtm │ │ │ │ └── models │ │ │ │ └── item │ │ │ │ ├── item_train_fixrtm_test.json │ │ │ │ └── marker_fixrtm_merged.json │ │ ├── kotlin-LICENSE.txt │ │ ├── mcmod.info │ │ ├── pack.mcmeta │ │ ├── sai-LICENSE.txt │ │ ├── webp-imageio-LICENSE.txt │ │ └── webp-imageio-NOTICE.txt │ └── rtm-patches │ │ ├── .gitattributes │ │ └── jp │ │ └── ngt │ │ └── rtm │ │ ├── ClientProxy.java.patch │ │ ├── CreativeTabRTM.java.patch │ │ ├── RTMBlock.java.patch │ │ ├── RTMCore.java.patch │ │ ├── RTMEntity.java.patch │ │ ├── RTMItem.java.patch │ │ ├── RTMRecipe.java.patch │ │ ├── RTMSound.java.patch │ │ ├── block │ │ ├── BlockCrossingGate.java.patch │ │ ├── BlockDecoration.java.patch │ │ ├── BlockFlag.java.patch │ │ ├── BlockFluorescent.java.patch │ │ ├── BlockLight.java.patch │ │ ├── BlockLinePole.java.patch │ │ ├── BlockMachineBase.java.patch │ │ ├── BlockMechanism.java.patch │ │ ├── BlockPipe.java.patch │ │ ├── BlockPlant.java.patch │ │ ├── BlockPoint.java.patch │ │ ├── BlockRailroadSign.java.patch │ │ ├── BlockScaffold.java.patch │ │ ├── BlockScaffoldStairs.java.patch │ │ ├── BlockSignBoard.java.patch │ │ ├── BlockStation.java.patch │ │ ├── BlockTurnstile.java.patch │ │ └── tileentity │ │ │ ├── RenderMachine.java.patch │ │ │ ├── RenderOrnament.java.patch │ │ │ ├── RenderRailroadSign.java.patch │ │ │ ├── RenderSignBoard.java.patch │ │ │ ├── TileEntityCrossingGate.java.patch │ │ │ ├── TileEntityFluorescent.java.patch │ │ │ ├── TileEntityMachineBase.java.patch │ │ │ ├── TileEntityMechanism.java.patch │ │ │ ├── TileEntityOrnament.java.patch │ │ │ ├── TileEntityPoint.java.patch │ │ │ ├── TileEntityRailroadSign.java.patch │ │ │ ├── TileEntitySignBoard.java.patch │ │ │ └── TileEntityTrainWorkBench.java.patch │ │ ├── command │ │ └── CommandRTM.java.patch │ │ ├── electric │ │ ├── BlockConnector.java.patch │ │ ├── BlockElectricalWiring.java.patch │ │ ├── BlockInsulator.java.patch │ │ ├── BlockSignal.java.patch │ │ ├── BlockSpeaker.java.patch │ │ ├── BlockTicketVendor.java.patch │ │ ├── RenderElectricalWiring.java.patch │ │ ├── RenderSignal.java.patch │ │ ├── TileEntityConnectorBase.java.patch │ │ ├── TileEntityDummyEW.java.patch │ │ ├── TileEntityElectricalWiring.java.patch │ │ └── TileEntitySignal.java.patch │ │ ├── entity │ │ ├── ai │ │ │ └── EntityAITravelByTrain.java.patch │ │ ├── npc │ │ │ ├── EntityMotorman.java.patch │ │ │ └── EntityNPC.java.patch │ │ ├── train │ │ │ ├── EntityBogie.java.patch │ │ │ ├── EntityTrainBase.java.patch │ │ │ ├── parts │ │ │ │ ├── EntityArtillery.java.patch │ │ │ │ ├── EntityCargo.java.patch │ │ │ │ ├── EntityCargoWithModel.java.patch │ │ │ │ ├── EntityContainer.java.patch │ │ │ │ ├── EntityFloor.java.patch │ │ │ │ └── EntityVehiclePart.java.patch │ │ │ └── util │ │ │ │ ├── EnumNotch.java.patch │ │ │ │ ├── Formation.java.patch │ │ │ │ └── TrainState.java.patch │ │ └── vehicle │ │ │ ├── EntityTrolley.java.patch │ │ │ ├── EntityVehicleBase.java.patch │ │ │ ├── RenderVehicleBase.java.patch │ │ │ ├── VehicleTrackerEntry.java.patch │ │ │ └── WeatherEffectDummy.java.patch │ │ ├── event │ │ ├── RTMEventHandler.java.patch │ │ ├── RTMKeyHandlerClient.java.patch │ │ └── RTMKeyHandlerServer.java.patch │ │ ├── gui │ │ ├── GuiIngameCustom.java.patch │ │ ├── GuiRailMarker.java.patch │ │ ├── GuiSignalConverter.java.patch │ │ ├── GuiVehicleControlPanel.java.patch │ │ └── RTMGuiHandler.java.patch │ │ ├── item │ │ ├── ItemCargo.java.patch │ │ ├── ItemInstalledObject.java.patch │ │ ├── ItemNPC.java.patch │ │ ├── ItemRail.java.patch │ │ ├── ItemTrain.java.patch │ │ ├── ItemVehicle.java.patch │ │ ├── ItemWire.java.patch │ │ └── ItemWithModel.java.patch │ │ ├── modelpack │ │ ├── ModelPackManager.java.patch │ │ ├── RTMResourceManager.java.patch │ │ ├── cfg │ │ │ ├── ResourceConfig.java.patch │ │ │ ├── TrainConfig.java.patch │ │ │ └── VehicleBaseConfig.java.patch │ │ ├── init │ │ │ ├── ModelPackConstructThread.java.patch │ │ │ └── ModelPackLoadThread.java.patch │ │ ├── modelset │ │ │ ├── ModelSetBase.java.patch │ │ │ ├── ModelSetNPC.java.patch │ │ │ ├── ModelSetSignal.java.patch │ │ │ ├── ModelSetTrain.java.patch │ │ │ ├── ModelSetVehicleBase.java.patch │ │ │ └── ResourceSet.java.patch │ │ └── state │ │ │ ├── DataEntry.java.patch │ │ │ ├── DataEntryVec.java.patch │ │ │ ├── DataMap.java.patch │ │ │ └── ResourceState.java.patch │ │ ├── network │ │ ├── PacketFormation.java.patch │ │ ├── PacketMarker.java.patch │ │ ├── PacketMarkerRPClient.java.patch │ │ ├── PacketModelPack.java.patch │ │ ├── PacketMoveMM.java.patch │ │ ├── PacketMovingMachine.java.patch │ │ ├── PacketNoticeHandlerClient.java.patch │ │ ├── PacketNoticeHandlerServer.java.patch │ │ ├── PacketPlaySound.java.patch │ │ ├── PacketRTMKey.java.patch │ │ ├── PacketSelectResource.java.patch │ │ ├── PacketSetTrainState.java.patch │ │ ├── PacketSignal.java.patch │ │ ├── PacketSignalConverter.java.patch │ │ ├── PacketSyncItem.java.patch │ │ └── PacketVehicleMovement.java.patch │ │ ├── rail │ │ ├── BlockLargeRailBase.java.patch │ │ ├── BlockMarker.java.patch │ │ ├── RenderMarkerBlock.java.patch │ │ ├── RenderTurntable.java.patch │ │ ├── TileEntityLargeRailBase.java.patch │ │ ├── TileEntityLargeRailCore.java.patch │ │ ├── TileEntityLargeRailSwitchCore.java.patch │ │ ├── TileEntityMarker.java.patch │ │ ├── TileEntityTurnTableCore.java.patch │ │ └── util │ │ │ ├── MarkerState.java.patch │ │ │ ├── RailMaker.java.patch │ │ │ ├── RailMapBasic.java.patch │ │ │ ├── RailMapSwitch.java.patch │ │ │ ├── RailMapTurntable.java.patch │ │ │ ├── RailPosition.java.patch │ │ │ └── SwitchType.java.patch │ │ ├── render │ │ ├── ModelObject.java.patch │ │ ├── PartsRenderer.java.patch │ │ └── RTMRenderers.java.patch │ │ ├── sound │ │ ├── MovingSoundMaker.java.patch │ │ ├── MovingSoundTrain.java.patch │ │ ├── SoundPlayer.java.patch │ │ └── SoundUpdaterTrain.java.patch │ │ └── world │ │ └── RTMChunkManager.java.patch └── test │ └── java │ └── com │ └── anatawa12 │ └── fixRtm │ ├── UtilsKtTest.kt │ └── utils │ ├── Base64OutputStreamTest.kt │ └── SortedSetListViewTest.kt └── version-map.md /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | 8 | [*.patch] 9 | trim_trailing_whitespace = false 10 | insert_final_newline = false 11 | 12 | [*.java] 13 | indent_size = 3 14 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [anatawa12] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | blank_issues_enabled: true 6 | contact_links: 7 | - name: fixRTM official Discord Server 8 | url: https://discord.gg/9VkuSAtpRQ 9 | about: You have questions? Please join us on Discord! 質問がありますか? Discord で聞いてみましょう! 10 | 11 | - name: KaizPatchX, similar mod for 1.7.10, 1.7.10向けの同様のMOD 12 | url: https://github.com/Kai-Z-JP/KaizPatchX 13 | about: Are you looking for 1.7.10? Please use KaizPatchX instead. 1.7.10版を探していますか? KaizPatchXを使用してください。 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request-en.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | name: Feature Request [EN] 6 | description: Create a request to add some feature 7 | labels: [enhancement, needs-triage] 8 | assignees: 9 | - anatawa12 10 | body: 11 | 12 | - type: markdown 13 | attributes: 14 | value: | 15 | Thanks for taking the time to request a feature. 16 | 17 | If you're using machine translation, 18 | please write in both your native language and English machine translated 19 | to avoid misreading and un-understandable English due to mistake of machine translator. 20 | 21 | - type: checkboxes 22 | id: terms 23 | attributes: 24 | label: Feature report check list 25 | options: 26 | - label: What you want is not included in the latest snapshot version of fixRTM. 27 | required: true 28 | - label: You couldn't find same request in the issues. 29 | required: true 30 | 31 | - type: textarea 32 | attributes: 33 | label: Describe the feature 34 | description: A clear and concise description of what you want. 35 | validations: 36 | required: true 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request-ja.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | name: 新機能のリクエスト [JA] 6 | description: 追加機能のリクエスト 7 | labels: [enhancement, needs-triage] 8 | assignees: 9 | - anatawa12 10 | body: 11 | 12 | - type: markdown 13 | attributes: 14 | value: | 15 | Thanks for taking the time to request a feature. 16 | 17 | 機械翻訳をご利用の場合は、機械翻訳機のミスによる誤読や理解できない日本語を避けるため、母語と機械翻訳された日本語の両方でお書きください。 18 | 19 | - type: checkboxes 20 | id: terms 21 | attributes: 22 | label: Feature report check list 23 | options: 24 | - label: 最新のSNAPSHOTバージョンの fixRTM にその機能が存在しないこと 25 | required: true 26 | - label: issues でそのリクエストがまだ無いこと。 27 | required: true 28 | 29 | - type: textarea 30 | attributes: 31 | label: Describe the feature 32 | description: なにを追加してほしいかを説明してください。 33 | validations: 34 | required: true 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/porting-request.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | name: Porting Request from KaizPatchX 6 | description: Request porting feature/bug fix from KaizPatchX. KaizPatchXから移植のリクエスト 7 | labels: [ porting, needs-triage ] 8 | assignees: 9 | - anatawa12 10 | body: 11 | 12 | - type: markdown 13 | attributes: 14 | value: | 15 | Thanks for taking the time to request a feature. 16 | 17 | If you're using machine translation, 18 | please write in both your native language and English machine translated 19 | to avoid misreading and un-understandable English due to mistake of machine translator. 20 | 21 | - type: checkboxes 22 | id: terms 23 | attributes: 24 | label: Feature report check list 25 | options: 26 | - label: You couldn't find same request in the issues. 27 | required: true 28 | 29 | - type: input 30 | attributes: 31 | label: link to issue/PullRequest/commit/release of KaizPatchX 32 | placeholder: "Kai-Z-JP/KaizPatchX#1 Kai-Z-JP/KaizPatchX@sha" 33 | validations: 34 | required: true 35 | 36 | - type: textarea 37 | attributes: 38 | label: Describe request 39 | description: Describe your request. 40 | validations: 41 | required: false 42 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | open-pull-requests-limit: 100 6 | schedule: 7 | interval: "daily" 8 | commit-message: 9 | prefix: "chore" 10 | include: "scope" 11 | ignore: 12 | - dependency-name: "net.minecraftforge.gradle:ForgeGradle" 13 | update-types: ["version-update:semver-major"] 14 | - dependency-name: "com.github.johnrengelman.shadow" 15 | update-types: ["version-update:semver-major"] 16 | -------------------------------------------------------------------------------- /.github/license-check/header-check.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "include": [ 4 | "{buildSrc,src}/**/*.{kt,java,js}", 5 | "commitlint.config.js", 6 | "**/*.gradle", 7 | "**/*.kts" 8 | ], 9 | "license": "./.github/license-check/header-triple-slash.txt" 10 | }, 11 | { 12 | "include": [ 13 | "**/*.yml", 14 | "**/*.cfg", 15 | "**/*.properties", 16 | "**/*.lang", 17 | "githooks/*", 18 | "src/main/java/com/anatawa12/fixRtm/ngtlib/renderer/model/CachedPolygonModelFormat.txt" 19 | ], 20 | "exclude": [ 21 | "gradle/wrapper/*" 22 | ], 23 | "license": "./.github/license-check/header-hash.txt" 24 | }, 25 | { 26 | "__comment": "ignored files:", 27 | "include": [ 28 | "**/*.md", 29 | "**/*.png", 30 | "**/*.json", 31 | "gradle/wrapper/*", 32 | "gradlew", 33 | "gradlew.bat", 34 | "LICENSE", 35 | "LICENSE-FOR-ORIGINAL-AUTHOR.txt", 36 | "important-structure/**/*", 37 | "src/main/{ngtlib,rtm}-patches/**/*.java.patch", 38 | "src/main/distResources/META-INF/services/**/*", 39 | "src/main/resources/*-LICENSE.txt", 40 | "src/main/resources/*-NOTICE.txt", 41 | "src/main/resources/LICENSE.txt", 42 | "src/main/resources/mcmod.info", 43 | "src/main/resources/pack.mcmeta", 44 | "src/main/resources/README.txt", 45 | "src/main/resources/sai-LICENSE.txt" 46 | ] 47 | } 48 | ] 49 | -------------------------------------------------------------------------------- /.github/license-check/header-hash.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) %year% anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | -------------------------------------------------------------------------------- /.github/license-check/header-triple-slash.txt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) %year% anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | -------------------------------------------------------------------------------- /.github/workflows/check-license.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | # This is a basic workflow to help you get started with Actions 6 | 7 | name: License Header Check 8 | 9 | on: 10 | push: {} 11 | 12 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 13 | jobs: 14 | # This workflow contains a single job called "build" 15 | license-header-check: 16 | # The type of runner that the job will run on 17 | runs-on: ubuntu-latest 18 | 19 | # Steps represent a sequence of tasks that will be executed as part of the job 20 | steps: 21 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 22 | - uses: actions/checkout@v3 23 | 24 | - uses: viperproject/check-license-header@v2 25 | with: 26 | path: . 27 | config: .github/license-check/header-check.json 28 | strict: true 29 | -------------------------------------------------------------------------------- /.github/workflows/commitlint.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | on: 6 | pull_request: 7 | branches: [ master, master-* ] 8 | types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ] 9 | 10 | jobs: 11 | check-conventional-commit: 12 | runs-on: ubuntu-latest 13 | if: ${{ !contains(github.event.pull_request.labels.*.name, 'NO-COMMIT-CHECK') }} 14 | steps: 15 | - uses: anatawa12/sh-actions/conventional-commitlint@master 16 | -------------------------------------------------------------------------------- /.github/workflows/no-add-import.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | name: No Add Import 6 | 7 | on: 8 | push: 9 | 10 | jobs: 11 | no-add-import: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - name: Changelog check for CHANGELOG-SNAPSHOTS.md 16 | run: | 17 | if grep -R '+import ' src/main/rtm-patches src/main/ngtlib-patches ; then 18 | echo "::error::There are added imports" 19 | exit 1 20 | fi 21 | -------------------------------------------------------------------------------- /.github/workflows/sh/get-unreleased-release-note.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sed -e "0,/^## /d" -e '/^## /Q' < "$1" 4 | -------------------------------------------------------------------------------- /.github/workflows/sh/prepare-changelog.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | INPUT="$1" 4 | temp="$(mktemp)" 5 | cat <"$INPUT" >"$temp" 6 | sed -e "/^###/{ 7 | N 8 | /###.*\n$/d 9 | }" <"$temp" \ 10 | | perl -pe 's/(?<= )`#(\d+)`(?= |$)/[`#$1`](https:\/\/github.com\/fixrtm\/fixRTM\/pull\/$1)/' \ 11 | >"$INPUT" 12 | 13 | rm "$temp" 14 | -------------------------------------------------------------------------------- /.github/workflows/sh/update-changelog.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | INPUT="$1" 4 | VERSION="$2" 5 | DATE="$3" 6 | 7 | LAST_VERSION="$(grep '\[Unreleased\]: ' -A1 < "$INPUT" | tail -1 | sed -E 's/^\[([0-9.]*)]: .*$/\1/')" 8 | 9 | temp="$(mktemp)" 10 | cat <"$INPUT" >"$temp" 11 | sed -e "/#* \\[Unreleased]/{ 12 | a\\ 13 | ### Added\\ 14 | \\ 15 | ### Changed\\ 16 | \\ 17 | ### Deprecated\\ 18 | \\ 19 | ### Removed\\ 20 | \\ 21 | ### Fixed\\ 22 | \\ 23 | ### Security\\ 24 | \\ 25 | ## [$VERSION] - $DATE 26 | } 27 | /^\\[Unreleased]/ { 28 | a\\ 29 | [Unreleased]: https://github.com/fixrtm/fixRTM/compare/$VERSION...HEAD\\ 30 | [$VERSION]: https://github.com/fixrtm/fixRTM/compare/$LAST_VERSION...$VERSION 31 | D 32 | } 33 | " <"$temp" >"$INPUT" 34 | 35 | rm "$temp" 36 | -------------------------------------------------------------------------------- /.patching-mods/.gitattributes: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT FILES IN THIS DIRECTORY 2 | # files in this directory are auto generated files by pathing mod 3 | # please do not edit and please do not ignore files in this directory 4 | *.yaml text eol=lf 5 | .gitattributes text eol=lf 6 | -------------------------------------------------------------------------------- /.something-releaser.json: -------------------------------------------------------------------------------- 1 | { 2 | "releaseChanger": [{ 3 | "changer": "gradle-properties", 4 | "info": "modVersion" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE-FOR-ORIGINAL-AUTHOR.txt: -------------------------------------------------------------------------------- 1 | RTMの作者にのみ適用されるライセンス 2 | 3 | RTMの作者はGNU Lessor General Public Licenseに関わらず、 4 | RTM及びNGTLibの改善の用途に限り以下の著作権表示を含めることを条件に 5 | 自由にソースコード及びリソースを使用することを認めます。 6 | 7 | (c) anatawa12 and other authors 2020 8 | 9 | ==== REFERENCE ENGLISH TRANSLATION ==== 10 | This English translation is only for Reference. 11 | 12 | The license applied for the original author of RTM 13 | 14 | Notwithstanding the GNU Lessor General Public License, 15 | the original author(s) of RTM are free to use the source code and resources 16 | only for the purpose of improving RTM and NGTLib, 17 | provided that the following copyright notice is included. 18 | 19 | (c) anatawa12 and other authors 2020 20 | -------------------------------------------------------------------------------- /README.en.md: -------------------------------------------------------------------------------- 1 | # fixRTM 2 | 3 | fixes some bugs of RTM and make RTM more useful! 4 | 5 | - [English](README.en.md) 6 | - [日本語](README.md) 7 | - [简体中文](README.zh.md) 8 | 9 | ## For RTM 1.7.10 Users 10 | 11 | Please use [KaizPatchX]. 12 | 13 | ## Download 14 | 15 | [Curse Forge](https://www.curseforge.com/minecraft/mc-mods/fixrtm) 16 | 17 | Also, you can download the latest nightly release at [nightly.link]. 18 | 19 | [nightly.link]: https://nightly.link/fixrtm/fixRTM/workflows/release/master/jar 20 | 21 | ## dependencies 22 | 23 | - [RTM](https://www.curseforge.com/minecraft/mc-mods/realtrainmod) the newest version when a release of fixRTM 24 | - [NGT Lib](https://www.curseforge.com/minecraft/mc-mods/ngtlib) (dependencies of RTM) 25 | - [Minecraft Forge](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.12.2.html) 14.23.5.2847 or 26 | later is supported. 27 | 28 | [here](version-map.md) is a version mapping between fixRTM and RTM 29 | 30 | [KaizPatchX]: https://github.com/Kai-Z-JP/KaizPatchX 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fixRTM 2 | 3 | [![Discord](https://img.shields.io/discord/749186892733480970.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/9VkuSAtpRQ) 4 | [![Github Actions](https://img.shields.io/github/actions/workflow/status/fixrtm/fixRTM/build.yml?branch=master&logo=github)](https://github.com/fixrtm/fixRTM/actions) 5 | [![Github Release](https://img.shields.io/github/v/release/fixrtm/fixRTM?logo=github)](https://github.com/fixrtm/fixRTM/releases/latest) 6 | [![Curse Download](https://img.shields.io/badge/CurseForge-download-brightgreen?logo=curseforge)](https://www.curseforge.com/minecraft/mc-mods/fixrtm) 7 | 8 | RTMのバグを減らし、使いやすくする! 9 | 10 | - [English](README.en.md) 11 | - [日本語](README.md) 12 | - [简体中文](README.zh.md) 13 | 14 | ## RTM 1.7.10のユーザーへ 15 | 16 | [KaizPatchX]を使用してください。 17 | 18 | ## ダウンロード 19 | 20 | [Curse Forge](https://www.curseforge.com/minecraft/mc-mods/fixrtm) 21 | 22 | また、最新評価版は[nightly.link]よりダウンロードできます。 23 | 24 | [nightly.link]: https://nightly.link/fixrtm/fixRTM/workflows/release/master/jar 25 | 26 | ## 前提mod 27 | 28 | - [RTM](https://www.curseforge.com/minecraft/mc-mods/realtrainmod) fixRTMのリリース時の最新バージョン 29 | - [NGT Lib](https://www.curseforge.com/minecraft/mc-mods/ngtlib) (RTMの前提mod) 30 | - [Minecraft Forge](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.12.2.html) 31 | 14.23.5.2847以降がサポートバージョンです。 32 | 33 | 対応表は[こちら](version-map.md) 34 | 35 | [KaizPatchX]: https://github.com/Kai-Z-JP/KaizPatchX 36 | -------------------------------------------------------------------------------- /README.zh.md: -------------------------------------------------------------------------------- 1 | # fixRTM 2 | 3 | 修复了RTM的一些bug,并让RTM变得更实用! 4 | 5 | - [English](README.en.md) 6 | - [日本語](README.md) 7 | - [简体中文](README.zh.md) 8 | 9 | ## 对于 RTM 1.7.10 的用户 10 | 11 | 请使用 [KaizPatchX]. 12 | 13 | ## 下载 14 | 15 | [Curse Forge](https://www.curseforge.com/minecraft/mc-mods/fixrtm) 16 | 17 | 此外,你可以在[nightly.link]下载最新评估版。 18 | 19 | [nightly.link]: https://nightly.link/fixrtm/fixRTM/workflows/release/master/jar 20 | 21 | ## 前置mod 22 | 23 | - [RTM](https://www.curseforge.com/minecraft/mc-mods/realtrainmod) 发布 fixRTM 时的最新版本 24 | - [NGT Lib](https://www.curseforge.com/minecraft/mc-mods/ngtlib) (RTM 前置mod) 25 | - [Minecraft Forge](https://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.12.2.html) 支持 14.23.5.2847 或更高版本 26 | 27 | [这里](version-map.md) 有一个 fixRTM 和 RTM 的版本对照表 28 | 29 | [KaizPatchX]: https://github.com/Kai-Z-JP/KaizPatchX 30 | -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | plugins { 6 | `kotlin-dsl` 7 | } 8 | 9 | repositories { 10 | mavenCentral() 11 | 12 | maven(url = "https://jitpack.io") 13 | } 14 | 15 | dependencies { 16 | implementation("org.ow2.asm:asm-commons:6.0") 17 | implementation("org.ow2.asm:asm-util:6.0") 18 | implementation("org.ow2.asm:asm:6.0") 19 | } 20 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/PrintStaticFields.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | import com.anatawa12.fixrtm.gradle.classHierarchy.ClassHierarchy 6 | import org.gradle.api.DefaultTask 7 | import org.gradle.api.file.FileTree 8 | import org.gradle.api.tasks.Input 9 | import org.gradle.api.tasks.InputFiles 10 | import org.gradle.api.tasks.OutputFile 11 | import org.gradle.api.tasks.TaskAction 12 | import java.io.File 13 | 14 | open class PrintStaticFields : DefaultTask() { 15 | @InputFiles 16 | var files: FileTree = project.files().asFileTree 17 | 18 | @OutputFile 19 | var outTo: File? = null 20 | 21 | @Input 22 | var ofClass: String? = null 23 | 24 | @TaskAction 25 | fun run() { 26 | val classes = ClassHierarchy().apply { load(files) } 27 | val outTo = outTo ?: error("outTo not inited") 28 | val ofClass = ofClass ?: error("ofClass not inited") 29 | 30 | val theClass = classes.getByInternalName(ofClass.replace('.', '/')) 31 | if (!theClass.isLoaded) 32 | throw IllegalStateException("ofClass is not loaded") 33 | 34 | val file = buildString { 35 | for (field in theClass.fields.filter { it.isStatic }) { 36 | append("name: ${field.name}\n") 37 | append("type: ${field.type}\n") 38 | append("\n") 39 | } 40 | } 41 | 42 | outTo.apply { parentFile.mkdirs() } 43 | .writeText(file) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/anatawa12/fixrtm/gradle/classHierarchy/ClassHierarchy.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixrtm.gradle.classHierarchy 6 | 7 | import org.gradle.api.file.FileTree 8 | import org.objectweb.asm.ClassReader 9 | import org.objectweb.asm.tree.ClassNode 10 | import java.io.File 11 | 12 | class ClassHierarchy { 13 | var classes = mutableMapOf() 14 | 15 | fun getByInternalName(internalName: String) = classes.getOrPut(internalName, { HClass(this, internalName) }) 16 | 17 | fun load(classFile: ByteArray) { 18 | val node = ClassNode().also { ClassReader(classFile).accept(it, 0) } 19 | val hClass = getByInternalName(node.name) 20 | hClass.classNode = node 21 | hClass.load() 22 | } 23 | 24 | fun load(classFiles: FileTree) { 25 | val files = mutableSetOf() 26 | classFiles.visit { 27 | if (isDirectory) return@visit 28 | files.add(file) 29 | } 30 | for (file in files) { 31 | load(file.readBytes()) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/anatawa12/fixrtm/gradle/classHierarchy/HClass.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixrtm.gradle.classHierarchy 6 | 7 | import org.objectweb.asm.tree.ClassNode 8 | 9 | class HClass( 10 | val loader: ClassHierarchy, 11 | val internalName: String 12 | ) { 13 | internal var classNode: ClassNode? = null 14 | val isLoaded get() = classNode != null 15 | 16 | private val node get() = classNode ?: throw IllegalStateException("not loaded") 17 | 18 | private val _childClasses = mutableListOf() 19 | val childClasses get() = _childClasses as List 20 | 21 | val parentClass get() = node.superName?.let { loader.getByInternalName(it) } 22 | val fields get() = node.fields.asSequence().map { HField(this, it) } 23 | 24 | val methods get() = node.methods.asSequence().map { HMethod(this, it) } 25 | 26 | internal fun load() { 27 | val classNode = checkNotNull(classNode) { "classNode is null" } 28 | for (interfaceName in classNode.interfaces) { 29 | loader.getByInternalName(interfaceName)._childClasses.add(this) 30 | } 31 | if (classNode.superName != null) { 32 | loader.getByInternalName(classNode.superName)._childClasses.add(this) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/anatawa12/fixrtm/gradle/classHierarchy/HField.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixrtm.gradle.classHierarchy 6 | 7 | import org.objectweb.asm.Opcodes 8 | import org.objectweb.asm.tree.FieldNode 9 | 10 | class HField(val declaringClass: HClass, private val node: FieldNode) { 11 | val isStatic get() = node.access and Opcodes.ACC_STATIC != 0 12 | val name get() = node.name 13 | val type get() = node.desc 14 | } 15 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/anatawa12/fixrtm/gradle/classHierarchy/HMethod.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixrtm.gradle.classHierarchy 6 | 7 | import org.gradle.api.Incubating 8 | import org.objectweb.asm.tree.MethodNode 9 | 10 | class HMethod(val declaringClass: HClass, @Incubating val node: MethodNode) { 11 | val name get() = node.name 12 | val desc get() = node.desc 13 | } 14 | -------------------------------------------------------------------------------- /doc/script-cache.md: -------------------------------------------------------------------------------- 1 | # javascriptのキャッシュ 2 | 3 | ## キャッシュの種類 4 | 5 | - Script class cache 6 | 7 | > コンパイル済javascript 8 | > 9 | > 通常のhash-basedではなく.classをベタ置きする 10 | 11 | - Executed Environment 12 | 13 | > evalでやる実行をしたあとの状態。 ModelPackBased 14 | > 15 | > key: スクリプトpath 16 | 17 | ### Executed Environment 18 | 19 | ロードしているスクリプトが変更されていない必要があるため、 キャッシュデータにロードしているスクリプトのResourceLoation+sha1を保存している 20 | -------------------------------------------------------------------------------- /doc/somethings-have-to-do-when-upgrade-RTM-or-NGTLib.md: -------------------------------------------------------------------------------- 1 | # RTM, FixRTMを更新するときにすること 2 | 3 | 1. `./gradlew prepareMods`を実行 4 | 1. `./apply_patch.sh`を実行してパッチを適用する 5 | 1. NGTLib/RTM内における`javax/script/ScriptEngine`の使用箇所を調べて`FIXScriptEngine`で実装していないところを確認する 6 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/MDKExample/.location -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/eclipse/.metadata/.plugins/org.eclipse.core.resources/.root/0.tree -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | #Sun Jun 05 18:58:07 CEST 2011 2 | version=1 3 | eclipse.preferences.version=1 4 | refresh.enabled=true 5 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs: -------------------------------------------------------------------------------- 1 | #Sun Jun 05 19:03:53 CEST 2011 2 | eclipse.preferences.version=1 3 | org.eclipse.debug.ui.UseContextualLaunch=false 4 | Console.highWaterMark=88000 5 | org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\r\n\r\n 6 | org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n 7 | StringVariablePreferencePage=130,107,107,86, 8 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.gathering.prefs: -------------------------------------------------------------------------------- 1 | #Sun Jun 05 18:58:07 CEST 2011 2 | eclipse.preferences.version=1 3 | org.eclipse.epp.usagedata.gathering.enabled=false 4 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Sun Sep 18 16:44:39 NZST 2011 2 | org.eclipse.jdt.core.compiler.compliance=1.6 3 | org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore 4 | org.eclipse.jdt.core.compiler.problem.deprecation=ignore 5 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 6 | org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore 7 | org.eclipse.jdt.core.compiler.problem.unusedImport=ignore 8 | eclipse.preferences.version=1 9 | org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore 10 | org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore 11 | org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore 12 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore 13 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 14 | org.eclipse.jdt.core.compiler.source=1.6 15 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs: -------------------------------------------------------------------------------- 1 | #Sun Jun 05 18:58:05 CEST 2011 2 | spacesForTabs=true 3 | eclipse.preferences.version=1 4 | overviewRuler_migration=migrated_3.1 5 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs: -------------------------------------------------------------------------------- 1 | #Sun Jun 05 18:58:07 CEST 2011 2 | IMPORT_FILES_AND_FOLDERS_MODE=prompt 3 | IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt 4 | SAVE_ALL_BEFORE_BUILD=true 5 | eclipse.preferences.version=1 6 | tipsAndTricks=true 7 | platformState=1287081747687 8 | quickStart=false 9 | PROBLEMS_FILTERS_MIGRATE=true 10 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | #Sun Jun 05 18:50:08 CEST 2011 2 | eclipse.preferences.version=1 3 | showIntro=false 4 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Client.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /eclipse/.metadata/.plugins/org.eclipse.debug.core/.launches/Server.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /githooks/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2022 anatawa12 and other contributors 3 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 4 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 5 | 6 | set -eu 7 | 8 | conventional-commitlint edit "$1" 9 | -------------------------------------------------------------------------------- /githooks/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2022 anatawa12 and other contributors 3 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 4 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 5 | 6 | set -eu 7 | 8 | GITHOOKS_DIR="$(cd "$(dirname $0)" && pwd)" 9 | 10 | if ! command -v conventional-commitlint > /dev/null 2>&1 ; then 11 | echo "Please install conventional-commitlint to run git hooks" >&2 12 | echo "https://github.com/anatawa12/conventional-commitlint" >&2 13 | exit 1 14 | fi 15 | 16 | echo "Installing pre-commit and commit-msg git hook" >&2 17 | 18 | copy_hook() { 19 | rm "$(git rev-parse --git-dir)/hooks/$1" 20 | ln -s "$GITHOOKS_DIR/$1" "$(git rev-parse --git-dir)/hooks/$1" 21 | } 22 | 23 | copy_hook commit-msg 24 | copy_hook pre-commit 25 | -------------------------------------------------------------------------------- /githooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 2022 anatawa12 and other contributors 3 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 4 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 5 | 6 | set -eu 7 | 8 | ./pm.create-diff --check 9 | 10 | # it takes few seconds; it's not acceptable 11 | #npm exec --yes github:anatawa12/check-license-header#v1 -- \ 12 | # check --strict --gitignore --config .github/license-check/header-check.json 13 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 6 | modGroup=com.anatawa12.fixRtm 7 | modVersion=2.0.29-beta.1 8 | modBaseName=fixRtm 9 | forgeVersion=1.12.2-14.23.5.2847 10 | mcpChannel=stable 11 | mcpVersion=39-1.12 12 | rtmVersion=2.4.24 13 | ngtVersion=2.4.21 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/java/lang/Object.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/java/lang/String.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/block/tileentity/MechanismType.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Enum 2 | name: useRS 3 | type: Z 4 | 5 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ConnectorConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: connectorType 3 | type: Ljava/lang/String; 4 | 5 | name: model 6 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 7 | 8 | name: name 9 | type: Ljava/lang/String; 10 | 11 | name: wirePos 12 | type: [F 13 | 14 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ContainerConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: containerHeight 3 | type: F 4 | 5 | name: containerLength 6 | type: F 7 | 8 | name: containerModel 9 | type: Ljava/lang/String; 10 | 11 | name: containerName 12 | type: Ljava/lang/String; 13 | 14 | name: containerTexture 15 | type: Ljava/lang/String; 16 | 17 | name: containerWidth 18 | type: F 19 | 20 | name: model 21 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 22 | 23 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/FirearmConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: ammoType 3 | type: B 4 | 5 | name: firearmModel 6 | type: Ljava/lang/String; 7 | 8 | name: firearmName 9 | type: Ljava/lang/String; 10 | 11 | name: firearmTexture 12 | type: Ljava/lang/String; 13 | 14 | name: fpvMode 15 | type: Z 16 | 17 | name: magazineSize 18 | type: I 19 | 20 | name: model 21 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 22 | 23 | name: modelPartsBarrel 24 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$Parts; 25 | 26 | name: modelPartsN 27 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$Parts; 28 | 29 | name: modelPartsX 30 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$Parts; 31 | 32 | name: modelPartsY 33 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$Parts; 34 | 35 | name: muzzlePos 36 | type: [F 37 | 38 | name: pitch 39 | type: [F 40 | 41 | name: playerPos 42 | type: [F 43 | 44 | name: rateOfFire 45 | type: I 46 | 47 | name: recoil 48 | type: F 49 | 50 | name: rotationSpeedX 51 | type: F 52 | 53 | name: rotationSpeedY 54 | type: F 55 | 56 | name: useOldSystem 57 | type: Z 58 | 59 | name: yaw 60 | type: [F 61 | 62 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/FlagConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/TextureConfig 2 | name: poleLength 3 | type: F 4 | 5 | name: resolutionU 6 | type: I 7 | 8 | name: resolutionV 9 | type: I 10 | 11 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/MachineConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: brightness 3 | type: [I 4 | 5 | name: followRailAngle 6 | type: Z 7 | 8 | name: machineType 9 | type: Ljava/lang/String; 10 | 11 | name: model 12 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 13 | 14 | name: name 15 | type: Ljava/lang/String; 16 | 17 | name: rotateByMetadata 18 | type: Z 19 | 20 | name: sound_OnActivate 21 | type: Ljava/lang/String; 22 | 23 | name: sound_Running 24 | type: Ljava/lang/String; 25 | 26 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/MechanismConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: acceleration 3 | type: F 4 | 5 | name: maxSpeed 6 | type: F 7 | 8 | name: model 9 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 10 | 11 | name: name 12 | type: Ljava/lang/String; 13 | 14 | name: radius 15 | type: F 16 | 17 | name: teethCount 18 | type: I 19 | 20 | name: transmissionRatioOFF 21 | type: [F 22 | 23 | name: transmissionRatioON 24 | type: [F 25 | 26 | name: type 27 | type: Ljp/ngt/rtm/block/tileentity/MechanismType; 28 | 29 | name: useRedstonePower 30 | type: Z 31 | 32 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: fragmentShaderPath 3 | type: Ljava/lang/String; 4 | 5 | name: modelFile 6 | type: Ljava/lang/String; 7 | 8 | name: rendererPath 9 | type: Ljava/lang/String; 10 | 11 | name: textures 12 | type: [[Ljava/lang/String; 13 | 14 | name: this$0 15 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig; 16 | 17 | name: vertexShaderPath 18 | type: Ljava/lang/String; 19 | 20 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ModelConfig$Parts.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: objects 3 | type: [Ljava/lang/String; 4 | 5 | name: pos 6 | type: [F 7 | 8 | name: this$0 9 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig; 10 | 11 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ModelConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ResourceConfig 2 | name: accuracy 3 | type: Ljava/lang/String; 4 | 5 | name: buttonTexture 6 | type: Ljava/lang/String; 7 | 8 | name: collisionParts 9 | type: [Ljava/lang/String; 10 | 11 | name: doCulling 12 | type: Z 13 | 14 | name: guiScriptPath 15 | type: Ljava/lang/String; 16 | 17 | name: guiTexture 18 | type: Ljava/lang/String; 19 | 20 | name: offset 21 | type: [F 22 | 23 | name: renderAABB 24 | type: [F 25 | 26 | name: scale 27 | type: F 28 | 29 | name: serverScriptPath 30 | type: Ljava/lang/String; 31 | 32 | name: smoothing 33 | type: Z 34 | 35 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/NPCConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: damage 3 | type: F 4 | 5 | name: health 6 | type: F 7 | 8 | name: lightTexture 9 | type: Ljava/lang/String; 10 | 11 | name: model 12 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 13 | 14 | name: name 15 | type: Ljava/lang/String; 16 | 17 | name: role 18 | type: Ljava/lang/String; 19 | 20 | name: speed 21 | type: F 22 | 23 | name: texture 24 | type: Ljava/lang/String; 25 | 26 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/OrnamentConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: conveyorSpeed 3 | type: F 4 | 5 | name: minRandomScale 6 | type: F 7 | 8 | name: model 9 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 10 | 11 | name: name 12 | type: Ljava/lang/String; 13 | 14 | name: ornamentType 15 | type: Ljava/lang/String; 16 | 17 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/RRSConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/TextureConfig 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/RailConfig$BallastSet.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: blockMetadata 3 | type: I 4 | 5 | name: blockName 6 | type: Ljava/lang/String; 7 | 8 | name: height 9 | type: F 10 | 11 | name: this$0 12 | type: Ljp/ngt/rtm/modelpack/cfg/RailConfig; 13 | 14 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/RailConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: allowCrossing 3 | type: Z 4 | 5 | name: ballastWidth 6 | type: I 7 | 8 | name: defaultBallast 9 | type: [Ljp/ngt/rtm/modelpack/cfg/RailConfig$BallastSet; 10 | 11 | name: model 12 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 13 | 14 | name: railModel 15 | type: Ljava/lang/String; 16 | 17 | name: railName 18 | type: Ljava/lang/String; 19 | 20 | name: railTexture 21 | type: Ljava/lang/String; 22 | 23 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ResourceConfig$DMInitValue.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: key 3 | type: Ljava/lang/String; 4 | 5 | name: minmax 6 | type: [D 7 | 8 | name: pattern 9 | type: [Ljava/lang/String; 10 | 11 | name: suggestions 12 | type: [Ljava/lang/String; 13 | 14 | name: this$0 15 | type: Ljp/ngt/rtm/modelpack/cfg/ResourceConfig; 16 | 17 | name: type 18 | type: Ljava/lang/String; 19 | 20 | name: value 21 | type: Ljava/lang/String; 22 | 23 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/ResourceConfig.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: defaultData 3 | type: Ljava/lang/String; 4 | 5 | name: defaultValues 6 | type: [Ljp/ngt/rtm/modelpack/cfg/ResourceConfig$DMInitValue; 7 | 8 | name: tags 9 | type: Ljava/lang/String; 10 | 11 | name: useCustomColor 12 | type: Z 13 | 14 | name: version 15 | type: S 16 | 17 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/SignalConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: lightTexture 3 | type: Ljava/lang/String; 4 | 5 | name: lights 6 | type: [Ljava/lang/String; 7 | 8 | name: maxSignalLevel 9 | type: I 10 | 11 | name: model 12 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 13 | 14 | name: modelPartsBody 15 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$Parts; 16 | 17 | name: modelPartsFixture 18 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$Parts; 19 | 20 | name: rotateBody 21 | type: Z 22 | 23 | name: signalModel 24 | type: Ljava/lang/String; 25 | 26 | name: signalName 27 | type: Ljava/lang/String; 28 | 29 | name: signalTexture 30 | type: Ljava/lang/String; 31 | 32 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/SignboardConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/TextureConfig 2 | name: animationCycle 3 | type: I 4 | 5 | name: backTexture 6 | type: I 7 | 8 | name: color 9 | type: I 10 | 11 | name: frame 12 | type: I 13 | 14 | name: lightValue 15 | type: I 16 | 17 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/TextureConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ResourceConfig 2 | name: depth 3 | type: F 4 | 5 | name: height 6 | type: F 7 | 8 | name: texture 9 | type: Ljava/lang/String; 10 | 11 | name: width 12 | type: F 13 | 14 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/TrainConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig 2 | name: accelerateion 3 | type: F 4 | 5 | name: bogieModel 6 | type: Ljava/lang/String; 7 | 8 | name: bogieModel2 9 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 10 | 11 | name: bogieModel3 12 | type: [Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 13 | 14 | name: bogiePos 15 | type: [[F 16 | 17 | name: bogieTexture 18 | type: Ljava/lang/String; 19 | 20 | name: isSingleTrain 21 | type: Z 22 | 23 | name: jointDelay 24 | type: [[F 25 | 26 | name: maxSpeed 27 | type: [F 28 | 29 | name: muteJointSound 30 | type: Z 31 | 32 | name: pantoPos 33 | type: [[F 34 | 35 | name: rollSpeedCoefficient 36 | type: F 37 | 38 | name: rollVariationCoefficient 39 | type: F 40 | 41 | name: rollWidthCoefficient 42 | type: F 43 | 44 | name: rolling 45 | type: F 46 | 47 | name: sound_BrakeRelease 48 | type: Ljava/lang/String; 49 | 50 | name: sound_BrakeRelease2 51 | type: Ljava/lang/String; 52 | 53 | name: trainDistance 54 | type: F 55 | 56 | name: trainModel 57 | type: Ljava/lang/String; 58 | 59 | name: trainModel2 60 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 61 | 62 | name: trainName 63 | type: Ljava/lang/String; 64 | 65 | name: trainTexture 66 | type: Ljava/lang/String; 67 | 68 | name: trainType 69 | type: Ljava/lang/String; 70 | 71 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig$Light.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: color 3 | type: I 4 | 5 | name: pos 6 | type: [F 7 | 8 | name: r 9 | type: F 10 | 11 | name: reverse 12 | type: Z 13 | 14 | name: this$0 15 | type: Ljp/ngt/rtm/modelpack/cfg/VehicleBaseConfig; 16 | 17 | name: type 18 | type: B 19 | 20 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig$Rollsign.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: disableLighting 3 | type: Z 4 | 5 | name: doAnimation 6 | type: Z 7 | 8 | name: pos 9 | type: [[[F 10 | 11 | name: this$0 12 | type: Ljp/ngt/rtm/modelpack/cfg/VehicleBaseConfig; 13 | 14 | name: uv 15 | type: [F 16 | 17 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig$VehicleParts.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig$Parts 2 | name: childParts 3 | type: [Ljp/ngt/rtm/modelpack/cfg/VehicleBaseConfig$VehicleParts; 4 | 5 | name: this$0 6 | type: Ljp/ngt/rtm/modelpack/cfg/VehicleBaseConfig; 7 | 8 | name: transform 9 | type: [[F 10 | 11 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/VehicleConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig 2 | name: acceleration 3 | type: [F 4 | 5 | name: changeYawOnStopping 6 | type: Z 7 | 8 | name: connectionDistance 9 | type: F 10 | 11 | name: friction 12 | type: [F 13 | 14 | name: gripPos 15 | type: [F 16 | 17 | name: hoveringSpeed 18 | type: F 19 | 20 | name: maxSpeed 21 | type: [F 22 | 23 | name: maxYaw 24 | type: [F 25 | 26 | name: model 27 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 28 | 29 | name: name 30 | type: Ljava/lang/String; 31 | 32 | name: pitchCoefficient 33 | type: [F 34 | 35 | name: rollCoefficient 36 | type: [F 37 | 38 | name: vehicleType 39 | type: Ljava/lang/String; 40 | 41 | name: vibration 42 | type: [F 43 | 44 | name: yawCoefficient 45 | type: [F 46 | 47 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceConfig/jp/ngt/rtm/modelpack/cfg/WireConfig.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/cfg/ModelConfig 2 | name: deflectionCoefficient 3 | type: F 4 | 5 | name: lengthCoefficient 6 | type: F 7 | 8 | name: model 9 | type: Ljp/ngt/rtm/modelpack/cfg/ModelConfig$ModelSource; 10 | 11 | name: name 12 | type: Ljava/lang/String; 13 | 14 | name: sectionLength 15 | type: F 16 | 17 | name: yOffset 18 | type: F 19 | 20 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/javax/script/ScriptEngine.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/entity/util/CollisionObj.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/cfg/ResourceConfig.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetBase.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ResourceSet 2 | name: buttonTexture 3 | type: Lnet/minecraft/util/ResourceLocation; 4 | 5 | name: collisionObj 6 | type: Ljp/ngt/rtm/entity/util/CollisionObj; 7 | 8 | name: guiSE 9 | type: Ljavax/script/ScriptEngine; 10 | 11 | name: guiTexture 12 | type: Lnet/minecraft/util/ResourceLocation; 13 | 14 | name: modelObj 15 | type: Ljp/ngt/rtm/render/ModelObject; 16 | 17 | name: serverSE 18 | type: Ljavax/script/ScriptEngine; 19 | 20 | name: syncFinished 21 | type: Z 22 | 23 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetConnector.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetContainer.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetFirearm.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetMachine.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetMechanism.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetNPC.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | name: lightTexture 3 | type: Lnet/minecraft/util/ResourceLocation; 4 | 5 | name: texture 6 | type: Lnet/minecraft/util/ResourceLocation; 7 | 8 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetOrnament.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetRail.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetSignal.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetTrain.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetVehicleBase 2 | name: bogieModels 3 | type: [Ljp/ngt/rtm/render/ModelObject; 4 | 5 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetVehicle.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetVehicleBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetVehicleBase.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | name: rollsignTexture 3 | type: Lnet/minecraft/util/ResourceLocation; 4 | 5 | name: soundSE 6 | type: Ljavax/script/ScriptEngine; 7 | 8 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ModelSetWire.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ModelSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/ResourceSet.txt: -------------------------------------------------------------------------------- 1 | super: java/lang/Object 2 | name: cfg 3 | type: Ljp/ngt/rtm/modelpack/cfg/ResourceConfig; 4 | 5 | name: dataFormatter 6 | type: Ljp/ngt/rtm/modelpack/state/DataFormatter; 7 | 8 | name: isDummySet 9 | type: Z 10 | 11 | name: md5 12 | type: [B 13 | 14 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/TextureSetBase.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/ResourceSet 2 | name: texture 3 | type: Lnet/minecraft/util/ResourceLocation; 4 | 5 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/TextureSetFlag.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/TextureSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/TextureSetRRS.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/TextureSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/modelset/TextureSetSignboard.txt: -------------------------------------------------------------------------------- 1 | super: jp/ngt/rtm/modelpack/modelset/TextureSetBase 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/modelpack/state/DataFormatter.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/jp/ngt/rtm/render/ModelObject.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /important-structure/fields-ResourceSet/net/minecraft/util/ResourceLocation.txt: -------------------------------------------------------------------------------- 1 | not loaded class 2 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/logo.png -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | buildscript { 6 | repositories { 7 | mavenCentral() 8 | maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") { 9 | name = "ossrh-snapshot" 10 | } 11 | maven(url = "https://maven.minecraftforge.net/") { 12 | name = "forge" 13 | } 14 | } 15 | dependencies { 16 | // use latest version by dependabot. dependabot supports dependencies in settings.gralde 17 | classpath("net.minecraftforge.gradle:ForgeGradle:5.1.76") 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/distResources/META-INF/services/javax.imageio.spi.ImageReaderSpi: -------------------------------------------------------------------------------- 1 | com.anatawa12.fixRtm.libs.webp.WebPImageReaderSpi 2 | -------------------------------------------------------------------------------- /src/main/distResources/META-INF/services/javax.imageio.spi.ImageWriterSpi: -------------------------------------------------------------------------------- 1 | com.anatawa12.fixRtm.libs.webp.WebPImageWriterSpi 2 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/ApiBridgeImpl.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm 6 | 7 | import com.anatawa12.fixRtm.api.IPermissionManager 8 | 9 | @Suppress("DEPRECATION") 10 | class ApiBridgeImpl : com.anatawa12.fixRtm.api.ApiBridge.IApiBridge { 11 | override fun getPermissions(): IPermissionManager = PermissionManager 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/Deprecation.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2022 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm 6 | 7 | import com.anatawa12.fixRtm.Loggers.getLogger 8 | import net.minecraftforge.fml.relauncher.FMLLaunchHandler 9 | 10 | object Deprecation { 11 | private val LOGGER = getLogger("Deprecation") 12 | @JvmStatic 13 | private val isDebugEnv = FMLLaunchHandler.isDeobfuscatedEnvironment() 14 | 15 | @JvmStatic 16 | fun found(name: String) { 17 | if (isDebugEnv) { 18 | throw DeprecationException(name) 19 | } else { 20 | LOGGER.warn("Deprecated function called", DeprecationException(name)) 21 | } 22 | } 23 | 24 | 25 | class DeprecationException(val name: String) : RuntimeException("Deprecated function called!: $name") 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/FixHooks.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | @file:JvmName("FixHooks") 6 | 7 | package com.anatawa12.fixRtm 8 | 9 | import jp.ngt.rtm.modelpack.ModelPackManager 10 | import net.minecraftforge.fml.common.FMLCommonHandler 11 | import net.minecraftforge.fml.common.StartupQuery 12 | 13 | @Suppress("unused") // called by transformer 14 | fun onFMLReadData() { 15 | if (FMLCommonHandler.instance().side.isClient) { 16 | if (!ModelPackManager.INSTANCE.modelConstructed) { 17 | if (!StartupQuery.confirm(""" 18 | It's very RECOMMENDED not to load world data before finished loading model packs. 19 | Do you want to continue loading world? 20 | """.trimIndent())) 21 | StartupQuery.abort() 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/Loggers.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm 6 | 7 | import org.apache.logging.log4j.LogManager 8 | import org.apache.logging.log4j.Logger 9 | 10 | object Loggers { 11 | fun getLogger(name: String): Logger = LogManager.getLogger("fixrtm/$name") 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/ThreadUtil.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm 6 | 7 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent 8 | import net.minecraftforge.fml.common.gameevent.TickEvent 9 | import net.minecraftforge.fml.relauncher.Side 10 | import java.util.concurrent.ConcurrentLinkedQueue 11 | 12 | object ThreadUtil { 13 | @JvmStatic 14 | fun runOnClientThread(block: Action) { 15 | client.add(block) 16 | } 17 | 18 | @JvmStatic 19 | fun runOnServerThread(block: Action) { 20 | server.add(block) 21 | } 22 | 23 | @JvmStatic 24 | fun runOnMainThread(side: Side, block: Action) { 25 | if (side.isClient) runOnClientThread(block) 26 | else runOnServerThread(block) 27 | } 28 | 29 | fun interface Action { 30 | operator fun invoke() 31 | } 32 | 33 | @SubscribeEvent 34 | fun onClientTick(@Suppress("UNUSED_PARAMETER") e: TickEvent.ClientTickEvent) { 35 | while (true) (client.poll() ?: return)() 36 | } 37 | 38 | @SubscribeEvent 39 | fun onServerTick(@Suppress("UNUSED_PARAMETER") e: TickEvent.ServerTickEvent) { 40 | while (true) (server.poll() ?: return)() 41 | } 42 | 43 | private val client = ConcurrentLinkedQueue() 44 | private val server = ConcurrentLinkedQueue() 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/api/ApiBridge.java: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.api; 6 | 7 | /** 8 | * internal bridge. please do not use 9 | */ 10 | @SuppressWarnings("DeprecatedIsStillUsed") 11 | @Deprecated 12 | public class ApiBridge { 13 | private ApiBridge() { 14 | } 15 | 16 | @Deprecated 17 | public interface IApiBridge { 18 | IPermissionManager getPermissions(); 19 | } 20 | 21 | @Deprecated 22 | static IApiBridge INSTANCE; 23 | 24 | static { 25 | try { 26 | INSTANCE = (IApiBridge) Class.forName("com.anatawa12.fixRtm.ApiBridgeImpl").newInstance(); 27 | } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { 28 | throw new RuntimeException("api bridge init failed", e); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/api/IPermissionManager.java: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.api; 6 | 7 | import net.minecraft.command.ICommandSender; 8 | 9 | /** 10 | * the endpoint for permissions. 11 | * This is not stable for implementation, just for use 12 | */ 13 | public abstract class IPermissionManager { 14 | @SuppressWarnings("deprecation") 15 | IPermissionManager INSTANCE = ApiBridge.INSTANCE.getPermissions(); 16 | 17 | public abstract void registerPermission(String permission); 18 | 19 | public abstract void hasPermission(ICommandSender player, String permission); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/asm/FixRtmCorePlugin.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2019 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.asm 6 | 7 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin 8 | 9 | @IFMLLoadingPlugin.TransformerExclusions( 10 | "com.anatawa12.fixRtm.asm.", 11 | "com.anatawa12.fixRtm.libs.", 12 | ) 13 | class FixRtmCorePlugin : IFMLLoadingPlugin { 14 | override fun getModContainerClass(): String? = null 15 | 16 | override fun getASMTransformerClass(): Array = arrayOf() 17 | 18 | override fun getSetupClass(): String? = null 19 | 20 | override fun injectData(p0: MutableMap?) { 21 | } 22 | 23 | override fun getAccessTransformerClass(): String? = null 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/asm/FixRtmDevEnvironmentOnlyCorePlugin.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.asm 6 | 7 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin 8 | 9 | // the core plugin only for TransformerExclusions 10 | @IFMLLoadingPlugin.TransformerExclusions( 11 | "kotlin.", 12 | "kotlinx.", 13 | "io.sigpipe.jbsdiff.", 14 | "org.intellij.lang.annotations.", 15 | "org.jetbrains.annotations.", 16 | "org.apache.commons.compress.", 17 | "org.tukaani.xz.", 18 | "com.luciad.imageio.webp.", 19 | ) 20 | class FixRtmDevEnvironmentOnlyCorePlugin : IFMLLoadingPlugin { 21 | override fun getModContainerClass(): String? = null 22 | 23 | override fun getASMTransformerClass(): Array = arrayOf() 24 | 25 | override fun getSetupClass(): String? = null 26 | 27 | override fun injectData(p0: MutableMap?) { 28 | } 29 | 30 | override fun getAccessTransformerClass(): String? = null 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/asm/hooking/HookingFixRtmCorePlugin.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.asm.hooking 6 | 7 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin 8 | 9 | @IFMLLoadingPlugin.SortingIndex(2000) 10 | class HookingFixRtmCorePlugin : IFMLLoadingPlugin { 11 | override fun getASMTransformerClass(): Array = arrayOf( 12 | HookingTransformer::class.qualifiedName!!, 13 | ) 14 | 15 | override fun getModContainerClass(): String? = null 16 | 17 | override fun getSetupClass(): String? = null 18 | 19 | override fun injectData(data: MutableMap?) { 20 | } 21 | 22 | override fun getAccessTransformerClass(): String? = null 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/asm/patching/PatchingFixRtmCorePlugin.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.asm.patching 6 | 7 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin 8 | 9 | // after sorting, but first 10 | @IFMLLoadingPlugin.SortingIndex(Int.MIN_VALUE + 1) 11 | class PatchingFixRtmCorePlugin : IFMLLoadingPlugin { 12 | override fun getModContainerClass(): String? = null 13 | 14 | override fun getASMTransformerClass(): Array = arrayOf( 15 | PatchApplier::class.qualifiedName!!, 16 | ) 17 | 18 | override fun getSetupClass(): String? = null 19 | 20 | override fun injectData(p0: MutableMap?) { 21 | } 22 | 23 | override fun getAccessTransformerClass(): String? = null 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/gui/GuiHandler.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.gui 6 | 7 | import com.anatawa12.fixRtm.gui.GuiId.ChangeOffset 8 | import com.anatawa12.fixRtm.gui.GuiId.values 9 | import jp.ngt.ngtlib.block.TileEntityPlaceable 10 | import net.minecraft.entity.player.EntityPlayer 11 | import net.minecraft.util.math.BlockPos 12 | import net.minecraft.world.World 13 | import net.minecraftforge.fml.common.network.IGuiHandler 14 | 15 | class GuiHandler : IGuiHandler { 16 | override fun getServerGuiElement(ID: Int, player: EntityPlayer?, world: World?, x: Int, y: Int, z: Int): Any? { 17 | return when (values()[ID]) { 18 | ChangeOffset -> null 19 | } 20 | } 21 | 22 | override fun getClientGuiElement(ID: Int, player: EntityPlayer?, world: World?, x: Int, y: Int, z: Int): Any? { 23 | return when (values()[ID]) { 24 | ChangeOffset -> GuiChangeOffset(world!!.getTileEntity(BlockPos(x, y, z)) as TileEntityPlaceable) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/gui/GuiId.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.gui 6 | 7 | enum class GuiId { 8 | ChangeOffset, 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/io/FIXModelPack.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.io 6 | 7 | import net.minecraft.util.ResourceLocation 8 | import java.io.File 9 | 10 | interface FIXModelPack { 11 | val sha1Hash: String 12 | val file: File 13 | val domains: Set 14 | fun getFile(location: ResourceLocation): FIXResource? 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/io/FIXResource.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.io 6 | 7 | import java.io.InputStream 8 | 9 | class FIXResource( 10 | val pack: FIXModelPack, 11 | val inputStream: InputStream, 12 | ) 13 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/network/SentAllModels.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.network 6 | 7 | import com.anatawa12.fixRtm.DummyModelPackManager 8 | import io.netty.buffer.ByteBuf 9 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage 10 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler 11 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext 12 | 13 | class SentAllModels() : IMessage { 14 | 15 | override fun fromBytes(buf: ByteBuf) { 16 | } 17 | 18 | override fun toBytes(buf: ByteBuf) { 19 | } 20 | 21 | companion object : IMessageHandler { 22 | override fun onMessage(message: SentAllModels, ctx: MessageContext): Nothing? { 23 | DummyModelPackManager.gotAllModels = true 24 | return null 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/ngtlib/command/CommandPermit.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.ngtlib.command 6 | 7 | import com.anatawa12.fixRtm.PermissionManager 8 | import net.minecraft.command.CommandBase 9 | import net.minecraft.server.MinecraftServer 10 | 11 | fun getTabCompletions( 12 | server: MinecraftServer, 13 | args: Array, 14 | ): List = when (args.size) { 15 | 1 -> CommandBase.getListOfStringsMatchingLastWord(args, "list", "myname", "add", "remove") 16 | 2 -> when (args[0]) { 17 | "add", "remove" -> CommandBase.getListOfStringsMatchingLastWord(args, 18 | server.onlinePlayerNames.toMutableList().apply { add("-all") }) 19 | else -> emptyList() 20 | } 21 | 3 -> when (args[0]) { 22 | "add", "remove" -> CommandBase.getListOfStringsMatchingLastWord(args, PermissionManager.permissions) 23 | else -> emptyList() 24 | } 25 | else -> emptyList() 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/ngtlib/io/ScriptUtil.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.ngtlib.io 6 | 7 | import com.anatawa12.fixRtm.utils.ThreadLocalProperties.Companion.removeLocalSystemProperty 8 | 9 | object ScriptUtil { 10 | fun prepareSystemProperty() { 11 | removeLocalSystemProperty("nashorn.args.prepend") 12 | removeLocalSystemProperty("nashorn.args") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/ngtlib/item/craft/OreDictionaryUtil.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.ngtlib.item.craft 6 | 7 | import net.minecraft.item.ItemStack 8 | import net.minecraftforge.oredict.OreDictionary 9 | 10 | 11 | object OreDictionaryUtil { 12 | @JvmStatic 13 | fun getOreIDs(stack: ItemStack): IntArray { 14 | return if (stack.isEmpty) intArrayOf() else OreDictionary.getOreIDs(stack) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/Hooks.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm 6 | 7 | import jp.ngt.ngtlib.io.NGTLog 8 | import jp.ngt.ngtlib.renderer.model.ModelFormatException 9 | import jp.ngt.rtm.modelpack.ModelPackManager 10 | import jp.ngt.rtm.modelpack.ResourceType 11 | import jp.ngt.rtm.modelpack.modelset.ResourceSet 12 | import net.minecraft.entity.player.EntityPlayer 13 | import net.minecraft.util.text.TextComponentTranslation 14 | 15 | @Suppress("unused") // Used with Transform 16 | fun eraseNullForModelSet(inSet: ResourceSet<*>?, type: ResourceType<*, *>): ResourceSet<*> { 17 | if (inSet != null) return inSet 18 | if (type.hasSubType) { 19 | return ModelPackManager.INSTANCE.dummyMap[type.name] 20 | ?: (ModelPackManager.INSTANCE.dummyMap[type.subType]) 21 | ?: error("ResourceType(${type.name}) and ResourceType(${type.subType}) don't have dummy ResourceSet") 22 | } else { 23 | return ModelPackManager.INSTANCE.dummyMap[type.name] 24 | ?: error("ResourceType(${type.name}) don't have dummyMap") 25 | } 26 | } 27 | 28 | @Suppress("unused") // Used with Transform 29 | fun MovingSoundMaker_loadSoundJson_nullCheck(map: Map?, domain: String): Map { 30 | if (map == null) 31 | throw ModelFormatException("sound.json for $domain is invalid.") 32 | return map 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/RTMResourceManager.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm 6 | 7 | import jp.ngt.ngtlib.io.NGTFileLoader 8 | import net.minecraft.util.ResourceLocation 9 | import java.io.File 10 | import java.io.IOException 11 | import java.io.InputStream 12 | 13 | @Throws(IOException::class) 14 | fun getInputStreamFromZip(zipPath: String, par1: ResourceLocation): InputStream? { 15 | return try { 16 | getInputStreamFromZip(zipPath, par1, "UTF-8") 17 | } catch (ignored: IllegalArgumentException) { 18 | getInputStreamFromZip(zipPath, par1, "MS932") 19 | } 20 | } 21 | 22 | @Throws(IOException::class) 23 | private fun getInputStreamFromZip(zipPath: String, par1: ResourceLocation, encoding: String): InputStream? { 24 | var stream: InputStream? = null 25 | val zip = NGTFileLoader.getArchive(File(zipPath), encoding) 26 | val enu = zip.entries() 27 | while (enu.hasMoreElements()) { 28 | val ze = enu.nextElement() 29 | if (!ze.isDirectory) { 30 | val fileInZip = File(zipPath, ze.name) 31 | if (par1.path.contains(fileInZip.name)) { 32 | stream = zip.getInputStream(ze) 33 | } 34 | } 35 | } 36 | return stream 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/block/BlockDecoration.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2023 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.block 6 | 7 | import jp.ngt.rtm.RTMItem 8 | import jp.ngt.rtm.block.tileentity.TileEntityDecoration 9 | import jp.ngt.rtm.item.ItemDecoration 10 | import net.minecraft.item.ItemStack 11 | import net.minecraft.util.math.BlockPos 12 | import net.minecraft.world.World 13 | 14 | fun getPickBlock(world: World, pos: BlockPos): ItemStack { 15 | val tileEntity = world.getTileEntity(pos) 16 | if (tileEntity is TileEntityDecoration) { 17 | val itemStack = ItemStack(RTMItem.decoration_block) 18 | ItemDecoration.setModel(itemStack, tileEntity.modelName) 19 | return itemStack 20 | } 21 | return ItemStack.EMPTY 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/block/tileentity/TileEntityMachineBase.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.block.tileentity 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.block.tileentity.TileEntityMachineBase 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun TileEntityMachineBase.addInfoToCrashReport(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/block/tileentity/TileEntityMechanism.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.block.tileentity 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.block.tileentity.TileEntityMechanism 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun TileEntityMechanism.addInfoToCrashReport(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/block/tileentity/TileEntityOrnament.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.block.tileentity 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.block.tileentity.TileEntityOrnament 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun TileEntityOrnament.addInfoToCrashReport(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/electric/TileEntityConnectorBase.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.electric 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.electric.TileEntityConnectorBase 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun TileEntityConnectorBase.addInfoToCrashReport(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/electric/TileEntitySignal.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.electric 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.electric.TileEntitySignal 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun TileEntitySignal.addInfoToCrashReport(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/EntityInstalledObject.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/npc/EntityNPC.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity.npc 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.entity.npc.EntityNPC 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun EntityNPC.addEntityCrashInfo(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/train/EntityBogie.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity.train 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import com.anatawa12.fixRtm.network.NetworkHandler 9 | import com.anatawa12.fixRtm.network.NotifyUntracked 10 | import jp.ngt.rtm.entity.train.EntityBogie 11 | import net.minecraft.crash.CrashReportCategory 12 | 13 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 14 | fun EntityBogie.onRemovedFromWorld() { 15 | if (world.isRemote) 16 | NetworkHandler.sendPacketServer(NotifyUntracked(entityId)) 17 | } 18 | 19 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 20 | fun EntityBogie.addEntityCrashInfo(category: CrashReportCategory) = 21 | addEntityCrashInfoAboutModelSet(category) { train?.resourceState?.resourceSet?.config } 22 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/train/parts/EntityCargoWithModel.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity.train.parts 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.entity.train.parts.EntityCargoWithModel 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun EntityCargoWithModel<*>.addEntityCrashInfo(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/vehicle/EntityTrolley.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity.vehicle 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import jp.ngt.rtm.entity.vehicle.EntityTrolley 9 | import net.minecraft.crash.CrashReportCategory 10 | 11 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 12 | fun EntityTrolley.addEntityCrashInfo(category: CrashReportCategory) = 13 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/vehicle/EntityVehicleBase.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity.vehicle 6 | 7 | import com.anatawa12.fixRtm.addEntityCrashInfoAboutModelSet 8 | import com.anatawa12.fixRtm.network.NetworkHandler 9 | import com.anatawa12.fixRtm.network.NotifyUntracked 10 | import jp.ngt.rtm.entity.vehicle.EntityVehicleBase 11 | import net.minecraft.crash.CrashReportCategory 12 | 13 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 14 | fun EntityVehicleBase<*>.onRemovedFromWorld() { 15 | if (world.isRemote) 16 | NetworkHandler.sendPacketServer(NotifyUntracked(entityId)) 17 | } 18 | 19 | @Suppress("EXTENSION_SHADOWED_BY_MEMBER", "unused") 20 | fun EntityVehicleBase<*>.addEntityCrashInfo(category: CrashReportCategory) = 21 | addEntityCrashInfoAboutModelSet(category) { resourceState?.resourceSet?.config } 22 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/entity/vehicle/VehicleTrackerEntry.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.entity.vehicle 6 | 7 | import jp.ngt.rtm.entity.train.EntityBogie 8 | import jp.ngt.rtm.entity.vehicle.EntityVehicleBase 9 | import jp.ngt.rtm.entity.vehicle.VehicleTrackerEntry 10 | import net.minecraft.entity.Entity 11 | import net.minecraft.entity.EntityTrackerEntry 12 | 13 | fun newEntityTrackerEntry( 14 | entityIn: Entity, 15 | rangeIn: Int, 16 | maxRangeIn: Int, 17 | updateFrequencyIn: Int, 18 | sendVelocityUpdatesIn: Boolean, 19 | ): EntityTrackerEntry { 20 | if (entityIn is EntityBogie) 21 | return VehicleTrackerEntry(entityIn) 22 | if (entityIn is EntityVehicleBase<*>) 23 | return VehicleTrackerEntry(entityIn) 24 | return EntityTrackerEntry(entityIn, rangeIn, maxRangeIn, updateFrequencyIn, sendVelocityUpdatesIn) 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/modelpack/ModelState.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.modelpack 6 | 7 | enum class ModelState(private val label: String, val marker: String) { 8 | INITIALIZED("Initialized", "I"), 9 | CONSTRUCTED("Constructed", "C"), 10 | 11 | ; 12 | 13 | override fun toString(): String { 14 | return label 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/modelpack/init/ModelConstructingException.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.modelpack.init 6 | 7 | 8 | class ModelConstructingException : Exception { 9 | constructor() : super() 10 | constructor(message: String) : super(message) 11 | constructor(cause: Throwable) : super(cause) 12 | constructor(message: String, cause: Throwable) : super(message, cause) 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/modelpack/init/UnconstructSetsQueue.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.modelpack.init 6 | 7 | import jp.ngt.rtm.modelpack.modelset.ResourceSet 8 | import java.util.concurrent.ConcurrentLinkedQueue 9 | import java.util.concurrent.atomic.AtomicInteger 10 | 11 | class UnconstructSetsQueue { 12 | private val count = AtomicInteger() 13 | private val backed = ConcurrentLinkedQueue>() 14 | 15 | @get:JvmName("size") 16 | val size get() = count.get() 17 | 18 | fun add(resourceSet: ResourceSet<*>) { 19 | count.getAndIncrement() 20 | backed.add(resourceSet) 21 | } 22 | 23 | fun poll(): ResourceSet<*>? = backed.poll() 24 | 25 | fun clear() { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/rail/BlockMarker.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2022 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.rtm.rail 6 | 7 | import jp.ngt.ngtlib.block.BlockUtil 8 | import jp.ngt.rtm.rail.BlockMarker 9 | import net.minecraft.block.state.IBlockState 10 | import net.minecraft.entity.EntityLivingBase 11 | import net.minecraft.item.ItemStack 12 | import net.minecraft.util.math.BlockPos 13 | import net.minecraft.world.World 14 | import kotlin.math.floor 15 | 16 | // Block metadata: 17 | // 0b0100: is diagonal flag 18 | // 0b0011: direction id 19 | object BlockMarker { 20 | const val MERGED_DAMAGE = 8 21 | 22 | @Suppress("UNUSED_PARAMETER") 23 | @JvmStatic 24 | fun onBlockPlacedBy( 25 | block: BlockMarker, 26 | world: World, 27 | pos: BlockPos, 28 | state: IBlockState, 29 | placer: EntityLivingBase, 30 | stack: ItemStack, 31 | ) { 32 | BlockUtil.setBlock(world, pos, block, getFaceMeta(placer), 2) 33 | } 34 | 35 | // NGTMath.floor(NGTMath.normalizeAngle((double)placer.rotationYaw + 180.0D) / 90.0D) & 3 36 | private val FACE_MAPPING = intArrayOf( 37 | 2, 6, 3, 7, 0, 4, 1, 5 38 | ) 39 | @JvmStatic 40 | fun getFaceMeta(placer: EntityLivingBase): Int { 41 | val angle = floor(placer.rotationYaw / 45.0 + 0.5).toInt() and 7 42 | return FACE_MAPPING[angle] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/rtm/world/RTMChunkManager.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | @file:JvmName("RTMChunkManagerKt") 6 | 7 | package com.anatawa12.fixRtm.rtm.world 8 | 9 | import net.minecraft.util.math.ChunkPos 10 | import kotlin.math.abs 11 | import kotlin.math.max 12 | 13 | 14 | fun getChunksAround(set: MutableSet, xChunk: Int, zChunk: Int, radius: Int) { 15 | set.clear() 16 | val list = mutableListOf() 17 | 18 | for (xx in xChunk - radius..xChunk + radius) { 19 | for (zz in zChunk - radius..zChunk + radius) { 20 | list.add(ChunkPos(xx, zz)) 21 | } 22 | } 23 | 24 | list.sortByDescending { max(abs(it.x - xChunk), abs(it.z - zChunk)) } 25 | 26 | set.addAll(list) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/scripting/sai/Util.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.scripting.sai 6 | 7 | import com.anatawa12.sai.Context 8 | import com.anatawa12.sai.ContextFactory 9 | 10 | inline fun usingContext(script: (Context) -> T): T { 11 | var oldContext: Context? = null 12 | return try { 13 | oldContext = Context.getCurrentContext() 14 | if (oldContext != null && oldContext.factory != FixRTMContextFactory) 15 | Context.exit() 16 | val context = FixRTMContextFactory.enterContext() 17 | script(context) 18 | } finally { 19 | Context.exit() 20 | if (oldContext != null && oldContext.factory != FixRTMContextFactory) 21 | oldContext.factory.enterContext(oldContext) 22 | } 23 | } 24 | 25 | object FixRTMContextFactory : ContextFactory() { 26 | override fun hasFeature(cx: Context?, featureIndex: Int): Boolean { 27 | return when (featureIndex) { 28 | Context.FEATURE_NATIVE_PRIMITIVES_HAVE_JAVA_METHODS -> true 29 | Context.FEATURE_FUNCTION_TO_STRING_RETURN_REAL_SOURCE -> true 30 | Context.FEATURE_E4X -> false 31 | else -> super.hasFeature(cx, featureIndex) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/utils/Geometric.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2022 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.utils 6 | 7 | import kotlin.math.sqrt 8 | 9 | data class Vec2d(val x: Double, val y: Double) { 10 | private val normSquared get() = this dot this 11 | private val norm get() = sqrt(normSquared) 12 | 13 | operator fun minus(other: Vec2d): Vec2d = Vec2d(x - other.x, y - other.y) 14 | operator fun plus(other: Vec2d): Vec2d = Vec2d(x + other.x, y + other.y) 15 | infix fun dot(other: Vec2d): Double = x * other.x + y * other.y 16 | 17 | 18 | infix fun distanceTo(other: Vec2d) = (this - other).norm 19 | } 20 | 21 | fun crossStraightLineAndLineSegments( 22 | straight1: Vec2d, 23 | straight2: Vec2d, 24 | segment1: Vec2d, 25 | segment2: Vec2d, 26 | ): Boolean { 27 | val straightVec = straight1 - straight2 28 | return (straightVec dot (segment1 - straight2)) * (straightVec dot (segment2 - straight2)) < 0 29 | } 30 | 31 | fun crossLineSegments( 32 | line11: Vec2d, 33 | line12: Vec2d, 34 | line21: Vec2d, 35 | line22: Vec2d, 36 | ): Boolean { 37 | return crossStraightLineAndLineSegments(line11, line12, line21, line22) 38 | && crossStraightLineAndLineSegments(line21, line22, line11, line12) 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/utils/MultiCloseScope.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.utils 6 | 7 | import java.io.Closeable 8 | 9 | interface MultiCloseScope { 10 | fun C.closer(): C 11 | } 12 | 13 | inline fun closeScope(block: MultiCloseScope.() -> T): T { 14 | val closeables = mutableListOf() 15 | var cause: Throwable? = null 16 | try { 17 | val scope = object : MultiCloseScope { 18 | override fun C.closer(): C { 19 | closeables += this 20 | return this 21 | } 22 | } 23 | return scope.block() 24 | } catch (e: Throwable) { 25 | cause = e 26 | throw e 27 | } finally { 28 | for (closeable in closeables) { 29 | try { 30 | closeable.close() 31 | } catch (closeException: Throwable) { 32 | if (cause != null) 33 | cause.addSuppressed(closeException) 34 | else 35 | cause = closeException 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/anatawa12/fixRtm/utils/ToStringOutputStream.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.utils 6 | 7 | import java.io.OutputStream 8 | 9 | /** 10 | * append as Latin-1 11 | */ 12 | class ToStringOutputStream(private val out: Appendable) : OutputStream() { 13 | override fun write(b: Int) { 14 | write(byteArrayOf(b.toByte())) 15 | } 16 | 17 | @Suppress("EXPERIMENTAL_API_USAGE") 18 | override fun write(b: ByteArray, off: Int, len: Int) { 19 | out.append(String(CharArray(len) { b[off + it].toUByte().toInt().toChar() })) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/.gitattributes: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT FILES IN THIS DIRECTORY 2 | # files in this directory are auto generated files by pathing mod 3 | # please do not edit and please do not ignore files in this directory 4 | *.java.patch text eol=lf 5 | .gitattributes text eol=lf 6 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/NGTCore.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/NGTCore.java 2 | +++ b/jp/ngt/ngtlib/NGTCore.java 3 | @@ -94,16 +94,16 @@ 4 | NETWORK_WRAPPER.registerMessage(PacketNoticeHandlerClient.class, PacketNotice.class, 0, Side.CLIENT); 5 | NETWORK_WRAPPER.registerMessage(PacketNoticeHandlerServer.class, PacketNotice.class, 1, Side.SERVER); 6 | NETWORK_WRAPPER.registerMessage(PacketNBTHandlerClient.class, PacketNBT.class, 2, Side.CLIENT); 7 | NETWORK_WRAPPER.registerMessage(PacketNBTHandlerServer.class, PacketNBT.class, 3, Side.SERVER); 8 | NETWORK_WRAPPER.registerMessage(PacketProtection.class, PacketProtection.class, 4, Side.CLIENT); 9 | + MinecraftForge.EVENT_BUS.register(RecipeManager.INSTANCE); 10 | } 11 | 12 | @EventHandler 13 | public void init(FMLInitializationEvent event) { 14 | proxy.init(); 15 | - MinecraftForge.EVENT_BUS.register(RecipeManager.INSTANCE); 16 | MinecraftForge.EVENT_BUS.register(new NGTEventHandler()); 17 | Usage.INSTANCE.add(protection_key, -1, "usage.item.protection_key"); 18 | 19 | try { 20 | PermissionManager.INSTANCE.load(); 21 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/block/TileEntityCustom.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/block/TileEntityCustom.java 2 | +++ b/jp/ngt/ngtlib/block/TileEntityCustom.java 3 | @@ -30,17 +30,10 @@ 4 | public int getZ() { 5 | return this.getPos().getZ(); 6 | } 7 | 8 | public SPacketUpdateTileEntity getUpdatePacket() { 9 | - World world = this.getWorld(); 10 | - TickProcessQueue.getInstance(Side.SERVER).add(new TickProcessEntry() { 11 | - public boolean process(World world) { 12 | - TileEntityCustom.this.sendPacket(); 13 | - return true; 14 | - } 15 | - }, 40); 16 | return new SPacketUpdateTileEntity(this.pos, -1, this.getUpdateTag()); 17 | } 18 | 19 | public NBTTagCompound getUpdateTag() { 20 | return this.writeToNBT(new NBTTagCompound()); 21 | @@ -49,12 +42,13 @@ 22 | public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { 23 | this.readFromNBT(pkt.getNbtCompound()); 24 | } 25 | 26 | protected void sendPacket() { 27 | - if (this.world == null || !this.world.isRemote) { 28 | - PacketNBT.sendToClient(this); 29 | + if (this.world != null && !this.world.isRemote) { 30 | + net.minecraft.block.state.IBlockState state = getWorld().getBlockState(getPos()); 31 | + getWorld().notifyBlockUpdate(getPos(), state, state, 0); 32 | } 33 | 34 | } 35 | 36 | @SideOnly(Side.CLIENT) 37 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/command/CommandPermit.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/command/CommandPermit.java 2 | +++ b/jp/ngt/ngtlib/command/CommandPermit.java 3 | @@ -50,6 +50,16 @@ 4 | NGTLog.sendChatMessage(sender, "/permit add "); 5 | NGTLog.sendChatMessage(sender, "/permit remove "); 6 | NGTLog.sendChatMessage(sender, "/permit list"); 7 | NGTLog.sendChatMessage(sender, "/permit myname"); 8 | } 9 | + 10 | + @org.jetbrains.annotations.NotNull 11 | + @Override 12 | + public java.util.List getTabCompletions( 13 | + @org.jetbrains.annotations.NotNull MinecraftServer server, 14 | + @org.jetbrains.annotations.NotNull ICommandSender sender, 15 | + @org.jetbrains.annotations.NotNull String[] args, 16 | + @org.jetbrains.annotations.Nullable net.minecraft.util.math.BlockPos targetPos) { 17 | + return com.anatawa12.fixRtm.ngtlib.command.CommandPermitKt.getTabCompletions(server, args); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/gui/GuiTextFieldCustom.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/gui/GuiTextFieldCustom.java 2 | +++ b/jp/ngt/ngtlib/gui/GuiTextFieldCustom.java 3 | @@ -468,10 +468,12 @@ 4 | this.disabledColor = p_146204_1_; 5 | } 6 | 7 | public void setFocused(boolean par1) { 8 | if (!this.isDisplayMode) { 9 | + this.setCursorPositionZero(); 10 | + this.setSelectionPos(this.getCursorPosition()); 11 | if (par1 && !this.isFocused) { 12 | this.cursorCounter = 0; 13 | } 14 | 15 | this.isFocused = par1; 16 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/io/NGTLog.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/io/NGTLog.java 2 | +++ b/jp/ngt/ngtlib/io/NGTLog.java 3 | @@ -13,25 +13,33 @@ 4 | import org.apache.logging.log4j.Level; 5 | import org.apache.logging.log4j.LogManager; 6 | import org.apache.logging.log4j.Logger; 7 | 8 | public final class NGTLog { 9 | - private static final Logger logger = LogManager.getLogger("NGT"); 10 | + public static final Logger logger = LogManager.getLogger("NGT"); 11 | private static final List startTimes = new ArrayList<>(); 12 | 13 | public static void debug(String par1) { 14 | - debug(par1); 15 | + debug(par1, new Object[0]); 16 | } 17 | 18 | public static void debug(String par1, Object... par2) { 19 | + _log_(par1, par2, Level.INFO); 20 | + } 21 | + 22 | + public static void trace(String par1, Object... par2) { 23 | + _log_(par1, par2, Level.TRACE); 24 | + } 25 | + 26 | + public static void _log_(String par1, Object[] par2, Level par3) { 27 | try { 28 | String s = par1; 29 | if (par2 != null && par2.length > 0) { 30 | s = String.format(par1, par2); 31 | } 32 | 33 | - logger.log(Level.INFO, s); 34 | + logger.log(par3, s); 35 | } catch (Exception exception) { 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/io/NGTText.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/io/NGTText.java 2 | +++ b/jp/ngt/ngtlib/io/NGTText.java 3 | @@ -71,11 +71,12 @@ 4 | } catch (UnsupportedEncodingException unsupportedencodingexception) { 5 | unsupportedencodingexception.printStackTrace(); 6 | inputstreamreader = new InputStreamReader(is); 7 | } 8 | } else { 9 | - inputstreamreader = new InputStreamReader(is); 10 | + kotlin.Pair pair = com.anatawa12.fixRtm.ngtlib.renderer.model.PolygonModelCharsetDetector.INSTANCE.detectCharset(is, java.nio.charset.Charset.defaultCharset()); 11 | + inputstreamreader = new InputStreamReader(pair.component2(), pair.component1()); 12 | } 13 | 14 | BufferedReader bufferedreader = new BufferedReader(inputstreamreader); 15 | Stream stream = bufferedreader.lines(); 16 | stream.forEachOrdered((line) -> list.add(line)); 17 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/item/craft/RecipeManager.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/item/craft/RecipeManager.java 2 | +++ b/jp/ngt/ngtlib/item/craft/RecipeManager.java 3 | @@ -75,11 +75,11 @@ 4 | for(int i1 = 0; i1 < j * k; ++i1) { 5 | char c0 = s.charAt(i1); 6 | if (map.containsKey(c0)) { 7 | aitemstack[i1] = ((ItemStack)map.get(c0)).copy(); 8 | } else { 9 | - aitemstack[i1] = null; 10 | + aitemstack[i1] = ItemStack.EMPTY; 11 | } 12 | } 13 | 14 | ShapedRecipes55 shapedrecipes55 = new ShapedRecipes55(j, k, aitemstack, output); 15 | INSTANCE.addRecipeToManager(shapedrecipes55); 16 | @@ -105,11 +105,11 @@ 17 | 18 | return null; 19 | } 20 | 21 | public ItemStack[] getRecipeItems(IRecipe par1) { 22 | - ItemStack[] aitemstack = new ItemStack[25]; 23 | + ItemStack[] aitemstack = com.anatawa12.fixRtm.UtilsKt.arrayOfItemStack(25); 24 | if (par1 instanceof ShapedRecipes55) { 25 | ShapedRecipes55 shapedrecipes55 = (ShapedRecipes55)par1; 26 | return shapedrecipes55.getRecipeItems(); 27 | } else if (par1 instanceof RepairRecipe) { 28 | RepairRecipe repairrecipe = (RepairRecipe)par1; 29 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/math/BezierCurve.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/math/BezierCurve.java 2 | +++ b/jp/ngt/ngtlib/math/BezierCurve.java 3 | @@ -79,10 +79,15 @@ 4 | if (this.normalizedParameters == null) { 5 | this.initNP(); 6 | } 7 | 8 | int i = NGTMath.floor((float)par2 * (float)this.split / (float)n); 9 | + 10 | + if (this.normalizedParameters.length == 0) { 11 | + return 0.0f; 12 | + } 13 | + 14 | return this.normalizedParameters[i]; 15 | } 16 | } 17 | 18 | private void initNP() { 19 | @@ -107,11 +112,21 @@ 20 | 21 | for(int l = 0; l < this.split; ++l) { 22 | float f2 = (float)l / (float)this.split; 23 | int j = 0; 24 | 25 | - for(j = 0; j < this.split - 1 && (!(afloat[j] <= f2) || !(f2 <= afloat[j + 1])); ++j) { 26 | + int searchMin = 0, searchMax = split - 1; 27 | + int loopTimes = 0; 28 | + while (!(afloat[j] <= f2 && f2 <= afloat[j + 1])) { 29 | + j = (searchMax - searchMin) / 2 + searchMin; 30 | + if (afloat[searchMin] <= f2 && f2 <= afloat[j + 1]){ 31 | + searchMax = j; 32 | + } else { 33 | + searchMin = j; 34 | + } 35 | + if (++loopTimes >= split - 1) 36 | + break; 37 | } 38 | 39 | float f3 = (f2 - afloat[j]) / (afloat[j + 1] - afloat[j]); 40 | f3 = ((float)j * (1.0F - f3) + (float)(1 + j) * f3) * (1.0F / (float)this.split); 41 | this.normalizedParameters[l] = f3; 42 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/network/PacketNBT.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/network/PacketNBT.java 2 | +++ b/jp/ngt/ngtlib/network/PacketNBT.java 3 | @@ -86,10 +86,12 @@ 4 | TileEntity tileentity = this.getTileEntity(world); 5 | if (tileentity != null) { 6 | tileentity.readFromNBT(this.nbtData); 7 | if (!world.isRemote) { 8 | tileentity.markDirty(); 9 | + // markDirty is not enough to sync data 10 | + jp.ngt.ngtlib.block.BlockUtil.markBlockForUpdate(tileentity.getWorld(), tileentity.getPos()); 11 | } 12 | 13 | return true; 14 | } 15 | } else if (b0 == 2) { 16 | @@ -136,9 +138,16 @@ 17 | 18 | public static void sendToClient(Entity entity) { 19 | NGTCore.NETWORK_WRAPPER.sendToAll(new PacketNBT(entity, true)); 20 | } 21 | 22 | + public static void sendToClient(Entity entity, EntityPlayerMP player) { 23 | + NGTCore.NETWORK_WRAPPER.sendTo(new PacketNBT(entity, true), player); 24 | + } 25 | + 26 | + /** @deprecated because it's slow. */ 27 | + @Deprecated 28 | public static void sendToClient(TileEntity entity) { 29 | + com.anatawa12.fixRtm.Deprecation.found("PacketNBT#sendToClient"); 30 | NGTCore.NETWORK_WRAPPER.sendToAll(new PacketNBT(entity, true)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/network/PacketNBTHandlerServer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/network/PacketNBTHandlerServer.java 2 | +++ b/jp/ngt/ngtlib/network/PacketNBTHandlerServer.java 3 | @@ -7,11 +7,11 @@ 4 | 5 | public class PacketNBTHandlerServer implements IMessageHandler { 6 | public IMessage onMessage(PacketNBT message, MessageContext ctx) { 7 | if (!message.nbtData.getBoolean("ToClient")) { 8 | World world = ctx.getServerHandler().player.world; 9 | - message.onGetPacket(world); 10 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> message.onGetPacket(world)); 11 | } 12 | 13 | return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/protection/ProtectionManager.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/protection/ProtectionManager.java 2 | +++ b/jp/ngt/ngtlib/protection/ProtectionManager.java 3 | @@ -56,10 +56,12 @@ 4 | return this.rightClickObject(player, object); 5 | } 6 | 7 | public boolean rightClickObject(EntityPlayer player, Object target) { 8 | NBTTagCompound nbttagcompound = this.getKeyNBT(player); 9 | + if (com.anatawa12.fixRtm.asm.config.MainConfig.allowPlacingVehiclesOnProtectedRail && target instanceof jp.ngt.rtm.rail.TileEntityLargeRailBase && player.inventory.getCurrentItem().getItem() == jp.ngt.rtm.RTMItem.itemtrain) 10 | + return false; 11 | return nbttagcompound != null ? this.useKey(player, nbttagcompound, target) : this.getLockState(player, target, "Uneditable"); 12 | } 13 | 14 | private boolean useKey(EntityPlayer player, NBTTagCompound keyNBT, Object target) { 15 | if (player.world.isRemote) { 16 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/renderer/model/ObjModel.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/renderer/model/ObjModel.java 2 | +++ b/jp/ngt/ngtlib/renderer/model/ObjModel.java 3 | @@ -254,13 +254,9 @@ 4 | 5 | public FileType getType() { 6 | return FileType.OBJ; 7 | } 8 | 9 | - public int getDrawMode() { 10 | - return 4; 11 | - } 12 | - 13 | public Map getMaterials() { 14 | return this.materials; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/util/NGTUtil.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/util/NGTUtil.java 2 | +++ b/jp/ngt/ngtlib/util/NGTUtil.java 3 | @@ -35,11 +35,11 @@ 4 | return !NGTUtilClient.getMinecraft().isSingleplayer(); 5 | } 6 | } 7 | 8 | public static boolean openedLANWorld() { 9 | - return !isServer() && !NGTUtilClient.getMinecraft().isSingleplayer() ? NGTUtilClient.getMinecraft().getIntegratedServer().getPublic() : false; 10 | + return isServer() && NGTUtilClient.getMinecraft().isSingleplayer() ? NGTUtilClient.getMinecraft().getIntegratedServer().getPublic() : false; 11 | } 12 | 13 | @SideOnly(Side.CLIENT) 14 | public static World getClientWorld() { 15 | return NGTCore.proxy.getWorld(); 16 | -------------------------------------------------------------------------------- /src/main/ngtlib-patches/jp/ngt/ngtlib/util/VersionChecker.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/ngtlib/util/VersionChecker.java 2 | +++ b/jp/ngt/ngtlib/util/VersionChecker.java 3 | @@ -74,14 +74,14 @@ 4 | List list1 = NGTText.readTextL(url.openStream(), ""); 5 | list.addAll(list1); 6 | } catch (MalformedURLException malformedurlexception) { 7 | NGTLog.debug("URL:" + s2); 8 | malformedurlexception.printStackTrace(); 9 | - return; 10 | + continue; 11 | } catch (IOException ioexception) { 12 | ioexception.printStackTrace(); 13 | - return; 14 | + continue; 15 | } 16 | 17 | String[] astring1 = list.toArray(new String[list.size()]); 18 | list.clear(); 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/fix-rtm_at.cfg: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | public net.minecraft.client.Minecraft field_110449_ao 6 | public net.minecraft.entity.EntityTracker field_72794_c 7 | public net.minecraft.client.renderer.EntityRenderer field_78530_s 8 | public net.minecraft.client.resources.SimpleReloadableResourceManager field_110548_a 9 | public net.minecraft.client.resources.SimpleReloadableResourceManager field_110547_c 10 | -------------------------------------------------------------------------------- /src/main/resources/README.txt: -------------------------------------------------------------------------------- 1 | FixRTM 2 | 3 | fixes some bugs of RTM and make RTM more useful! 4 | 5 | LICENSE: LGPL (see LICENSE.txt) 6 | 7 | This mod is a plug-in of the RTM and NGTLib, mods made by ngt5479. 8 | 9 | Thanks: 10 | 11 | This software uses Kotlin, a programming language and libraries made by JetBrains s.r.o. and contributors 12 | published under Apache License 2.0 (see kotlin-LICENSE.txt). 13 | 14 | This software uses jbsdiff, a library made by malensek and contributors 15 | published under 2-Clause BSD License (see jbsdiff-LICENSE.txt). 16 | 17 | This software uses Sai, a JavaScript runtime library made by anatawa12 and other contributors, 18 | a fork of Rhino, the one made by Mozilla foundation and contributors 19 | published under Mozilla Public License Version 2.0 (see sai-LICENSE.txt). 20 | 21 | This software uses webp-imageio, a library made by Luciad and contributors 22 | published under Apache License 2.0 (see webp-imageio-LICENSE.txt and webp-imageio-NOTICE.txt). 23 | 24 | This software is made with Intellij IDEA, a IDE made by JetBrains s.r.o. and contributors. 25 | 26 | This software is made with gradle, a build tool made by gradle team and contributors. 27 | 28 | This software is made with a fork of ForgeGradle by anatawa12, a build tool made by Minecraft Forge team and contributors. 29 | 30 | This software is made with a jasm, a assembly language made by anatawa12 and contributors. 31 | 32 | (c) anatawa12 2019-2020 33 | -------------------------------------------------------------------------------- /src/main/resources/assets/fix-rtm/lang/en_us.lang: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | fix-rtm.rtm.commands.rtm.state.usage=/rtm (door|pan|speed) 6 | fix-rtm.rtm.commands.rtm.summon.usage=/rtm summon [yaw] [dataTag] 7 | fix-rtm.rtm.commands.rtm.summon.no-type=Type named %s not found. 8 | fix-rtm.rtm.commands.rtm.summon.model-not-found=Model named %1$s of %2$s not found. 9 | fix-rtm.rtm.commands.rtm.summon.rail-not-found=Rail not found at %s. 10 | fix-rtm.launch-error.error.rtm-ngtlib-mismatch=RTM or NGTLib version mismatch detected!\nThis version of fixRTM requires RTM %s and NGTLib %s.\nUse exact requested version of RTM and NGTLib. 11 | -------------------------------------------------------------------------------- /src/main/resources/assets/fix-rtm/lang/ja_jp.lang: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 anatawa12 and other contributors 2 | # This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | # See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | fix-rtm.launch-error.error.rtm-ngtlib-mismatch=fixRTMが要求するバージョンと、RTM、NGTLibのバージョンが一致していません!\nこのバージョンのfixRTMはRTM %sとNGTLib %sに対応しています。\n要求バージョンと同じものを使用してください。 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/fix-rtm/textures/ajwm5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/src/main/resources/assets/fix-rtm/textures/ajwm5.png -------------------------------------------------------------------------------- /src/main/resources/assets/fix-rtm/textures/blocks/marker_merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/src/main/resources/assets/fix-rtm/textures/blocks/marker_merged.png -------------------------------------------------------------------------------- /src/main/resources/assets/fix-rtm/textures/template/test_train_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fixrtm/fixRTM/fcb78f4521d6d4421f93e8c6efd069eda6192358/src/main/resources/assets/fix-rtm/textures/template/test_train_text.png -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/fix-rtm/scripts/render-gear.js: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2020 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | var renderClass = "jp.ngt.rtm.render.MechanismPartsRenderer"; 6 | importPackage(Packages.org.lwjgl.opengl); 7 | importPackage(Packages.jp.ngt.ngtlib.renderer); 8 | importPackage(Packages.jp.ngt.ngtlib.math); 9 | importPackage(Packages.jp.ngt.rtm.render); 10 | 11 | function init(par1, par2) { 12 | var modelName = par1.getConfig().getName(); 13 | main = renderer.registerParts(new Parts("__")); 14 | } 15 | 16 | function render(entity, pass, par3) { 17 | GL11.glPushMatrix(); 18 | 19 | if (pass == 0) { 20 | var rotation = renderer.getRotation(entity, Axis.POSITIVE_Y); 21 | GL11.glRotatef(rotation, 0.0, 1.0, 0.0); 22 | main.render(renderer); 23 | } 24 | 25 | GL11.glPopMatrix(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/assets/rtm/models/item/item_train_fixrtm_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "fix-rtm:generated/items/item_test_train" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/rtm/models/item/marker_fixrtm_merged.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "fix-rtm:blocks/marker_merged" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "fix-rtm", 4 | "name": "Fix RTM", 5 | "description": "Fix RTM's bugs made by anatawa12", 6 | "version": "${version}", 7 | "mcversion": "${mcversion}", 8 | "url": "", 9 | "updateUrl": "", 10 | "authorList": [ 11 | "anatawa12" 12 | ], 13 | "credits": "", 14 | "logoFile": "", 15 | "screenshots": [], 16 | "dependencies": [] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "examplemod resources", 4 | "pack_format": 3, 5 | "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/webp-imageio-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Luciad WebP Image I/O support library 2 | Copyright 2016 Luciad 3 | 4 | This product includes software developed at 5 | Luciad (http://www.luciad.com). 6 | -------------------------------------------------------------------------------- /src/main/rtm-patches/.gitattributes: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT FILES IN THIS DIRECTORY 2 | # files in this directory are auto generated files by pathing mod 3 | # please do not edit and please do not ignore files in this directory 4 | *.java.patch text eol=lf 5 | .gitattributes text eol=lf 6 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/ClientProxy.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/ClientProxy.java 2 | +++ b/jp/ngt/rtm/ClientProxy.java 3 | @@ -211,10 +211,11 @@ 4 | } 5 | 6 | public static void playSound(MovingSoundCustom sound, float vol, float pitch) { 7 | sound.setVolume(vol); 8 | sound.setPitch(pitch); 9 | + sound.update(); 10 | NGTSound.playSound(sound); 11 | } 12 | 13 | public FormationManager getFormationManager() { 14 | return NGTUtil.isServer() ? super.getFormationManager() : this.fmClient; 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/CreativeTabRTM.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/CreativeTabRTM.java 2 | +++ b/jp/ngt/rtm/CreativeTabRTM.java 3 | @@ -7,10 +7,13 @@ 4 | 5 | public class CreativeTabRTM extends CreativeTabs { 6 | public static final CreativeTabs RAILWAY = new CreativeTabRTM("rtm_railway"); 7 | public static final CreativeTabs INDUSTRY = new CreativeTabRTM("rtm_industry"); 8 | public static final CreativeTabs TOOLS = new CreativeTabRTM("rtm_tools"); 9 | + // workaround for reobf 10 | + @SuppressWarnings("unused") 11 | + public static final CreativeTabs field_78040_i = TOOLS; 12 | 13 | public CreativeTabRTM(String label) { 14 | super(label); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/RTMBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/RTMBlock.java 2 | +++ b/jp/ngt/rtm/RTMBlock.java 3 | @@ -237,18 +237,20 @@ 4 | registerBlockModel(marker, 3, "marker3"); 5 | registerBlockModel(marker, 4, "marker20"); 6 | registerBlockModel(marker, 5, "marker21"); 7 | registerBlockModel(marker, 6, "marker22"); 8 | registerBlockModel(marker, 7, "marker23"); 9 | + registerBlockModel(marker, 8, "marker_fixrtm_merged"); 10 | registerBlockModel(markerSwitch, 0, "marker0"); 11 | registerBlockModel(markerSwitch, 1, "marker1"); 12 | registerBlockModel(markerSwitch, 2, "marker2"); 13 | registerBlockModel(markerSwitch, 3, "marker3"); 14 | registerBlockModel(markerSwitch, 4, "marker20"); 15 | registerBlockModel(markerSwitch, 5, "marker21"); 16 | registerBlockModel(markerSwitch, 6, "marker22"); 17 | registerBlockModel(markerSwitch, 7, "marker23"); 18 | + registerBlockModel(markerSwitch, 8, "marker_fixrtm_merged"); 19 | registerBlockModels(signalConverter, "signal_converter", 0, 1, 2, 3, 4); 20 | registerBlockModels(trainWorkBench, "train_workbench", 0, 1); 21 | registerBlockModel(slot, 0, "slot"); 22 | registerBlockModel(movingMachine, 0, "moving_machine"); 23 | registerBlockModel(movingMachine, 1, "vehicle_generator"); 24 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/RTMCore.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/RTMCore.java 2 | +++ b/jp/ngt/rtm/RTMCore.java 3 | @@ -23,10 +23,12 @@ 4 | import net.minecraftforge.fml.common.event.FMLServerStartingEvent; 5 | import net.minecraftforge.fml.common.network.NetworkRegistry; 6 | import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; 7 | import org.apache.logging.log4j.Level; 8 | 9 | +// marked as modified to check RTM version with patch system 10 | + 11 | @Mod( 12 | modid = "rtm", 13 | name = "RealTrainMod", 14 | version = "2.4.24", 15 | acceptedMinecraftVersions = "[1.12.2]" 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/RTMEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/RTMEntity.java 2 | +++ b/jp/ngt/rtm/RTMEntity.java 3 | @@ -86,12 +86,12 @@ 4 | NGTUtilClient.registerEntityRender(EntityVehicle.class, RenderVehicleBase.class); 5 | NGTUtilClient.registerEntityRender(EntityTrainBase.class, RenderVehicleBase.class); 6 | NGTUtilClient.registerEntityRender(WeatherEffectDummy.class, RenderWeatherEffectDummy.class); 7 | NGTUtilClient.registerEntityRender(EntityBogie.class, RenderBogie.class); 8 | NGTUtilClient.registerEntityRender(EntityFloor.class, RenderSeat.class); 9 | - NGTUtilClient.registerEntityRender(EntityATC.class, RenderEntityInstalledObject.class); 10 | - NGTUtilClient.registerEntityRender(EntityTrainDetector.class, RenderEntityInstalledObject.class); 11 | + NGTUtilClient.registerEntityRender(EntityATC.class, com.anatawa12.fixRtm.rtm.entity.RenderEntityElectricalWiring.class); 12 | + NGTUtilClient.registerEntityRender(EntityTrainDetector.class, com.anatawa12.fixRtm.rtm.entity.RenderEntityElectricalWiring.class); 13 | NGTUtilClient.registerEntityRender(EntityBumpingPost.class, RenderEntityInstalledObject.class); 14 | NGTUtilClient.registerEntityRender(EntityContainer.class, RenderContainer.class); 15 | NGTUtilClient.registerEntityRender(EntityArtillery.class, RenderArtillery.class); 16 | NGTUtilClient.registerEntityRender(EntityBullet.class, RenderBullet.class); 17 | NGTUtilClient.registerEntityRender(EntityTie.class, RenderTie.class); 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/RTMItem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/RTMItem.java 2 | +++ b/jp/ngt/rtm/RTMItem.java 3 | @@ -134,11 +134,11 @@ 4 | registerItemModels(installedObject, "istl_obj_", ItemInstalledObject.IstlObjType.values()); 5 | registerItemModel(itemtrain, 0, "item_train_0"); 6 | registerItemModel(itemtrain, 1, "item_train_1"); 7 | registerItemModel(itemtrain, 2, "item_train_2"); 8 | registerItemModel(itemtrain, 3, "item_train_3"); 9 | - registerItemModel(itemtrain, 127, "item_train_127"); 10 | + registerItemModel(itemtrain, 127, "item_train_fixrtm_test"); 11 | registerItemModel(itemMotorman, 0, "item_npc_0"); 12 | registerItemModel(itemMotorman, 1, "item_npc_1"); 13 | registerItemModel(itemCargo, 0, "cargo_0"); 14 | registerItemModel(itemCargo, 1, "cargo_1"); 15 | registerItemModel(itemCargo, 2, "cargo_2"); 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockCrossingGate.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockCrossingGate.java 2 | +++ b/jp/ngt/rtm/block/BlockCrossingGate.java 3 | @@ -46,6 +46,11 @@ 4 | 5 | private void checkPower(World world, int x, int y, int z) { 6 | TileEntityCrossingGate tileentitycrossinggate = (TileEntityCrossingGate)BlockUtil.getTileEntity(world, x, y, z); 7 | tileentitycrossinggate.isGettingPower = world.getRedstonePowerFromNeighbors(new BlockPos(x, y, z)) > 0; 8 | } 9 | + 10 | + @Override 11 | + public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.CROSSING); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockDecoration.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockDecoration.java 2 | +++ b/jp/ngt/rtm/block/BlockDecoration.java 3 | @@ -12,6 +12,10 @@ 4 | } 5 | 6 | public TileEntity createNewTileEntity(World world, int meta) { 7 | return new TileEntityDecoration(); 8 | } 9 | + 10 | + public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 11 | + return com.anatawa12.fixRtm.rtm.block.BlockDecorationKt.getPickBlock(world, pos); 12 | + } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockFlag.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockFlag.java 2 | +++ b/jp/ngt/rtm/block/BlockFlag.java 3 | @@ -31,6 +31,11 @@ 4 | entityplayer.openGui(RTMCore.instance, RTMCore.guiIdSelectTileEntityTexture, holder.getWorld(), i, j, k); 5 | } 6 | 7 | return true; 8 | } 9 | + 10 | + @Override 11 | + public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.FLAG); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockFluorescent.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockFluorescent.java 2 | +++ b/jp/ngt/rtm/block/BlockFluorescent.java 3 | @@ -52,6 +52,16 @@ 4 | } 5 | } 6 | 7 | return 15; 8 | } 9 | + 10 | + @Override 11 | + protected boolean onBlockActivated(jp.ngt.ngtlib.block.BlockArgHolder holder, float hitX, float hitY, float hitZ) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.onBlockActivated(holder); 13 | + } 14 | + 15 | + @Override 16 | + public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 17 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.FLUORESCENT); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockLight.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockLight.java 2 | +++ b/jp/ngt/rtm/block/BlockLight.java 3 | @@ -30,6 +30,11 @@ 4 | return super.removedByPlayer(holder, willHarvest); 5 | } else { 6 | return PermissionManager.INSTANCE.hasPermission(holder.getPlayer(), "editOrnament") ? super.removedByPlayer(holder, willHarvest) : false; 7 | } 8 | } 9 | + 10 | + @Override 11 | + public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.LIGHT); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockLinePole.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockLinePole.java 2 | +++ b/jp/ngt/rtm/block/BlockLinePole.java 3 | @@ -48,6 +48,16 @@ 4 | } else { 5 | Material material = iblockstate.getMaterial(); 6 | return material != Material.AIR && !material.isLiquid(); 7 | } 8 | } 9 | + 10 | + @Override 11 | + protected boolean onBlockActivated(jp.ngt.ngtlib.block.BlockArgHolder holder, float hitX, float hitY, float hitZ) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.onBlockActivated(holder); 13 | + } 14 | + 15 | + @Override 16 | + public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 17 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.LINEPOLE); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockMechanism.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockMechanism.java 2 | +++ b/jp/ngt/rtm/block/BlockMechanism.java 3 | @@ -29,6 +29,11 @@ 4 | return true; 5 | } else { 6 | return false; 7 | } 8 | } 9 | + 10 | + @Override 11 | + public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.MECHANISM); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockPipe.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockPipe.java 2 | +++ b/jp/ngt/rtm/block/BlockPipe.java 3 | @@ -73,6 +73,16 @@ 4 | } 5 | 6 | protected ItemStack getItem(int damage) { 7 | return new ItemStack(RTMItem.installedObject, 1, ItemInstalledObject.IstlObjType.PIPE.id); 8 | } 9 | + 10 | + @Override 11 | + protected boolean onBlockActivated(jp.ngt.ngtlib.block.BlockArgHolder holder, float hitX, float hitY, float hitZ) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.onBlockActivated(holder); 13 | + } 14 | + 15 | + @Override 16 | + public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 17 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.PIPE); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockPlant.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockPlant.java 2 | +++ b/jp/ngt/rtm/block/BlockPlant.java 3 | @@ -12,6 +12,16 @@ 4 | } 5 | 6 | public TileEntity createNewTileEntity(World world, int par2) { 7 | return new TileEntityPlantOrnament(); 8 | } 9 | + 10 | + @Override 11 | + protected boolean onBlockActivated(jp.ngt.ngtlib.block.BlockArgHolder holder, float hitX, float hitY, float hitZ) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.onBlockActivated(holder); 13 | + } 14 | + 15 | + @Override 16 | + public net.minecraft.item.ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, net.minecraft.util.math.BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 17 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.PLANT); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockPoint.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockPoint.java 2 | +++ b/jp/ngt/rtm/block/BlockPoint.java 3 | @@ -65,6 +65,11 @@ 4 | } 5 | 6 | public boolean canProvidePower(IBlockState state) { 7 | return true; 8 | } 9 | + 10 | + @Override 11 | + public net.minecraft.item.ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.POINT); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockRailroadSign.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockRailroadSign.java 2 | +++ b/jp/ngt/rtm/block/BlockRailroadSign.java 3 | @@ -38,15 +38,20 @@ 4 | int i = holder.getBlockPos().getX(); 5 | int j = holder.getBlockPos().getY(); 6 | int k = holder.getBlockPos().getZ(); 7 | EntityPlayer entityplayer = holder.getPlayer(); 8 | RTMCore rtmcore = RTMCore.instance; 9 | + if (holder.getPlayer().inventory.getCurrentItem().getItem() == RTMItem.crowbar) { 10 | + com.anatawa12.fixRtm.UtilsKt.openGui(holder.getPlayer(), com.anatawa12.fixRtm.gui.GuiId.ChangeOffset, holder.getWorld(), i, j, k); 11 | + return true; 12 | + } 13 | entityplayer.openGui(RTMCore.instance, RTMCore.guiIdSelectTileEntityTexture, holder.getWorld(), i, j, k); 14 | } 15 | 16 | return true; 17 | } 18 | 19 | - protected ItemStack getItem(int damage) { 20 | - return new ItemStack(RTMItem.installedObject, 1, ItemInstalledObject.IstlObjType.RAILLOAD_SIGN.id); 21 | + @Override 22 | + public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { 23 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.RAILLOAD_SIGN); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockScaffold.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockScaffold.java 2 | +++ b/jp/ngt/rtm/block/BlockScaffold.java 3 | @@ -152,6 +152,16 @@ 4 | entity.motionY += vec.getY() * d0; 5 | entity.motionZ += vec.getZ() * d0; 6 | } 7 | 8 | } 9 | + 10 | + @Override 11 | + protected boolean onBlockActivated(jp.ngt.ngtlib.block.BlockArgHolder holder, float hitX, float hitY, float hitZ) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.onBlockActivated(holder); 13 | + } 14 | + 15 | + @Override 16 | + public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 17 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.SCAFFOLD); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockScaffoldStairs.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockScaffoldStairs.java 2 | +++ b/jp/ngt/rtm/block/BlockScaffoldStairs.java 3 | @@ -162,6 +162,16 @@ 4 | 5 | } 6 | 7 | public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity) { 8 | } 9 | + 10 | + @Override 11 | + protected boolean onBlockActivated(jp.ngt.ngtlib.block.BlockArgHolder holder, float hitX, float hitY, float hitZ) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.onBlockActivated(holder); 13 | + } 14 | + 15 | + @Override 16 | + public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { 17 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.STAIR); 18 | + } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockStation.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockStation.java 2 | +++ b/jp/ngt/rtm/block/BlockStation.java 3 | @@ -56,6 +56,11 @@ 4 | int j = pos.getY(); 5 | int k = pos.getZ(); 6 | } 7 | 8 | } 9 | + 10 | + @Override 11 | + protected net.minecraft.item.ItemStack getItem(int damage) { 12 | + return new net.minecraft.item.ItemStack(this); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/BlockTurnstile.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/BlockTurnstile.java 2 | +++ b/jp/ngt/rtm/block/BlockTurnstile.java 3 | @@ -113,6 +113,11 @@ 4 | } 5 | 6 | public PathNodeType getAiPathNodeType(IBlockState state, IBlockAccess world, BlockPos pos) { 7 | return canThrough(world, pos) ? PathNodeType.OPEN : PathNodeType.BLOCKED; 8 | } 9 | + 10 | + @Override 11 | + public ItemStack getPickBlock(IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.TURNSTILE); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/RenderMachine.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/RenderMachine.java 2 | +++ b/jp/ngt/rtm/block/tileentity/RenderMachine.java 3 | @@ -18,10 +18,11 @@ 4 | private void renderMachine(TileEntityMachineBase par1, double par2, double par4, double par6, float par8) { 5 | GL11.glPushMatrix(); 6 | GL11.glEnable(32826); 7 | GL11.glTranslatef((float)par2 + 0.5F, (float)par4, (float)par6 + 0.5F); 8 | GL11.glTranslatef(0.0F, 0.5F, 0.0F); 9 | + GL11.glTranslatef(par1.getOffsetX(), par1.getOffsetY(), par1.getOffsetZ()); 10 | ModelSetMachine modelsetmachine = par1.getResourceState().getResourceSet(); 11 | MachineConfig machineconfig = modelsetmachine.getConfig(); 12 | if (machineconfig.rotateByMetadata) { 13 | switch(par1.getBlockMetadata()) { 14 | case 0: 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/RenderOrnament.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/RenderOrnament.java 2 | +++ b/jp/ngt/rtm/block/tileentity/RenderOrnament.java 3 | @@ -15,10 +15,14 @@ 4 | GL11.glEnable(32826); 5 | GL11.glTranslatef((float)par2 + 0.5F, (float)par4 + 0.5F, (float)par6 + 0.5F); 6 | ModelSetOrnament modelsetornament = par1.getResourceState().getResourceSet(); 7 | OrnamentConfig ornamentconfig = modelsetornament.getConfig(); 8 | int i = MinecraftForgeClient.getRenderPass(); 9 | + 10 | + GL11.glTranslatef(par1.getOffsetX(), par1.getOffsetY(), par1.getOffsetZ()); 11 | + GL11.glRotatef(par1.getRotation(), 0.0F, 1.0F, 0.0F); 12 | + 13 | if (modelsetornament.modelObj.renderer.getScript() == null) { 14 | float f = par1.getRandomScale(); 15 | GL11.glScalef(f, f, f); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/RenderRailroadSign.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/RenderRailroadSign.java 2 | +++ b/jp/ngt/rtm/block/tileentity/RenderRailroadSign.java 3 | @@ -12,10 +12,11 @@ 4 | public class RenderRailroadSign extends TileEntitySpecialRenderer { 5 | public void renderRailroadSignAt(TileEntityRailroadSign tileEntity, double par2, double par4, double par6, float par8) { 6 | GL11.glPushMatrix(); 7 | GL11.glEnable(32826); 8 | GL11.glTranslatef((float)par2 + 0.5F, (float)par4, (float)par6 + 0.5F); 9 | + GL11.glTranslatef(tileEntity.getOffsetX(), tileEntity.getOffsetY(), tileEntity.getOffsetZ()); 10 | GL11.glPushMatrix(); 11 | float f = 1.25F; 12 | float f1 = 0.25F; 13 | float f2 = 0.0675F; 14 | boolean flag = !tileEntity.getWorld().isAirBlock(tileEntity.getPos().up()); 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/RenderSignBoard.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/RenderSignBoard.java 2 | +++ b/jp/ngt/rtm/block/tileentity/RenderSignBoard.java 3 | @@ -54,10 +54,13 @@ 4 | } 5 | } else { 6 | GL11.glTranslatef(0.0F, 0.0F, f2 - 0.5F); 7 | } 8 | 9 | + GL11.glTranslatef(tileEntity.getOffsetX(), tileEntity.getOffsetY(), tileEntity.getOffsetZ()); 10 | + GL11.glRotatef(tileEntity.getRotation(), 0.0F, 1.0F, 0.0F); 11 | + 12 | GL11.glDisable(2896); 13 | NGTTessellator ngttessellator = NGTTessellator.instance; 14 | this.bindTexture(texturesetsignboard.texture); 15 | float f5 = signboardconfig.backTexture == 1 ? 0.5F : 1.0F; 16 | float f6 = signboardconfig.backTexture == 1 ? 0.5F : 0.0F; 17 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityCrossingGate.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityCrossingGate.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityCrossingGate.java 3 | @@ -62,12 +62,13 @@ 4 | 5 | @SideOnly(Side.CLIENT) 6 | public AxisAlignedBB getRenderBoundingBox() { 7 | float[] afloat = (this.getResourceState().getResourceSet().getConfig()).renderAABB; 8 | BlockPos blockpos = this.getPos(); 9 | - return new AxisAlignedBB((double)((float)blockpos.getX() + afloat[0]), (double)((float)blockpos.getY() + afloat[1]), (double)((float)blockpos.getZ() + afloat[2]), (double)((float)blockpos.getX() + afloat[3]), (double)((float)blockpos.getY() + afloat[4]), (double)((float)blockpos.getZ() + afloat[5])); 10 | + return new AxisAlignedBB((double)((float)blockpos.getX() + afloat[0]), (double)((float)blockpos.getY() + afloat[1]), (double)((float)blockpos.getZ() + afloat[2]), (double)((float)blockpos.getX() + afloat[3]), (double)((float)blockpos.getY() + afloat[4]), (double)((float)blockpos.getZ() + afloat[5])) 11 | + .offset(getOffsetX(), getOffsetY(), getOffsetZ()); 12 | } 13 | 14 | - protected ResourceType getSubType() { 15 | + public ResourceType getSubType() { 16 | return RTMResource.MACHINE_GATE; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityFluorescent.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityFluorescent.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityFluorescent.java 3 | @@ -37,9 +37,21 @@ 4 | } 5 | } 6 | 7 | } 8 | 9 | - protected ResourceType getSubType() { 10 | + public ResourceType getSubType() { 11 | return RTMResource.ORNAMENT_LAMP; 12 | } 13 | + 14 | + @Override 15 | + public void setRotation(net.minecraft.entity.player.EntityPlayer player, float rotationInterval, boolean synch) { 16 | + int yaw = net.minecraft.util.math.MathHelper.floor(jp.ngt.ngtlib.math.NGTMath.normalizeAngle(-player.rotationYaw + 180.0D + (rotationInterval / 2.0D)) / (double) rotationInterval); 17 | + if (this.dirF >= 4) { 18 | + yaw += 90 / rotationInterval; 19 | + } 20 | + if (this.dirF == 1 || this.dirF == 7) { 21 | + yaw += 180 / rotationInterval; 22 | + } 23 | + this.setRotation((float) yaw * rotationInterval, synch); 24 | + } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityMachineBase.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityMachineBase.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityMachineBase.java 3 | @@ -85,11 +85,12 @@ 4 | return pass >= 0; 5 | } 6 | 7 | @SideOnly(Side.CLIENT) 8 | public AxisAlignedBB getRenderBoundingBox() { 9 | - return new AxisAlignedBB(this.getPos(), this.getPos().add(1, 1, 1)); 10 | + return new AxisAlignedBB(this.getPos(), this.getPos().add(1, 1, 1)) 11 | + .offset(getOffsetX(), getOffsetY(), getOffsetZ()); 12 | } 13 | 14 | public ResourceState getResourceState() { 15 | return this.state; 16 | } 17 | @@ -109,7 +110,13 @@ 18 | 19 | public boolean closeGui(ResourceState par1) { 20 | return true; 21 | } 22 | 23 | - protected abstract ResourceType getSubType(); 24 | + public abstract ResourceType getSubType(); 25 | + 26 | + @Override 27 | + public void addInfoToCrashReport(net.minecraft.crash.CrashReportCategory reportCategory) { 28 | + super.addInfoToCrashReport(reportCategory); 29 | + com.anatawa12.fixRtm.rtm.block.tileentity.TileEntityMachineBaseKt.addInfoToCrashReport(this, reportCategory); 30 | + } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityMechanism.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityMechanism.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityMechanism.java 3 | @@ -533,6 +533,12 @@ 4 | } 5 | 6 | public boolean closeGui(ResourceState par1) { 7 | return true; 8 | } 9 | + 10 | + @Override 11 | + public void addInfoToCrashReport(net.minecraft.crash.CrashReportCategory reportCategory) { 12 | + super.addInfoToCrashReport(reportCategory); 13 | + com.anatawa12.fixRtm.rtm.block.tileentity.TileEntityMechanismKt.addInfoToCrashReport(this, reportCategory); 14 | + } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityOrnament.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityOrnament.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityOrnament.java 3 | @@ -11,11 +11,11 @@ 4 | import net.minecraft.util.math.AxisAlignedBB; 5 | import net.minecraft.util.math.BlockPos; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | -public abstract class TileEntityOrnament extends TileEntityCustom implements IResourceSelector { 10 | +public abstract class TileEntityOrnament extends jp.ngt.ngtlib.block.TileEntityPlaceable implements IResourceSelector { 11 | private ResourceState state = new ResourceState<>(this.getSubType(), this); 12 | private byte attachedSide; 13 | private float randomScale; 14 | 15 | public void readFromNBT(NBTTagCompound nbt) { 16 | @@ -83,6 +83,12 @@ 17 | public boolean closeGui(ResourceState par1) { 18 | return true; 19 | } 20 | 21 | protected abstract ResourceType getSubType(); 22 | + 23 | + @Override 24 | + public void addInfoToCrashReport(net.minecraft.crash.CrashReportCategory reportCategory) { 25 | + super.addInfoToCrashReport(reportCategory); 26 | + com.anatawa12.fixRtm.rtm.block.tileentity.TileEntityOrnamentKt.addInfoToCrashReport(this, reportCategory); 27 | + } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityPoint.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityPoint.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityPoint.java 3 | @@ -44,12 +44,13 @@ 4 | this.markDirty(); 5 | } 6 | 7 | @SideOnly(Side.CLIENT) 8 | public AxisAlignedBB getRenderBoundingBox() { 9 | - return new AxisAlignedBB(this.getPos().add(-1, 0, -1), this.getPos().add(2, 1, 2)); 10 | + return new AxisAlignedBB(this.getPos().add(-1, 0, -1), this.getPos().add(2, 1, 2)) 11 | + .offset(getOffsetX(), getOffsetY(), getOffsetZ()); 12 | } 13 | 14 | - protected ResourceType getSubType() { 15 | + public ResourceType getSubType() { 16 | return RTMResource.MACHINE_POINT; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntityRailroadSign.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntityRailroadSign.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntityRailroadSign.java 3 | @@ -29,11 +29,12 @@ 4 | return nbt; 5 | } 6 | 7 | @SideOnly(Side.CLIENT) 8 | public AxisAlignedBB getRenderBoundingBox() { 9 | - return new AxisAlignedBB(this.getPos(), this.getPos().add(1, 2, 1)); 10 | + return new AxisAlignedBB(this.getPos(), this.getPos().add(1, 2, 1)) 11 | + .offset(getOffsetX(), getOffsetY(), getOffsetZ()); 12 | } 13 | 14 | public void updateResourceState() { 15 | if (this.world == null || !this.world.isRemote) { 16 | this.sendPacket(); 17 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/block/tileentity/TileEntitySignBoard.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/block/tileentity/TileEntitySignBoard.java 2 | +++ b/jp/ngt/rtm/block/tileentity/TileEntitySignBoard.java 3 | @@ -12,11 +12,11 @@ 4 | import net.minecraft.util.ITickable; 5 | import net.minecraft.util.math.AxisAlignedBB; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | -public class TileEntitySignBoard extends TileEntityCustom implements IResourceSelector, ITickable { 10 | +public class TileEntitySignBoard extends jp.ngt.ngtlib.block.TileEntityPlaceable implements IResourceSelector, ITickable { 11 | private ResourceStateSignboard state = new ResourceStateSignboard(RTMResource.SIGNBOARD, this); 12 | public boolean isGettingPower; 13 | private byte direction; 14 | @SideOnly(Side.CLIENT) 15 | public int counter; 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/BlockConnector.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/BlockConnector.java 2 | +++ b/jp/ngt/rtm/electric/BlockConnector.java 3 | @@ -73,13 +73,18 @@ 4 | } 5 | 6 | } 7 | 8 | protected ItemStack getItem(int damage) { 9 | - damage = damage < 6 ? ItemInstalledObject.IstlObjType.CONNECTOR_IN.id : ItemInstalledObject.IstlObjType.CONNECTOR_OUT.id; 10 | + damage = istlObjType(damage).id; 11 | return new ItemStack(RTMItem.installedObject, 1, damage); 12 | } 13 | 14 | public boolean canConnect(World world, int x, int y, int z) { 15 | return true; 16 | } 17 | + 18 | + @Override 19 | + protected ItemInstalledObject.IstlObjType istlObjType(int damage) { 20 | + return damage < 6 ? ItemInstalledObject.IstlObjType.CONNECTOR_IN : ItemInstalledObject.IstlObjType.CONNECTOR_OUT; 21 | + } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/BlockInsulator.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/BlockInsulator.java 2 | +++ b/jp/ngt/rtm/electric/BlockInsulator.java 3 | @@ -11,6 +11,11 @@ 4 | } 5 | 6 | protected ItemStack getItem(int damage) { 7 | return new ItemStack(RTMItem.installedObject, 1, 3); 8 | } 9 | + 10 | + @Override 11 | + protected jp.ngt.rtm.item.ItemInstalledObject.IstlObjType istlObjType(int damage) { 12 | + return jp.ngt.rtm.item.ItemInstalledObject.IstlObjType.INSULATOR; 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/BlockSpeaker.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/BlockSpeaker.java 2 | +++ b/jp/ngt/rtm/electric/BlockSpeaker.java 3 | @@ -45,6 +45,11 @@ 4 | } 5 | 6 | public boolean canConnect(World world, int x, int y, int z) { 7 | return true; 8 | } 9 | + 10 | + @Override 11 | + public ItemStack getPickBlock(net.minecraft.block.state.IBlockState state, net.minecraft.util.math.RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { 12 | + return com.anatawa12.fixRtm.rtm.block.BlockOrnamentMain.getPickBlock(world, pos, ItemInstalledObject.IstlObjType.SPEAKER); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/RenderSignal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/RenderSignal.java 2 | +++ b/jp/ngt/rtm/electric/RenderSignal.java 3 | @@ -24,10 +24,11 @@ 4 | GL11.glTranslatef((float)par2, (float)par4, (float)par6); 5 | int i = MinecraftForgeClient.getRenderPass(); 6 | float f = tileEntity.getBlockDirection(); 7 | GL11.glPushMatrix(); 8 | GL11.glTranslatef(0.5F, 0.0F, 0.5F); 9 | + GL11.glTranslatef(tileEntity.getOffsetX(), tileEntity.getOffsetY(), tileEntity.getOffsetZ()); 10 | GL11.glRotatef(f, 0.0F, 1.0F, 0.0F); 11 | ModelSetSignal modelsetsignal = tileEntity.getResourceState().getResourceSet(); 12 | if (modelsetsignal != null && !modelsetsignal.isDummy()) { 13 | modelsetsignal.modelObj.render(tileEntity, modelsetsignal.getConfig(), i, partialTicks); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/TileEntityConnectorBase.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/TileEntityConnectorBase.java 2 | +++ b/jp/ngt/rtm/electric/TileEntityConnectorBase.java 3 | @@ -72,10 +72,13 @@ 4 | case 5: 5 | vec3 = vec3.rotateAroundX(-90.0F); 6 | vec3 = vec3.rotateAroundY(90.0F); 7 | } 8 | 9 | + vec3 = vec3.rotateAroundY(this.getRotation()); 10 | + vec3 = vec3.add(this.getOffsetX(), this.getOffsetY(), this.getOffsetZ()); 11 | + 12 | this.wirePos = vec3; 13 | } 14 | 15 | public int[] getSelectorPos() { 16 | return new int[]{this.getX(), this.getY(), this.getZ()}; 17 | @@ -107,6 +110,19 @@ 18 | public ResourceState getResourceState() { 19 | return this.state; 20 | } 21 | 22 | protected abstract ResourceType getSubType(); 23 | + 24 | + @Override 25 | + public void setOffset(float offsetX, float offsetY, float offsetZ, boolean sync) { 26 | + super.setOffset(offsetX, offsetY, offsetZ, sync); 27 | + if (world != null) 28 | + this.updateWirePos(); 29 | + } 30 | + 31 | + @Override 32 | + public void addInfoToCrashReport(net.minecraft.crash.CrashReportCategory reportCategory) { 33 | + super.addInfoToCrashReport(reportCategory); 34 | + com.anatawa12.fixRtm.rtm.electric.TileEntityConnectorBaseKt.addInfoToCrashReport(this, reportCategory); 35 | + } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/TileEntityDummyEW.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/TileEntityDummyEW.java 2 | +++ b/jp/ngt/rtm/electric/TileEntityDummyEW.java 3 | @@ -31,6 +31,11 @@ 4 | } 5 | 6 | public boolean isBlockTile() { 7 | return false; 8 | } 9 | + 10 | + @Override 11 | + public jp.ngt.ngtlib.math.Vec3 getWirePos() { 12 | + return new jp.ngt.ngtlib.math.Vec3(0.0, -0.5, 0.0); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/electric/TileEntitySignal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/electric/TileEntitySignal.java 2 | +++ b/jp/ngt/rtm/electric/TileEntitySignal.java 3 | @@ -140,14 +140,16 @@ 4 | return pass >= 0; 5 | } 6 | 7 | @SideOnly(Side.CLIENT) 8 | public AxisAlignedBB getRenderBoundingBox() { 9 | - int i = this.getPos().getX(); 10 | - int j = this.getPos().getY(); 11 | - int k = this.getPos().getZ(); 12 | - return new AxisAlignedBB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 2), (double)(k + 1)); 13 | + double i = this.getPos().getX() + this.getOffsetX(); 14 | + double j = this.getPos().getY() + this.getOffsetY(); 15 | + double k = this.getPos().getZ() + this.getOffsetZ(); 16 | + return new AxisAlignedBB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 2), (double)(k + 1)) 17 | + // because it has simple block part 18 | + .union(new AxisAlignedBB(this.getPos(), this.getPos().add(1, 1, 1))); 19 | } 20 | 21 | public void updateResourceState() { 22 | if (this.world == null || !this.world.isRemote) { 23 | this.markDirty(); 24 | @@ -165,6 +167,12 @@ 25 | } 26 | 27 | public ResourceStateWithBlock getResourceState() { 28 | return this.state; 29 | } 30 | + 31 | + @Override 32 | + public void addInfoToCrashReport(net.minecraft.crash.CrashReportCategory reportCategory) { 33 | + super.addInfoToCrashReport(reportCategory); 34 | + com.anatawa12.fixRtm.rtm.electric.TileEntitySignalKt.addInfoToCrashReport(this, reportCategory); 35 | + } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/ai/EntityAITravelByTrain.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/ai/EntityAITravelByTrain.java 2 | +++ b/jp/ngt/rtm/entity/ai/EntityAITravelByTrain.java 3 | @@ -51,12 +51,14 @@ 4 | return this.activeTask.shouldExecute(); 5 | } 6 | } 7 | 8 | private void dismount() { 9 | - this.npc.startRiding((Entity)null); 10 | - ((EntityFloor)this.npc.getRidingEntity()).onDismount(this.npc); 11 | + EntityFloor floor = ((EntityFloor)this.npc.getRidingEntity()); 12 | + assert floor != null; 13 | + this.npc.dismountRidingEntity(); 14 | + floor.onDismount(this.npc); 15 | } 16 | 17 | public boolean shouldContinueExecuting() { 18 | boolean flag = this.activeTask.shouldContinueExecuting(); 19 | if (!flag) { 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/npc/EntityMotorman.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/npc/EntityMotorman.java 2 | +++ b/jp/ngt/rtm/entity/npc/EntityMotorman.java 3 | @@ -56,10 +56,17 @@ 4 | public void entityInit() { 5 | super.entityInit(); 6 | this.getDataManager().register(HELD_ITEM, new ItemStack(Items.APPLE)); 7 | } 8 | 9 | + // force role to be motorman 10 | + public void onLivingUpdate() { 11 | + this.myRole = Role.MOTORMAN; 12 | + this.roleChanged = false; 13 | + super.onLivingUpdate(); 14 | + } 15 | + 16 | public void writeEntityToNBT(NBTTagCompound nbt) { 17 | super.writeEntityToNBT(nbt); 18 | if (this.getDiagram() != null) { 19 | NBTTagCompound nbttagcompound = new NBTTagCompound(); 20 | ItemStack itemstack = this.getDiagram(); 21 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/npc/EntityNPC.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/npc/EntityNPC.java 2 | +++ b/jp/ngt/rtm/entity/npc/EntityNPC.java 3 | @@ -48,11 +48,11 @@ 4 | private ResourceState state = new ResourceState<>(RTMResource.NPC, this); 5 | private ScriptExecuterNPC executer = new ScriptExecuterNPC(); 6 | protected Role myRole = Role.MANNEQUIN; 7 | private EntityDummyPlayer playerDummy; 8 | protected int useItemCount; 9 | - private boolean roleChanged; 10 | + protected boolean roleChanged; 11 | public InventoryNPC inventory = new InventoryNPC(this); 12 | 13 | public EntityNPC(World world) { 14 | super(world); 15 | this.setSize(0.6F, 1.8F); 16 | @@ -398,6 +398,12 @@ 17 | return this.state; 18 | } 19 | 20 | public void setSwingingArms(boolean swingingArms) { 21 | } 22 | + 23 | + @Override 24 | + public void addEntityCrashInfo(net.minecraft.crash.CrashReportCategory category) { 25 | + super.addEntityCrashInfo(category); 26 | + com.anatawa12.fixRtm.rtm.entity.npc.EntityNPCKt.addEntityCrashInfo(this, category); 27 | + } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/train/parts/EntityArtillery.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/train/parts/EntityArtillery.java 2 | +++ b/jp/ngt/rtm/entity/train/parts/EntityArtillery.java 3 | @@ -360,6 +360,11 @@ 4 | public void updateResourceState() { 5 | super.updateResourceState(); 6 | this.setBarrelYaw(0.0F); 7 | this.setBarrelPitch(0.0F); 8 | } 9 | + 10 | + @Override 11 | + protected ItemStack getItem() { 12 | + return new ItemStack(RTMItem.itemCargo, 1, 1); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/train/parts/EntityCargo.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/train/parts/EntityCargo.java 2 | +++ b/jp/ngt/rtm/entity/train/parts/EntityCargo.java 3 | @@ -97,11 +97,13 @@ 4 | public boolean attackEntityFrom(DamageSource par1, float par2) { 5 | if (!this.isEntityInvulnerable(par1) && !this.isDead) { 6 | if (!par1.isExplosion() && par1.getTrueSource() instanceof EntityPlayer) { 7 | if (!this.world.isRemote && (this.isIndependent || this.getVehicle() == null)) { 8 | this.setDead(); 9 | - this.dropCargoItem(); 10 | + if (!((EntityPlayer) par1.getTrueSource()).capabilities.isCreativeMode) { 11 | + this.dropCargoItem(); 12 | + } 13 | } 14 | 15 | return true; 16 | } else { 17 | return false; 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/train/parts/EntityCargoWithModel.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/train/parts/EntityCargoWithModel.java 2 | +++ b/jp/ngt/rtm/entity/train/parts/EntityCargoWithModel.java 3 | @@ -79,6 +79,29 @@ 4 | this.updateResourceState(); 5 | return true; 6 | } 7 | 8 | protected abstract ResourceType getSubType(); 9 | + 10 | + @Override 11 | + public void addEntityCrashInfo(net.minecraft.crash.CrashReportCategory category) { 12 | + super.addEntityCrashInfo(category); 13 | + com.anatawa12.fixRtm.rtm.entity.train.parts.EntityCargoWithModelKt.addEntityCrashInfo(this, category); 14 | + } 15 | + 16 | + 17 | + @Override 18 | + public ItemStack getPickedResult(net.minecraft.util.math.RayTraceResult target) { 19 | + if (target.entityHit instanceof EntityCargoWithModel) { 20 | + EntityCargoWithModel cargo = (EntityCargoWithModel) target.entityHit; 21 | + ItemStack itemStack = this.getItem(); 22 | + 23 | + //noinspection unchecked,rawtypes 24 | + ((jp.ngt.rtm.item.ItemWithModel) jp.ngt.rtm.RTMItem.itemCargo).setModelState(itemStack, cargo.getResourceState()); 25 | + return itemStack; 26 | + } else { 27 | + return null; 28 | + } 29 | + } 30 | + 31 | + protected abstract ItemStack getItem(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/train/parts/EntityContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/train/parts/EntityContainer.java 2 | +++ b/jp/ngt/rtm/entity/train/parts/EntityContainer.java 3 | @@ -71,11 +71,12 @@ 4 | ItemUtil.writeToNBT(nbttagcompound, this.containerSlots[i]); 5 | nbttaglist.appendTag(nbttagcompound); 6 | } 7 | } 8 | 9 | - nbt.setTag("Items", nbttaglist); 10 | + if (nbttaglist.tagCount() != 0) 11 | + nbt.setTag("Items", nbttaglist); 12 | } 13 | 14 | private NBTTagCompound getCargoNBT() { 15 | if (!this.itemCargo.hasTagCompound()) { 16 | this.itemCargo.setTagCompound(new NBTTagCompound()); 17 | @@ -262,6 +263,11 @@ 18 | } 19 | 20 | public boolean isEmpty() { 21 | return false; 22 | } 23 | + 24 | + @Override 25 | + protected ItemStack getItem() { 26 | + return new ItemStack(jp.ngt.rtm.RTMItem.itemCargo, 1, 0); 27 | + } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/train/parts/EntityFloor.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/train/parts/EntityFloor.java 2 | +++ b/jp/ngt/rtm/entity/train/parts/EntityFloor.java 3 | @@ -120,6 +120,26 @@ 4 | @SideOnly(Side.CLIENT) 5 | public int getBrightnessForRender() { 6 | EntityVehicleBase entityvehiclebase = this.getVehicle(); 7 | return entityvehiclebase != null ? entityvehiclebase.getBrightnessForRender() : super.getBrightnessForRender(); 8 | } 9 | + 10 | + @Override 11 | + public void updatePassenger(Entity passenger) { 12 | + super.updatePassenger(passenger); 13 | + 14 | + if (!this.isPassenger(passenger)) return; 15 | + 16 | + EntityVehicleBase vehicle = this.getVehicle(); 17 | + 18 | + if (!(passenger instanceof EntityPlayer) || !(vehicle instanceof jp.ngt.rtm.entity.train.EntityTrainBase)) return; 19 | + 20 | + EntityPlayer player = ((EntityPlayer) passenger); 21 | + 22 | + float yaw = net.minecraft.util.math.MathHelper.wrapDegrees(vehicle.rotationYaw - vehicle.prevRotationYaw); 23 | + float pitch = net.minecraft.util.math.MathHelper.wrapDegrees(vehicle.rotationPitch - vehicle.prevRotationPitch); 24 | + 25 | + player.renderYawOffset -= yaw; 26 | + player.rotationYaw -= yaw; 27 | + player.rotationPitch -= pitch; 28 | + } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/train/parts/EntityVehiclePart.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/train/parts/EntityVehiclePart.java 2 | +++ b/jp/ngt/rtm/entity/train/parts/EntityVehiclePart.java 3 | @@ -167,11 +167,11 @@ 4 | this.needsUpdatePos = false; 5 | } 6 | 7 | @SideOnly(Side.CLIENT) 8 | public void setPositionAndRotationDirect(double par1, double par3, double par5, float par7, float par8, int par9, boolean par10) { 9 | - if (this.getVehicle() == null || this.getVehicle().getSpeed() <= 0.0F) { 10 | + if (this.getVehicle() == null || this.getVehicle().getSpeed() == 0.0F) { 11 | this.setPosition(par1, par3, par5); 12 | this.setRotation(par7, par8); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/vehicle/EntityTrolley.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/vehicle/EntityTrolley.java 2 | +++ b/jp/ngt/rtm/entity/vehicle/EntityTrolley.java 3 | @@ -159,6 +159,12 @@ 4 | } 5 | } 6 | 7 | return true; 8 | } 9 | + 10 | + @Override 11 | + public void addEntityCrashInfo(net.minecraft.crash.CrashReportCategory category) { 12 | + super.addEntityCrashInfo(category); 13 | + com.anatawa12.fixRtm.rtm.entity.vehicle.EntityTrolleyKt.addEntityCrashInfo(this, category); 14 | + } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/vehicle/RenderVehicleBase.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/vehicle/RenderVehicleBase.java 2 | +++ b/jp/ngt/rtm/entity/vehicle/RenderVehicleBase.java 3 | @@ -44,18 +44,18 @@ 4 | } 5 | 6 | protected void renderVehicleBase(EntityVehicleBase vehicle, double par2, double par4, double par6, float par8, float par9) { 7 | GL11.glPushMatrix(); 8 | GL11.glEnable(32826); 9 | - GL11.glTranslatef((float)par2, (float)par4 + vehicle.getVehicleYOffset(), (float)par6); 10 | + GL11.glTranslated(par2, par4 + vehicle.getVehicleYOffset(), par6); 11 | float f = vehicle.prevRotationYaw + NGTMath.wrapAngle(vehicle.rotationYaw - vehicle.prevRotationYaw) * par9; 12 | GL11.glRotatef(f, 0.0F, 1.0F, 0.0F); 13 | float f1 = vehicle.prevRotationPitch + (vehicle.rotationPitch - vehicle.prevRotationPitch) * par9; 14 | GL11.glRotatef(-f1, 1.0F, 0.0F, 0.0F); 15 | float f2 = vehicle.prevRotationRoll + (vehicle.rotationRoll - vehicle.prevRotationRoll) * par9; 16 | GL11.glRotatef(f2, 0.0F, 0.0F, 1.0F); 17 | - if (Minecraft.getMinecraft().gameSettings.showDebugInfo) { 18 | + if (Minecraft.getMinecraft().getRenderManager().isDebugBoundingBox()) { 19 | this.debugCollision(vehicle); 20 | } 21 | 22 | VehicleNGTO vehiclengto = vehicle.getNGTO(); 23 | if (vehiclengto != null) { 24 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/entity/vehicle/WeatherEffectDummy.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/entity/vehicle/WeatherEffectDummy.java 2 | +++ b/jp/ngt/rtm/entity/vehicle/WeatherEffectDummy.java 3 | @@ -57,6 +57,11 @@ 4 | protected void readEntityFromNBT(NBTTagCompound compound) { 5 | } 6 | 7 | protected void writeEntityToNBT(NBTTagCompound compound) { 8 | } 9 | + 10 | + @Override 11 | + public net.minecraft.util.math.AxisAlignedBB getEntityBoundingBox() { 12 | + return this.parent.getEntityBoundingBox(); 13 | + } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/event/RTMEventHandler.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/event/RTMEventHandler.java 2 | +++ b/jp/ngt/rtm/event/RTMEventHandler.java 3 | @@ -15,15 +15,18 @@ 4 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 5 | import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; 6 | 7 | public final class RTMEventHandler { 8 | @SubscribeEvent 9 | - public void onPlayerLoggedIn(PlayerLoggedInEvent event) { 10 | + public void onServerConnectionFromClient(net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEvent event) { 11 | if (NGTUtil.isSMP() || NGTUtil.openedLANWorld()) { 12 | - ModelPackManager.INSTANCE.sendModelSetsToClient((EntityPlayerMP)event.player); 13 | + ModelPackManager.INSTANCE.sendModelSetsToClient(((net.minecraft.network.NetHandlerPlayServer)event.getHandler()).player); 14 | } 15 | + } 16 | 17 | + @SubscribeEvent 18 | + public void onPlayerLoggedIn(PlayerLoggedInEvent event) { 19 | DecorationStore.INSTANCE.loadModels(event.player.getEntityWorld()); 20 | SpeakerSounds.getInstance(true).syncSoundList(); 21 | } 22 | 23 | @SubscribeEvent 24 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/gui/GuiIngameCustom.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/gui/GuiIngameCustom.java 2 | +++ b/jp/ngt/rtm/gui/GuiIngameCustom.java 3 | @@ -210,11 +210,11 @@ 4 | float f1 = f * (float)train.brakeAirCount / 2880.0F; 5 | this.drawMeter(j, k, 32, 32, 48, f1, 512); 6 | float f2 = f * (float)this.getBrake(train) / 432.0F; 7 | this.drawMeter(j, k, 32, 0, 48, f2, 512); 8 | float f3 = (train.getResourceState().getResourceSet().getConfig()).maxSpeed[4]; 9 | - float f4 = 270.0F * train.getSpeed() / f3; 10 | + float f4 = 270.0F * Math.abs(train.getSpeed()) / f3; 11 | this.drawMeter(i - 136, this.height - 29, 32, 64, 48, f4, 512); 12 | this.drawLever(train); 13 | } 14 | 15 | private void drawLever(EntityTrainBase train) { 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/item/ItemCargo.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/item/ItemCargo.java 2 | +++ b/jp/ngt/rtm/item/ItemCargo.java 3 | @@ -96,12 +96,12 @@ 4 | default: 5 | return RTMResource.CONTAINER; 6 | } 7 | } 8 | 9 | - public int getGuiId(ItemStack stack) { 10 | - return RTMCore.guiIdSelectItemModel; 11 | + @Override @SideOnly(Side.CLIENT) public net.minecraft.client.gui.GuiScreen newGuiScreen(ItemArgHolder holder) { 12 | + return newGuiSelectModel(holder); 13 | } 14 | 15 | protected ResourceState getNewState(ItemStack itemStack, ResourceType type) { 16 | return new ResourceState(type, (Object)null); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/item/ItemNPC.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/item/ItemNPC.java 2 | +++ b/jp/ngt/rtm/item/ItemNPC.java 3 | @@ -58,12 +58,12 @@ 4 | } 5 | 6 | } 7 | } 8 | 9 | - public int getGuiId(ItemStack stack) { 10 | - return RTMCore.guiIdSelectItemModel; 11 | + @Override @SideOnly(Side.CLIENT) public net.minecraft.client.gui.GuiScreen newGuiScreen(ItemArgHolder holder) { 12 | + return newGuiSelectModel(holder); 13 | } 14 | 15 | protected ResourceType getModelType(ItemStack itemStack) { 16 | return itemStack.getItemDamage() == 1 ? RTMResource.NPC : null; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/item/ItemVehicle.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/item/ItemVehicle.java 2 | +++ b/jp/ngt/rtm/item/ItemVehicle.java 3 | @@ -167,12 +167,12 @@ 4 | } 5 | 6 | return RTMResource.VEHICLE_CAR; 7 | } 8 | 9 | - public int getGuiId(ItemStack stack) { 10 | - return RTMCore.guiIdSelectItemModel; 11 | + @Override @SideOnly(Side.CLIENT) public net.minecraft.client.gui.GuiScreen newGuiScreen(ItemArgHolder holder) { 12 | + return newGuiSelectModel(holder); 13 | } 14 | 15 | protected ResourceState getNewState(ItemStack itemStack, ResourceType type) { 16 | return new ResourceState(type, (Object)null); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/item/ItemWire.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/item/ItemWire.java 2 | +++ b/jp/ngt/rtm/item/ItemWire.java 3 | @@ -15,12 +15,12 @@ 4 | 5 | protected ResourceType getModelType(ItemStack itemStack) { 6 | return RTMResource.WIRE; 7 | } 8 | 9 | - public int getGuiId(ItemStack stack) { 10 | - return RTMCore.guiIdSelectItemModel; 11 | + @net.minecraftforge.fml.relauncher.SideOnly(net.minecraftforge.fml.relauncher.Side.CLIENT) public net.minecraft.client.gui.GuiScreen newGuiScreen(ItemArgHolder holder) { 12 | + return newGuiSelectModel(holder); 13 | } 14 | 15 | protected ResourceState getNewState(ItemStack itemStack, ResourceType type) { 16 | return new ResourceState(type, (Object)null); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/cfg/ResourceConfig.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/cfg/ResourceConfig.java 2 | +++ b/jp/ngt/rtm/modelpack/cfg/ResourceConfig.java 3 | @@ -5,10 +5,11 @@ 4 | public abstract class ResourceConfig { 5 | public short version; 6 | public boolean useCustomColor; 7 | public String tags; 8 | public ResourceConfig.DMInitValue[] defaultValues; 9 | + public java.io.File file; 10 | /** @deprecated */ 11 | @Deprecated 12 | public String defaultData; 13 | 14 | public abstract String getName(); 15 | @@ -28,14 +29,18 @@ 16 | } 17 | 18 | } 19 | 20 | protected String fixSoundPath(String path) { 21 | + return fixSoundPath(path, null); 22 | + } 23 | + 24 | + protected String fixSoundPath(String path, String defaults) { 25 | if (path != null && path.length() != 0) { 26 | return !path.contains(":") ? "rtm:" + path : path; 27 | } else { 28 | - return null; 29 | + return defaults; 30 | } 31 | } 32 | 33 | public class DMInitValue { 34 | public String type; 35 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig.java 2 | +++ b/jp/ngt/rtm/modelpack/cfg/VehicleBaseConfig.java 3 | @@ -17,10 +17,17 @@ 4 | public String sound_Deceleration; 5 | public String sound_D_S; 6 | public String sound_Horn; 7 | public String sound_DoorOpen; 8 | public String sound_DoorClose; 9 | + 10 | + /** 11 | + * ATSのサウンド 12 | + */ 13 | + public String sound_ATSChime; 14 | + public String sound_ATSBell; 15 | + 16 | public String[][] sound_Announcement; 17 | public String soundScriptPath; 18 | public Object[][] smoke; 19 | public VehicleBaseConfig.Light[] headLights; 20 | public VehicleBaseConfig.Light[] tailLights; 21 | @@ -45,10 +52,12 @@ 22 | this.sound_Deceleration = this.fixSoundPath(this.sound_Deceleration); 23 | this.sound_D_S = this.fixSoundPath(this.sound_D_S); 24 | this.sound_Horn = this.fixSoundPath(this.sound_Horn); 25 | this.sound_DoorOpen = this.fixSoundPath(this.sound_DoorOpen); 26 | this.sound_DoorClose = this.fixSoundPath(this.sound_DoorClose); 27 | + this.sound_ATSChime = this.fixSoundPath(this.sound_ATSChime, "rtm:sounds/train/ats.ogg"); 28 | + this.sound_ATSBell = this.fixSoundPath(this.sound_ATSBell, "rtm:sounds/train/ats_bell.ogg"); 29 | if (this.sound_Announcement != null) { 30 | for(int i = 0; i < this.sound_Announcement.length; ++i) { 31 | this.sound_Announcement[i][1] = this.fixSoundPath(this.sound_Announcement[i][1]); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/modelset/ModelSetNPC.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/modelset/ModelSetNPC.java 2 | +++ b/jp/ngt/rtm/modelpack/modelset/ModelSetNPC.java 3 | @@ -44,10 +44,11 @@ 4 | 5 | public NPCConfig getDummyConfig() { 6 | return NPCConfig.getDummy(); 7 | } 8 | 9 | + // TODO: CrashReport when use java 10 | @SideOnly(Side.CLIENT) 11 | public void renderModelInGui(Minecraft par1) { 12 | if (this.modelObj != null) { 13 | this.modelObj.render((Object)null, this.getConfig(), 0, 0.0F); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/modelset/ModelSetSignal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/modelset/ModelSetSignal.java 2 | +++ b/jp/ngt/rtm/modelpack/modelset/ModelSetSignal.java 3 | @@ -43,10 +43,11 @@ 4 | 5 | public SignalConfig getDummyConfig() { 6 | return SignalConfig.getDummyConfig(); 7 | } 8 | 9 | + // TODO: CrashReport when use java 10 | @SideOnly(Side.CLIENT) 11 | public void renderModelInGui(Minecraft par1) { 12 | SignalConfig signalconfig = this.getConfig(); 13 | this.modelObj.render((Object)null, signalconfig, 0, 0.0F); 14 | this.modelObj.render((Object)null, signalconfig, 1, 0.0F); 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/modelset/ModelSetTrain.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/modelset/ModelSetTrain.java 2 | +++ b/jp/ngt/rtm/modelpack/modelset/ModelSetTrain.java 3 | @@ -48,10 +48,11 @@ 4 | 5 | public TrainConfig getDummyConfig() { 6 | return TrainConfig.getDummyConfig(); 7 | } 8 | 9 | + // TODO: CrashReport when use java 10 | @SideOnly(Side.CLIENT) 11 | protected void renderPartsInGui(Minecraft par1) { 12 | TrainConfig trainconfig = this.cfg; 13 | 14 | for(int i = 0; i < 2; ++i) { 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/modelset/ResourceSet.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/modelset/ResourceSet.java 2 | +++ b/jp/ngt/rtm/modelpack/modelset/ResourceSet.java 3 | @@ -8,10 +8,11 @@ 4 | public abstract class ResourceSet { 5 | protected final T cfg; 6 | public final DataFormatter dataFormatter; 7 | private boolean isDummySet; 8 | public byte[] md5; 9 | + public com.anatawa12.fixRtm.rtm.modelpack.ModelState state = com.anatawa12.fixRtm.rtm.modelpack.ModelState.INITIALIZED; 10 | 11 | public ResourceSet() { 12 | this.cfg = this.getDummyConfig(); 13 | this.dataFormatter = new DataFormatter(this.cfg); 14 | this.isDummySet = true; 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/state/DataEntry.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/state/DataEntry.java 2 | +++ b/jp/ngt/rtm/modelpack/state/DataEntry.java 3 | @@ -29,12 +29,12 @@ 4 | return new DataEntryInt(j, flag); 5 | } else if (datatype == DataType.DOUBLE) { 6 | double d0 = data.isEmpty() ? 0.0D : Double.valueOf(data); 7 | return new DataEntryDouble(d0, flag); 8 | } else if (datatype == DataType.BOOLEAN) { 9 | - boolean flag = data.isEmpty() ? false : Boolean.valueOf(data); 10 | - return new DataEntryBoolean(flag, flag); 11 | + boolean f = data.isEmpty() ? false : Boolean.valueOf(data); 12 | + return new DataEntryBoolean(f, flag); 13 | } else if (datatype == DataType.STRING) { 14 | return new DataEntryString(data, flag); 15 | } else if (datatype == DataType.VEC) { 16 | Vec3 vec3 = DataEntryVec.fromString(data); 17 | return new DataEntryVec(vec3, flag); 18 | @@ -43,6 +43,11 @@ 19 | return new DataEntryHex(i, flag); 20 | } else { 21 | return null; 22 | } 23 | } 24 | + 25 | + @Override 26 | + public String toString() { 27 | + return data.toString(); 28 | + } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/state/DataEntryVec.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/state/DataEntryVec.java 2 | +++ b/jp/ngt/rtm/modelpack/state/DataEntryVec.java 3 | @@ -24,9 +24,10 @@ 4 | public String toString() { 5 | return "" + this.data.getX() + " " + this.data.getY() + " " + this.data.getZ(); 6 | } 7 | 8 | public static Vec3 fromString(String par1) { 9 | + if (par1.isEmpty()) return new Vec3(0, 0, 0); 10 | String[] astring = par1.split(" "); 11 | return new Vec3(Double.valueOf(astring[0]), Double.valueOf(astring[1]), Double.valueOf(astring[2])); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/state/DataMap.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/state/DataMap.java 2 | +++ b/jp/ngt/rtm/modelpack/state/DataMap.java 3 | @@ -134,17 +134,17 @@ 4 | 5 | private void set(String key, DataEntry value, int flag) { 6 | if (!this.dataFormatter.check(key, value)) { 7 | NGTLog.debug("Invalid data : %s=%s", new Object[]{key, value.toString()}); 8 | } else { 9 | - boolean flag = (flag & 1) != 0; 10 | + boolean flag2 = (flag & 1) != 0; 11 | boolean flag1 = NGTUtil.isServer(); 12 | - if (flag1 || !flag || this.entity == null) { 13 | + if (flag1 || !flag2 || this.entity == null) { 14 | this.map.put(key, value); 15 | } 16 | 17 | - if (flag) { 18 | + if (flag2) { 19 | this.sendPacket(key, value, flag1); 20 | } 21 | 22 | } 23 | } 24 | @@ -182,11 +182,11 @@ 25 | ++i; 26 | stringbuilder.append(entry.getKey()); 27 | stringbuilder.append("=("); 28 | stringbuilder.append(entry.getValue().getType().key); 29 | stringbuilder.append(")"); 30 | - stringbuilder.append((entry.getValue()).data.toString()); 31 | + stringbuilder.append((entry.getValue()).toString()); 32 | if (i < this.map.size()) { 33 | stringbuilder.append(","); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/modelpack/state/ResourceState.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/modelpack/state/ResourceState.java 2 | +++ b/jp/ngt/rtm/modelpack/state/ResourceState.java 3 | @@ -84,11 +84,11 @@ 4 | this.setResourceName(this.type.defaultName); 5 | } 6 | 7 | public T getResourceSet() { 8 | if (this.modelSet == null || this.modelSet.isDummy()) { 9 | - this.modelSet = ModelPackManager.INSTANCE.getResourceSet(this.type, this.modelName); 10 | + this.modelSet = (T)com.anatawa12.fixRtm.rtm.HooksKt.eraseNullForModelSet(ModelPackManager.INSTANCE.getResourceSet(this.type, this.modelName), this.type); 11 | if (!this.modelSet.isDummy()) { 12 | this.modelSet.dataFormatter.initDataMap(this.dataMap); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketFormation.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketFormation.java 2 | +++ b/jp/ngt/rtm/network/PacketFormation.java 3 | @@ -31,10 +31,13 @@ 4 | this.formationId = buffer.readLong(); 5 | this.data = ByteBufUtils.readTag(buffer); 6 | } 7 | 8 | public IMessage onMessage(PacketFormation message, MessageContext ctx) { 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnMainThread(ctx.side, () -> doMessage(message)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketFormation message) { 13 | Formation formation = Formation.readFromNBT(message.data, true); 14 | FormationManager.getInstance().setFormation(message.formationId, formation); 15 | - return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketMarker.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketMarker.java 2 | +++ b/jp/ngt/rtm/network/PacketMarker.java 3 | @@ -49,14 +49,16 @@ 4 | } 5 | 6 | } 7 | 8 | public IMessage onMessage(PacketMarker message, MessageContext ctx) { 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnClientThread(() -> doMessage(message)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketMarker message) { 13 | World world = NGTUtil.getClientWorld(); 14 | TileEntity tileentity = message.getTileEntity(world); 15 | if (tileentity instanceof TileEntityMarker) { 16 | ((TileEntityMarker)tileentity).setMarkersPos(message.list); 17 | } 18 | - 19 | - return null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketModelPack.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketModelPack.java 2 | +++ b/jp/ngt/rtm/network/PacketModelPack.java 3 | @@ -40,11 +40,12 @@ 4 | int j = buffer.writerIndex() - buffer.readerIndex(); 5 | if (i > j) { 6 | i = j; 7 | } 8 | 9 | - this.bytes = buffer.readBytes(i).array(); 10 | + this.bytes = new byte[i]; 11 | + buffer.readBytes(bytes); 12 | } 13 | 14 | public IMessage onMessage(PacketModelPack message, MessageContext ctx) { 15 | MP_WRITER.onPacket(message.name, message.size, message.bytes); 16 | return null; 17 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketMoveMM.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketMoveMM.java 2 | +++ b/jp/ngt/rtm/network/PacketMoveMM.java 3 | @@ -48,13 +48,15 @@ 4 | this.moveY = buffer.readDouble(); 5 | this.moveZ = buffer.readDouble(); 6 | } 7 | 8 | public IMessage onMessage(PacketMoveMM message, MessageContext ctx) { 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnClientThread(() -> doMessage(message)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketMoveMM message) { 13 | World world = NGTUtil.getClientWorld(); 14 | if (world != null) { 15 | EntityMMBoundingBox.handleMMMovement(world, message.entityIds, message.moveX, message.moveY, message.moveZ); 16 | } 17 | - 18 | - return null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketMovingMachine.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketMovingMachine.java 2 | +++ b/jp/ngt/rtm/network/PacketMovingMachine.java 3 | @@ -57,10 +57,13 @@ 4 | this.v = buffer.readBoolean(); 5 | } 6 | 7 | public IMessage onMessage(PacketMovingMachine message, MessageContext ctx) { 8 | World world = ctx.getServerHandler().player.world; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, world)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketMovingMachine message, World world) { 13 | TileEntityMovingMachine tileentitymovingmachine = (TileEntityMovingMachine)message.getTileEntity(world); 14 | tileentitymovingmachine.setData(message.w, message.h, message.d, message.x, message.y, message.z, message.s, message.v); 15 | - return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketNoticeHandlerServer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketNoticeHandlerServer.java 2 | +++ b/jp/ngt/rtm/network/PacketNoticeHandlerServer.java 3 | @@ -22,10 +22,14 @@ 4 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 5 | 6 | public class PacketNoticeHandlerServer implements IMessageHandler { 7 | public IMessage onMessage(PacketNotice message, MessageContext ctx) { 8 | EntityPlayer entityplayer = ctx.getServerHandler().player; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, entityplayer)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketNotice message, EntityPlayer entityplayer) { 13 | World world = entityplayer.world; 14 | String s = message.notice; 15 | if ((message.type & 1) == 0) { 16 | if (s.equals("isConnected")) { 17 | RTMCore.NETWORK_WRAPPER.sendToAll(new PacketNotice((byte)1, "setConnected")); 18 | @@ -84,9 +88,7 @@ 19 | } 20 | } else if (s.startsWith("speaker")) { 21 | SpeakerSounds.getInstance(true).onGetPacket(s, true); 22 | } 23 | } 24 | - 25 | - return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketPlaySound.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketPlaySound.java 2 | +++ b/jp/ngt/rtm/network/PacketPlaySound.java 3 | @@ -47,10 +47,14 @@ 4 | this.volume = buffer.readFloat(); 5 | this.pitch = buffer.readFloat(); 6 | } 7 | 8 | public IMessage onMessage(PacketPlaySound message, MessageContext ctx) { 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnClientThread(() -> doMessage(message)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketPlaySound message) { 13 | World world = NGTUtil.getClientWorld(); 14 | if (message.forEntity()) { 15 | Entity entity = message.getEntity(world); 16 | if (entity != null) { 17 | RTMCore.proxy.playSound(entity, message.sound, message.volume, message.pitch); 18 | @@ -59,9 +63,7 @@ 19 | TileEntity tileentity = message.getTileEntity(world); 20 | if (tileentity != null) { 21 | RTMCore.proxy.playSound(tileentity, message.sound, message.volume, message.pitch); 22 | } 23 | } 24 | - 25 | - return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketRTMKey.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketRTMKey.java 2 | +++ b/jp/ngt/rtm/network/PacketRTMKey.java 3 | @@ -35,10 +35,13 @@ 4 | this.sound = ByteBufUtils.readUTF8String(buffer); 5 | } 6 | 7 | public IMessage onMessage(PacketRTMKey message, MessageContext ctx) { 8 | World world = ctx.getServerHandler().player.world; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, world)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketRTMKey message, World world) { 13 | EntityPlayer entityplayer = world.getPlayerEntityByName(message.playerName); 14 | RTMKeyHandlerServer.INSTANCE.onKeyDown(entityplayer, message.keyId, message.sound); 15 | - return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketSelectResource.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketSelectResource.java 2 | +++ b/jp/ngt/rtm/network/PacketSelectResource.java 3 | @@ -41,10 +41,14 @@ 4 | this.data = ByteBufUtils.readTag(buffer); 5 | } 6 | 7 | public IMessage onMessage(PacketSelectResource message, MessageContext ctx) { 8 | EntityPlayer entityplayer = ctx.getServerHandler().player; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, entityplayer)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketSelectResource message, EntityPlayer entityplayer) { 13 | World world = entityplayer.world; 14 | IResourceSelector iresourceselector = null; 15 | if (message.pos[1] >= 0) { 16 | try { 17 | TileEntity tileentity = BlockUtil.getTileEntity(world, message.pos[0], message.pos[1], message.pos[2]); 18 | @@ -67,9 +71,7 @@ 19 | iresourceselector.updateResourceState(); 20 | } else { 21 | iresourceselector.updateResourceState(); 22 | } 23 | } 24 | - 25 | - return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketSetTrainState.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketSetTrainState.java 2 | +++ b/jp/ngt/rtm/network/PacketSetTrainState.java 3 | @@ -36,14 +36,16 @@ 4 | this.stateData = buffer.readByte(); 5 | } 6 | 7 | public IMessage onMessage(PacketSetTrainState message, MessageContext ctx) { 8 | EntityPlayer entityplayer = ctx.getServerHandler().player; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, entityplayer)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketSetTrainState message, EntityPlayer entityplayer) { 13 | World world = entityplayer.world; 14 | Entity entity = message.getEntity(world); 15 | if (entity instanceof EntityVehicleBase) { 16 | ((EntityVehicleBase)entity).setVehicleState(message.stateId, message.stateData); 17 | } 18 | - 19 | - return null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketSignal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketSignal.java 2 | +++ b/jp/ngt/rtm/network/PacketSignal.java 3 | @@ -30,14 +30,17 @@ 4 | super.fromBytes(buffer); 5 | this.level = buffer.readInt(); 6 | } 7 | 8 | public IMessage onMessage(PacketSignal message, MessageContext ctx) { 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnClientThread(() -> doMessage(message)); 10 | + return null; 11 | + } 12 | + 13 | + private void doMessage(PacketSignal message) { 14 | World world = NGTUtil.getClientWorld(); 15 | TileEntity tileentity = message.getTileEntity(world); 16 | if (tileentity instanceof TileEntitySignal) { 17 | ((TileEntitySignal)tileentity).setSignal(message.level); 18 | } 19 | - 20 | - return null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketSignalConverter.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketSignalConverter.java 2 | +++ b/jp/ngt/rtm/network/PacketSignalConverter.java 3 | @@ -37,10 +37,13 @@ 4 | this.signal2 = buffer.readInt(); 5 | } 6 | 7 | public IMessage onMessage(PacketSignalConverter message, MessageContext ctx) { 8 | World world = ctx.getServerHandler().player.world; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, world)); 10 | + return null; 11 | + } 12 | + private void doMessage(PacketSignalConverter message, World world) { 13 | TileEntitySignalConverter tileentitysignalconverter = (TileEntitySignalConverter)message.getTileEntity(world); 14 | tileentitysignalconverter.setSignalProp(message.signal1, message.signal2, TileEntitySignalConverter.ComparatorType.getType(message.comparatorIndex)); 15 | - return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketSyncItem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketSyncItem.java 2 | +++ b/jp/ngt/rtm/network/PacketSyncItem.java 3 | @@ -35,14 +35,17 @@ 4 | this.slotNumber = buffer.readInt(); 5 | } 6 | 7 | public IMessage onMessage(PacketSyncItem message, MessageContext ctx) { 8 | World world = ctx.getServerHandler().player.world; 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnServerThread(() -> doMessage(message, world)); 10 | + return null; 11 | + } 12 | + 13 | + public void doMessage(PacketSyncItem message, World world) { 14 | EntityPlayer entityplayer = world.getPlayerEntityByName(message.playerName); 15 | if (entityplayer != null) { 16 | entityplayer.openContainer.getSlot(message.slotNumber).putStack(message.item); 17 | entityplayer.openContainer.detectAndSendChanges(); 18 | } 19 | - 20 | - return null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/network/PacketVehicleMovement.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/network/PacketVehicleMovement.java 2 | +++ b/jp/ngt/rtm/network/PacketVehicleMovement.java 3 | @@ -74,16 +74,20 @@ 4 | this.vehicleRoll = buffer.readFloat(); 5 | this.vehicleSpeed = buffer.readFloat(); 6 | } 7 | 8 | public IMessage onMessage(PacketVehicleMovement message, MessageContext ctx) { 9 | + com.anatawa12.fixRtm.ThreadUtil.runOnClientThread(() -> this.doMessage(message)); 10 | + return null; 11 | + } 12 | + 13 | + private void doMessage(PacketVehicleMovement message) { 14 | World world = NGTUtil.getClientWorld(); 15 | if (world == null) { 16 | - return null; 17 | + return; 18 | } else if (message.vehicleY < 0) { 19 | this.deleteEntity(world, message.entityId); 20 | - return null; 21 | } else { 22 | Entity entity = world.getEntityByID(message.entityId); 23 | if (entity != null && !entity.isDead) { 24 | double d0 = (double)message.vehicleX * 0.03125D; 25 | double d1 = (double)message.vehicleY * 0.03125D; 26 | @@ -98,12 +102,10 @@ 27 | ((EntityBogie)entity).setRoll(message.vehicleRoll); 28 | } 29 | } else { 30 | NGTLog.debug("[PVM] Entity is null or dead %d", new Object[]{message.entityId}); 31 | } 32 | - 33 | - return null; 34 | } 35 | } 36 | 37 | private void deleteEntity(World world, int id) { 38 | Entity entity = world.getEntityByID(id); 39 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/rail/RenderTurntable.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/rail/RenderTurntable.java 2 | +++ b/jp/ngt/rtm/rail/RenderTurntable.java 3 | @@ -28,11 +28,12 @@ 4 | RenderLargeRail.BLOCK_RENDERER.renderRailBlocks(rail, par2, par4, par6, par8); 5 | GLHelper.enableLighting(); 6 | NGTUtilClient.getMinecraft().entityRenderer.enableLightmap(); 7 | GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 8 | GL11.glTranslatef((float)(par2 + 0.5D), (float)par4, (float)(par6 + 0.5D)); 9 | - GL11.glRotatef(rail.getRotation(), 0.0F, 1.0F, 0.0F); 10 | + float rot = rail.getPrevRotation() + (net.minecraft.util.math.MathHelper.wrapDegrees(rail.getRotation() - rail.getPrevRotation())) * par8; 11 | + GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F); 12 | GL11.glTranslatef(-((float)(par2 + 0.5D)), -((float)par4), -((float)(par6 + 0.5D))); 13 | 14 | try { 15 | RailPartsRendererBase railpartsrendererbase = (RailPartsRendererBase)modelsetrail.modelObj.renderer; 16 | railpartsrendererbase.renderRail(rail, 0, par2, par4, par6, par8); 17 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/rail/TileEntityLargeRailBase.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/rail/TileEntityLargeRailBase.java 2 | +++ b/jp/ngt/rtm/rail/TileEntityLargeRailBase.java 3 | @@ -151,10 +151,11 @@ 4 | int j = x + (i != 1 && i != 2 ? 0 : 1); 5 | int k = z + (i != 0 && i != 1 ? 0 : 1); 6 | double d0 = Double.MAX_VALUE; 7 | 8 | for(RailMap railmap : arailmap) { 9 | + if (railmap == null) return null; 10 | int l = railmap.getNearlestPoint(128, (double)j, (double)k); 11 | if (l < 0) { 12 | l = 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/rail/TileEntityLargeRailSwitchCore.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/rail/TileEntityLargeRailSwitchCore.java 2 | +++ b/jp/ngt/rtm/rail/TileEntityLargeRailSwitchCore.java 3 | @@ -25,10 +25,11 @@ 4 | 5 | for(int i = 0; i < b0; ++i) { 6 | this.railPositions[i] = RailPosition.readFromNBT(nbt.getCompoundTag("RP" + i)); 7 | } 8 | 9 | + this.fixRTMRailMapVersion = nbt.getInteger("fixRTMRailMapVersion"); 10 | } 11 | 12 | private RailPosition getRP(int x, int y, int z, byte dir, boolean b) { 13 | RailPosition railposition = new RailPosition(x, y, z, dir, (byte)(b ? 1 : 0)); 14 | railposition.anchorYaw = NGTMath.wrapAngle((float)dir * 45.0F); 15 | @@ -40,20 +41,21 @@ 16 | 17 | for(int i = 0; i < this.railPositions.length; ++i) { 18 | nbt.setTag("RP" + i, this.railPositions[i].writeToNBT()); 19 | } 20 | 21 | + nbt.setInteger("fixRTMRailMapVersion", this.fixRTMRailMapVersion); 22 | } 23 | 24 | public void setRailPositions(RailPosition[] par1) { 25 | super.setRailPositions(par1); 26 | this.onBlockChanged(); 27 | } 28 | 29 | public void createRailMap() { 30 | if (this.isLoaded() && this.switchObj == null) { 31 | - this.switchObj = (new RailMaker(this.getWorld(), this.railPositions)).getSwitch(); 32 | + this.switchObj = (new RailMaker(this.getWorld(), this.railPositions, this.fixRTMRailMapVersion)).getSwitch(); 33 | } 34 | 35 | } 36 | 37 | public SwitchType getSwitch() { 38 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/rail/util/MarkerState.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/rail/util/MarkerState.java 2 | +++ b/jp/ngt/rtm/rail/util/MarkerState.java 3 | @@ -3,11 +3,13 @@ 4 | public enum MarkerState { 5 | DISTANCE, 6 | GRID, 7 | LINE1, 8 | LINE2, 9 | - ANCHOR21; 10 | + ANCHOR21, 11 | + FIT_NEIGHBOR, 12 | + ; 13 | 14 | private int bitMask() { 15 | return 1 << this.ordinal(); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/rail/util/RailMapSwitch.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/rail/util/RailMapSwitch.java 2 | +++ b/jp/ngt/rtm/rail/util/RailMapSwitch.java 3 | @@ -3,12 +3,18 @@ 4 | public final class RailMapSwitch extends RailMapBasic { 5 | public final RailDir startDir; 6 | public final RailDir endDir; 7 | private boolean isOpen; 8 | 9 | + /** @deprecated use {@link #RailMapSwitch(RailPosition, RailPosition, RailDir, RailDir, int)} */ 10 | + @Deprecated 11 | public RailMapSwitch(RailPosition par1, RailPosition par2, RailDir sDir, RailDir eDir) { 12 | - super(par1, par2); 13 | + this(par1, par2, sDir, eDir, 0); 14 | + com.anatawa12.fixRtm.Deprecation.found("RailMapSwitch#RailMapSwitch"); 15 | + } 16 | + public RailMapSwitch(RailPosition par1, RailPosition par2, RailDir sDir, RailDir eDir, int version) { 17 | + super(par1, par2, version); 18 | this.startDir = sDir; 19 | this.endDir = eDir; 20 | } 21 | 22 | /** @deprecated */ 23 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/rail/util/RailMapTurntable.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/rail/util/RailMapTurntable.java 2 | +++ b/jp/ngt/rtm/rail/util/RailMapTurntable.java 3 | @@ -10,12 +10,20 @@ 4 | public final int centerY; 5 | public final int centerZ; 6 | public final int radius; 7 | private float rotation; 8 | 9 | + 10 | + /** @deprecated use {@link #RailMapTurntable(RailPosition, RailPosition, int, int, int, int, int)} */ 11 | + @Deprecated 12 | public RailMapTurntable(RailPosition par1, RailPosition par2, int x, int y, int z, int r) { 13 | - super(par1, par2); 14 | + this(par1, par2, x, y, z, r, 0); 15 | + com.anatawa12.fixRtm.Deprecation.found("RailMapTurntable#RailMapTurntable"); 16 | + } 17 | + 18 | + public RailMapTurntable(RailPosition par1, RailPosition par2, int x, int y, int z, int r, int version) { 19 | + super(par1, par2, version); 20 | this.centerX = x; 21 | this.centerY = y; 22 | this.centerZ = z; 23 | this.radius = r; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/render/RTMRenderers.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/render/RTMRenderers.java 2 | +++ b/jp/ngt/rtm/render/RTMRenderers.java 3 | @@ -9,14 +9,13 @@ 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | 6 | @SideOnly(Side.CLIENT) 7 | public final class RTMRenderers { 8 | public static R getRendererWithScript(ResourceLocation par1, String... args) { 9 | - String s = ModelPackManager.INSTANCE.getScript(par1.getPath()); 10 | - ScriptEngine scriptengine = ScriptUtil.doScript(s); 11 | + ScriptEngine scriptengine = com.anatawa12.fixRtm.scripting.FIXScriptUtil.getScriptAndDoScript(par1.toString()); 12 | String s1 = (String)ScriptUtil.getScriptField(scriptengine, "renderClass"); 13 | - R r = getRenderer(s1, args); 14 | + R r = (R)getRenderer(s1, args); 15 | r.setScript(scriptengine, par1); 16 | scriptengine.put("renderer", r); 17 | return r; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/sound/MovingSoundMaker.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/sound/MovingSoundMaker.java 2 | +++ b/jp/ngt/rtm/sound/MovingSoundMaker.java 3 | @@ -93,10 +93,11 @@ 4 | 5 | try { 6 | String s = NGTText.getText(new ResourceLocation(domain, "sounds.json"), true); 7 | Map map1 = (Map)NGTJson.getGson().fromJson(s, TYPE); 8 | 9 | + com.anatawa12.fixRtm.rtm.HooksKt.MovingSoundMaker_loadSoundJson_nullCheck(map, domain); 10 | for(Entry entry : map1.entrySet()) { 11 | if (!(entry.getValue()).sounds.isEmpty()) { 12 | Object object = (entry.getValue()).sounds.get(0); 13 | String s1; 14 | if (object instanceof Map) { 15 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/sound/MovingSoundTrain.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/sound/MovingSoundTrain.java 2 | +++ b/jp/ngt/rtm/sound/MovingSoundTrain.java 3 | @@ -17,11 +17,11 @@ 4 | super.update(); 5 | if (this.changePitch) { 6 | EntityTrainBase entitytrainbase = (EntityTrainBase)this.entity; 7 | ModelSetTrain modelsettrain = entitytrainbase.getResourceState().getResourceSet(); 8 | float f = (modelsettrain.getConfig()).maxSpeed[0]; 9 | - float f1 = (entitytrainbase.getSpeed() - f) / ((modelsettrain.getConfig()).maxSpeed[4] - f) + 1.0F; 10 | + float f1 = (Math.abs(entitytrainbase.getSpeed()) - f) / ((modelsettrain.getConfig()).maxSpeed[4] - f) + 1.0F; 11 | this.pitch = f1; 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/sound/SoundPlayer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/sound/SoundPlayer.java 2 | +++ b/jp/ngt/rtm/sound/SoundPlayer.java 3 | @@ -33,11 +33,11 @@ 4 | this.stopSound(); 5 | } 6 | 7 | this.sound = MovingSoundMaker.create(tile, sound, repeat); 8 | if (this.sound != null) { 9 | - this.sound.setVolume(10.0F); 10 | + this.sound.setVolume(4.0F); 11 | ClientProxy.playSound(this.sound, 10.0F, 1.0F); 12 | } 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/main/rtm-patches/jp/ngt/rtm/world/RTMChunkManager.java.patch: -------------------------------------------------------------------------------- 1 | --- a/jp/ngt/rtm/world/RTMChunkManager.java 2 | +++ b/jp/ngt/rtm/world/RTMChunkManager.java 3 | @@ -39,18 +39,11 @@ 4 | } 5 | 6 | } 7 | 8 | public void getChunksAround(Set set, int xChunk, int zChunk, int radius) { 9 | - set.clear(); 10 | - 11 | - for(int i = xChunk - radius; i <= xChunk + radius; ++i) { 12 | - for(int j = zChunk - radius; j <= zChunk + radius; ++j) { 13 | - set.add(new ChunkPos(i, j)); 14 | - } 15 | - } 16 | - 17 | + com.anatawa12.fixRtm.rtm.world.RTMChunkManagerKt.getChunksAround(set, xChunk, zChunk, radius); 18 | } 19 | 20 | public Ticket getNewTicket(World world, Type type) { 21 | return ForgeChunkManager.requestTicket(RTMCore.instance, world, type); 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/anatawa12/fixRtm/utils/SortedSetListViewTest.kt: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2021 anatawa12 and other contributors 2 | /// This file is part of fixRTM, released under GNU LGPL v3 with few exceptions 3 | /// See LICENSE at https://github.com/fixrtm/fixRTM for more details 4 | 5 | package com.anatawa12.fixRtm.utils 6 | 7 | import org.junit.jupiter.api.Assertions.* 8 | import org.junit.jupiter.api.Test 9 | import java.util.* 10 | 11 | class SortedSetListViewTest { 12 | @Test 13 | fun test() { 14 | val sortedSet = TreeSet(setOf( 15 | "abc", 16 | "def", 17 | "ghi", 18 | "jkl", 19 | )) 20 | val sortedList = SortedSetListView(sortedSet) 21 | assertEquals("abc", sortedList[0]) 22 | assertEquals("def", sortedList[1]) 23 | assertEquals("ghi", sortedList[2]) 24 | assertEquals("jkl", sortedList[3]) 25 | 26 | val subList = sortedList.subList(1, 3) 27 | assertEquals("def", subList[0]) 28 | assertEquals("ghi", subList[1]) 29 | 30 | val listIter = sortedList.listIterator(2) 31 | assertEquals("ghi", listIter.next()) 32 | assertEquals("jkl", listIter.next()) 33 | assertEquals(4, listIter.nextIndex()) 34 | assertEquals("jkl", listIter.previous()) 35 | assertEquals("ghi", listIter.previous()) 36 | assertEquals("def", listIter.previous()) 37 | assertEquals("abc", listIter.previous()) 38 | assertEquals(0, listIter.nextIndex()) 39 | assertEquals(-1, listIter.previousIndex()) 40 | } 41 | } 42 | --------------------------------------------------------------------------------