├── .editorconfig ├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── dependencies.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── repositories.gradle ├── settings.gradle └── src └── main ├── java └── jss │ ├── bugtorch │ ├── BugTorch.java │ ├── config │ │ └── BugTorchConfig.java │ ├── ducks │ │ └── IOffsetDuck.java │ ├── listeners │ │ └── ButtonManager.java │ ├── mixinplugin │ │ ├── BugTorchEarlyMixins.java │ │ └── BugTorchLateMixins.java │ ├── mixins │ │ ├── early │ │ │ ├── cofhcore │ │ │ │ └── fix │ │ │ │ │ └── MixinInventoryHelper.java │ │ │ └── minecraft │ │ │ │ ├── backport │ │ │ │ ├── MixinBlockDeadBush.java │ │ │ │ ├── MixinBlockWeb.java │ │ │ │ ├── MixinEntityMinecartTNT.java │ │ │ │ ├── MixinItemEnderPearl.java │ │ │ │ └── MixinItemFireball.java │ │ │ │ ├── fastrandom │ │ │ │ ├── MixinBlockChest.java │ │ │ │ ├── MixinBlockHopper.java │ │ │ │ ├── MixinEffectRenderer.java │ │ │ │ ├── MixinEntity.java │ │ │ │ ├── MixinItem.java │ │ │ │ ├── MixinMinecraftServer.java │ │ │ │ ├── MixinRenderItem.java │ │ │ │ ├── MixinWorld.java │ │ │ │ └── MixinWorldClient.java │ │ │ │ ├── fix │ │ │ │ ├── MixinBlockLeaves.java │ │ │ │ ├── MixinBlockLiquid.java │ │ │ │ ├── MixinBlockSilverfish.java │ │ │ │ ├── MixinContainer.java │ │ │ │ ├── MixinEntityLeashKnot.java │ │ │ │ ├── MixinItemLilyPad.java │ │ │ │ ├── MixinSoundManager.java │ │ │ │ ├── MixinVillageSiege.java │ │ │ │ ├── MixinWorldGenCanopyTree.java │ │ │ │ └── block │ │ │ │ │ └── MixinSoundTypeAnvil.java │ │ │ │ ├── logcleanup │ │ │ │ ├── MixinEntity.java │ │ │ │ ├── MixinNetHandlerPlayClient.java │ │ │ │ └── MixinNioSocketChannel.java │ │ │ │ ├── optimization │ │ │ │ ├── MixinBlock.java │ │ │ │ ├── MixinBlockChest.java │ │ │ │ ├── MixinBlockHopper.java │ │ │ │ ├── MixinBlockRedstoneTorch.java │ │ │ │ ├── MixinBlockSnow.java │ │ │ │ ├── MixinBlockSnowBlock.java │ │ │ │ ├── MixinEntityItem.java │ │ │ │ ├── MixinEntityLivingBase.java │ │ │ │ ├── MixinGameSettings_Options.java │ │ │ │ ├── MixinMinecraftServer.java │ │ │ │ └── gamesettings │ │ │ │ │ ├── MixinFasterLoadOptions.java │ │ │ │ │ └── MixinFasterSetOptions.java │ │ │ │ ├── placement │ │ │ │ ├── MixinBlockBasePressurePlate.java │ │ │ │ ├── MixinBlockFence.java │ │ │ │ ├── MixinBlockPumpkin.java │ │ │ │ └── MixinBlockWall.java │ │ │ │ ├── rendering │ │ │ │ ├── MixinBlockEnchantmentTable.java │ │ │ │ ├── MixinEffectRenderer.java │ │ │ │ ├── MixinMapItemRenderer.java │ │ │ │ └── MixinRenderItem.java │ │ │ │ ├── shearing │ │ │ │ ├── MixinBlockLeaves.java │ │ │ │ ├── MixinBlockTallGrass.java │ │ │ │ └── MixinItemShears.java │ │ │ │ ├── tweaks │ │ │ │ ├── MixinBlockEndPortal.java │ │ │ │ ├── MixinEntityLightningBolt.java │ │ │ │ ├── MixinFoodStats.java │ │ │ │ ├── MixinIntegratedServer.java │ │ │ │ ├── MixinRecipeArmorDyes.java │ │ │ │ ├── blockfarmland │ │ │ │ │ ├── MixinHydroponics.java │ │ │ │ │ ├── MixinNewTextures.java │ │ │ │ │ └── MixinNoTrample.java │ │ │ │ ├── damage │ │ │ │ │ ├── MixinFireDamage_Entity.java │ │ │ │ │ ├── MixinFireDamage_EntityPlayer.java │ │ │ │ │ └── MixinLavaDamage.java │ │ │ │ ├── entitylivingbase │ │ │ │ │ ├── MixinScalingDrowningDamage.java │ │ │ │ │ ├── MixinScalingSuffocationDamage.java │ │ │ │ │ └── MixinTranslucentClientPotionEffects.java │ │ │ │ └── potion │ │ │ │ │ ├── MixinsPotionPoison.java │ │ │ │ │ └── MixinsPotionWither.java │ │ │ │ ├── villagertrademeta │ │ │ │ ├── MixinMerchantRecipe.java │ │ │ │ └── MixinSlotMerchantResult.java │ │ │ │ └── worldgen │ │ │ │ ├── MixinStructureComponent.java │ │ │ │ ├── MixinStructureMineshaftPieces$Room.java │ │ │ │ ├── MixinStructureStart.java │ │ │ │ ├── MixinStructureVillagePieces_Path.java │ │ │ │ ├── MixinStructureVillagePieces_Well.java │ │ │ │ └── MixinWorld.java │ │ └── late │ │ │ ├── aetherii │ │ │ └── optimization │ │ │ │ └── MixinClientEventHandler.java │ │ │ ├── crayfishfurniture │ │ │ ├── fix │ │ │ │ ├── MixinTileEntityDishwasher.java │ │ │ │ ├── MixinTileEntityMicrowave.java │ │ │ │ └── MixinTileEntityWashingMachine.java │ │ │ └── tweak │ │ │ │ └── MixinFurnitureAchievements.java │ │ │ ├── extrautils │ │ │ └── tweaks │ │ │ │ ├── MixinItemGoldenLasso.java │ │ │ │ ├── MixinTileEntityTradingPost.java │ │ │ │ └── damage │ │ │ │ └── MixinDarknessDamage.java │ │ │ ├── ganyssurface │ │ │ └── rendering │ │ │ │ └── MixinBlockWoodTrapdoor.java │ │ │ ├── llibrary │ │ │ ├── fix │ │ │ │ └── MixinWebUtils.java │ │ │ └── tweak │ │ │ │ └── MixinWebUtils.java │ │ │ ├── thaumcraft │ │ │ └── sanitizearrayaccess │ │ │ │ ├── MixinBlockCandle.java │ │ │ │ └── MixinBlockCandleRenderer.java │ │ │ └── witchery │ │ │ ├── fix │ │ │ └── MixinBlockGarlicGarland.java │ │ │ ├── rendering │ │ │ └── MixinBlockWitchLeaves.java │ │ │ └── shearing │ │ │ └── MixinBlockWitchLeaves.java │ └── modsupport │ │ ├── ExtraUtilitiesSupport.java │ │ ├── PamsTemperatePlantsSupport.java │ │ ├── ThaumcraftSupport.java │ │ ├── TorchLeversSupport.java │ │ ├── VanillaSupport.java │ │ ├── VillageNamesSupport.java │ │ └── WitcherySupport.java │ └── util │ └── RandomXoshiro256StarStar.java └── resources ├── META-INF └── bugtorch_at.cfg ├── assets ├── bugtorch │ ├── lang │ │ ├── de_DE.lang │ │ ├── en_US.lang │ │ └── fr_FR.lang │ └── sounds.json └── minecraft │ └── textures │ └── blocks │ ├── farmland_dry_side.png │ ├── farmland_wet_side.png │ └── planks.png ├── mcmod.info ├── mixins.bugtorch.early.json ├── mixins.bugtorch.json └── mixins.bugtorch.late.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # This is the universal Text Editor Configuration 2 | # for all GTNewHorizons projects 3 | # See: https://editorconfig.org/ 4 | 5 | root = true 6 | 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_size = 4 11 | indent_style = space 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | [*.{bat,ini}] 16 | end_of_line = crlf 17 | 18 | [*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}] 19 | indent_size = 2 20 | 21 | [*.lang] 22 | trim_trailing_whitespace = false 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | 3 | *.[jJ][aA][rR] binary 4 | 5 | *.[pP][nN][gG] binary 6 | *.[jJ][pP][gG] binary 7 | *.[jJ][pP][eE][gG] binary 8 | *.[gG][iI][fF] binary 9 | *.[tT][iI][fF] binary 10 | *.[tT][iI][fF][fF] binary 11 | *.[iI][cC][oO] binary 12 | *.[sS][vV][gG] text 13 | *.[eE][pP][sS] binary 14 | *.[xX][cC][fF] binary 15 | 16 | *.[kK][aA][rR] binary 17 | *.[mM]4[aA] binary 18 | *.[mM][iI][dD] binary 19 | *.[mM][iI][dD][iI] binary 20 | *.[mM][pP]3 binary 21 | *.[oO][gG][gG] binary 22 | *.[rR][aA] binary 23 | 24 | *.7[zZ] binary 25 | *.[gG][zZ] binary 26 | *.[tT][aA][rR] binary 27 | *.[tT][gG][zZ] binary 28 | *.[zZ][iI][pP] binary 29 | 30 | *.[tT][cC][nN] binary 31 | *.[sS][oO] binary 32 | *.[dD][lL][lL] binary 33 | *.[dD][yY][lL][iI][bB] binary 34 | *.[pP][sS][dD] binary 35 | *.[tT][tT][fF] binary 36 | *.[oO][tT][fF] binary 37 | 38 | *.[pP][aA][tT][cC][hH] -text 39 | 40 | *.[bB][aA][tT] text eol=crlf 41 | *.[cC][mM][dD] text eol=crlf 42 | *.[pP][sS]1 text eol=crlf 43 | 44 | *[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .settings 3 | /.idea/ 4 | /.vscode/ 5 | /run/ 6 | /build/ 7 | /eclipse/ 8 | .classpath 9 | .project 10 | /bin/ 11 | /config/ 12 | /crash-reports/ 13 | /logs/ 14 | options.txt 15 | /saves/ 16 | usernamecache.json 17 | banned-ips.json 18 | banned-players.json 19 | eula.txt 20 | ops.json 21 | server.properties 22 | servers.dat 23 | usercache.json 24 | whitelist.json 25 | /out/ 26 | *.iml 27 | *.ipr 28 | *.iws 29 | src/main/resources/mixins.*([!.]).json 30 | *.bat 31 | *.DS_Store 32 | !gradlew.bat 33 | .factorypath 34 | addon.local.gradle 35 | addon.local.gradle.kts 36 | addon.late.local.gradle 37 | addon.late.local.gradle.kts 38 | layout.json 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Jonathan Simmons 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BugTorch 2 | 3 | BugTorch is a mod for Minecraft 1.7.10. It mostly fixes bugs. The name was picked because of a joke involving bug spray and a lighter. 4 | 5 | ## Requirements 6 | 7 | - [UniMixins](https://github.com/LegacyModdingMC/UniMixins) 8 | 9 | ## What it does 10 | 11 | Fixes bugs, backports some stuff that doesn't add new content, and optionally does some other stuff. 12 | 13 | For a more detailed features list see the [Modrinth page](https://modrinth.com/mod/bugtorch) 14 | 15 | ## Modpacks 16 | 17 | Go ahead. Its using the MIT license, I couldn't stop you even if I wanted to. 18 | 19 | ## Disclaimer 20 | 21 | This software and its developers are not affiliated with BugTorch Systems, LLC, a maker of self-filling and self-lighting tiki torches sold under the brand name “BugTorch”. 22 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | //version: 1707058017 2 | 3 | plugins { 4 | id 'com.gtnewhorizons.gtnhconvention' 5 | } 6 | -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | // Adapted from https://github.com/FalsePattern/ExampleMod1.7.10/blob/e85da4bd22966b5ba49614c3dbd0bfa206722f4e/build.gradle#L980-L988 2 | 3 | def deobfCurse(String mavenDep) { 4 | def repoURL = "https://cursemaven.com/" 5 | String[] parts = ("curse.maven:" + mavenDep).split(":") 6 | parts[0] = parts[0].replace('.', '/') 7 | def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar" 8 | return deobf(jarURL) 9 | } 10 | 11 | dependencies { 12 | runtimeOnly("com.github.GTNewHorizons:Baubles:1.0.4:dev") 13 | 14 | implementation("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") 15 | implementation("com.github.GTNewHorizons:TX-Loader:1.7.1:dev") 16 | implementation deobfCurse("witchery-69673:2234410") 17 | implementation deobfCurse("village-names-259230:5591137") 18 | 19 | compileOnly deobfCurse("gilded-games-util-228114:2273362") 20 | compileOnly deobfCurse("aether-ii-223796:2273367") 21 | 22 | compileOnly deobfCurse("extra-utilities-225561:2264383") 23 | compileOnly deobfCurse("cofh-core-69162:2388750") 24 | compileOnly deobfCurse("ganys-surface-222303:2284819") 25 | compileOnly deobfCurse("pams-temperate-plants-221916:2206430") 26 | compileOnly deobfCurse("llibrary-243298:2319767") 27 | compileOnly deobfCurse("mrcrayfish-furniture-mod-55438:2221679") 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable. 2 | # LOCAL to test local config updates. 3 | gtnh.settings.blowdryerTag = 0.2.2 4 | 5 | # Human-readable mod name, available for mcmod.info population. 6 | modName = BugTorch 7 | 8 | # Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation. 9 | # Conventionally lowercase. 10 | modId = bugtorch 11 | 12 | # Root package of the mod, used to find various classes in other properties, 13 | # mcmod.info substitution, enabling assertions in run tasks, etc. 14 | modGroup = jss.bugtorch 15 | 16 | # Whether to use modGroup as the maven publishing group. 17 | # Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods. 18 | useModGroupForPublishing = false 19 | 20 | # Updates your build.gradle and settings.gradle automatically whenever an update is available. 21 | autoUpdateBuildScript = false 22 | 23 | # Version of Minecraft to target 24 | minecraftVersion = 1.7.10 25 | 26 | # Version of Minecraft Forge to target 27 | forgeVersion = 10.13.4.1614 28 | 29 | # Specify an MCP channel for dependency deobfuscation and the deobfParams task. 30 | channel = stable 31 | 32 | # Specify an MCP mappings version for dependency deobfuscation and the deobfParams task. 33 | mappingsVersion = 12 34 | 35 | # Defines other MCP mappings for dependency deobfuscation. 36 | remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ 37 | 38 | # Select a default username for testing your mod. You can always override this per-run by running 39 | # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. 40 | developmentEnvironmentUserName = Developer 41 | 42 | # Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. 43 | # See https://github.com/bsideup/jabel for details on how this works. 44 | enableModernJavaSyntax = true 45 | 46 | # Enables injecting missing generics into the decompiled source code for a better coding experience. 47 | # Turns most publicly visible List, Map, etc. into proper List, Map types. 48 | enableGenericInjection = true 49 | 50 | # Generate a class with a String field for the mod version named as defined below. 51 | # If generateGradleTokenClass is empty or not missing, no such class will be generated. 52 | # If gradleTokenVersion is empty or missing, the field will not be present in the class. 53 | generateGradleTokenClass = jss.bugtorch.Tags 54 | 55 | # Name of the token containing the project's current version to generate/replace. 56 | gradleTokenVersion = VERSION 57 | 58 | # [DEPRECATED] 59 | # Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java 60 | # public static final String VERSION = "GRADLETOKEN_VERSION"; 61 | # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's 62 | # version in @Mod([...], version = VERSION, [...]). 63 | # Leave these properties empty to skip individual token replacements. 64 | replaceGradleTokenInFile = 65 | 66 | # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can 67 | # leave this property empty. 68 | # Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api 69 | apiPackage = 70 | 71 | # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ 72 | # There can be multiple files in a space-separated list. 73 | # Example value: mymodid_at.cfg nei_at.cfg 74 | accessTransformersFile = bugtorch_at.cfg 75 | 76 | # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! 77 | usesMixins = true 78 | 79 | # Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main. 80 | # This can speed up compile times thanks to not running the mixin annotation processor on all input sources. 81 | # Mixin classes will have access to "main" classes, but not the other way around. 82 | separateMixinSourceSet = 83 | 84 | # Adds some debug arguments like verbose output and class export. 85 | usesMixinDebug = false 86 | 87 | # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. 88 | mixinPlugin = 89 | 90 | # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! 91 | mixinsPackage = mixins 92 | 93 | # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! 94 | # This parameter is for legacy compatibility only 95 | # Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin 96 | coreModClass = mixinplugin.BugTorchEarlyMixins 97 | 98 | # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class 99 | # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! 100 | containsMixinsAndOrCoreModOnly = false 101 | 102 | # Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. 103 | forceEnableMixins = false 104 | 105 | # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your 106 | # responsibility to check the license and request permission for distribution if required. 107 | usesShadowedDependencies = false 108 | 109 | # If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access 110 | # their own classes, making the minimization unreliable. 111 | minimizeShadowedDependencies = true 112 | 113 | # If disabled, won't rename the shadowed classes. 114 | relocateShadowedDependencies = true 115 | 116 | # Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories. 117 | includeWellKnownRepositories = true 118 | 119 | # A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated 120 | # list of strings, with the acceptable keys being(case does not matter): 121 | # cursemaven 122 | # modrinth 123 | excludeWellKnownRepositories = 124 | 125 | # Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven. 126 | # Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables. 127 | # If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle. 128 | usesMavenPublishing = true 129 | 130 | # Maven repository to publish the mod to. 131 | # mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/ 132 | 133 | # Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token. 134 | # 135 | # The project's ID on Modrinth. Can be either the slug or the ID. 136 | # Leave this empty if you don't want to publish to Modrinth. 137 | modrinthProjectId = 138 | 139 | # The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. 140 | # Syntax: scope1-type1:name1;scope2-type2:name2;... 141 | # Where scope can be one of [required, optional, incompatible, embedded], 142 | # type can be one of [project, version], 143 | # and the name is the Modrinth project or version slug/id of the other mod. 144 | # Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech 145 | # Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true 146 | modrinthRelations = 147 | 148 | # Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. 149 | # 150 | # The project's numeric ID on CurseForge. You can find this in the About Project box. 151 | # Leave this empty if you don't want to publish on CurseForge. 152 | curseForgeProjectId = 153 | 154 | # The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. 155 | # Syntax: type1:name1;type2:name2;... 156 | # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], 157 | # and the name is the CurseForge project slug of the other mod. 158 | # Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft 159 | # Note: UniMixins is automatically set as a required dependency if usesMixins = true. 160 | curseForgeRelations = 161 | 162 | # Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older 163 | # projects. New projects should not use this parameter. 164 | # customArchiveBaseName = 165 | 166 | # Optional parameter to have the build automatically fail if an illegal version is used. 167 | # This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'. 168 | # The check is ONLY performed if the version is a git tag. 169 | # Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+ 170 | # versionPattern = 171 | 172 | # Uncomment to prevent the source code from being published. 173 | # noPublishedSources = true 174 | 175 | # Uncomment this to disable Spotless checks. 176 | # This should only be uncommented to keep it easier to sync with upstream/other forks. 177 | # That is, if there is no other active fork/upstream, NEVER change this. 178 | disableSpotless = true 179 | 180 | # Uncomment this to disable Checkstyle checks (currently wildcard import check). 181 | # disableCheckstyle = true 182 | 183 | # Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle" 184 | # (force use delegated build). 185 | # This is meant to be set in $HOME/.gradle/gradle.properties. 186 | # e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build. 187 | # WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want! 188 | # Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you. 189 | # ideaOverrideBuildType = idea 190 | 191 | # Whether IDEA should run spotless checks when pressing the Build button. 192 | # This is meant to be set in $HOME/.gradle/gradle.properties. 193 | # ideaCheckSpotlessOnBuild = true 194 | 195 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jss2a98aj/BugTorch/8d3e8225ba614c7fa7619a1c9d47dfdcfe326a76/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-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - ./gradlew setupCIWorkspace -------------------------------------------------------------------------------- /repositories.gradle: -------------------------------------------------------------------------------- 1 | // Add any additional repositories for your dependencies here. 2 | 3 | repositories { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | 2 | pluginManagement { 3 | repositories { 4 | maven { 5 | // RetroFuturaGradle 6 | name "GTNH Maven" 7 | url "https://nexus.gtnewhorizons.com/repository/public/" 8 | mavenContent { 9 | includeGroup("com.gtnewhorizons") 10 | includeGroupByRegex("com\\.gtnewhorizons\\..+") 11 | } 12 | } 13 | gradlePluginPortal() 14 | mavenCentral() 15 | mavenLocal() 16 | } 17 | } 18 | 19 | plugins { 20 | id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30' 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/BugTorch.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch; 2 | 3 | import java.io.File; 4 | 5 | import cpw.mods.fml.common.FMLCommonHandler; 6 | import cpw.mods.fml.common.Loader; 7 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 8 | import cpw.mods.fml.relauncher.Side; 9 | import glowredman.txloader.TXLoaderCore; 10 | import glowredman.txloader.Asset.Source; 11 | import jss.bugtorch.listeners.ButtonManager; 12 | import jss.bugtorch.mixinplugin.BugTorchEarlyMixins; 13 | import jss.bugtorch.modsupport.ExtraUtilitiesSupport; 14 | import jss.bugtorch.modsupport.PamsTemperatePlantsSupport; 15 | import jss.bugtorch.modsupport.ThaumcraftSupport; 16 | import jss.bugtorch.modsupport.TorchLeversSupport; 17 | import jss.bugtorch.modsupport.VanillaSupport; 18 | import jss.bugtorch.modsupport.VillageNamesSupport; 19 | import jss.bugtorch.modsupport.WitcherySupport; 20 | import net.minecraftforge.common.MinecraftForge; 21 | import net.minecraftforge.oredict.OreDictionary; 22 | import org.apache.logging.log4j.LogManager; 23 | import org.apache.logging.log4j.Logger; 24 | 25 | import cpw.mods.fml.common.Mod; 26 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 27 | import jss.bugtorch.config.BugTorchConfig; 28 | 29 | @Mod( 30 | modid = BugTorch.MODID, 31 | name = BugTorch.NAME, 32 | version = BugTorch.VERSION, 33 | acceptableRemoteVersions = "*", 34 | dependencies = "required-after:gtnhmixins@[2.0.0,);after:Thaumcraft;after:temperateplants;after:VillageNames;after:witchery;" 35 | ) 36 | public class BugTorch { 37 | 38 | public static final String MODID = "bugtorch"; 39 | public static final String NAME = "BugTorch"; 40 | public static final String VERSION = Tags.VERSION; 41 | public static final Logger logger = LogManager.getLogger(NAME); 42 | // cached to boost looping, should be used pretty often due to how recipe lookup works 43 | public static final int[] dyeOreIds = new int[16]; 44 | 45 | public BugTorch() { 46 | String configFolder = Loader.instance().getConfigDir().getAbsolutePath() + File.separator + MODID + File.separator; 47 | BugTorchConfig.loadBaseConfig(new File(configFolder + "base.cfg")); 48 | BugTorchConfig.loadModdedConfig(new File(configFolder + "modSupport.cfg")); 49 | if (BugTorchEarlyMixins.txLoaderPresent) { 50 | new Runnable() { 51 | @Override 52 | public void run() { 53 | TXLoaderCore.getAssetBuilder("minecraft/sounds/mob/ghast/fireball4.ogg") 54 | .setOverride("bugtorch/sounds/mob/ghast/fireball4.ogg") 55 | .setSource(Source.ASSET) 56 | .setVersion("1.19.2") 57 | .add(); 58 | } 59 | }.run(); 60 | } 61 | } 62 | 63 | @Mod.EventHandler 64 | public void preInit(FMLPreInitializationEvent event) { 65 | VanillaSupport.enableSupport(); 66 | 67 | if(event.getSide() == Side.CLIENT) { 68 | FMLCommonHandler.instance().bus().register(ButtonManager.INSTANCE); 69 | MinecraftForge.EVENT_BUS.register(ButtonManager.INSTANCE); 70 | } 71 | } 72 | 73 | @Mod.EventHandler 74 | public void postInit(FMLPostInitializationEvent event) { 75 | String[] dyes = { 76 | "dyeBlack", 77 | "dyeRed", 78 | "dyeGreen", 79 | "dyeBrown", 80 | "dyeBlue", 81 | "dyePurple", 82 | "dyeCyan", 83 | "dyeLightGray", 84 | "dyeGray", 85 | "dyePink", 86 | "dyeLime", 87 | "dyeYellow", 88 | "dyeLightBlue", 89 | "dyeMagenta", 90 | "dyeOrange", 91 | "dyeWhite" 92 | }; 93 | for (int i = 0; i < dyes.length; i++) { 94 | dyeOreIds[i] = OreDictionary.getOreID(dyes[i]); 95 | } 96 | 97 | if(Loader.isModLoaded("ExtraUtilities")) { 98 | ExtraUtilitiesSupport.enableSupport(); 99 | } 100 | 101 | if(Loader.isModLoaded("temperateplants")) { 102 | PamsTemperatePlantsSupport.enableSupport(); 103 | } 104 | 105 | if(Loader.isModLoaded("Thaumcraft")) { 106 | ThaumcraftSupport.enableSupport(); 107 | } 108 | 109 | if(Loader.isModLoaded("torchLevers")) { 110 | TorchLeversSupport.enableSupport(); 111 | } 112 | 113 | if(Loader.isModLoaded("witchery")) { 114 | WitcherySupport.enableSupport(); 115 | } 116 | 117 | if(Loader.isModLoaded("VillageNames")) { 118 | VillageNamesSupport.enableSupport(); 119 | } 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/ducks/IOffsetDuck.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.ducks; 2 | 3 | public interface IOffsetDuck { 4 | 5 | abstract void offset(int x, int y, int z); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/listeners/ButtonManager.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.listeners; 2 | 3 | import cpw.mods.fml.common.eventhandler.EventPriority; 4 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 5 | import jss.bugtorch.config.BugTorchConfig; 6 | import net.minecraft.client.gui.GuiButton; 7 | import net.minecraft.client.gui.GuiIngameMenu; 8 | import net.minecraft.client.gui.GuiOptions; 9 | import net.minecraftforge.client.event.GuiScreenEvent; 10 | 11 | import java.util.List; 12 | import java.util.Optional; 13 | 14 | public class ButtonManager { 15 | public static final ButtonManager INSTANCE = new ButtonManager(); 16 | 17 | @SuppressWarnings("unchecked") 18 | @SubscribeEvent(priority = EventPriority.LOWEST) 19 | public void onGui(GuiScreenEvent.InitGuiEvent.Post event) { 20 | if(event.gui instanceof GuiOptions) { 21 | //Super Secret Settings 22 | Optional optionalSuperSecretSettings = ((List)event.buttonList).stream().filter(button -> button.id == 8675309).findFirst(); 23 | if(optionalSuperSecretSettings.isPresent()) { 24 | GuiButton superSecretSettings = optionalSuperSecretSettings.get(); 25 | superSecretSettings.visible = BugTorchConfig.showSuperSecretSettingsButton != -1; 26 | superSecretSettings.enabled = BugTorchConfig.showSuperSecretSettingsButton == 1; 27 | } 28 | //Broadcast Settings 29 | Optional optionalBroadcastSettings = ((List)event.buttonList).stream().filter(button -> button.id == 107).findFirst(); 30 | if(optionalBroadcastSettings.isPresent()) { 31 | GuiButton broadcastSettings = optionalBroadcastSettings.get(); 32 | broadcastSettings.visible = BugTorchConfig.showBroadcastSettingsButton != -1; 33 | broadcastSettings.enabled = BugTorchConfig.showBroadcastSettingsButton == 1; 34 | //If Broadcast Settings is not visible move Super Secret Settings to its place 35 | if(!broadcastSettings.visible && optionalSuperSecretSettings.isPresent()) { 36 | GuiButton superSecretSettings = optionalSuperSecretSettings.get(); 37 | superSecretSettings.xPosition = broadcastSettings.xPosition; 38 | superSecretSettings.yPosition = broadcastSettings.yPosition; 39 | } 40 | } 41 | } else if(BugTorchConfig.showBroadcastSettingsButton != 1 && event.gui instanceof GuiIngameMenu) { 42 | //Open to LAN 43 | Optional optionalOpenToLan = ((List)event.buttonList).stream().filter(button -> button.id == 7).findFirst(); 44 | if(optionalOpenToLan.isPresent()) { 45 | GuiButton openToLan = optionalOpenToLan.get(); 46 | openToLan.visible = BugTorchConfig.showOpenToLanButton != -1; 47 | openToLan.enabled = BugTorchConfig.showOpenToLanButton == 1; 48 | } 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixinplugin/BugTorchEarlyMixins.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixinplugin; 2 | 3 | import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader; 4 | import cpw.mods.fml.relauncher.FMLLaunchHandler; 5 | import cpw.mods.fml.relauncher.IFMLLoadingPlugin; 6 | import jss.bugtorch.BugTorch; 7 | import jss.bugtorch.config.BugTorchConfig; 8 | import net.minecraft.launchwrapper.Launch; 9 | 10 | import java.io.File; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Map; 14 | import java.util.Set; 15 | 16 | @IFMLLoadingPlugin.Name("BugTorchEarlyMixins") 17 | @IFMLLoadingPlugin.MCVersion("1.7.10") 18 | public class BugTorchEarlyMixins implements IFMLLoadingPlugin, IEarlyMixinLoader { 19 | 20 | public static boolean txLoaderPresent; 21 | 22 | @Override 23 | public String getMixinConfig() { 24 | return "mixins.bugtorch.early.json"; 25 | } 26 | 27 | @Override 28 | public List getMixins(Set loadedCoreMods) { 29 | String configFolder = "config" + File.separator + BugTorch.MODID + File.separator; 30 | BugTorchConfig.loadBaseMixinConfig(new File(Launch.minecraftHome, configFolder + "mixins.cfg")); 31 | BugTorchConfig.loadModdedMixinConfig(new File(Launch.minecraftHome, configFolder + "mixinsModSupport.cfg")); 32 | 33 | boolean client = FMLLaunchHandler.side().isClient(); 34 | List mixins = new ArrayList<>(); 35 | 36 | boolean useNotFineOverlap = true; 37 | if(loadedCoreMods.contains("jss.notfine.mixinplugin.NotFineEarlyMixins") || loadedCoreMods.contains("com.gtnewhorizons.angelica.loading.AngelicaTweaker")) { 38 | BugTorch.logger.info("NotFine detected, skipping redundant early mixins."); 39 | useNotFineOverlap = false; 40 | } 41 | 42 | txLoaderPresent = client && loadedCoreMods.contains("glowredman.txloader.TXLoaderCore"); 43 | 44 | //Backports 45 | if(BugTorchConfig.cobwebsCanBeSheared) { 46 | mixins.add("minecraft.backport.MixinBlockWeb"); 47 | } 48 | if(BugTorchConfig.deadBushesDropSticks) { 49 | mixins.add("minecraft.backport.MixinBlockDeadBush"); 50 | } 51 | if(BugTorchConfig.fireArrowsDetonateTNTCarts) { 52 | mixins.add("minecraft.backport.MixinEntityMinecartTNT"); 53 | } 54 | if(BugTorchConfig.throwEnderPearlsInCreativeMode) { 55 | mixins.add("minecraft.backport.MixinItemEnderPearl"); 56 | } 57 | 58 | //Bugfixes 59 | if(client && BugTorchConfig.fixAnvilSoundTypeStepSound) { 60 | mixins.add("minecraft.fix.block.MixinSoundTypeAnvil"); 61 | } 62 | if(BugTorchConfig.fixDarkOakRemovingBlocks) { 63 | mixins.add("minecraft.fix.MixinWorldGenCanopyTree"); 64 | } 65 | if(client && useNotFineOverlap && BugTorchConfig.fixEnchantmentBlendFunc) { 66 | mixins.add("minecraft.rendering.MixinRenderItem"); 67 | } 68 | if(txLoaderPresent && BugTorchConfig.fixFireChargeUseSound) { 69 | mixins.add("minecraft.backport.MixinItemFireball"); 70 | } 71 | if(client && BugTorchConfig.fixLavaHissOnAirReplace) { 72 | mixins.add("minecraft.fix.MixinBlockLiquid"); 73 | } 74 | if(BugTorchConfig.fixLeadsBreakingOnSomeFenceInstances) { 75 | mixins.add("minecraft.fix.MixinEntityLeashKnot"); 76 | } 77 | if(BugTorchConfig.fixLeafDecayCheckRange) { 78 | mixins.add("minecraft.fix.MixinBlockLeaves"); 79 | } 80 | if(BugTorchConfig.fixMergeItemStack) { 81 | if(loadedCoreMods.contains("cofh.asm.LoadingPlugin")) { 82 | mixins.add("cofhcore.fix.MixinInventoryHelper"); 83 | } else { 84 | mixins.add("minecraft.fix.MixinContainer"); 85 | } 86 | } 87 | if(BugTorchConfig.fixLilyPadPlacementSide) { 88 | mixins.add("minecraft.fix.MixinItemLilyPad"); 89 | } 90 | if(BugTorchConfig.fixMineshaftAirPockets) { 91 | mixins.add("minecraft.worldgen.MixinStructureStart"); 92 | mixins.add("minecraft.worldgen.MixinStructureMineshaftPieces$Room"); 93 | } 94 | if(BugTorchConfig.fixNettyConnectionFailureResourceLeak) { 95 | mixins.add("minecraft.logcleanup.MixinNioSocketChannel"); 96 | } 97 | if(client && useNotFineOverlap && BugTorchConfig.fixParticleDepthSorting) { 98 | mixins.add("minecraft.rendering.MixinEffectRenderer"); 99 | } 100 | if(BugTorchConfig.fixPumpkinPlacementCheck) { 101 | mixins.add("minecraft.placement.MixinBlockPumpkin"); 102 | } 103 | if(BugTorchConfig.fixRedstoneTorchMemoryLeak) { 104 | mixins.add("minecraft.optimization.MixinBlockRedstoneTorch"); 105 | } 106 | if(BugTorchConfig.fixStoneMonsterEggDoubleSpawns) { 107 | mixins.add("minecraft.fix.MixinBlockSilverfish"); 108 | } 109 | if(BugTorchConfig.fixStructureComponentFillReplacement) { 110 | mixins.add("minecraft.worldgen.MixinStructureComponent"); 111 | } 112 | if(BugTorchConfig.fixShearedGrassDropDupe) { 113 | mixins.add("minecraft.shearing.MixinBlockTallGrass"); 114 | } 115 | if(BugTorchConfig.fixShearedLeavesDropDupe) { 116 | mixins.add("minecraft.shearing.MixinBlockLeaves"); 117 | } 118 | if(BugTorchConfig.fixShearsNotTakingDamageFromNormalBlocks) { 119 | mixins.add("minecraft.shearing.MixinItemShears"); 120 | } 121 | if(client && BugTorchConfig.fixSignPacketChatMessages) { 122 | mixins.add("minecraft.logcleanup.MixinNetHandlerPlayClient"); 123 | } 124 | if(BugTorchConfig.fixVillagePathsHavePlantsOnTop) { 125 | mixins.add("minecraft.worldgen.MixinStructureVillagePieces_Path"); 126 | } 127 | if(BugTorchConfig.fixVillagerTradeMetadataDetection) { 128 | mixins.add("minecraft.villagertrademeta.MixinSlotMerchantResult"); 129 | mixins.add("minecraft.villagertrademeta.MixinMerchantRecipe"); 130 | } 131 | if(BugTorchConfig.fixVillageSieges) { 132 | mixins.add("minecraft.fix.MixinVillageSiege"); 133 | } 134 | if(BugTorchConfig.fixVillageWellDesertMaterial) { 135 | mixins.add("minecraft.worldgen.MixinStructureVillagePieces_Well"); 136 | } 137 | 138 | if (client && BugTorchConfig.fixLWJGL2OpenALCrash && !(loadedCoreMods.contains("me.eigenraven.lwjgl3ify.core.Lwjgl3ifyCoremod"))) { 139 | mixins.add("minecraft.fix.MixinSoundManager"); 140 | } 141 | 142 | //Performance 143 | if(BugTorchConfig.brokenChestsDontSplitStacks) { 144 | mixins.add("minecraft.optimization.MixinBlockChest"); 145 | } 146 | if(BugTorchConfig.brokenHoppersDontSplitStacks) { 147 | mixins.add("minecraft.optimization.MixinBlockHopper"); 148 | } 149 | if(BugTorchConfig.fasterDroppedItemStackingChecks) { 150 | mixins.add("minecraft.optimization.MixinEntityItem"); 151 | } 152 | if(BugTorchConfig.fasterEntityLivingBaseIsPotionActiveAndSetAir) { 153 | mixins.add("minecraft.optimization.MixinEntityLivingBase"); 154 | } 155 | if(BugTorchConfig.fasterGetBlockByIdForAirBlocks) { 156 | mixins.add("minecraft.optimization.MixinBlock"); 157 | } 158 | if(!loadedCoreMods.contains("optifine.OptiFineForgeTweaker")) { 159 | if(BugTorchConfig.fasterOptionInteractions) { 160 | mixins.add("minecraft.optimization.gamesettings.MixinFasterSetOptions"); 161 | mixins.add("minecraft.optimization.MixinGameSettings_Options"); 162 | } 163 | if(BugTorchConfig.fasterOptionLoading) { 164 | mixins.add("minecraft.optimization.gamesettings.MixinFasterLoadOptions"); 165 | } 166 | } 167 | if(BugTorchConfig.fasterSnowBlockTicks) { 168 | mixins.add("minecraft.optimization.MixinBlockSnowBlock"); 169 | } 170 | if(client && useNotFineOverlap && BugTorchConfig.moreAccurateLayeredSnowFaceCulling) { 171 | mixins.add("minecraft.optimization.MixinBlockSnow"); 172 | } 173 | if(client && BugTorchConfig.replaceRandomInEffectRenderer) { 174 | mixins.add("minecraft.fastrandom.MixinEffectRenderer"); 175 | } 176 | if(BugTorchConfig.replaceRandomInEntity) { 177 | mixins.add("minecraft.fastrandom.MixinEntity"); 178 | } 179 | if(BugTorchConfig.replaceRandomInItem) { 180 | mixins.add("minecraft.fastrandom.MixinItem"); 181 | } 182 | if(BugTorchConfig.replaceRandomInMinecraftServer) { 183 | mixins.add("minecraft.fastrandom.MixinMinecraftServer"); 184 | } 185 | if(client && BugTorchConfig.replaceRandomInRenderItem) { 186 | mixins.add("minecraft.fastrandom.MixinRenderItem"); 187 | } 188 | if(BugTorchConfig.replaceRandomInWorld) { 189 | BugTorch.logger.info("World.class will use a faster Random implementation, this impacts world generation slightly."); 190 | mixins.add("minecraft.fastrandom.MixinWorld"); 191 | } 192 | if(client && useNotFineOverlap && BugTorchConfig.replaceRandomInWorldClient) { 193 | mixins.add("minecraft.fastrandom.MixinWorldClient"); 194 | } 195 | if(client && BugTorchConfig.skipInitialWorldChunkLoad) { 196 | mixins.add("minecraft.optimization.MixinMinecraftServer"); 197 | } 198 | 199 | //Tweaks 200 | if(client && useNotFineOverlap && BugTorchConfig.enchantmentParticlesForPowerAboveZero) { 201 | mixins.add("minecraft.rendering.MixinBlockEnchantmentTable"); 202 | } 203 | if(BugTorchConfig.excludeLogsFromTopSolidOrLiquidBlock) { 204 | mixins.add("minecraft.worldgen.MixinWorld"); 205 | } 206 | if(BugTorchConfig.farmlandHydroponics) { 207 | mixins.add("minecraft.tweaks.blockfarmland.MixinHydroponics"); 208 | } 209 | if(client && BugTorchConfig.farmlandNewTextures) { 210 | mixins.add("minecraft.tweaks.blockfarmland.MixinNewTextures"); 211 | } 212 | if(BugTorchConfig.farmlandNoTrample) { 213 | mixins.add("minecraft.tweaks.blockfarmland.MixinNoTrample"); 214 | } 215 | if(client && BugTorchConfig.lanPortOverride && !loadedCoreMods.contains("com.mitchej123.hodgepodge.core.HodgepodgeCore")) { 216 | mixins.add("minecraft.tweaks.MixinIntegratedServer"); 217 | } 218 | if(BugTorchConfig.placeEndPortalsAnywhere) { 219 | mixins.add("minecraft.tweaks.MixinBlockEndPortal"); 220 | } 221 | if(BugTorchConfig.placePressurePlatesOnAnyWallOrFence) { 222 | mixins.add("minecraft.placement.MixinBlockBasePressurePlate"); 223 | } 224 | if(BugTorchConfig.placeTorchesOnAnyFence) { 225 | mixins.add("minecraft.placement.MixinBlockFence"); 226 | } 227 | if(BugTorchConfig.placeTorchesOnAnyWall) { 228 | mixins.add("minecraft.placement.MixinBlockWall"); 229 | } 230 | if(client && BugTorchConfig.potionParticlesAreClearForClientPlayer) { 231 | mixins.add("minecraft.tweaks.entitylivingbase.MixinTranslucentClientPotionEffects"); 232 | } 233 | if(BugTorchConfig.reduceLightningVolume < 10000f) { 234 | mixins.add("minecraft.tweaks.MixinEntityLightningBolt"); 235 | } 236 | if(BugTorchConfig.removeEntityDuplicateExtendedPropertiesIdentifierSpam) { 237 | mixins.add("minecraft.logcleanup.MixinEntity"); 238 | } 239 | if(BugTorchConfig.scaledDrowningDamageMaxHealthFlat > 0f || BugTorchConfig.scaledDrowningDamageMaxHealthMult > 0f) { 240 | mixins.add("minecraft.tweaks.entitylivingbase.MixinScalingDrowningDamage"); 241 | } 242 | if(BugTorchConfig.scaledLavaDamageMaxHealthFlat > 0f || BugTorchConfig.scaledLavaDamageMaxHealthMult > 0f) { 243 | mixins.add("minecraft.tweaks.damage.MixinLavaDamage"); 244 | } 245 | if(BugTorchConfig.scaledFireDamageMaxHealthFlat > 0f || BugTorchConfig.scaledFireDamageMaxHealthMult > 0f) { 246 | mixins.add("minecraft.tweaks.damage.MixinFireDamage_Entity"); 247 | mixins.add("minecraft.tweaks.damage.MixinFireDamage_EntityPlayer"); 248 | } 249 | if(BugTorchConfig.scaledStarvationDamageMaxHealthFlat > 0f || BugTorchConfig.scaledStarvationDamageMaxHealthMult > 0f) { 250 | mixins.add("minecraft.tweaks.MixinFoodStats"); 251 | } 252 | if(BugTorchConfig.scaledSuffocationDamageMaxHealthFlat > 0f || BugTorchConfig.scaledSuffocationDamageMaxHealthMult > 0f) { 253 | mixins.add("minecraft.tweaks.entitylivingbase.MixinScalingSuffocationDamage"); 254 | } 255 | if(BugTorchConfig.scaledPoisonDamageMaxHealthFlat > 0f || BugTorchConfig.scaledPoisonDamageMaxHealthMult > 0f) { 256 | mixins.add("minecraft.tweaks.potion.MixinsPotionPoison"); 257 | } 258 | if(BugTorchConfig.scaledWitherDamageMaxHealthFlat > 0f || BugTorchConfig.scaledWitherDamageMaxHealthMult > 0f) { 259 | mixins.add("minecraft.tweaks.potion.MixinsPotionWither"); 260 | } 261 | if(BugTorchConfig.useAnyDyeOnLeatherArmor) { 262 | mixins.add("minecraft.tweaks.MixinRecipeArmorDyes"); 263 | } 264 | 265 | return mixins; 266 | } 267 | 268 | @Override 269 | public String[] getASMTransformerClass() { 270 | return null; 271 | } 272 | 273 | @Override 274 | public String getModContainerClass() { 275 | return null; 276 | } 277 | 278 | @Override 279 | public String getSetupClass() { 280 | return null; 281 | } 282 | 283 | @Override 284 | public void injectData(Map data) { 285 | 286 | } 287 | 288 | @Override 289 | public String getAccessTransformerClass() { 290 | return null; 291 | } 292 | 293 | } 294 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixinplugin/BugTorchLateMixins.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixinplugin; 2 | 3 | import com.gtnewhorizon.gtnhmixins.ILateMixinLoader; 4 | import com.gtnewhorizon.gtnhmixins.LateMixin; 5 | import cpw.mods.fml.relauncher.FMLLaunchHandler; 6 | import jss.bugtorch.config.BugTorchConfig; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.Set; 11 | 12 | @LateMixin 13 | public class BugTorchLateMixins implements ILateMixinLoader { 14 | 15 | @Override 16 | public String getMixinConfig() { 17 | return "mixins.bugtorch.late.json"; 18 | } 19 | 20 | @Override 21 | public List getMixins(Set loadedMods) { 22 | 23 | if(!loadedMods.contains("cfm")) { 24 | BugTorchConfig.fixCrayfishFurnitureNullPointerException = false; 25 | BugTorchConfig.disableCrayfishFurnitureAchievements = false; 26 | } 27 | if(!loadedMods.contains("ganyssurface")) { 28 | BugTorchConfig.fixGanysSurfaceOpenTrapdoorBackTexture = false; 29 | } 30 | if(!loadedMods.contains("llibrary")) { 31 | BugTorchConfig.fixLLibraryMalformedJsonCrash = false; 32 | BugTorchConfig.proxyLLibraryPastebin = false; 33 | } 34 | if(!loadedMods.contains("Thaumcraft")) { 35 | BugTorchConfig.fixThaumcraftCandleColorArrayOutOfBounds = false; 36 | } 37 | if(!loadedMods.contains("witchery")) { 38 | BugTorchConfig.fixWitcheryGarlicGarlandBlockBounds = false; 39 | BugTorchConfig.fixWitcheryLeavesOptifineRendering = false; 40 | BugTorchConfig.fixWitcheryLeavesShearDupe = false; 41 | } 42 | if(!loadedMods.contains("aether")) { 43 | BugTorchConfig.reuseAetherIIRenderPlayer = false; 44 | } 45 | if(loadedMods.contains("notfine")) { 46 | BugTorchConfig.fixWitcheryLeavesOptifineRendering = false; 47 | } 48 | if(!loadedMods.contains("ExtraUtilities")) { 49 | BugTorchConfig.extraUtilitiesGoldenLassoBlacklist = new String[0]; 50 | BugTorchConfig.extraUtilitiesTradingPostVillageNamesNitwitFilter = false; 51 | BugTorchConfig.scaledExtraUtilitiesDarknessDamageMaxHealthFlat = 0; 52 | BugTorchConfig.scaledExtraUtilitiesDarknessDamageMaxHealthMult = 0; 53 | } 54 | if(!loadedMods.contains("VillageNames")) { 55 | BugTorchConfig.extraUtilitiesTradingPostVillageNamesNitwitFilter = false; 56 | } 57 | 58 | boolean client = FMLLaunchHandler.side().isClient(); 59 | List mixins = new ArrayList<>(); 60 | 61 | //Mod bugfixes 62 | if(BugTorchConfig.fixCrayfishFurnitureNullPointerException) { 63 | mixins.add("crayfishfurniture.fix.MixinTileEntityDishwasher"); 64 | mixins.add("crayfishfurniture.fix.MixinTileEntityMicrowave"); 65 | mixins.add("crayfishfurniture.fix.MixinTileEntityWashingMachine"); 66 | } 67 | if(client && BugTorchConfig.fixGanysSurfaceOpenTrapdoorBackTexture) { 68 | mixins.add("ganyssurface.rendering.MixinBlockWoodTrapdoor"); 69 | } 70 | if(BugTorchConfig.fixLLibraryMalformedJsonCrash && !BugTorchConfig.proxyLLibraryPastebin) { 71 | mixins.add("llibrary.fix.MixinWebUtils"); 72 | } 73 | if(BugTorchConfig.fixThaumcraftCandleColorArrayOutOfBounds) { 74 | if(client) { 75 | mixins.add("thaumcraft.sanitizearrayaccess.MixinBlockCandleRenderer"); 76 | } 77 | mixins.add("thaumcraft.sanitizearrayaccess.MixinBlockCandle"); 78 | } 79 | if(BugTorchConfig.fixWitcheryGarlicGarlandBlockBounds) { 80 | mixins.add("witchery.fix.MixinBlockGarlicGarland"); 81 | } 82 | if(client && BugTorchConfig.fixWitcheryLeavesOptifineRendering) { 83 | mixins.add("witchery.rendering.MixinBlockWitchLeaves"); 84 | } 85 | if(BugTorchConfig.fixWitcheryLeavesShearDupe) { 86 | mixins.add("witchery.shearing.MixinBlockWitchLeaves"); 87 | } 88 | if(client && BugTorchConfig.reuseAetherIIRenderPlayer) { 89 | mixins.add("aetherii.optimization.MixinClientEventHandler"); 90 | } 91 | 92 | //Mod tweaks 93 | if(BugTorchConfig.disableCrayfishFurnitureAchievements) { 94 | mixins.add("crayfishfurniture.tweak.MixinFurnitureAchievements"); 95 | } 96 | if(BugTorchConfig.extraUtilitiesGoldenLassoBlacklist.length > 0) { 97 | mixins.add("extrautils.tweaks.MixinItemGoldenLasso"); 98 | } 99 | if(BugTorchConfig.extraUtilitiesTradingPostVillageNamesNitwitFilter) { 100 | mixins.add("extrautils.tweaks.MixinTileEntityTradingPost"); 101 | } 102 | if(BugTorchConfig.proxyLLibraryPastebin) { 103 | mixins.add("llibrary.tweak.MixinWebUtils"); 104 | } 105 | if(BugTorchConfig.scaledExtraUtilitiesDarknessDamageMaxHealthFlat > 0f || BugTorchConfig.scaledExtraUtilitiesDarknessDamageMaxHealthMult > 0f) { 106 | mixins.add("extrautils.tweaks.damage.MixinDarknessDamage"); 107 | } 108 | 109 | return mixins; 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/cofhcore/fix/MixinInventoryHelper.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.cofhcore.fix; 2 | 3 | import cofh.lib.util.helpers.InventoryHelper; 4 | import net.minecraft.inventory.Slot; 5 | import net.minecraft.item.ItemStack; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | 9 | import java.util.List; 10 | 11 | @Mixin(value = InventoryHelper.class, remap = false) 12 | public abstract class MixinInventoryHelper { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Fix item dupes and inventory loss from CoFHLib by replacing this mergeItemStack with an adaption of MixinsContainer's. 17 | */ 18 | @Overwrite(remap = false) 19 | public static boolean mergeItemStack(List inventorySlots, ItemStack input, int start, int length, boolean reverse, boolean unused) { 20 | boolean couldMerge = false; 21 | int index = reverse ? length - 1 : start; 22 | int increment = reverse ? -1 : 1; 23 | 24 | Slot slot; 25 | ItemStack slotStack; 26 | 27 | if(input.isStackable()) { 28 | while(input.stackSize > 0 && (!reverse && index < length || reverse && index >= start)) { 29 | slot = inventorySlots.get(index); 30 | slotStack = slot.getStack(); 31 | 32 | if(slotStack != null) { 33 | int maxRemovableFromInput = Math.min(input.getMaxStackSize(), slot.getSlotStackLimit()); 34 | int removeFromInput = Math.min(maxRemovableFromInput, input.stackSize); 35 | ItemStack partialStack = input.copy(); 36 | partialStack.stackSize = removeFromInput; 37 | 38 | if(slot.isItemValid(partialStack) && slotStack.getItem().equals(input.getItem()) && input.getItemDamage() == slotStack.getItemDamage() && ItemStack.areItemStackTagsEqual(input, slotStack)) { 39 | int combinedStackSize = slotStack.stackSize + input.stackSize; 40 | 41 | if(combinedStackSize <= input.getMaxStackSize()) { 42 | slotStack.stackSize = combinedStackSize; 43 | slot.onSlotChanged(); 44 | input.stackSize = 0; 45 | couldMerge = true; 46 | } else if(slotStack.stackSize < input.getMaxStackSize()) { 47 | removeFromInput = maxRemovableFromInput - slotStack.stackSize; 48 | slotStack.stackSize = slotStack.getMaxStackSize(); 49 | slot.onSlotChanged(); 50 | input.stackSize -= removeFromInput; 51 | couldMerge = true; 52 | } 53 | } 54 | } 55 | index += increment; 56 | } 57 | } 58 | 59 | index = reverse ? length - 1 : start; 60 | 61 | while(input.stackSize > 0 && (!reverse && index < length || reverse && index >= start)) { 62 | slot = inventorySlots.get(index); 63 | slotStack = slot.getStack(); 64 | 65 | if(slotStack == null) { 66 | int removeFromInput = Math.min(slot.getSlotStackLimit(), input.stackSize); 67 | ItemStack partialStack = input.copy(); 68 | partialStack.stackSize = removeFromInput; 69 | 70 | if(slot.isItemValid(partialStack)) { 71 | slot.putStack(partialStack); 72 | slot.onSlotChanged(); 73 | input.stackSize -= removeFromInput; 74 | couldMerge = true; 75 | } 76 | } 77 | index += increment; 78 | } 79 | 80 | return couldMerge; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/backport/MixinBlockDeadBush.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.backport; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | import net.minecraft.block.BlockBush; 9 | import net.minecraft.block.BlockDeadBush; 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.init.Items; 12 | import net.minecraft.item.Item; 13 | import net.minecraft.item.ItemShears; 14 | import net.minecraft.world.World; 15 | 16 | @Mixin(value = BlockDeadBush.class) 17 | public abstract class MixinBlockDeadBush extends BlockBush { 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Make dead bushes drop sticks. 22 | */ 23 | @Overwrite() 24 | public Item getItemDropped(int meta, Random rand, int fortune) { 25 | return Items.stick; 26 | } 27 | 28 | /** 29 | * @author jss2a98aj 30 | * @reason Make dead bushes drop 0-2 items. 31 | */ 32 | public int quantityDropped(Random random) { 33 | return random.nextInt(3); 34 | } 35 | 36 | /** 37 | * @author jss2a98aj 38 | * @reason Prevents duplicate drops when shearing. 39 | */ 40 | @Override 41 | public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { 42 | if (!(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemShears)) { 43 | super.harvestBlock(world, player, x, y, z, meta); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/backport/MixinBlockWeb.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.backport; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | 6 | import org.spongepowered.asm.mixin.Mixin; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.block.BlockWeb; 10 | import net.minecraft.block.material.Material; 11 | import net.minecraft.entity.player.EntityPlayer; 12 | import net.minecraft.init.Blocks; 13 | import net.minecraft.item.ItemShears; 14 | import net.minecraft.item.ItemStack; 15 | import net.minecraft.world.IBlockAccess; 16 | import net.minecraft.world.World; 17 | import net.minecraftforge.common.IShearable; 18 | 19 | @Mixin(value = BlockWeb.class) 20 | public abstract class MixinBlockWeb extends Block implements IShearable { 21 | 22 | protected MixinBlockWeb(Material material) { 23 | super(material); 24 | } 25 | 26 | /** 27 | * @author jss2a98aj 28 | * @reason Allows spiderwebs to be sheared without silk touch. 29 | */ 30 | @Override 31 | public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) { 32 | return true; 33 | } 34 | 35 | @Override 36 | public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) { 37 | return new ArrayList(Arrays.asList(new ItemStack(Blocks.web, 1, 0))); 38 | } 39 | 40 | /** 41 | * @author jss2a98aj 42 | * @reason Prevents duplicate drops when shearing. 43 | */ 44 | @Override 45 | public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { 46 | if (!(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemShears)) { 47 | super.harvestBlock(world, player, x, y, z, meta); 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/backport/MixinEntityMinecartTNT.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.backport; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Shadow; 5 | 6 | import net.minecraft.entity.Entity; 7 | import net.minecraft.entity.item.EntityMinecart; 8 | import net.minecraft.entity.item.EntityMinecartTNT; 9 | import net.minecraft.entity.projectile.EntityArrow; 10 | import net.minecraft.util.DamageSource; 11 | import net.minecraft.world.World; 12 | 13 | @Mixin(value = EntityMinecartTNT.class) 14 | public abstract class MixinEntityMinecartTNT extends EntityMinecart { 15 | 16 | public MixinEntityMinecartTNT(World world) { 17 | super(world); 18 | } 19 | 20 | @Shadow 21 | protected void explodeCart(double p_94103_1_) { 22 | } 23 | 24 | /** 25 | * @author jss2a98aj 26 | * @reason Fire arrows striking a cart will make it explode. 27 | */ 28 | public boolean attackEntityFrom(DamageSource source, float amount) { 29 | Entity entity = source.getSourceOfDamage(); 30 | 31 | if (entity instanceof EntityArrow) { 32 | EntityArrow entityarrow = (EntityArrow) entity; 33 | 34 | if (entityarrow.isBurning()) { 35 | explodeCart(entityarrow.motionX * entityarrow.motionX + entityarrow.motionY * entityarrow.motionY + entityarrow.motionZ * entityarrow.motionZ); 36 | } 37 | } 38 | return super.attackEntityFrom(source, amount); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/backport/MixinItemEnderPearl.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.backport; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.entity.item.EntityEnderPearl; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.Item; 9 | import net.minecraft.item.ItemEnderPearl; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.world.World; 12 | 13 | @Mixin(value = ItemEnderPearl.class) 14 | public abstract class MixinItemEnderPearl extends Item { 15 | 16 | /** 17 | * @author jss2a98aj 18 | * @reason Allows Ender Pearls to be thrown in creative mode. 19 | */ 20 | @Overwrite() 21 | public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { 22 | if (!player.capabilities.isCreativeMode) { 23 | --itemStack.stackSize; 24 | } 25 | world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); 26 | 27 | if (!world.isRemote) { 28 | world.spawnEntityInWorld(new EntityEnderPearl(world, player)); 29 | } 30 | return itemStack; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/backport/MixinItemFireball.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.backport; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.ModifyArg; 6 | 7 | import jss.bugtorch.BugTorch; 8 | import net.minecraft.item.Item; 9 | import net.minecraft.item.ItemFireball; 10 | 11 | @Mixin(ItemFireball.class) 12 | public class MixinItemFireball extends Item { 13 | 14 | @ModifyArg(at = @At(target = "Lnet/minecraft/world/World;playSoundEffect(DDDLjava/lang/String;FF)V", value = "INVOKE"), method = "onItemUse") 15 | private String getName(String original) { 16 | return BugTorch.MODID + ":item.fireCharge.use"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinBlockChest.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import jss.util.RandomXoshiro256StarStar; 4 | import net.minecraft.block.BlockChest; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | 8 | import java.util.Random; 9 | 10 | @Mixin(value = BlockChest.class) 11 | public abstract class MixinBlockChest { 12 | 13 | /** 14 | * Xoshiro256** is faster than Random. 15 | */ 16 | @Final 17 | private Random field_149955_b = new RandomXoshiro256StarStar(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinBlockHopper.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import jss.util.RandomXoshiro256StarStar; 4 | import net.minecraft.block.BlockHopper; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | 8 | import java.util.Random; 9 | 10 | @Mixin(value = BlockHopper.class) 11 | public abstract class MixinBlockHopper { 12 | 13 | /** 14 | * Xoshiro256** is faster than Random. 15 | */ 16 | @Final 17 | private Random field_149922_a = new RandomXoshiro256StarStar(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinEffectRenderer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import jss.util.RandomXoshiro256StarStar; 4 | import net.minecraft.client.particle.EffectRenderer; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | import java.util.Random; 8 | 9 | @Mixin(value = EffectRenderer.class) 10 | public abstract class MixinEffectRenderer { 11 | 12 | /** 13 | * Xoshiro256** is faster than Random. 14 | */ 15 | public Random rand = new RandomXoshiro256StarStar(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinEntity.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | import jss.util.RandomXoshiro256StarStar; 10 | import net.minecraft.entity.Entity; 11 | 12 | @Mixin(value = Entity.class) 13 | public abstract class MixinEntity { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Xoshiro256** is faster than Random. 18 | */ 19 | @Redirect(method = "*", at = @At(value = "NEW", target = "java/util/Random")) 20 | private Random redirectInitRandom() { 21 | return new RandomXoshiro256StarStar(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinItem.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | import jss.util.RandomXoshiro256StarStar; 8 | import net.minecraft.item.Item; 9 | 10 | @Mixin(value = Item.class) 11 | public abstract class MixinItem { 12 | 13 | /** 14 | * Xoshiro256** is faster than Random. 15 | */ 16 | @SuppressWarnings("unused") 17 | private static Random itemRand = new RandomXoshiro256StarStar(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinMinecraftServer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | 8 | import jss.util.RandomXoshiro256StarStar; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | @Mixin(value = MinecraftServer.class) 12 | public abstract class MixinMinecraftServer { 13 | 14 | /** 15 | * Xoshiro256** is faster than Random. 16 | */ 17 | @Final 18 | private Random field_147146_q = new RandomXoshiro256StarStar(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinRenderItem.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | import jss.util.RandomXoshiro256StarStar; 8 | import net.minecraft.client.renderer.entity.RenderItem; 9 | 10 | @Mixin(value = RenderItem.class) 11 | public abstract class MixinRenderItem { 12 | 13 | /** 14 | * Xoshiro256** is faster than Random. 15 | */ 16 | @SuppressWarnings("unused") 17 | private Random random = new RandomXoshiro256StarStar(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinWorld.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | import jss.util.RandomXoshiro256StarStar; 8 | import net.minecraft.world.World; 9 | 10 | @Mixin(value = World.class) 11 | public abstract class MixinWorld { 12 | 13 | /** 14 | * Xoshiro256** is faster than Random. 15 | */ 16 | public Random rand = new RandomXoshiro256StarStar(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fastrandom/MixinWorldClient.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fastrandom; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | import jss.util.RandomXoshiro256StarStar; 10 | import net.minecraft.client.multiplayer.WorldClient; 11 | 12 | @Mixin(value = WorldClient.class) 13 | public abstract class MixinWorldClient { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Xoshiro256** is faster than Random. 18 | */ 19 | @Redirect(method = "doVoidFogParticles", at = @At(value = "NEW", target = "java/util/Random", ordinal = 0)) 20 | private Random redirectDoVoidFogParticlesRandom() { 21 | return new RandomXoshiro256StarStar(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinBlockLeaves.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import com.llamalad7.mixinextras.sugar.Local; 4 | import net.minecraft.block.BlockLeaves; 5 | import net.minecraft.block.BlockLeavesBase; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.world.World; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 11 | 12 | @Mixin(value = BlockLeaves.class, priority = 100) 13 | public abstract class MixinBlockLeaves extends BlockLeavesBase { 14 | protected MixinBlockLeaves(Material p_i45433_1_, boolean p_i45433_2_) { 15 | super(p_i45433_1_, p_i45433_2_); 16 | } 17 | 18 | @ModifyVariable(method = "updateTick", at = @At(value = "STORE"), ordinal = 0) 19 | private byte editLeafDecayVal(byte value, 20 | @Local(argsOnly = true) World world, 21 | @Local(argsOnly = true, ordinal = 0) int x, 22 | @Local(argsOnly = true, ordinal = 1) int y, 23 | @Local(argsOnly = true, ordinal = 2) int z) { 24 | if(value == 4) { //Default value 25 | return 7; 26 | } 27 | return value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinBlockLiquid.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.Block; 7 | import net.minecraft.block.BlockLiquid; 8 | import net.minecraft.init.Blocks; 9 | import net.minecraft.world.World; 10 | 11 | @Mixin(value = BlockLiquid.class) 12 | public abstract class MixinBlockLiquid { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Lava should only hiss when mixing with water. 17 | */ 18 | @Overwrite() 19 | protected void func_149799_m(World worldIn, int x, int y, int z) { 20 | Block block = worldIn.getBlock(x, y, z); 21 | if (block == Blocks.cobblestone | block == Blocks.obsidian | block == Blocks.stone) { 22 | worldIn.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); 23 | for (int l = 0; l < 8; ++l) { 24 | worldIn.spawnParticle("largesmoke", (double)x + Math.random(), (double)y + 1.2D, (double)z + Math.random(), 0.0D, 0.0D, 0.0D); 25 | } 26 | } 27 | } 28 | 29 | } 30 | 31 | // I would like to do this instead, but the mixin fails to apply? 32 | /* 33 | @Mixin(value = BlockLiquid.class) 34 | public class MixinBlockLiquid extends Block { 35 | 36 | MixinBlockLiquid(Material worldIn) { 37 | super(worldIn); 38 | } 39 | 40 | @Shadow 41 | protected void func_149799_m(World worldIn, int x, int y, int z) { 42 | } 43 | 44 | @Overwrite() 45 | private void func_149805_n(World worldIn, int x, int y, int z) { 46 | if (worldIn.getBlock(x, y, z) == this) { 47 | if (this.blockMaterial == Material.lava) { 48 | if (worldIn.getBlock(x, y, z - 1).getMaterial() == Material.water || 49 | worldIn.getBlock(x, y, z + 1).getMaterial() == Material.water || 50 | worldIn.getBlock(x - 1, y, z).getMaterial() == Material.water || 51 | worldIn.getBlock(x + 1, y, z).getMaterial() == Material.water || 52 | worldIn.getBlock(x, y + 1, z).getMaterial() == Material.water ) { 53 | int l = worldIn.getBlockMetadata(x, y, z); 54 | 55 | if (l == 0) { 56 | worldIn.setBlock(x, y, z, Blocks.obsidian); 57 | this.func_149799_m(worldIn, x, y, z); 58 | } else if (l <= 4) { //Paper Spigot does else if (l > 0) 59 | worldIn.setBlock(x, y, z, Blocks.cobblestone); 60 | this.func_149799_m(worldIn, x, y, z); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | 67 | } 68 | */ 69 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinBlockSilverfish.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.BlockSilverfish; 7 | import net.minecraft.world.World; 8 | 9 | @Mixin(value = BlockSilverfish.class) 10 | public abstract class MixinBlockSilverfish { 11 | 12 | /** 13 | * @author jss2a98aj 14 | * @reason Stops two Silverfish from spawning when a player breaks infested blocks. 15 | */ 16 | @Overwrite() 17 | public void dropBlockAsItemWithChance(World world, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinContainer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import net.minecraft.inventory.Container; 4 | import net.minecraft.inventory.Slot; 5 | import net.minecraft.item.ItemStack; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | import java.util.List; 11 | 12 | @Mixin(value = Container.class) 13 | public abstract class MixinContainer { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Fixes few edge case bugs in mergeItemStack. 18 | */ 19 | @Overwrite 20 | protected boolean mergeItemStack(ItemStack input, int start, int length, boolean reverse) { 21 | boolean couldMerge = false; 22 | int index = reverse ? length - 1 : start; 23 | int increment = reverse ? -1 : 1; 24 | 25 | Slot slot; 26 | ItemStack slotStack; 27 | 28 | if(input.isStackable()) { 29 | while(input.stackSize > 0 && (!reverse && index < length || reverse && index >= start)) { 30 | slot = inventorySlots.get(index); 31 | slotStack = slot.getStack(); 32 | 33 | if(slotStack != null) { 34 | int maxRemovableFromInput = Math.min(input.getMaxStackSize(), slot.getSlotStackLimit()); 35 | int removeFromInput = Math.min(maxRemovableFromInput, input.stackSize); 36 | ItemStack partialStack = input.copy(); 37 | partialStack.stackSize = removeFromInput; 38 | 39 | if(slot.isItemValid(partialStack) && slotStack.getItem().equals(input.getItem()) && input.getItemDamage() == slotStack.getItemDamage() && ItemStack.areItemStackTagsEqual(input, slotStack)) { 40 | int combinedStackSize = slotStack.stackSize + input.stackSize; 41 | 42 | if(combinedStackSize <= input.getMaxStackSize()) { 43 | slotStack.stackSize = combinedStackSize; 44 | slot.onSlotChanged(); 45 | input.stackSize = 0; 46 | couldMerge = true; 47 | } else if(slotStack.stackSize < input.getMaxStackSize()) { 48 | removeFromInput = maxRemovableFromInput - slotStack.stackSize; 49 | slotStack.stackSize = slotStack.getMaxStackSize(); 50 | slot.onSlotChanged(); 51 | input.stackSize -= removeFromInput; 52 | couldMerge = true; 53 | } 54 | } 55 | } 56 | index += increment; 57 | } 58 | } 59 | 60 | index = reverse ? length - 1 : start; 61 | 62 | while(input.stackSize > 0 && (!reverse && index < length || reverse && index >= start)) { 63 | slot = inventorySlots.get(index); 64 | slotStack = slot.getStack(); 65 | 66 | if(slotStack == null) { 67 | int removeFromInput = Math.min(slot.getSlotStackLimit(), input.stackSize); 68 | ItemStack partialStack = input.copy(); 69 | partialStack.stackSize = removeFromInput; 70 | 71 | if(slot.isItemValid(partialStack)) { 72 | slot.putStack(partialStack); 73 | slot.onSlotChanged(); 74 | input.stackSize -= removeFromInput; 75 | couldMerge = true; 76 | } 77 | } 78 | index += increment; 79 | } 80 | 81 | return couldMerge; 82 | } 83 | 84 | @Shadow 85 | public List inventorySlots; 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinEntityLeashKnot.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.BlockFence; 5 | import net.minecraft.entity.EntityHanging; 6 | import net.minecraft.entity.EntityLeashKnot; 7 | import net.minecraft.world.World; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | 11 | @Mixin(value = EntityLeashKnot.class) 12 | public abstract class MixinEntityLeashKnot extends EntityHanging { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Prevent leads from breaking after being used with some modded fences. 17 | */ 18 | @Overwrite 19 | public boolean onValidSurface() { 20 | Block block = worldObj.getBlock(field_146063_b, field_146064_c, field_146062_d); 21 | return block.getRenderType() == 11 || block instanceof BlockFence; 22 | } 23 | 24 | public MixinEntityLeashKnot(World worldIn) { super(worldIn); } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinItemLilyPad.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.item.ItemLilyPad; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.world.World; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(value = ItemLilyPad.class) 13 | public abstract class MixinItemLilyPad { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Prevent client side ghost placement 18 | */ 19 | @Inject( 20 | method = "onItemRightClick(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/EntityPlayer;)Lnet/minecraft/item/ItemStack;", 21 | at = @At(value = "HEAD"), 22 | cancellable = true 23 | ) 24 | void serverAuthoritativeOnItemRightClick(ItemStack itemStack, World world, EntityPlayer player, CallbackInfoReturnable cir) { 25 | if(world.isRemote) { 26 | cir.setReturnValue(itemStack); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinSoundManager.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import net.minecraft.client.audio.SoundManager; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Inject; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 8 | 9 | @Mixin(SoundManager.class) 10 | public abstract class MixinSoundManager { 11 | @Inject(method = "reloadSoundSystem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/audio/SoundManager;loadSoundSystem()V")) 12 | public void snooze(CallbackInfo ctx) throws InterruptedException { 13 | Thread.sleep(333); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinVillageSiege.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import java.util.Iterator; 4 | import java.util.List; 5 | 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | import net.minecraft.entity.EnumCreatureType; 11 | import net.minecraft.entity.player.EntityPlayer; 12 | import net.minecraft.util.ChunkCoordinates; 13 | import net.minecraft.util.MathHelper; 14 | import net.minecraft.util.Vec3; 15 | import net.minecraft.village.Village; 16 | import net.minecraft.village.VillageSiege; 17 | import net.minecraft.world.SpawnerAnimals; 18 | import net.minecraft.world.World; 19 | 20 | @Mixin(value = VillageSiege.class) 21 | public abstract class MixinVillageSiege { 22 | 23 | @Shadow 24 | private World worldObj; 25 | @Shadow 26 | private int field_75533_d; 27 | @Shadow 28 | private int field_75534_e; 29 | @Shadow 30 | private Village theVillage; 31 | @Shadow 32 | private int field_75532_g; 33 | @Shadow 34 | private int field_75538_h; 35 | @Shadow 36 | private int field_75539_i; 37 | 38 | /** 39 | * @author jss2a98aj 40 | * @reason Allows Zombie sieges to start. 41 | */ 42 | @Overwrite() 43 | private boolean func_75529_b() { 44 | List list = worldObj.playerEntities; 45 | Iterator iterator = list.iterator(); 46 | 47 | while (true) { 48 | if (!iterator.hasNext()) { 49 | return false; 50 | } 51 | 52 | EntityPlayer entityplayer = iterator.next(); 53 | 54 | theVillage = worldObj.villageCollectionObj.findNearestVillage((int)entityplayer.posX, (int)entityplayer.posY, (int)entityplayer.posZ, 1); 55 | 56 | if (theVillage != null && theVillage.getNumVillageDoors() >= 10 && theVillage.getTicksSinceLastDoorAdding() >= 20 && theVillage.getNumVillagers() >= 20) { 57 | ChunkCoordinates chunkcoordinates = theVillage.getCenter(); 58 | float f = (float)theVillage.getVillageRadius(); 59 | boolean flag = false; 60 | 61 | for (int i = 0; i < 10; ++i) { 62 | float f1 = worldObj.rand.nextFloat() * (float)Math.PI * 2.0F; 63 | field_75532_g = chunkcoordinates.posX + (int)((double)(MathHelper.cos(f1) * f) * 0.9D); 64 | field_75538_h = chunkcoordinates.posY; 65 | field_75539_i = chunkcoordinates.posZ + (int)((double)(MathHelper.sin(f1) * f) * 0.9D); 66 | flag = false; 67 | Iterator iterator1 = worldObj.villageCollectionObj.getVillageList().iterator(); 68 | 69 | while (iterator1.hasNext()) { 70 | Village village = iterator1.next(); 71 | 72 | if (village != theVillage && village.isInRange(field_75532_g, field_75538_h, field_75539_i)) { 73 | flag = true; 74 | break; 75 | } 76 | } 77 | 78 | if (!flag) { 79 | break; 80 | } 81 | } 82 | 83 | if (flag) { 84 | return false; 85 | } 86 | 87 | Vec3 vec3 = func_75527_a(field_75532_g, field_75538_h, field_75539_i); 88 | 89 | if (vec3 != null) { 90 | break; 91 | } 92 | } 93 | } 94 | 95 | field_75534_e = 0; 96 | field_75533_d = 20; 97 | return true; 98 | } 99 | 100 | /** 101 | * @author jss2a98aj 102 | * @reason Fixes Zombie spawn location selection. 103 | */ 104 | @Overwrite() 105 | private Vec3 func_75527_a(int x, int y, int z) { 106 | for (int i = 0; i < 10; ++i) { 107 | int i1 = x + worldObj.rand.nextInt(16) - 8; 108 | int j1 = y + worldObj.rand.nextInt(6) - 3; 109 | int k1 = z + worldObj.rand.nextInt(16) - 8; 110 | 111 | if (theVillage.isInRange(i1, j1, k1) && SpawnerAnimals.canCreatureTypeSpawnAtLocation(EnumCreatureType.monster, worldObj, i1, j1, k1)) { 112 | return Vec3.createVectorHelper((double)i1, (double)j1, (double)k1); 113 | } 114 | } 115 | return null; 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/MixinWorldGenCanopyTree.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.world.World; 5 | import net.minecraft.world.gen.feature.WorldGenAbstractTree; 6 | import net.minecraft.world.gen.feature.WorldGenCanopyTree; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(value = WorldGenCanopyTree.class) 12 | public abstract class MixinWorldGenCanopyTree extends WorldGenAbstractTree { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Prevent unexpected breakage of blocks 17 | */ 18 | @Redirect( 19 | method = "generate(Lnet/minecraft/world/World;Ljava/util/Random;III)Z", 20 | at = @At( 21 | value = "INVOKE", 22 | target = "Lnet/minecraft/world/gen/feature/WorldGenCanopyTree;setBlockAndNotifyAdequately(Lnet/minecraft/world/World;IIILnet/minecraft/block/Block;I)V", 23 | ordinal = 4 24 | ) 25 | ) 26 | void ifReplaceableSetBlockAndNotifyAdequately(WorldGenCanopyTree gen, World world, int x, int y, int z, Block block, int meta) { 27 | if(isReplaceable(world, x, y, z)) { 28 | setBlockAndNotifyAdequately(world, x, y, z, block, meta); 29 | } 30 | } 31 | 32 | private MixinWorldGenCanopyTree(boolean doBlockNotify) { 33 | super(doBlockNotify); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/fix/block/MixinSoundTypeAnvil.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.fix.block; 2 | 3 | import net.minecraft.block.Block; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | 6 | @Mixin(targets = "net/minecraft/block/Block$3") 7 | public abstract class MixinSoundTypeAnvil extends Block.SoundType { 8 | 9 | @Override 10 | public String getStepResourcePath() { 11 | return "step.stone"; 12 | } 13 | 14 | MixinSoundTypeAnvil(String name, float volume, float frequency) { 15 | super(name, volume, frequency); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/logcleanup/MixinEntity.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.logcleanup; 2 | 3 | import java.util.HashMap; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | import cpw.mods.fml.common.FMLLog; 10 | import net.minecraft.entity.Entity; 11 | import net.minecraftforge.common.IExtendedEntityProperties; 12 | 13 | @Mixin(value = Entity.class) 14 | public abstract class MixinEntity { 15 | 16 | @Shadow(remap = false) 17 | protected HashMap extendedProperties; 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Stops log spam caused by some mods. 22 | */ 23 | @Overwrite(remap = false) 24 | public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties) { 25 | if (identifier == null) { 26 | FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); 27 | return ""; 28 | } 29 | if (properties == null) { 30 | FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); 31 | return ""; 32 | } 33 | 34 | String baseIdentifier = identifier; 35 | int identifierModCount = 1; 36 | while (this.extendedProperties.containsKey(identifier)) { 37 | identifier = String.format("%s%d", baseIdentifier, identifierModCount++); 38 | } 39 | 40 | this.extendedProperties.put(identifier, properties); 41 | return identifier; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/logcleanup/MixinNetHandlerPlayClient.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.logcleanup; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraft.client.network.NetHandlerPlayClient; 9 | import net.minecraft.network.play.server.S33PacketUpdateSign; 10 | import net.minecraft.tileentity.TileEntity; 11 | import net.minecraft.tileentity.TileEntitySign; 12 | 13 | @Mixin(value = NetHandlerPlayClient.class) 14 | public abstract class MixinNetHandlerPlayClient { 15 | 16 | @Shadow 17 | private Minecraft gameController; 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Stops a chat message from being sent to players when they receive an invalid sign packet. 22 | */ 23 | @Overwrite() 24 | public void handleUpdateSign(S33PacketUpdateSign updatePacket) { 25 | if (this.gameController.theWorld.blockExists(updatePacket.func_149346_c(), updatePacket.func_149345_d(), updatePacket.func_149344_e())) { 26 | TileEntity tileentity = this.gameController.theWorld.getTileEntity(updatePacket.func_149346_c(), updatePacket.func_149345_d(), updatePacket.func_149344_e()); 27 | 28 | if (tileentity instanceof TileEntitySign) { 29 | TileEntitySign tileentitysign = (TileEntitySign) tileentity; 30 | 31 | if (tileentitysign.func_145914_a()) { 32 | for (int i = 0; i < 4; ++i) { 33 | tileentitysign.signText[i] = updatePacket.func_149347_f()[i]; 34 | } 35 | tileentitysign.markDirty(); 36 | } 37 | } 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/logcleanup/MixinNioSocketChannel.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.logcleanup; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.channels.SelectableChannel; 6 | import java.nio.channels.SocketChannel; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | 11 | import io.netty.buffer.ByteBuf; 12 | import io.netty.channel.Channel; 13 | import io.netty.channel.ChannelOutboundBuffer; 14 | import io.netty.channel.nio.AbstractNioByteChannel; 15 | import io.netty.channel.socket.nio.NioSocketChannel; 16 | 17 | @Mixin(value = NioSocketChannel.class, remap = false) 18 | public abstract class MixinNioSocketChannel extends AbstractNioByteChannel { 19 | 20 | MixinNioSocketChannel(Channel parent, SelectableChannel ch) { 21 | super(parent, ch); 22 | } 23 | 24 | /** 25 | * @author C0bra5 26 | * @reason Fixes Netty causing excessive log spam and a resource leak when a connection is improperly terminated. 27 | */ 28 | @Overwrite 29 | protected void doWrite(ChannelOutboundBuffer in) throws Exception { 30 | for (;;) { 31 | // Do non-gathering write for a single buffer case. 32 | final int msgCount = in.size(); 33 | if (msgCount <= 1) { 34 | super.doWrite(in); 35 | return; 36 | } 37 | 38 | // Ensure the pending writes are made of ByteBufs only. 39 | ByteBuffer[] nioBuffers = in.nioBuffers(); 40 | if (nioBuffers == null) { 41 | super.doWrite(in); 42 | return; 43 | } 44 | 45 | int nioBufferCnt = in.nioBufferCount(); 46 | long expectedWrittenBytes = in.nioBufferSize(); 47 | 48 | final SocketChannel ch = (SocketChannel)javaChannel(); 49 | long writtenBytes = 0; 50 | boolean done = false; 51 | for (int i = config().getWriteSpinCount() - 1; i >= 0; i --) { 52 | long localWrittenBytes = 0l; 53 | try { 54 | localWrittenBytes = ch.write(nioBuffers, 0, nioBufferCnt); 55 | } catch(IOException ex) { 56 | close(); 57 | } 58 | 59 | if (localWrittenBytes == 0) { 60 | break; 61 | } 62 | expectedWrittenBytes -= localWrittenBytes; 63 | writtenBytes += localWrittenBytes; 64 | if (expectedWrittenBytes == 0) { 65 | done = true; 66 | break; 67 | } 68 | } 69 | 70 | if (done) { 71 | // Release all buffers 72 | for (int i = msgCount; i > 0; i --) { 73 | in.remove(); 74 | } 75 | 76 | // Finish the write loop if no new messages were flushed by in.remove(). 77 | if (in.isEmpty()) { 78 | clearOpWrite(); 79 | break; 80 | } 81 | } else { 82 | // Did not write all buffers completely. 83 | // Release the fully written buffers and update the indexes of the partially written buffer. 84 | 85 | for (int i = msgCount; i > 0; i --) { 86 | final ByteBuf buf = (ByteBuf) in.current(); 87 | final int readerIndex = buf.readerIndex(); 88 | final int readableBytes = buf.writerIndex() - readerIndex; 89 | 90 | if (readableBytes < writtenBytes) { 91 | in.progress(readableBytes); 92 | in.remove(); 93 | writtenBytes -= readableBytes; 94 | } else if (readableBytes > writtenBytes) { 95 | buf.readerIndex(readerIndex + (int) writtenBytes); 96 | in.progress(writtenBytes); 97 | break; 98 | } else { // readableBytes == writtenBytes 99 | in.progress(readableBytes); 100 | in.remove(); 101 | break; 102 | } 103 | } 104 | 105 | setOpWrite(); 106 | break; 107 | } 108 | } 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinBlock.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import org.spongepowered.asm.mixin.Final; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.init.Blocks; 10 | import net.minecraft.util.RegistryNamespaced; 11 | 12 | @Mixin(value = Block.class) 13 | public abstract class MixinBlock { 14 | 15 | @Shadow 16 | @Final 17 | public static RegistryNamespaced blockRegistry; 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Most calls have 0 (air), this makes those calls faster. 22 | */ 23 | @Overwrite() 24 | public static Block getBlockById(int blockId) { 25 | if (blockId == 0) return Blocks.air; 26 | Block ret = (Block) blockRegistry.getObjectById(blockId); 27 | return ret == null ? Blocks.air : ret; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinBlockChest.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | import net.minecraft.block.Block; 11 | import net.minecraft.block.BlockChest; 12 | import net.minecraft.block.BlockContainer; 13 | import net.minecraft.block.material.Material; 14 | import net.minecraft.entity.item.EntityItem; 15 | import net.minecraft.item.ItemStack; 16 | import net.minecraft.nbt.NBTTagCompound; 17 | import net.minecraft.tileentity.TileEntityChest; 18 | import net.minecraft.world.World; 19 | 20 | @Mixin(value = BlockChest.class) 21 | public abstract class MixinBlockChest extends BlockContainer { 22 | 23 | protected MixinBlockChest(Material material) { 24 | super(material); 25 | } 26 | 27 | @Shadow() 28 | @Final 29 | private Random field_149955_b; 30 | 31 | /** 32 | * @author jss2a98aj 33 | * @reason Splitting dropped item stacks just for them to stack right after is basically pointless. 34 | */ 35 | @Overwrite() 36 | public void breakBlock(World world, int x, int y, int z, Block block, int meta) { 37 | TileEntityChest tileEntityChest = (TileEntityChest) world.getTileEntity(x, y, z); 38 | if (tileEntityChest != null) { 39 | for (int slot = 0; slot < tileEntityChest.getSizeInventory(); ++slot) { 40 | ItemStack itemStack = tileEntityChest.getStackInSlot(slot); 41 | if (itemStack != null) { 42 | float randX = field_149955_b.nextFloat() * 0.8F + 0.1F; 43 | float randY = field_149955_b.nextFloat() * 0.8F + 0.1F; 44 | float randZ = field_149955_b.nextFloat() * 0.8F + 0.1F; 45 | EntityItem entityitem = new EntityItem(world,(float) x + randX, (float) y + randY, (float) z + randZ, itemStack); 46 | float motionMult = 0.05F; 47 | entityitem.motionX = (float) field_149955_b.nextGaussian() * motionMult; 48 | entityitem.motionY = (float) field_149955_b.nextGaussian() * motionMult + 0.2F; 49 | entityitem.motionZ = (float) field_149955_b.nextGaussian() * motionMult; 50 | if (itemStack.hasTagCompound()) { 51 | entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); 52 | } 53 | world.spawnEntityInWorld(entityitem); 54 | } 55 | } 56 | world.func_147453_f(x, y, z, block); 57 | } 58 | super.breakBlock(world, x, y, z, block, meta); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinBlockHopper.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | import net.minecraft.block.Block; 11 | import net.minecraft.block.BlockContainer; 12 | import net.minecraft.block.BlockHopper; 13 | import net.minecraft.block.material.Material; 14 | import net.minecraft.entity.item.EntityItem; 15 | import net.minecraft.item.ItemStack; 16 | import net.minecraft.nbt.NBTTagCompound; 17 | import net.minecraft.tileentity.TileEntityHopper; 18 | import net.minecraft.world.World; 19 | 20 | @Mixin(value = BlockHopper.class) 21 | public abstract class MixinBlockHopper extends BlockContainer { 22 | 23 | protected MixinBlockHopper(Material material) { 24 | super(material); 25 | } 26 | 27 | @Shadow() 28 | @Final 29 | private Random field_149922_a; 30 | 31 | /** 32 | * @author jss2a98aj 33 | * @reason Splitting dropped item stacks just for them to stack right after is basically pointless. 34 | */ 35 | @Overwrite() 36 | public void breakBlock(World world, int x, int y, int z, Block block, int meta) { 37 | TileEntityHopper tileEntityHopper = (TileEntityHopper) world.getTileEntity(x, y, z); 38 | if (tileEntityHopper != null) { 39 | for (int slot = 0; slot < tileEntityHopper.getSizeInventory(); ++slot) { 40 | ItemStack itemStack = tileEntityHopper.getStackInSlot(slot); 41 | if (itemStack != null) { 42 | float randX = field_149922_a.nextFloat() * 0.8F + 0.1F; 43 | float randY = field_149922_a.nextFloat() * 0.8F + 0.1F; 44 | float randZ = field_149922_a.nextFloat() * 0.8F + 0.1F; 45 | EntityItem entityitem = new EntityItem(world, (float) x + randX, (float) y + randY, (float) z + randZ, itemStack); 46 | float motionMult = 0.05F; 47 | entityitem.motionX = (float) field_149922_a.nextGaussian() * motionMult; 48 | entityitem.motionY = (float) field_149922_a.nextGaussian() * motionMult + 0.2F; 49 | entityitem.motionZ = (float) field_149922_a.nextGaussian() * motionMult; 50 | if (itemStack.hasTagCompound()) { 51 | entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); 52 | } 53 | world.spawnEntityInWorld(entityitem); 54 | } 55 | } 56 | world.func_147453_f(x, y, z, block); 57 | } 58 | super.breakBlock(world, x, y, z, block, meta); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinBlockRedstoneTorch.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | import java.util.WeakHashMap; 6 | 7 | import org.spongepowered.asm.mixin.Mixin; 8 | 9 | import net.minecraft.block.BlockRedstoneTorch; 10 | import net.minecraft.world.World; 11 | 12 | @Mixin(value = BlockRedstoneTorch.class) 13 | public abstract class MixinBlockRedstoneTorch { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Stops a memory leak by changing a HashMap to a WeakHashMap so worlds can be garbage collected 18 | */ 19 | @SuppressWarnings("unused") 20 | private static Map> field_150112_b = new WeakHashMap<>(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinBlockSnow.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import cpw.mods.fml.relauncher.Side; 7 | import cpw.mods.fml.relauncher.SideOnly; 8 | import net.minecraft.block.Block; 9 | import net.minecraft.block.BlockSnow; 10 | import net.minecraft.block.material.Material; 11 | import net.minecraft.init.Blocks; 12 | import net.minecraft.world.IBlockAccess; 13 | 14 | @Mixin(value = BlockSnow.class) 15 | public abstract class MixinBlockSnow extends Block { 16 | 17 | MixinBlockSnow(Material material) { 18 | super(material); 19 | } 20 | 21 | /** 22 | * @author jss2a98aj 23 | * @reason Culling for layered snow block sides. 24 | */ 25 | @Overwrite() 26 | @SideOnly(Side.CLIENT) 27 | public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { 28 | Block otherBlock = world.getBlock(x, y, z); 29 | // If the other block is also layered snow. 30 | if (otherBlock == Blocks.snow_layer) { 31 | int otherMeta = world.getBlockMetadata(x, y, z); 32 | switch (side) { 33 | case 0:// -y 34 | return false; 35 | case 1:// +y 36 | if(world.getBlockMetadata(x, y - 1, z) == 7) 37 | return false; 38 | break; 39 | case 2:// -z 40 | if(world.getBlockMetadata(x, y, z + 1) <= otherMeta) 41 | return false; 42 | break; 43 | case 3:// +z 44 | if(world.getBlockMetadata(x, y, z - 1) <= otherMeta) 45 | return false; 46 | break; 47 | case 4:// -x 48 | if(world.getBlockMetadata(x + 1, y, z) <= otherMeta) 49 | return false; 50 | break; 51 | case 5:// +x 52 | if(world.getBlockMetadata(x - 1, y, z) <= otherMeta) 53 | return false; 54 | } 55 | } 56 | boolean otherOpaque = otherBlock.isOpaqueCube(); 57 | // If the other block is opaque and this is not the top or the top is at full height. 58 | if(otherOpaque && (side != 1 || world.getBlockMetadata(x, y - 1, z) == 7)) { 59 | return false; 60 | } 61 | return true; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinBlockSnowBlock.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | import net.minecraft.block.BlockSnowBlock; 9 | import net.minecraft.world.World; 10 | 11 | @Mixin(value = BlockSnowBlock.class) 12 | public abstract class MixinBlockSnowBlock { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Makes this block's ticks much faster as it was never intended to tick. 17 | */ 18 | @Overwrite() 19 | public void updateTick(World world, int x, int y, int z, Random random) { 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinEntityItem.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 7 | 8 | import net.minecraft.entity.Entity; 9 | import net.minecraft.entity.item.EntityItem; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.world.World; 12 | 13 | @Mixin(value = EntityItem.class) 14 | public abstract class MixinEntityItem extends Entity { 15 | 16 | public MixinEntityItem(World world) { 17 | super(world); 18 | } 19 | 20 | /** 21 | * @author jss2a98aj 22 | * @reason If an item stack is full don't attempt to stack with nearby stacks. 23 | */ 24 | @Inject(method = "searchForOtherItemsNearby", at = @At("HEAD"), cancellable = true) 25 | private void searchForOtherItemsNearbyHead(CallbackInfo ci) { 26 | final ItemStack stack = getDataWatcher().getWatchableObjectItemStack(10); 27 | if ( stack != null && stack.stackSize >= stack.getMaxStackSize()) { 28 | ci.cancel(); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinEntityLivingBase.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import java.util.HashMap; 4 | 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | import net.minecraft.entity.Entity; 11 | import net.minecraft.entity.EntityLivingBase; 12 | import net.minecraft.potion.Potion; 13 | import net.minecraft.potion.PotionEffect; 14 | import net.minecraft.world.World; 15 | 16 | @Mixin(value = EntityLivingBase.class) 17 | public abstract class MixinEntityLivingBase extends Entity { 18 | 19 | MixinEntityLivingBase(World world) { 20 | super(world); 21 | } 22 | 23 | @Shadow 24 | @Final 25 | private HashMap activePotionsMap; 26 | 27 | /** 28 | * @author jss2a98aj 29 | * @reason If the potion array is empty don't waste time checking it. 30 | */ 31 | @Overwrite() 32 | public boolean isPotionActive(int potionID) { 33 | return activePotionsMap.size() != 0 && activePotionsMap.containsKey(potionID); 34 | } 35 | 36 | /** 37 | * @author jss2a98aj 38 | * @reason If the potion array is empty don't waste time checking it. 39 | */ 40 | @Overwrite() 41 | public boolean isPotionActive(Potion potion) { 42 | return activePotionsMap.size() != 0 && activePotionsMap.containsKey(potion.id); 43 | } 44 | 45 | /** 46 | * @author jss2a98aj 47 | * @reason Keeps the datawatcher from being updated when no change in air has occurred. 48 | */ 49 | @Override 50 | public void setAir(int airAmount) { 51 | if (getAir() != airAmount) { 52 | super.setAir(airAmount); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinGameSettings_Options.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import net.minecraft.client.settings.GameSettings; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | @Mixin(value = GameSettings.Options.class) 7 | public abstract class MixinGameSettings_Options { 8 | 9 | /** 10 | * @author jss2a98aj 11 | * @reason Makes this function not as unreasonably slow. 12 | */ 13 | @Overwrite 14 | public static GameSettings.Options getEnumOptions(int ordinal) { 15 | GameSettings.Options[] options = GameSettings.Options.values(); 16 | if(ordinal >= options.length | ordinal < 0) { 17 | return null; 18 | } else { 19 | return options[ordinal]; 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/MixinMinecraftServer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.server.MinecraftServer; 7 | 8 | @Mixin(value = MinecraftServer.class) 9 | public abstract class MixinMinecraftServer { 10 | 11 | /** 12 | * @author jss2a98aj 13 | * @reason Makes initial world loading faster. 14 | */ 15 | @Overwrite() 16 | public void initialWorldChunkLoad() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/optimization/gamesettings/MixinFasterSetOptions.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.optimization.gamesettings; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.settings.GameSettings; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.world.EnumDifficulty; 7 | import org.lwjgl.opengl.Display; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | 12 | @Mixin(value = GameSettings.class, priority = 990) 13 | public abstract class MixinFasterSetOptions { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Makes this function not unreasonably slow. 18 | */ 19 | @Overwrite 20 | public void setOptionFloatValue(GameSettings.Options option, float value) { 21 | switch(option) { 22 | case SENSITIVITY: 23 | mouseSensitivity = value; 24 | break; 25 | case FOV: 26 | fovSetting = value; 27 | break; 28 | case GAMMA: 29 | gammaSetting = value; 30 | break; 31 | case FRAMERATE_LIMIT: 32 | limitFramerate = (int) value; 33 | break; 34 | case CHAT_OPACITY: 35 | chatOpacity = value; 36 | mc.ingameGUI.getChatGUI().refreshChat(); 37 | break; 38 | case CHAT_HEIGHT_FOCUSED: 39 | chatHeightFocused = value; 40 | mc.ingameGUI.getChatGUI().refreshChat(); 41 | break; 42 | case CHAT_HEIGHT_UNFOCUSED: 43 | chatHeightUnfocused = value; 44 | mc.ingameGUI.getChatGUI().refreshChat(); 45 | break; 46 | case CHAT_WIDTH: 47 | chatWidth = value; 48 | mc.ingameGUI.getChatGUI().refreshChat(); 49 | break; 50 | case CHAT_SCALE: 51 | chatScale = value; 52 | mc.ingameGUI.getChatGUI().refreshChat(); 53 | break; 54 | case ANISOTROPIC_FILTERING: 55 | if (anisotropicFiltering != (int) value) { 56 | anisotropicFiltering = (int) value; 57 | mc.getTextureMapBlocks().setAnisotropicFiltering(this.anisotropicFiltering); 58 | mc.scheduleResourcesRefresh(); 59 | } 60 | break; 61 | case MIPMAP_LEVELS: 62 | if (mipmapLevels != (int) value) { 63 | mipmapLevels = (int) value; 64 | mc.getTextureMapBlocks().setMipmapLevels(this.mipmapLevels); 65 | mc.scheduleResourcesRefresh(); 66 | } 67 | break; 68 | case RENDER_DISTANCE: 69 | renderDistanceChunks = (int) value; 70 | break; 71 | case STREAM_BYTES_PER_PIXEL: 72 | field_152400_J = value; 73 | break; 74 | case STREAM_VOLUME_MIC: 75 | field_152401_K = value; 76 | mc.func_152346_Z().func_152915_s(); 77 | break; 78 | case STREAM_VOLUME_SYSTEM: 79 | field_152402_L = value; 80 | mc.func_152346_Z().func_152915_s(); 81 | break; 82 | case STREAM_KBPS: 83 | field_152403_M = value; 84 | break; 85 | case STREAM_FPS: 86 | field_152404_N = value; 87 | break; 88 | default: 89 | break; 90 | } 91 | } 92 | 93 | /** 94 | * @author jss2a98aj 95 | * @reason Makes this function not unreasonably slow. 96 | */ 97 | @Overwrite 98 | public void setOptionValue(GameSettings.Options option, int value) { 99 | switch(option) { 100 | case INVERT_MOUSE: 101 | invertMouse = !invertMouse; 102 | break; 103 | case GUI_SCALE: 104 | guiScale = guiScale + value & 3; 105 | break; 106 | case PARTICLES: 107 | particleSetting = (particleSetting + value) % 3; 108 | break; 109 | case VIEW_BOBBING: 110 | viewBobbing = !viewBobbing; 111 | break; 112 | case RENDER_CLOUDS: 113 | clouds = !clouds; 114 | break; 115 | case FORCE_UNICODE_FONT: 116 | forceUnicodeFont = !forceUnicodeFont; 117 | mc.fontRenderer.setUnicodeFlag(mc.getLanguageManager().isCurrentLocaleUnicode() || forceUnicodeFont); 118 | break; 119 | case ADVANCED_OPENGL: 120 | advancedOpengl = !advancedOpengl; 121 | mc.renderGlobal.loadRenderers(); 122 | case FBO_ENABLE: 123 | fboEnable = !fboEnable; 124 | break; 125 | case ANAGLYPH: 126 | anaglyph = !anaglyph; 127 | //refreshResources was overkill. 128 | mc.renderGlobal.loadRenderers(); 129 | break; 130 | case DIFFICULTY: 131 | difficulty = EnumDifficulty.getDifficultyEnum(difficulty.getDifficultyId() + value & 3); 132 | break; 133 | case GRAPHICS: 134 | fancyGraphics = !fancyGraphics; 135 | mc.renderGlobal.loadRenderers(); 136 | break; 137 | case AMBIENT_OCCLUSION: 138 | ambientOcclusion = (ambientOcclusion + value) % 3; 139 | mc.renderGlobal.loadRenderers(); 140 | break; 141 | case CHAT_VISIBILITY: 142 | chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility((chatVisibility.getChatVisibility() + value) % 3); 143 | break; 144 | case STREAM_COMPRESSION: 145 | field_152405_O = (field_152405_O + value) % 3; 146 | break; 147 | case STREAM_SEND_METADATA: 148 | field_152406_P = !field_152406_P; 149 | break; 150 | case STREAM_CHAT_ENABLED: 151 | field_152408_R = (field_152408_R + value) % 3; 152 | break; 153 | case STREAM_CHAT_USER_FILTER: 154 | field_152409_S = (field_152409_S + value) % 3; 155 | break; 156 | case STREAM_MIC_TOGGLE_BEHAVIOR: 157 | field_152410_T = (field_152410_T + value) % 2; 158 | break; 159 | case CHAT_COLOR: 160 | chatColours = !chatColours; 161 | break; 162 | case CHAT_LINKS: 163 | chatLinks = !chatLinks; 164 | break; 165 | case CHAT_LINKS_PROMPT: 166 | chatLinksPrompt = !chatLinksPrompt; 167 | break; 168 | case SNOOPER_ENABLED: 169 | snooperEnabled = !snooperEnabled; 170 | break; 171 | case SHOW_CAPE: 172 | showCape = !showCape; 173 | break; 174 | case TOUCHSCREEN: 175 | touchscreen = !touchscreen; 176 | break; 177 | case USE_FULLSCREEN: 178 | fullScreen = !fullScreen; 179 | if (mc.isFullScreen() != fullScreen) { 180 | mc.toggleFullscreen(); 181 | } 182 | break; 183 | case ENABLE_VSYNC: 184 | enableVsync = !enableVsync; 185 | Display.setVSyncEnabled(enableVsync); 186 | break; 187 | default: 188 | break; 189 | } 190 | saveOptions(); 191 | } 192 | 193 | /** 194 | * @author jss2a98aj 195 | * @reason Makes this function not unreasonably slow. 196 | */ 197 | 198 | @Shadow 199 | public void saveOptions() { 200 | } 201 | 202 | @Shadow protected Minecraft mc; 203 | 204 | @Shadow public float mouseSensitivity; 205 | @Shadow public boolean invertMouse; 206 | @Shadow public float fovSetting; 207 | @Shadow public float gammaSetting; 208 | @Shadow public int renderDistanceChunks; 209 | @Shadow public int guiScale; 210 | @Shadow public int particleSetting; 211 | @Shadow public boolean viewBobbing; 212 | @Shadow public boolean anaglyph; 213 | @Shadow public boolean advancedOpengl; 214 | @Shadow public int limitFramerate; 215 | @Shadow public boolean fboEnable; 216 | @Shadow public EnumDifficulty difficulty; 217 | @Shadow public boolean fancyGraphics; 218 | @Shadow public int ambientOcclusion; 219 | @Shadow public boolean clouds; 220 | @Shadow public EntityPlayer.EnumChatVisibility chatVisibility; 221 | @Shadow public boolean chatColours; 222 | @Shadow public boolean chatLinks; 223 | @Shadow public boolean chatLinksPrompt; 224 | @Shadow public float chatOpacity; 225 | @Shadow public boolean snooperEnabled; 226 | @Shadow public boolean fullScreen; 227 | @Shadow public boolean enableVsync; 228 | @Shadow public boolean showCape; 229 | @Shadow public boolean touchscreen; 230 | @Shadow public float chatHeightFocused; 231 | @Shadow public float chatHeightUnfocused; 232 | @Shadow public float chatScale; 233 | @Shadow public float chatWidth; 234 | @Shadow public int mipmapLevels; 235 | @Shadow public int anisotropicFiltering; 236 | @Shadow public float field_152400_J; 237 | @Shadow public float field_152401_K; 238 | @Shadow public float field_152402_L; 239 | @Shadow public float field_152403_M; 240 | @Shadow public float field_152404_N; 241 | @Shadow public int field_152405_O; 242 | @Shadow public boolean field_152406_P; 243 | @Shadow public int field_152408_R; 244 | @Shadow public int field_152409_S; 245 | @Shadow public int field_152410_T; 246 | @Shadow public boolean forceUnicodeFont; 247 | 248 | } 249 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/placement/MixinBlockBasePressurePlate.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.placement; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.Block; 7 | import net.minecraft.block.BlockBasePressurePlate; 8 | import net.minecraft.block.BlockFence; 9 | import net.minecraft.block.BlockWall; 10 | import net.minecraft.block.material.Material; 11 | import net.minecraft.world.World; 12 | 13 | @Mixin(value = BlockBasePressurePlate.class) 14 | public abstract class MixinBlockBasePressurePlate extends Block { 15 | 16 | MixinBlockBasePressurePlate(Material material) { 17 | super(material); 18 | } 19 | 20 | /** 21 | * @author jss2a98aj 22 | * @reason Allows pressure plates to be placed on anything that extends BlockFence or BlockWall. 23 | */ 24 | @Overwrite 25 | public boolean canPlaceBlockAt(World world, int x, int y, int z) { 26 | Block below = world.getBlock(x, y - 1, z); 27 | return World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) || below instanceof BlockFence || below instanceof BlockWall; 28 | } 29 | 30 | /** 31 | * @author jss2a98aj 32 | * @reason Allows pressure plates to be placed on anything that extends BlockFence or BlockWall. 33 | */ 34 | @Overwrite 35 | public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { 36 | if (!canPlaceBlockAt(world, x, y , z)) { 37 | dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); 38 | world.setBlockToAir(x, y, z); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/placement/MixinBlockFence.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.placement; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | 5 | import net.minecraft.block.BlockFence; 6 | import net.minecraft.world.World; 7 | 8 | @Mixin(value = BlockFence.class) 9 | public class MixinBlockFence { 10 | 11 | /** 12 | * @author jss2a98aj 13 | * @reason Allows torches to be placed on anything that extends BlockFence. 14 | */ 15 | public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { 16 | return true; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/placement/MixinBlockPumpkin.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.placement; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.BlockPumpkin; 7 | import net.minecraft.world.World; 8 | 9 | @Mixin(value = BlockPumpkin.class) 10 | public abstract class MixinBlockPumpkin { 11 | 12 | /** 13 | * @author jss2a98aj 14 | * @reason Allows pumpkins to be placed without a solid block below them. 15 | */ 16 | @Overwrite() 17 | public boolean canPlaceBlockAt(World world, int x, int y, int z) { 18 | return world.getBlock(x, y, z).isReplaceable(world, x, y, z); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/placement/MixinBlockWall.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.placement; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | 5 | import net.minecraft.block.BlockWall; 6 | import net.minecraft.world.World; 7 | 8 | @Mixin(value = BlockWall.class) 9 | public class MixinBlockWall { 10 | 11 | /** 12 | * @author jss2a98aj 13 | * @reason Allows torches to be placed on anything that extends BlockWall. 14 | */ 15 | public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { 16 | return true; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/rendering/MixinBlockEnchantmentTable.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.rendering; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | import net.minecraft.block.BlockContainer; 9 | import net.minecraft.block.BlockEnchantmentTable; 10 | import net.minecraft.block.material.Material; 11 | import net.minecraft.world.World; 12 | 13 | 14 | @Mixin(value = BlockEnchantmentTable.class) 15 | public abstract class MixinBlockEnchantmentTable extends BlockContainer { 16 | 17 | protected MixinBlockEnchantmentTable(Material material) { 18 | super(material); 19 | } 20 | 21 | /** 22 | * @author jss2a98aj 23 | * @reason Makes anything with enchantment power cause enchantment particles. 24 | */ 25 | @Overwrite() 26 | public void randomDisplayTick(World world, int x, int y, int z, Random rand) { 27 | //Unneeded in vanilla as the super call is empty. 28 | //super.randomDisplayTick(world, x, y, z, rand); 29 | for (int xPos = x - 2; xPos <= x + 2; ++xPos) { 30 | for (int zPos = z - 2; zPos <= z + 2; ++zPos) { 31 | if (xPos > x - 2 && xPos < x + 2 && zPos == z - 1) { 32 | zPos = z + 2; 33 | } 34 | if (rand.nextInt(16) == 0) { 35 | for (int yPos = y; yPos <= y + 1; ++yPos) { 36 | if (world.getBlock(xPos, yPos, zPos).getEnchantPowerBonus(world, xPos, yPos, zPos) > 0f) { 37 | if (!world.isAirBlock((xPos - x) / 2 + x, yPos, (zPos - z) / 2 + z)) { 38 | break; 39 | } 40 | world.spawnParticle("enchantmenttable", (double)x + 0.5D, (double)y + 2.0D, (double)z + 0.5D, (double)((float)(xPos - x) + rand.nextFloat()) - 0.5D, (double)((float)(yPos - y) - rand.nextFloat() - 1.0F), (double)((float)(zPos - z) + rand.nextFloat()) - 0.5D); 41 | } 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/rendering/MixinEffectRenderer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.rendering; 2 | 3 | import net.minecraft.client.particle.EffectRenderer; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Redirect; 7 | 8 | @Mixin(value = EffectRenderer.class) 9 | public abstract class MixinEffectRenderer { 10 | 11 | /** 12 | * @author jss2a98aj 13 | * @reason Makes most particles render with the expected depth. 14 | */ 15 | @Redirect(method = "renderParticles", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDepthMask(Z)V", ordinal = 0, remap = false)) 16 | private void skipGlDepthMask(boolean flag) { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/rendering/MixinMapItemRenderer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.rendering; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | 5 | import net.minecraft.client.gui.MapItemRenderer; 6 | 7 | @Mixin(value = MapItemRenderer.class) 8 | public abstract class MixinMapItemRenderer { 9 | 10 | // TODO 11 | // MC-3416 12 | // Player location marker invisible on map (wrong Z-Order) 13 | // Swap line 151 "++i;" to "--i;" it is a part of func_148237_a 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/rendering/MixinRenderItem.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.rendering; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraft.client.renderer.OpenGlHelper; 9 | import net.minecraft.client.renderer.Tessellator; 10 | import net.minecraft.client.renderer.entity.RenderItem; 11 | 12 | @Mixin(value = RenderItem.class) 13 | public abstract class MixinRenderItem { 14 | 15 | @Shadow 16 | public float zLevel; 17 | 18 | /** 19 | * @author jss2a98aj 20 | * @reason Makes renderGlint faster and fixes glBlendFunc being left with the wrong values. 21 | */ 22 | @Overwrite 23 | private void renderGlint(int unused, int posX, int posY, int width, int height) { 24 | final float timeUVSpeed = 0.00390625F; 25 | final Tessellator tessellator = Tessellator.instance; 26 | final long time = Minecraft.getSystemTime(); 27 | 28 | float layerUVNoise = 4.0F; 29 | 30 | OpenGlHelper.glBlendFunc(772, 1, 0, 0); 31 | 32 | OpenGlHelper.glBlendFunc(772, 1, 0, 1); 33 | 34 | //for(int layer = 0; layer < 2; ++layer) { 35 | final int timeUVDenominator = 3000 /*+ layer * 1873*/; 36 | final float timeUVNoise = (float)(time % (long)timeUVDenominator) / (float)timeUVDenominator * 256F; 37 | 38 | tessellator.startDrawingQuads(); 39 | tessellator.addVertexWithUV( 40 | posX, (posY + height), zLevel, 41 | ((timeUVNoise + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed) 42 | ); 43 | tessellator.addVertexWithUV( 44 | (posX + width), (posY + height), zLevel, 45 | ((timeUVNoise + (float)width + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed) 46 | ); 47 | tessellator.addVertexWithUV( 48 | (posX + width), posY, zLevel, 49 | ((timeUVNoise + (float)width) * timeUVSpeed), 0D 50 | ); 51 | tessellator.addVertexWithUV( 52 | posX, posY, zLevel, 53 | (timeUVNoise * timeUVSpeed), 0D 54 | ); 55 | tessellator.draw(); 56 | 57 | //layerUVNoise = -1.0F; 58 | //} 59 | 60 | OpenGlHelper.glBlendFunc(770, 771, 1, 0); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/shearing/MixinBlockLeaves.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.shearing; 2 | 3 | import net.minecraft.block.BlockLeaves; 4 | import net.minecraft.block.BlockLeavesBase; 5 | import net.minecraft.block.material.Material; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.item.ItemShears; 8 | import net.minecraft.world.World; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Overwrite; 11 | 12 | @Mixin(value = BlockLeaves.class) 13 | public abstract class MixinBlockLeaves extends BlockLeavesBase { 14 | 15 | MixinBlockLeaves(Material material, boolean renderFlag) { 16 | super(material, renderFlag); 17 | } 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Prevents duplicate drops when shearing. 22 | */ 23 | @Overwrite() 24 | public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { 25 | if (!(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemShears)) { 26 | super.harvestBlock(world, player, x, y, z, meta); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/shearing/MixinBlockTallGrass.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.shearing; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.BlockBush; 7 | import net.minecraft.block.BlockTallGrass; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | import net.minecraft.item.ItemShears; 10 | import net.minecraft.world.World; 11 | 12 | @Mixin(value = BlockTallGrass.class) 13 | public abstract class MixinBlockTallGrass extends BlockBush { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Prevents duplicate drops when shearing. 18 | */ 19 | @Overwrite() 20 | @Override 21 | public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { 22 | if (!(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemShears)) { 23 | super.harvestBlock(world, player, x, y, z, meta); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/shearing/MixinItemShears.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.shearing; 2 | 3 | import java.util.ArrayList; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.enchantment.Enchantment; 10 | import net.minecraft.enchantment.EnchantmentHelper; 11 | import net.minecraft.entity.item.EntityItem; 12 | import net.minecraft.entity.player.EntityPlayer; 13 | import net.minecraft.item.Item; 14 | import net.minecraft.item.ItemShears; 15 | import net.minecraft.item.ItemStack; 16 | import net.minecraft.stats.StatList; 17 | import net.minecraftforge.common.IShearable; 18 | 19 | @Mixin(value = ItemShears.class) 20 | public abstract class MixinItemShears extends Item { 21 | 22 | /** 23 | * @author jss2a98aj 24 | * @reason Makes Shears take damage when breaking blocks and stops shearable logic from running in creative mode. 25 | */ 26 | @Overwrite(remap = false) 27 | public boolean onBlockStartBreak(ItemStack itemStack, int x, int y, int z, EntityPlayer player) { 28 | if (player.worldObj.isRemote || player.capabilities.isCreativeMode) { 29 | return false; 30 | } 31 | Block block = player.worldObj.getBlock(x, y, z); 32 | if (block instanceof IShearable) { 33 | IShearable target = (IShearable)block; 34 | if (target.isShearable(itemStack, player.worldObj, x, y, z)) { 35 | ArrayList drops = target.onSheared(itemStack, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemStack)); 36 | for(ItemStack stack : drops) { 37 | float f = 0.7F; 38 | // Swap to itemRand rather than making a new random instance every time shears break an IShearable block 39 | double dx = (double)(itemRand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; 40 | double dy = (double)(itemRand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; 41 | double dz = (double)(itemRand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; 42 | EntityItem entityitem = new EntityItem(player.worldObj, (double)x + dx, (double)y + dy, (double)z + dz, stack); 43 | entityitem.delayBeforeCanPickup = 10; 44 | player.worldObj.spawnEntityInWorld(entityitem); 45 | } 46 | player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); 47 | } 48 | } 49 | itemStack.damageItem(1, player); 50 | return false; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/MixinBlockEndPortal.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.BlockEndPortal; 7 | import net.minecraft.world.World; 8 | 9 | @Mixin(value = BlockEndPortal.class) 10 | public abstract class MixinBlockEndPortal { 11 | 12 | /** 13 | * @author jss2a98aj 14 | * @reason Allows end portals to be placed outside of the overworld. 15 | */ 16 | @Overwrite() 17 | public void onBlockAdded(World worldIn, int x, int y, int z) { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/MixinEntityLightningBolt.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.effect.EntityLightningBolt; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.Constant; 7 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 8 | 9 | @Mixin(value = EntityLightningBolt.class) 10 | public abstract class MixinEntityLightningBolt { 11 | 12 | @ModifyConstant(method = "onUpdate", constant = @Constant(floatValue = 10000.0F)) 13 | private static float reduceLightningVolume(float old) { 14 | return BugTorchConfig.reduceLightningVolume; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/MixinFoodStats.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.util.DamageSource; 6 | import net.minecraft.util.FoodStats; 7 | import net.minecraft.world.EnumDifficulty; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(value = FoodStats.class, priority = 1010) 13 | public abstract class MixinFoodStats { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Makes starvation damage scale with max health. 18 | */ 19 | @Redirect( 20 | method = "onUpdate", 21 | at = @At( 22 | value = "INVOKE", 23 | target = "Lnet/minecraft/entity/player/EntityPlayer;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z" 24 | ) 25 | ) 26 | private boolean bugTorch$scalingStarvationDamage(EntityPlayer player, DamageSource source, float damage) { 27 | float survivalThreshold = player.worldObj.difficultySetting == EnumDifficulty.HARD ? 0f : 1f; 28 | return player.attackEntityFrom(source, Math.min( 29 | BugTorchConfig.scaledStarvationDamageMaxHealthMult * player.getMaxHealth() + BugTorchConfig.scaledStarvationDamageMaxHealthFlat, 30 | player.getHealth() - survivalThreshold 31 | )); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/MixinIntegratedServer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.net.InetAddress; 6 | import java.net.Proxy; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | 12 | import jss.bugtorch.config.BugTorchConfig; 13 | import net.minecraft.client.multiplayer.ThreadLanServerPing; 14 | import net.minecraft.server.MinecraftServer; 15 | import net.minecraft.server.integrated.IntegratedServer; 16 | import net.minecraft.world.WorldSettings; 17 | 18 | @Mixin(value = IntegratedServer.class) 19 | public abstract class MixinIntegratedServer extends MinecraftServer { 20 | 21 | @Shadow 22 | private boolean isPublic; 23 | 24 | @Shadow 25 | private ThreadLanServerPing lanServerPing; 26 | 27 | public MixinIntegratedServer(File file, Proxy proxy) { 28 | super(file, proxy); 29 | } 30 | 31 | /** 32 | * @author jss2a98aj 33 | * @reason Allows a specific port to be selected instead of a random one. 34 | */ 35 | @Overwrite() 36 | public String shareToLAN(WorldSettings.GameType gameType, boolean allowCommands) { 37 | try { 38 | int i = BugTorchConfig.lanPortToUseForOverride; 39 | func_147137_ag().addLanEndpoint((InetAddress)null, i); 40 | isPublic = true; 41 | lanServerPing = new ThreadLanServerPing(getMOTD(), i + ""); 42 | lanServerPing.start(); 43 | getConfigurationManager().func_152604_a(gameType); 44 | getConfigurationManager().setCommandsAllowedForAll(allowCommands); 45 | return i + ""; 46 | } catch (IOException ex) { 47 | return null; 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/MixinRecipeArmorDyes.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks; 2 | 3 | import jss.bugtorch.BugTorch; 4 | import net.minecraft.init.Items; 5 | import net.minecraft.inventory.InventoryCrafting; 6 | import net.minecraft.item.Item; 7 | import net.minecraft.item.ItemArmor; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.item.crafting.RecipesArmorDyes; 10 | import net.minecraft.world.World; 11 | import net.minecraftforge.oredict.OreDictionary; 12 | import org.apache.commons.lang3.ArrayUtils; 13 | import org.spongepowered.asm.mixin.Mixin; 14 | import org.spongepowered.asm.mixin.injection.At; 15 | import org.spongepowered.asm.mixin.injection.Inject; 16 | import org.spongepowered.asm.mixin.injection.Redirect; 17 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 18 | 19 | @Mixin(value = RecipesArmorDyes.class, priority = 1100) 20 | public abstract class MixinRecipeArmorDyes { 21 | @Inject(method = "matches", at = @At("HEAD"), cancellable = true) 22 | public void recipesArmorDyesMatchBetter(InventoryCrafting inv, World world, CallbackInfoReturnable ctx) { 23 | boolean hasArmor = false, hasDye = false; 24 | 25 | for (int i = 0; i < inv.getSizeInventory(); i++) { 26 | ItemStack stack = inv.getStackInSlot(i); 27 | //the ide has no idea how vital this continue is 28 | if (stack == null) { 29 | continue; 30 | } else if (stack.getItem() instanceof ItemArmor && !hasArmor && ((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.CLOTH) { 31 | hasArmor = true; 32 | } else { 33 | boolean pass = false; 34 | int[] ids = OreDictionary.getOreIDs(stack); 35 | for (int dyeOreId : BugTorch.dyeOreIds) { 36 | if (ArrayUtils.contains(ids, dyeOreId)) { 37 | pass = hasDye = true; 38 | } 39 | } 40 | if (!pass) { 41 | ctx.setReturnValue(false); 42 | return; 43 | } 44 | } 45 | } 46 | ctx.setReturnValue(hasArmor && hasDye); 47 | } 48 | 49 | @Redirect(method = "getCraftingResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;", ordinal = 2)) 50 | public Item recipesArmorDyesPreventEarlyReturn(ItemStack stack) { 51 | //early return prevention 52 | return Items.dye; 53 | } 54 | 55 | @Redirect(method = "getCraftingResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItemDamage()I")) 56 | public int recipesArmorDyesMatchDyeToColorMeta(ItemStack stack) { 57 | int[] od = OreDictionary.getOreIDs(stack); 58 | for (int i = 0; i < BugTorch.dyeOreIds.length; i++) { 59 | if(ArrayUtils.contains(od, BugTorch.dyeOreIds[i])) return i; 60 | } 61 | return 15; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/blockfarmland/MixinHydroponics.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.blockfarmland; 2 | 3 | import net.minecraft.block.BlockFarmland; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.world.World; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | 9 | @Mixin(value = BlockFarmland.class) 10 | public abstract class MixinHydroponics { 11 | 12 | /** 13 | * @author jss2a98aj 14 | * @reason Hydroponics. 15 | */ 16 | @Overwrite() 17 | private boolean func_149821_m(World world, int x, int y, int z) { 18 | if (world.getBlock(x, y - 1, z).getMaterial() == Material.water) { 19 | return true; 20 | } 21 | for (int xSearch = x - 4; xSearch <= x + 4; ++xSearch) { 22 | for (int zSearch = z - 4; zSearch <= z + 4; ++zSearch) { 23 | if (world.getBlock(xSearch, y, zSearch).getMaterial() == Material.water) { 24 | return true; 25 | } 26 | } 27 | } 28 | return false; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/blockfarmland/MixinNewTextures.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.blockfarmland; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.BlockFarmland; 5 | import net.minecraft.block.material.Material; 6 | import net.minecraft.client.renderer.texture.IIconRegister; 7 | import net.minecraft.util.IIcon; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | 11 | @Mixin(value = BlockFarmland.class) 12 | public abstract class MixinNewTextures extends Block { 13 | 14 | MixinNewTextures(Material material) { 15 | super(material); 16 | } 17 | 18 | @Shadow 19 | private IIcon field_149824_a;// wet 20 | @Shadow 21 | private IIcon field_149823_b;// dry 22 | 23 | private IIcon sideWet; 24 | private IIcon sideDry; 25 | 26 | public IIcon getIcon(int side, int meta) { 27 | return meta > 0 ? (side == 1 ? field_149824_a : sideWet) : (side == 1 ? field_149823_b : sideDry); 28 | } 29 | 30 | /** 31 | * @author jss2a98aj 32 | * @reason New side/bottom textures. 33 | */ 34 | public void registerBlockIcons(IIconRegister iconRegister) { 35 | field_149824_a = iconRegister.registerIcon(getTextureName() + "_wet"); 36 | field_149823_b = iconRegister.registerIcon(getTextureName() + "_dry"); 37 | sideWet = iconRegister.registerIcon(getTextureName() + "_wet_side"); 38 | sideDry = iconRegister.registerIcon(getTextureName() + "_dry_side"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/blockfarmland/MixinNoTrample.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.blockfarmland; 2 | 3 | import net.minecraft.block.BlockFarmland; 4 | import net.minecraft.entity.Entity; 5 | import net.minecraft.world.World; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | 9 | @Mixin(value = BlockFarmland.class) 10 | public abstract class MixinNoTrample { 11 | 12 | /** 13 | * @author jss2a98aj 14 | * @reason I don't like crops getting trampled. 15 | */ 16 | @Overwrite() 17 | public void onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance) { 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/damage/MixinFireDamage_Entity.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.damage; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.util.DamageSource; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(value = Entity.class) 11 | public abstract class MixinFireDamage_Entity { 12 | 13 | /** 14 | * @author jss2a98aj 15 | * @reason Makes fire damage scale with max health. 16 | */ 17 | @Redirect( 18 | method = "onEntityUpdate()V", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/entity/Entity;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z" 22 | ) 23 | ) 24 | private boolean bugTorch$scalingFireDamage(Entity entity, DamageSource source, float damage) { 25 | return bugTorch$doFireDamage(); 26 | } 27 | 28 | public boolean bugTorch$doFireDamage() { 29 | return attackEntityFrom(DamageSource.onFire, 1.0F); 30 | } 31 | 32 | @Shadow 33 | public abstract boolean attackEntityFrom(DamageSource source, float amount); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/damage/MixinFireDamage_EntityPlayer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.damage; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.util.DamageSource; 7 | import net.minecraft.world.World; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | 10 | @Mixin(value = EntityPlayer.class) 11 | public abstract class MixinFireDamage_EntityPlayer extends EntityLivingBase { 12 | 13 | public boolean bugTorch$doFireDamage() { 14 | return attackEntityFrom(DamageSource.onFire, 15 | BugTorchConfig.scaledFireDamageMaxHealthMult * getMaxHealth() + BugTorchConfig.scaledFireDamageMaxHealthFlat 16 | ); 17 | } 18 | 19 | public MixinFireDamage_EntityPlayer(World world) { 20 | super(world); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/damage/MixinLavaDamage.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.damage; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.util.DamageSource; 7 | import net.minecraft.world.World; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | 10 | @Mixin(value = EntityPlayer.class) 11 | public abstract class MixinLavaDamage extends EntityLivingBase { 12 | 13 | /** 14 | * @author jss2a98aj 15 | * @reason Makes lava damage scale with max health. 16 | */ 17 | @Override 18 | protected void setOnFireFromLava() { 19 | if(!isImmuneToFire) { 20 | attackEntityFrom(DamageSource.lava, 21 | BugTorchConfig.scaledLavaDamageMaxHealthMult * getMaxHealth() + BugTorchConfig.scaledLavaDamageMaxHealthFlat 22 | ); 23 | setFire(15); 24 | } 25 | } 26 | 27 | public MixinLavaDamage(World world) { 28 | super(world); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/entitylivingbase/MixinScalingDrowningDamage.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.entitylivingbase; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.util.DamageSource; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(value = EntityLivingBase.class) 12 | public abstract class MixinScalingDrowningDamage { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Makes drowning damage scale with max health on players. 17 | */ 18 | @Redirect( 19 | method = "onEntityUpdate", 20 | at = @At( 21 | value = "INVOKE", 22 | target = "Lnet/minecraft/entity/EntityLivingBase;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z", 23 | ordinal = 1 24 | ) 25 | ) 26 | private boolean bugTorch$scalingDrowningDamage(EntityLivingBase entity, DamageSource source, float damage) { 27 | return entity.attackEntityFrom(source, 28 | (entity instanceof EntityPlayer) 29 | ? BugTorchConfig.scaledDrowningDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledDrowningDamageMaxHealthFlat 30 | : damage 31 | ); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/entitylivingbase/MixinScalingSuffocationDamage.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.entitylivingbase; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.util.DamageSource; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(value = EntityLivingBase.class) 12 | public abstract class MixinScalingSuffocationDamage { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Makes wall suffocation damage scale with max health on players. 17 | */ 18 | @Redirect( 19 | method = "onEntityUpdate", 20 | at = @At( 21 | value = "INVOKE", 22 | target = "Lnet/minecraft/entity/EntityLivingBase;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z", 23 | ordinal = 0 24 | ) 25 | ) 26 | private boolean bugTorch$scalingSuffocationDamage(EntityLivingBase entity, DamageSource source, float damage) { 27 | return entity.attackEntityFrom(source, 28 | (entity instanceof EntityPlayer) 29 | ? BugTorchConfig.scaledSuffocationDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledSuffocationDamageMaxHealthFlat 30 | : damage); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/entitylivingbase/MixinTranslucentClientPotionEffects.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.entitylivingbase; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 6 | 7 | import net.minecraft.client.entity.AbstractClientPlayer; 8 | import net.minecraft.entity.EntityLivingBase; 9 | 10 | @Mixin(value = EntityLivingBase.class) 11 | public abstract class MixinTranslucentClientPotionEffects { 12 | 13 | /** 14 | * @author Roadhog360 15 | * @reason Makes potion particles rendering on a player's character translucent. 16 | */ 17 | @ModifyVariable(method = "updatePotionEffects()V", at = @At("STORE"), ordinal = 0) 18 | private boolean checkIfClient(boolean flag) { 19 | return flag || (EntityLivingBase) (Object) this instanceof AbstractClientPlayer; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/potion/MixinsPotionPoison.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.potion; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.potion.Potion; 7 | import net.minecraft.util.DamageSource; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(value = Potion.class) 13 | public abstract class MixinsPotionPoison { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Makes poison effect damage scale with max health. 18 | */ 19 | @Redirect( 20 | method = "performEffect", 21 | at = @At( 22 | value = "INVOKE", 23 | target = "Lnet/minecraft/entity/EntityLivingBase;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z", 24 | ordinal = 0 25 | ) 26 | ) 27 | private boolean bugTorch$scalingWitherEffectDamage(EntityLivingBase entity, DamageSource source, float damage) { 28 | return entity.attackEntityFrom(source, 29 | (entity instanceof EntityPlayer) 30 | ? Math.min( 31 | BugTorchConfig.scaledPoisonDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledPoisonDamageMaxHealthFlat, 32 | entity.getHealth() - 1f 33 | ) 34 | : damage); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/potion/MixinsPotionWither.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.tweaks.potion; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.entity.EntityLivingBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.potion.Potion; 7 | import net.minecraft.util.DamageSource; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(value = Potion.class) 13 | public abstract class MixinsPotionWither { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Makes wither effect damage scale with max health. 18 | */ 19 | @Redirect( 20 | method = "performEffect", 21 | at = @At( 22 | value = "INVOKE", 23 | target = "Lnet/minecraft/entity/EntityLivingBase;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z", 24 | ordinal = 1 25 | ) 26 | ) 27 | private boolean bugTorch$scalingWitherEffectDamage(EntityLivingBase entity, DamageSource source, float damage) { 28 | return entity.attackEntityFrom(source, 29 | (entity instanceof EntityPlayer) 30 | ? BugTorchConfig.scaledWitherDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledWitherDamageMaxHealthFlat 31 | : damage); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/villagertrademeta/MixinMerchantRecipe.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.villagertrademeta; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.village.MerchantRecipe; 9 | 10 | @Mixin(value = MerchantRecipe.class) 11 | public abstract class MixinMerchantRecipe { 12 | 13 | @Shadow 14 | private ItemStack itemToBuy; 15 | @Shadow 16 | private ItemStack secondItemToBuy; 17 | @Shadow 18 | private ItemStack itemToSell; 19 | 20 | /** 21 | * @author jss2a98aj 22 | * @reason Villager trades will now respect metadata. 23 | */ 24 | @Overwrite() 25 | public boolean hasSameIDsAs(MerchantRecipe trade) { 26 | return (itemToBuy.getItem() == trade.itemToBuy.getItem() && itemToBuy.getItemDamage() == trade.itemToBuy.getItemDamage()) && 27 | (itemToSell.getItem() == trade.itemToSell.getItem() && itemToSell.getItemDamage() == trade.itemToSell.getItemDamage()) ? 28 | secondItemToBuy == null && trade.secondItemToBuy == null || 29 | secondItemToBuy != null && trade.secondItemToBuy != null && 30 | (secondItemToBuy.getItem() == trade.secondItemToBuy.getItem() && secondItemToBuy.getItemDamage() == trade.secondItemToBuy.getItemDamage()) 31 | : false; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/villagertrademeta/MixinSlotMerchantResult.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.villagertrademeta; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.inventory.SlotMerchantResult; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.village.MerchantRecipe; 9 | 10 | @Mixin(value = SlotMerchantResult.class) 11 | public abstract class MixinSlotMerchantResult { 12 | 13 | /** 14 | * @author jss2a98aj 15 | * @reason Villager trades will now respect metadata. 16 | */ 17 | @Overwrite() 18 | private boolean func_75230_a(MerchantRecipe requirements, ItemStack offeredItem1, ItemStack offeredItem2) { 19 | ItemStack itemstack1 = requirements.getItemToBuy(); 20 | ItemStack itemstack2 = requirements.getSecondItemToBuy(); 21 | 22 | if (offeredItem1 != null && offeredItem1.getItem() == itemstack1.getItem() && (offeredItem1.getItemDamage() == itemstack1.getItemDamage())) { 23 | if (itemstack2 != null && offeredItem2 != null && itemstack2.getItem() == offeredItem2.getItem() && itemstack2.getItemDamage() == offeredItem2.getItemDamage()) { 24 | offeredItem1.stackSize -= itemstack1.stackSize; 25 | offeredItem2.stackSize -= itemstack2.stackSize; 26 | return true; 27 | } 28 | 29 | if (itemstack2 == null && offeredItem2 == null) { 30 | offeredItem1.stackSize -= itemstack1.stackSize; 31 | return true; 32 | } 33 | } 34 | return false; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/worldgen/MixinStructureComponent.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.worldgen; 2 | 3 | import net.minecraft.block.BlockLog; 4 | import net.minecraft.init.Blocks; 5 | import net.minecraftforge.common.IPlantable; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Overwrite; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | 10 | import net.minecraft.block.Block; 11 | import net.minecraft.block.material.Material; 12 | import net.minecraft.world.World; 13 | import net.minecraft.world.gen.structure.StructureBoundingBox; 14 | import net.minecraft.world.gen.structure.StructureComponent; 15 | 16 | @Mixin(value = StructureComponent.class) 17 | public abstract class MixinStructureComponent { 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Makes func_151554_b replace blocks that are considered replaceable. 22 | */ 23 | @Overwrite() 24 | protected void func_151554_b(World world, Block block, int metadata, int structX, int structY, int structZ, StructureBoundingBox sbb) { 25 | final int x = getXWithOffset(structX, structZ); 26 | int y = getYWithOffset(structY); 27 | final int z = getZWithOffset(structX, structZ); 28 | 29 | if(sbb.isVecInside(x, y, z)) { 30 | Block otherBlock; 31 | Material material; 32 | do { 33 | otherBlock = world.getBlock(x, y, z); 34 | material = otherBlock.getMaterial(); 35 | if(y > 1 && (material.isReplaceable() || material.isLiquid() || otherBlock instanceof IPlantable || world.isAirBlock(x, y, z))) { 36 | world.setBlock(x, y, z, block, metadata, 2); 37 | --y; 38 | } else { 39 | break; 40 | } 41 | } while(true); 42 | } 43 | } 44 | 45 | /** 46 | * @author jss2a98aj 47 | * @reason Makes clearCurrentPositionBlocksUpwards treat logs and leaves as air. 48 | */ 49 | @Overwrite() 50 | protected void clearCurrentPositionBlocksUpwards(World world, int structX, int structY, int structZ, StructureBoundingBox sbb) { 51 | final int x = this.getXWithOffset(structX, structZ); 52 | int y = this.getYWithOffset(structY); 53 | final int z = this.getZWithOffset(structX, structZ); 54 | 55 | if(!sbb.isVecInside(x, y, z)) { 56 | return; 57 | } 58 | while(y < 255) { 59 | Block block = world.getBlock(x, y, z); 60 | if(block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z) || block instanceof BlockLog || block.getMaterial() == Material.vine) { 61 | return; 62 | } 63 | world.setBlock(x, y, z, Blocks.air, 0, 2); 64 | ++y; 65 | } 66 | } 67 | 68 | @Shadow 69 | protected abstract int getXWithOffset(int x, int z); 70 | @Shadow 71 | protected abstract int getYWithOffset(int y); 72 | @Shadow 73 | protected abstract int getZWithOffset(int x, int z); 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/worldgen/MixinStructureMineshaftPieces$Room.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.worldgen; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | 8 | import jss.bugtorch.ducks.IOffsetDuck; 9 | import net.minecraft.world.gen.structure.StructureBoundingBox; 10 | import net.minecraft.world.gen.structure.StructureComponent; 11 | import net.minecraft.world.gen.structure.StructureMineshaftPieces; 12 | 13 | @Mixin(value = StructureMineshaftPieces.Room.class) 14 | public abstract class MixinStructureMineshaftPieces$Room extends StructureComponent implements IOffsetDuck { 15 | 16 | @Shadow 17 | private List roomsLinkedToTheRoom; 18 | 19 | /** 20 | * Used to move Mineshaft air pockets to the intended place. 21 | */ 22 | public void offset(int x, int y, int z) { 23 | for(StructureBoundingBox bb : roomsLinkedToTheRoom) { 24 | bb.offset(x, y, z); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/worldgen/MixinStructureStart.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.worldgen; 2 | 3 | import java.util.Iterator; 4 | import java.util.Random; 5 | 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 11 | 12 | import jss.bugtorch.ducks.IOffsetDuck; 13 | import net.minecraft.world.World; 14 | import net.minecraft.world.gen.structure.StructureComponent; 15 | import net.minecraft.world.gen.structure.StructureMineshaftPieces; 16 | import net.minecraft.world.gen.structure.StructureStart; 17 | 18 | @Mixin(value = StructureStart.class) 19 | public abstract class MixinStructureStart { 20 | 21 | /** 22 | * @author Roadhog360 23 | * @reason Move Mineshaft air pockets to the intended place. 24 | */ 25 | @Inject(method = "markAvailableHeight(Lnet/minecraft/world/World;Ljava/util/Random;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/gen/structure/StructureBoundingBox;offset(III)V", ordinal = 1), locals = LocalCapture.CAPTURE_FAILHARD) 26 | private void offsetCustom(World world, Random rand, int p_75067_3_, CallbackInfo info, int i, int k, int l, Iterator iterator, StructureComponent component) { 27 | if(component instanceof StructureMineshaftPieces.Room) { 28 | ((IOffsetDuck)component).offset(0, l, 0); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/worldgen/MixinStructureVillagePieces_Path.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.worldgen; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.init.Blocks; 10 | import net.minecraft.world.World; 11 | import net.minecraft.world.gen.structure.StructureBoundingBox; 12 | import net.minecraft.world.gen.structure.StructureVillagePieces; 13 | import net.minecraft.world.gen.structure.StructureVillagePieces.Path; 14 | 15 | @Mixin(value = Path.class) 16 | public abstract class MixinStructureVillagePieces_Path extends StructureVillagePieces.Road { 17 | 18 | /** 19 | * @author jss2a98aj 20 | * @reason Keeps flowers and grass from being left above village paths. 21 | */ 22 | @Overwrite() 23 | public boolean addComponentParts(World world, Random random, StructureBoundingBox structBoundingBox) { 24 | Block block = func_151558_b(Blocks.gravel, 0); 25 | 26 | for (int x = boundingBox.minX; x <= boundingBox.maxX; ++x) { 27 | for (int z = boundingBox.minZ; z <= boundingBox.maxZ; ++z) { 28 | if (structBoundingBox.isVecInside(x, 64, z)) { 29 | int y = world.getTopSolidOrLiquidBlock(x, z) - 1; 30 | world.setBlock(x, y, z, block, 0, 2); 31 | if(!world.getBlock(x, y + 1, z).canBlockStay(world, x, y + 1, z)) { 32 | world.setBlock(x, y + 1, z, Blocks.air, 0, 2); 33 | } 34 | } 35 | } 36 | } 37 | return true; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/worldgen/MixinStructureVillagePieces_Well.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.worldgen; 2 | 3 | import java.util.Random; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.init.Blocks; 10 | import net.minecraft.world.World; 11 | import net.minecraft.world.biome.BiomeGenBase; 12 | import net.minecraft.world.gen.structure.StructureBoundingBox; 13 | import net.minecraft.world.gen.structure.StructureVillagePieces; 14 | import net.minecraft.world.gen.structure.StructureVillagePieces.Well; 15 | 16 | @Mixin(value = Well.class) 17 | public abstract class MixinStructureVillagePieces_Well extends StructureVillagePieces.Village { 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Makes village wells spawned in deserts use the correct materials. 22 | */ 23 | @Overwrite() 24 | public boolean addComponentParts(World world, Random random, StructureBoundingBox boundingBox) { 25 | if (field_143015_k < 0) { 26 | field_143015_k = getAverageGroundLevel(world, boundingBox); 27 | 28 | if (field_143015_k < 0) { 29 | return true; 30 | } 31 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 3, 0); 32 | } 33 | BiomeGenBase biome = world.getBiomeGenForCoords(getXWithOffset(0, 0), getZWithOffset(0, 0)); 34 | boolean desert = (biome == BiomeGenBase.desert | biome == BiomeGenBase.desertHills); 35 | Block block = desert ? Blocks.sandstone : Blocks.cobblestone; 36 | fillWithBlocks(world, boundingBox, 1, 0, 1, 4, 12, 4, block, Blocks.water, false); 37 | placeBlockAtCurrentPosition(world, Blocks.air, 0, 2, 12, 2, boundingBox); 38 | placeBlockAtCurrentPosition(world, Blocks.air, 0, 3, 12, 2, boundingBox); 39 | placeBlockAtCurrentPosition(world, Blocks.air, 0, 2, 12, 3, boundingBox); 40 | placeBlockAtCurrentPosition(world, Blocks.air, 0, 3, 12, 3, boundingBox); 41 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 1, 13, 1, boundingBox); 42 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 1, 14, 1, boundingBox); 43 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 4, 13, 1, boundingBox); 44 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 4, 14, 1, boundingBox); 45 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 1, 13, 4, boundingBox); 46 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 1, 14, 4, boundingBox); 47 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 4, 13, 4, boundingBox); 48 | placeBlockAtCurrentPosition(world, Blocks.fence, 0, 4, 14, 4, boundingBox); 49 | fillWithBlocks(world, boundingBox, 1, 15, 1, 4, 15, 4, block, block, false); 50 | block = desert ? Blocks.sandstone : Blocks.gravel; 51 | for (int z = 0; z <= 5; ++z) { 52 | for (int x = 0; x <= 5; ++x) { 53 | if (x == 0 | x == 5 | z == 0 | z == 5) { 54 | placeBlockAtCurrentPosition(world, block, 0, x, 11, z, boundingBox); 55 | clearCurrentPositionBlocksUpwards(world, x, 12, z, boundingBox); 56 | } 57 | } 58 | } 59 | return true; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/early/minecraft/worldgen/MixinWorld.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.early.minecraft.worldgen; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.world.IBlockAccess; 6 | import net.minecraft.world.World; 7 | import net.minecraft.world.chunk.Chunk; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Overwrite; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | 12 | @Mixin(value = World.class) 13 | public abstract class MixinWorld implements IBlockAccess { 14 | 15 | /** 16 | * @author jss2a98aj 17 | * @reason Stops structures and mobs from spawning on trees. 18 | */ 19 | @Overwrite 20 | public int getTopSolidOrLiquidBlock(int x, int z) { 21 | Chunk chunk = getChunkFromBlockCoords(x, z); 22 | int chunkX = x & 15; 23 | int chunkZ = z & 15; 24 | for(int y = chunk.getTopFilledSegment() + 15; y > 0; --y) { 25 | Block block = chunk.getBlock(chunkX, y, chunkZ); 26 | Material material = block.getMaterial(); 27 | if(material.blocksMovement() && !material.isReplaceable() && !block.isLeaves(this, x, y, z) && !block.isFoliage(this, x, y, z) && !block.isWood(this, x, y, z)) { 28 | return y + 1; 29 | } 30 | } 31 | return -1; 32 | } 33 | 34 | @Shadow 35 | public abstract Chunk getChunkFromBlockCoords(int x, int z); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/aetherii/optimization/MixinClientEventHandler.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.aetherii.optimization; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.Redirect; 6 | 7 | import net.aetherteam.aether.client.ClientEventHandler; 8 | import net.aetherteam.aether.client.renders.entities.player.RenderPlayerAether; 9 | 10 | @Mixin(value = ClientEventHandler.class, remap = false) 11 | public abstract class MixinClientEventHandler { 12 | 13 | RenderPlayerAether reusedRenderPlayerAether; 14 | 15 | /** 16 | * @author makamys 17 | * @reason There is no reason to create a new RenderPlayer object every frame, and doing so wastes memory and causes horrible performance with RenderPlayerAPI. 18 | */ 19 | @Redirect(method = {"onRenderPlayer", "onRenderHand"}, at = @At(value = "NEW", target = "net/aetherteam/aether/client/renders/entities/player/RenderPlayerAether")) 20 | public RenderPlayerAether redirectNewRenderPlayerAether() { 21 | if(reusedRenderPlayerAether == null) { 22 | reusedRenderPlayerAether = new RenderPlayerAether(); 23 | } 24 | return reusedRenderPlayerAether; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/crayfishfurniture/fix/MixinTileEntityDishwasher.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.crayfishfurniture.fix; 2 | 3 | import com.mrcrayfish.furniture.tileentity.TileEntityDishwasher; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | 7 | @Mixin(value = TileEntityDishwasher.class) 8 | public abstract class MixinTileEntityDishwasher { 9 | 10 | /** 11 | * @author jss2a98aj 12 | * @reason Stop crashing vanilla and modded content that looks for ISidedInventory. 13 | */ 14 | @Overwrite 15 | public int[] getAccessibleSlotsFromSide(int side) { 16 | return new int[]{}; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/crayfishfurniture/fix/MixinTileEntityMicrowave.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.crayfishfurniture.fix; 2 | 3 | import com.mrcrayfish.furniture.tileentity.TileEntityMicrowave; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | 7 | @Mixin(value = TileEntityMicrowave.class) 8 | public abstract class MixinTileEntityMicrowave { 9 | 10 | /** 11 | * @author jss2a98aj 12 | * @reason Stop crashing vanilla and modded content that looks for ISidedInventory. 13 | */ 14 | @Overwrite 15 | public int[] getAccessibleSlotsFromSide(int side) { 16 | return new int[]{}; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/crayfishfurniture/fix/MixinTileEntityWashingMachine.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.crayfishfurniture.fix; 2 | 3 | import com.mrcrayfish.furniture.tileentity.TileEntityWashingMachine; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | 7 | @Mixin(value = TileEntityWashingMachine.class) 8 | public abstract class MixinTileEntityWashingMachine { 9 | 10 | /** 11 | * @author jss2a98aj 12 | * @reason Stop crashing vanilla and modded content that looks for ISidedInventory. 13 | */ 14 | @Overwrite 15 | public int[] getAccessibleSlotsFromSide(int side) { 16 | return new int[]{}; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/crayfishfurniture/tweak/MixinFurnitureAchievements.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.crayfishfurniture.tweak; 2 | 3 | import com.mrcrayfish.furniture.FurnitureAchievements; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | 8 | @Mixin(value = FurnitureAchievements.class) 9 | public abstract class MixinFurnitureAchievements { 10 | 11 | /** 12 | * @author jss2a98aj 13 | * @reason Disables achievements. 14 | */ 15 | @Overwrite(remap = false) 16 | public static void loadAchievements() {} 17 | 18 | /** 19 | * @author jss2a98aj 20 | * @reason Disables achievements. 21 | */ 22 | @Overwrite(remap = false) 23 | public static void registerPage() {} 24 | 25 | /** 26 | * @author jss2a98aj 27 | * @reason Disables achievements. 28 | */ 29 | @Overwrite(remap = false) 30 | public static void triggerAchievement(EntityPlayer player, String name) {} 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/extrautils/tweaks/MixinItemGoldenLasso.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.extrautils.tweaks; 2 | 3 | import com.rwtema.extrautils.item.ItemGoldenLasso; 4 | import jss.bugtorch.config.BugTorchConfig; 5 | import net.minecraft.entity.EntityLivingBase; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.item.ItemStack; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(value = ItemGoldenLasso.class) 14 | public abstract class MixinItemGoldenLasso { 15 | 16 | @Inject( 17 | method = "itemInteractionForEntity(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/entity/EntityLivingBase;)Z", 18 | at = @At( 19 | value = "HEAD", 20 | ordinal = 0 21 | ), 22 | cancellable = true 23 | ) 24 | public void injectBlacklist(ItemStack stack, EntityPlayer player, EntityLivingBase entity, CallbackInfoReturnable cir) { 25 | if(entity == null) { 26 | return; 27 | } 28 | String entityString = entity.getClass().toString().substring(6); 29 | for(String entry : BugTorchConfig.extraUtilitiesGoldenLassoBlacklist) { 30 | if(entry.substring(entry.length() - 1).equals("*")) { 31 | int compLength = entry.length() - 1; 32 | if(entityString.length() > compLength && entityString.substring(0, compLength).equals(entry.substring(0, compLength))) { 33 | cir.setReturnValue(false); 34 | return; 35 | } 36 | } 37 | if(entry.equals(entityString)) { 38 | cir.setReturnValue(false); 39 | return; 40 | } 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/extrautils/tweaks/MixinTileEntityTradingPost.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.extrautils.tweaks; 2 | 3 | import com.rwtema.extrautils.tileentity.TileEntityTradingPost; 4 | import jss.bugtorch.modsupport.VillageNamesSupport; 5 | import net.minecraft.entity.EntityLiving; 6 | import net.minecraft.entity.IMerchant; 7 | import net.minecraft.entity.passive.EntityVillager; 8 | import net.minecraft.util.AxisAlignedBB; 9 | import net.minecraft.util.Vec3; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.Overwrite; 12 | import org.spongepowered.asm.mixin.Shadow; 13 | 14 | @Mixin(value = TileEntityTradingPost.class) 15 | public abstract class MixinTileEntityTradingPost { 16 | 17 | /** 18 | * @author jss2a98aj 19 | * @reason Filter out invalid Nitwit trades from Village Names 20 | */ 21 | @Overwrite(remap = false) 22 | public boolean isValidVillager(IMerchant villager, boolean locationAlreadyChecked) { 23 | if(!(villager instanceof EntityLiving)) { 24 | return false; 25 | } 26 | EntityVillager entity = (EntityVillager)villager; 27 | boolean mature = !entity.isChild() && entity.getProfession() != VillageNamesSupport.nitwit; 28 | return mature && (locationAlreadyChecked || getAABB().isVecInside(Vec3.createVectorHelper(entity.posX, entity.posY, entity.posZ))); 29 | } 30 | 31 | @Shadow(remap = false) 32 | public abstract AxisAlignedBB getAABB(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/extrautils/tweaks/damage/MixinDarknessDamage.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.extrautils.tweaks.damage; 2 | 3 | import com.rwtema.extrautils.worldgen.Underdark.DarknessTickHandler; 4 | import jss.bugtorch.config.BugTorchConfig; 5 | import net.minecraft.entity.player.EntityPlayerMP; 6 | import net.minecraft.util.DamageSource; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(value = DarknessTickHandler.class) 12 | public abstract class MixinDarknessDamage { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Makes drowning damage scale with max health on players. 17 | */ 18 | @Redirect( 19 | method = "tickStart(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", 20 | at = @At( 21 | value = "INVOKE", 22 | target = "Lnet/minecraft/entity/player/EntityPlayerMP;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z" 23 | ), 24 | require = 1 25 | ) 26 | private boolean bugTorch$scalingDarknessDamage(EntityPlayerMP entity, DamageSource source, float damage) { 27 | return entity.attackEntityFrom(source, 28 | BugTorchConfig.scaledExtraUtilitiesDarknessDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledExtraUtilitiesDarknessDamageMaxHealthFlat 29 | ); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/ganyssurface/rendering/MixinBlockWoodTrapdoor.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.ganyssurface.rendering; 2 | 3 | import org.spongepowered.asm.mixin.Final; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | 8 | import cpw.mods.fml.relauncher.Side; 9 | import cpw.mods.fml.relauncher.SideOnly; 10 | import ganymedes01.ganyssurface.blocks.BlockWoodTrapdoor; 11 | import net.minecraft.block.BlockTrapDoor; 12 | import net.minecraft.block.material.Material; 13 | import net.minecraft.init.Blocks; 14 | import net.minecraft.util.IIcon; 15 | 16 | @Mixin(value = BlockWoodTrapdoor.class) 17 | public abstract class MixinBlockWoodTrapdoor extends BlockTrapDoor { 18 | 19 | @Shadow(remap = false) 20 | @Final 21 | public int woodMeta; 22 | 23 | MixinBlockWoodTrapdoor(Material material) { 24 | super(material); 25 | } 26 | 27 | /** 28 | * @author jss2a98aj 29 | * @reason Makes trapdoors from Gany's Surface have the correct back texture when open. 30 | */ 31 | @Overwrite() 32 | @SideOnly(Side.CLIENT) 33 | public IIcon getIcon(int side, int meta) { 34 | if (func_150118_d(meta)) { 35 | switch (meta & 3) { 36 | case 0:// North/South 37 | case 1: 38 | if (side == 2 | side == 3) 39 | return super.getIcon(side, meta); 40 | break; 41 | case 2:// East/West 42 | case 3: 43 | if (side == 4 | side == 5) 44 | return super.getIcon(side, meta); 45 | break; 46 | } 47 | return Blocks.planks.getIcon(side, woodMeta); 48 | } 49 | return side == 0 | side == 1 ? super.getIcon(side, meta) : Blocks.planks.getIcon(side, woodMeta); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/llibrary/fix/MixinWebUtils.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.llibrary.fix; 2 | 3 | import net.ilexiconn.llibrary.server.util.WebUtils; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | 8 | @Mixin(value = WebUtils.class, remap = false) 9 | public abstract class MixinWebUtils { 10 | 11 | /** 12 | * @author jss2a98aj 13 | * @reason Fixes a crash caused by invalid data being provided for unknown reasons. 14 | */ 15 | @Overwrite 16 | public static String readPastebin(String pasteID) { 17 | if(pasteID.equals("aLjMgBAV")) { 18 | return "[]"; 19 | } 20 | return readURL("http://pastebin.com/raw.php?i=" + pasteID); 21 | } 22 | 23 | @Shadow 24 | public static String readURL(String url) { 25 | return null; 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/llibrary/tweak/MixinWebUtils.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.llibrary.tweak; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.ilexiconn.llibrary.server.util.WebUtils; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Overwrite; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | import java.util.List; 10 | 11 | @Mixin(value = WebUtils.class, remap = false) 12 | public abstract class MixinWebUtils { 13 | 14 | /** 15 | * @author jss2a98aj 16 | * @reason Fixes a crash caused by invalid data being provided from regional blocks. 17 | */ 18 | @Overwrite 19 | public static String readPastebin(String pasteID) { 20 | if(BugTorchConfig.fixLLibraryMalformedJsonCrash && pasteID.equals("aLjMgBAV")) { 21 | return "[]"; 22 | } 23 | return readURL("http://pastebinp.com/raw.php?i=" + pasteID); 24 | } 25 | 26 | /** 27 | * @author jss2a98aj 28 | * @reason Fixes a crash caused by invalid data being provided from regional blocks. 29 | */ 30 | @Overwrite 31 | public static List readPastebinAsList(String pasteID) { 32 | return readURLAsList("http://pastebinp.com/raw.php?i=" + pasteID); 33 | } 34 | 35 | @Shadow 36 | public static String readURL(String url) { 37 | return null; 38 | } 39 | 40 | @Shadow 41 | public static List readURLAsList(String url) { 42 | return null; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/thaumcraft/sanitizearrayaccess/MixinBlockCandle.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.thaumcraft.sanitizearrayaccess; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import net.minecraft.block.Block; 7 | import net.minecraft.block.material.Material; 8 | import net.minecraft.world.IBlockAccess; 9 | import thaumcraft.common.blocks.BlockCandle; 10 | import thaumcraft.common.lib.utils.Utils; 11 | 12 | @Mixin(value = BlockCandle.class) 13 | public abstract class MixinBlockCandle extends Block { 14 | 15 | protected MixinBlockCandle(Material material) { 16 | super(material); 17 | } 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Prevents an array out of bounds exception when metadata greater than 15 is used. 22 | */ 23 | @Overwrite() 24 | public int getRenderColor(int meta) { 25 | return Utils.colors[meta >= Utils.colors.length ? 0 : meta]; 26 | } 27 | 28 | /** 29 | * @author jss2a98aj 30 | * @reason Prevents an array out of bounds exception when metadata greater than 15 is used. 31 | */ 32 | @Overwrite() 33 | public int colorMultiplier(IBlockAccess world, int x, int y, int z) { 34 | int meta = world.getBlockMetadata(x, y, z); 35 | return Utils.colors[meta >= Utils.colors.length ? 0 : meta]; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/thaumcraft/sanitizearrayaccess/MixinBlockCandleRenderer.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.thaumcraft.sanitizearrayaccess; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 6 | 7 | import thaumcraft.client.renderers.block.BlockCandleRenderer; 8 | import thaumcraft.common.lib.utils.Utils; 9 | 10 | @Mixin(value = BlockCandleRenderer.class) 11 | public abstract class MixinBlockCandleRenderer { 12 | 13 | /** 14 | * @author jss2a98aj 15 | * @reason Prevents an array out of bounds exception when metadata greater than 15 is used. 16 | */ 17 | @ModifyVariable(method = "renderInventoryBlock(Lnet/minecraft/block/Block;IILnet/minecraft/client/renderer/RenderBlocks;)V", at = @At("HEAD"), ordinal = 0, remap = false) 18 | private int sanitizeRenderInventoryBlock(int meta) { 19 | return meta >= Utils.colors.length ? 0 : meta; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/witchery/fix/MixinBlockGarlicGarland.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.witchery.fix; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Overwrite; 5 | 6 | import com.emoniph.witchery.blocks.BlockGarlicGarland; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.block.material.Material; 10 | import net.minecraft.world.IBlockAccess; 11 | 12 | @Mixin(value = BlockGarlicGarland.class, remap = false) 13 | public abstract class MixinBlockGarlicGarland extends Block { 14 | 15 | protected MixinBlockGarlicGarland(Material material) { 16 | super(material); 17 | } 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Corrects a bound that had a coordinate added to it. 22 | */ 23 | @Overwrite() 24 | public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { 25 | int meta = world.getBlockMetadata(x, y, z); 26 | switch(meta) { 27 | case 2: 28 | setBlockBounds(0.1F, 0.8F, 1.0F, 0.9F, 1.0F, 0.85F); 29 | break; 30 | case 3: 31 | setBlockBounds(0.1F, 0.8F, 0.0F, 0.9F, 1.0F, 0.15F); 32 | break; 33 | case 4: 34 | setBlockBounds(1.0F, 0.8F, 0.1F, 0.85F, 1.0F, 0.9F); 35 | break; 36 | case 5: 37 | setBlockBounds(0.0F, 0.8F, 0.1F, 0.15F, 1.0F, 0.9F); 38 | break; 39 | default: 40 | setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/witchery/rendering/MixinBlockWitchLeaves.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.witchery.rendering; 2 | 3 | 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Overwrite; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import com.emoniph.witchery.blocks.BlockWitchLeaves; 8 | import net.minecraft.block.BlockLeavesBase; 9 | import net.minecraft.block.material.Material; 10 | import net.minecraft.init.Blocks; 11 | import net.minecraft.util.IIcon; 12 | 13 | @Mixin(value = BlockWitchLeaves.class, remap = false) 14 | public abstract class MixinBlockWitchLeaves extends BlockLeavesBase { 15 | 16 | MixinBlockWitchLeaves(Material material, boolean renderFlag) { 17 | super(material, renderFlag); 18 | } 19 | 20 | @Shadow(remap = false) 21 | private IIcon[][] iconsForModes; 22 | 23 | /** 24 | * @author jss2a98aj 25 | * @reason Optifine and CoFH Tweaks compatible fast/fancy rendering. 26 | */ 27 | @Overwrite() 28 | public boolean isOpaqueCube() { 29 | return Blocks.leaves.isOpaqueCube(); 30 | } 31 | 32 | /** 33 | * @author jss2a98aj 34 | * @reason Optifine and CoFH Tweaks compatible fast/fancy rendering. 35 | */ 36 | @Overwrite() 37 | public IIcon getIcon (int side, int metadata) { 38 | return (Blocks.leaves.isOpaqueCube() ? iconsForModes[1] : iconsForModes[0])[metadata % 4]; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/mixins/late/witchery/shearing/MixinBlockWitchLeaves.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.mixins.late.witchery.shearing; 2 | 3 | import com.emoniph.witchery.blocks.BlockWitchLeaves; 4 | import net.minecraft.block.BlockLeavesBase; 5 | import net.minecraft.block.material.Material; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.item.ItemShears; 8 | import net.minecraft.world.World; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Overwrite; 11 | 12 | @Mixin(value = BlockWitchLeaves.class, remap = false) 13 | public abstract class MixinBlockWitchLeaves extends BlockLeavesBase { 14 | 15 | MixinBlockWitchLeaves(Material material, boolean renderFlag) { 16 | super(material, renderFlag); 17 | } 18 | 19 | /** 20 | * @author jss2a98aj 21 | * @reason Prevents duplicate drops when shearing 22 | */ 23 | @Overwrite() 24 | public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { 25 | if (!(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemShears)) { 26 | super.harvestBlock(world, player, x, y, z, meta); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/ExtraUtilitiesSupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import com.rwtema.extrautils.ExtraUtils; 4 | import jss.bugtorch.config.BugTorchConfig; 5 | import net.minecraft.block.Block; 6 | 7 | public class ExtraUtilitiesSupport { 8 | 9 | public static void enableSupport() { 10 | //Bugfixes 11 | if(BugTorchConfig.fixExtraUtilitiesBlockSounds) { 12 | if(ExtraUtils.chandelier != null) { 13 | ExtraUtils.chandelier.stepSound = Block.soundTypeWood; 14 | } 15 | if(ExtraUtils.curtain != null) { 16 | ExtraUtils.curtain.stepSound = Block.soundTypeCloth; 17 | } 18 | if(ExtraUtils.decorative2 != null) { 19 | ExtraUtils.decorative2.stepSound = Block.soundTypeGlass; 20 | } 21 | if(ExtraUtils.magnumTorch != null) { 22 | ExtraUtils.magnumTorch.stepSound = Block.soundTypeWood; 23 | } 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/PamsTemperatePlantsSupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import com.pam.temperateplants.temperateplants; 4 | 5 | import jss.bugtorch.config.BugTorchConfig; 6 | 7 | public class PamsTemperatePlantsSupport { 8 | 9 | public static void enableSupport() { 10 | //Bugfixes 11 | if(BugTorchConfig.fixPamsTemperatePlantsBlockSounds) { 12 | temperateplants.pamtemperatePlant.setStepSound(net.minecraft.block.Block.soundTypeGrass); 13 | } 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/ThaumcraftSupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import cpw.mods.fml.common.registry.GameRegistry; 4 | import jss.bugtorch.config.BugTorchConfig; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraftforge.oredict.OreDictionary; 7 | import net.minecraftforge.oredict.ShapedOreRecipe; 8 | import thaumcraft.common.config.ConfigBlocks; 9 | 10 | public class ThaumcraftSupport { 11 | 12 | public static void enableSupport() { 13 | ItemStack ancientStone = new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 11); 14 | 15 | //Ore dictionary 16 | if(BugTorchConfig.registerThaumcraftLeavesToTheOreDictionary) { 17 | OreDictionary.registerOre("treeLeaves", new ItemStack(ConfigBlocks.blockMagicalLeaves, 1, OreDictionary.WILDCARD_VALUE)); 18 | } 19 | 20 | if(BugTorchConfig.registerThaumcraftThaumiumBlockToTheOreDictionary) { 21 | OreDictionary.registerOre("blockThaumium", new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 4)); 22 | } 23 | 24 | if(BugTorchConfig.registerThaumcraftWoodStairsToTheOreDictionary) { 25 | OreDictionary.registerOre("stairWood", new ItemStack(ConfigBlocks.blockStairsSilverwood)); 26 | OreDictionary.registerOre("stairWood", new ItemStack(ConfigBlocks.blockStairsGreatwood)); 27 | } 28 | 29 | //Tweaks 30 | if(BugTorchConfig.craftThaumcraftAncientStoneSlabsAndStairs) { 31 | GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ConfigBlocks.blockSlabStone, 6, 1), "XXX", Character.valueOf('X'), ancientStone)); 32 | GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ConfigBlocks.blockStairsEldritch, 4), "X ", "XX ", "XXX", Character.valueOf('X'), ancientStone)); 33 | } 34 | 35 | if(BugTorchConfig.reverseCraftThaumcraftSlabs) { 36 | GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), "X", "X", Character.valueOf('X'), new ItemStack(ConfigBlocks.blockSlabWood, 1, 0))); 37 | GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7), "X", "X", Character.valueOf('X'), new ItemStack(ConfigBlocks.blockSlabWood, 1, 1))); 38 | GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 7), "X", "X", Character.valueOf('X'), new ItemStack(ConfigBlocks.blockSlabStone, 1, 0))); 39 | if(BugTorchConfig.craftThaumcraftAncientStoneSlabsAndStairs) { 40 | GameRegistry.addRecipe(new ShapedOreRecipe(ancientStone, "X", "X", Character.valueOf('X'), new ItemStack(ConfigBlocks.blockSlabStone, 1, 1))); 41 | } 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/TorchLeversSupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import cpw.mods.fml.common.registry.GameRegistry; 4 | import net.minecraft.block.Block; 5 | 6 | public class TorchLeversSupport { 7 | 8 | public static void enableSupport() { 9 | //Bugfixes 10 | String torchLevers = "torchLevers"; 11 | Block block = GameRegistry.findBlock(torchLevers, "bookButton"); 12 | if(block != null) { 13 | block.stepSound = Block.soundTypeWood; 14 | } 15 | block = GameRegistry.findBlock(torchLevers, "paintingDoor"); 16 | if(block != null) { 17 | block.stepSound = Block.soundTypeWood; 18 | } 19 | block = GameRegistry.findBlock(torchLevers, "carpetDoor1"); 20 | if(block != null) { 21 | block.stepSound = Block.soundTypeWood; 22 | } 23 | block = GameRegistry.findBlock(torchLevers, "carpetDoor2"); 24 | if(block != null) { 25 | block.stepSound = Block.soundTypeWood; 26 | } 27 | block = GameRegistry.findBlock(torchLevers, "carpetDoor3"); 28 | if(block != null) { 29 | block.stepSound = Block.soundTypeWood; 30 | } 31 | block = GameRegistry.findBlock(torchLevers, "carpetDoor4"); 32 | if(block != null) { 33 | block.stepSound = Block.soundTypeWood; 34 | } 35 | block = GameRegistry.findBlock(torchLevers, "carpetDoor5"); 36 | if(block != null) { 37 | block.stepSound = Block.soundTypeWood; 38 | } 39 | block = GameRegistry.findBlock(torchLevers, "carpetDoor6"); 40 | if(block != null) { 41 | block.stepSound = Block.soundTypeWood; 42 | } 43 | block = GameRegistry.findBlock(torchLevers, "carpetDoor7"); 44 | if(block != null) { 45 | block.stepSound = Block.soundTypeWood; 46 | } 47 | block = GameRegistry.findBlock(torchLevers, "carpetDoor8"); 48 | if(block != null) { 49 | block.stepSound = Block.soundTypeWood; 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/VanillaSupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import jss.bugtorch.config.BugTorchConfig; 4 | import net.minecraft.block.Block; 5 | import net.minecraft.block.BlockTrapDoor; 6 | import net.minecraft.init.Blocks; 7 | 8 | public class VanillaSupport { 9 | 10 | public static void enableSupport() { 11 | //Backports 12 | if(BugTorchConfig.enableFloatingTrapDoors) { 13 | BlockTrapDoor.disableValidation = true; 14 | } 15 | 16 | //Bugfixes 17 | if(BugTorchConfig.fixBlockSounds) { 18 | Blocks.bed.setStepSound(Block.soundTypeCloth); 19 | Blocks.tripwire.setStepSound(Block.soundTypeCloth); 20 | Blocks.web.setStepSound(Block.soundTypeCloth); 21 | 22 | Blocks.redstone_wire.setStepSound(Block.soundTypeSand); 23 | 24 | Blocks.jukebox.setStepSound(Block.soundTypeWood); 25 | Blocks.noteblock.setStepSound(Block.soundTypeWood); 26 | Blocks.tripwire_hook.setStepSound(Block.soundTypeWood); 27 | 28 | Blocks.heavy_weighted_pressure_plate.setStepSound(Block.soundTypeMetal); 29 | Blocks.light_weighted_pressure_plate.setStepSound(Block.soundTypeMetal); 30 | } 31 | 32 | if(BugTorchConfig.fixCarpetBlocksRandomlyTicking) { 33 | Blocks.carpet.setTickRandomly(false); 34 | } 35 | 36 | if(BugTorchConfig.fixJackOLanternBlocksRandomlyTicking) { 37 | Blocks.lit_pumpkin.setTickRandomly(false); 38 | } 39 | 40 | if(BugTorchConfig.fixPumpkinBlocksRandomlyTicking) { 41 | Blocks.pumpkin.setTickRandomly(false); 42 | } 43 | 44 | if(BugTorchConfig.fixSnowBlocksRandomlyTicking) { 45 | Blocks.snow.setTickRandomly(false); 46 | } 47 | 48 | if(BugTorchConfig.fixTorchBlocksRandomlyTicking) { 49 | Blocks.torch.setTickRandomly(false); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/VillageNamesSupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import astrotibs.villagenames.VillageNames; 4 | import jss.bugtorch.config.BugTorchConfig; 5 | 6 | public class VillageNamesSupport { 7 | 8 | public static int nitwit = 5; 9 | 10 | public static void enableSupport() { 11 | //Tweaks 12 | if(BugTorchConfig.enableVillageNamesMetadataSensitiveTrades) { 13 | VillageNames.canVillagerTradesDistinguishMeta = true; 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/jss/bugtorch/modsupport/WitcherySupport.java: -------------------------------------------------------------------------------- 1 | package jss.bugtorch.modsupport; 2 | 3 | import com.emoniph.witchery.Witchery; 4 | 5 | import jss.bugtorch.config.BugTorchConfig; 6 | import net.minecraft.block.Block; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraftforge.oredict.OreDictionary; 9 | 10 | public class WitcherySupport { 11 | 12 | public static void enableSupport() { 13 | //Bugfixes 14 | if(BugTorchConfig.fixWitcheryBlockSounds) { 15 | Witchery.Blocks.BRAMBLE.setStepSound(Block.soundTypeGrass); 16 | Witchery.Blocks.WOOD_SLAB_SINGLE.setStepSound(Block.soundTypeWood); 17 | Witchery.Blocks.WOOD_SLAB_DOUBLE.setStepSound(Block.soundTypeWood); 18 | Witchery.Blocks.STOCKADE.setStepSound(Block.soundTypeWood); 19 | Witchery.Blocks.STOCKADE_ICE.setStepSound(Block.soundTypeGlass); 20 | Witchery.Blocks.PERPETUAL_ICE.setStepSound(Block.soundTypeGlass); 21 | Witchery.Blocks.PERPETUAL_ICE_DOOR.setStepSound(Block.soundTypeGlass); 22 | Witchery.Blocks.PERPETUAL_ICE_STAIRS.setStepSound(Block.soundTypeGlass); 23 | Witchery.Blocks.PERPETUAL_ICE_SLAB_SINGLE.setStepSound(Block.soundTypeGlass); 24 | Witchery.Blocks.PERPETUAL_ICE_SLAB_DOUBLE.setStepSound(Block.soundTypeGlass); 25 | Witchery.Blocks.PERPETUAL_ICE_FENCE.setStepSound(Block.soundTypeGlass); 26 | Witchery.Blocks.PERPETUAL_ICE_FENCE_GATE.setStepSound(Block.soundTypeGlass); 27 | Witchery.Blocks.PERPETUAL_ICE_PRESSURE_PLATE.setStepSound(Block.soundTypeGlass); 28 | Witchery.Blocks.REFILLING_CHEST.setStepSound(Block.soundTypeWood); 29 | Witchery.Blocks.LEECH_CHEST.setStepSound(Block.soundTypeWood); 30 | Witchery.Blocks.COFFIN.setStepSound(Block.soundTypeWood); 31 | Witchery.Blocks.CURSED_BUTTON_WOOD.setStepSound(Block.soundTypeWood); 32 | } 33 | 34 | //Ore dictionary 35 | if(BugTorchConfig.registerWitcheryWoodSlabsToTheOreDictionary) { 36 | OreDictionary.registerOre("slabWood", new ItemStack(Witchery.Blocks.WOOD_SLAB_SINGLE, 1, OreDictionary.WILDCARD_VALUE)); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/jss/util/RandomXoshiro256StarStar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To the extent possible under law, the author has dedicated all copyright 3 | * and related and neighboring rights to this software to the public domain 4 | * worldwide. This software is distributed without any warranty. 5 | * 6 | * See 7 | */ 8 | 9 | package jss.util; 10 | 11 | import java.util.Random; 12 | import java.util.concurrent.atomic.AtomicLong; 13 | 14 | /** 15 | * Implementation of Random based on the xoshiro256** RNG. No-dependencies 16 | * Java port of the original C code, 17 | * which is public domain. This Java port is similarly dedicated to the public 18 | * domain. 19 | *

20 | * Individual instances are not thread-safe. Each thread must have its own 21 | * instance which is not shared. 22 | * 23 | * @see http://xoshiro.di.unimi.it/ 24 | * @author David Blackman and Sebastiano Vigna <vigna@acm.org> (original C code) 25 | * @author Una Thompson <una@unascribed.com> (Java port) 26 | */ 27 | public class RandomXoshiro256StarStar extends Random { 28 | private static final long serialVersionUID = -2837799889588687855L; 29 | 30 | private static final AtomicLong uniq = new AtomicLong(System.nanoTime()); 31 | 32 | private static final long nextUniq() { 33 | return splitmix64_2(uniq.addAndGet(SPLITMIX1_MAGIC)); 34 | } 35 | 36 | public RandomXoshiro256StarStar() { 37 | this(System.nanoTime()^nextUniq()); 38 | } 39 | 40 | public RandomXoshiro256StarStar(long seed) { 41 | super(seed); 42 | // super will call setSeed 43 | } 44 | 45 | public RandomXoshiro256StarStar(long s1, long s2, long s3, long s4) { 46 | setState(s1, s2, s3, s4); 47 | } 48 | 49 | // used to "stretch" seeds into a full 256-bit state; also makes 50 | // it safe to pass in zero as a seed 51 | //// 52 | // what generator is used here is unimportant, as long as it's 53 | // from a different family, but splitmix64 happens to be an 54 | // incredibly simple high-quality generator of a completely 55 | // different family (and is recommended by the xoshiro authors) 56 | 57 | private static final long SPLITMIX1_MAGIC = 0x9E3779B97F4A7C15L; 58 | 59 | private static long splitmix64_1(long x) { 60 | return (x + SPLITMIX1_MAGIC); 61 | } 62 | 63 | private static long splitmix64_2(long z) { 64 | z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9L; 65 | z = (z ^ (z >> 27)) * 0x94D049BB133111EBL; 66 | return z ^ (z >> 31); 67 | } 68 | 69 | @Override 70 | public void setSeed(long seed) { 71 | // update haveNextNextGaussian flag in super 72 | super.setSeed(seed); 73 | long sms = splitmix64_1(seed); 74 | s0 = splitmix64_2(sms); 75 | sms = splitmix64_1(sms); 76 | s1 = splitmix64_2(sms); 77 | sms = splitmix64_1(sms); 78 | s2 = splitmix64_2(sms); 79 | sms = splitmix64_1(sms); 80 | s3 = splitmix64_2(sms); 81 | } 82 | 83 | public void setState(long s0, long s1, long s2, long s4) { 84 | if (s0 == 0 && s1 == 0 && s2 == 0 && s4 == 0) 85 | throw new IllegalArgumentException("xoshiro256** state cannot be all zeroes"); 86 | this.s0 = s0; 87 | this.s1 = s1; 88 | this.s2 = s2; 89 | this.s3 = s4; 90 | } 91 | 92 | // not called, implemented instead of just throwing for completeness 93 | @Override 94 | protected int next(int bits) { 95 | return (int)(nextLong() & ((1L << bits) - 1)); 96 | } 97 | 98 | @Override 99 | public int nextInt() { 100 | return (int)nextLong(); 101 | } 102 | 103 | @Override 104 | public int nextInt(int bound) { 105 | return (int)nextLong(bound); 106 | } 107 | 108 | public long nextLong(long bound) { 109 | if (bound <= 0) throw new IllegalArgumentException("bound must be positive"); 110 | // clear sign bit for positive-only, modulo to bound 111 | return (nextLong() & Long.MAX_VALUE) % bound; 112 | } 113 | 114 | @Override 115 | public double nextDouble() { 116 | return (nextLong() >>> 11) * 0x1.0P-53; 117 | } 118 | 119 | @Override 120 | public float nextFloat() { 121 | return (nextLong() >>> 40) * 0x1.0P-24f; 122 | } 123 | 124 | @Override 125 | public boolean nextBoolean() { 126 | return (nextLong() & 1) != 0; 127 | } 128 | 129 | @Override 130 | public void nextBytes(byte[] buf) { 131 | nextBytes(buf, 0, buf.length); 132 | } 133 | 134 | public void nextBytes(byte[] buf, int ofs, int len) { 135 | if (ofs < 0) throw new ArrayIndexOutOfBoundsException("Offset "+ofs+" is negative"); 136 | if (ofs >= buf.length) throw new ArrayIndexOutOfBoundsException("Offset "+ofs+" is greater than buffer length"); 137 | if (ofs+len > buf.length) throw new ArrayIndexOutOfBoundsException("Length "+len+" with offset "+ofs+" is past end of buffer"); 138 | int j = 8; 139 | long l = 0; 140 | for (int i = ofs; i < ofs+len; i++) { 141 | if (j >= 8) { 142 | l = nextLong(); 143 | j = 0; 144 | } 145 | buf[i] = (byte)(l&0xFF); 146 | l = l >>> 8L; 147 | j++; 148 | } 149 | } 150 | 151 | /* This is xoshiro256** 1.0, our all-purpose, rock-solid generator. It has 152 | excellent (sub-ns) speed, a state (256 bits) that is large enough for 153 | any parallel application, and it passes all tests we are aware of. 154 | 155 | For generating just floating-point numbers, xoshiro256+ is even faster. 156 | 157 | The state must be seeded so that it is not everywhere zero. If you have 158 | a 64-bit seed, we suggest to seed a splitmix64 generator and use its 159 | output to fill s. */ 160 | 161 | private static long rotl(long x, int k) { 162 | return (x << k) | (x >>> (64 - k)); 163 | } 164 | 165 | 166 | private long s0; 167 | private long s1; 168 | private long s2; 169 | private long s3; 170 | 171 | @Override 172 | public long nextLong() { 173 | long result_starstar = rotl(s1 * 5, 7) * 9; 174 | 175 | long t = s1 << 17; 176 | 177 | s2 ^= s0; 178 | s3 ^= s1; 179 | s1 ^= s2; 180 | s0 ^= s3; 181 | 182 | s2 ^= t; 183 | 184 | s3 = rotl(s3, 45); 185 | 186 | return result_starstar; 187 | } 188 | 189 | } 190 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/bugtorch_at.cfg: -------------------------------------------------------------------------------- 1 | # BugTorch Access Transformer configuration file 2 | public net.minecraft.village.MerchantRecipe field_77403_a #itemToBuy 3 | public net.minecraft.village.MerchantRecipe field_77401_b #secondItemToBuy 4 | public net.minecraft.village.MerchantRecipe field_77402_c #itemToSell 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bugtorch/lang/de_DE.lang: -------------------------------------------------------------------------------- 1 | # Missing lang entries for Mystcraft 2 | myst.symbol.TerrainFlat.name=Normale Flachland-Welt 3 | myst.symbol.TerrainVoid.name=Leeren-Welt 4 | 5 | # Missing lang entries for Thaumcraft 6 | tile.blockCosmeticDoubleSlabStone.name=Steinstufe 7 | tile.blockCosmeticDoubleSlabWood.name=Holzstufe 8 | 9 | # Missing lang entries for Extra Utilities 10 | tile.dirt.name=Erde 11 | tile.sand.name=Sand 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/bugtorch/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | # Missing lang entries for Mystcraft 2 | myst.symbol.TerrainFlat.name=Flat Normal World 3 | myst.symbol.TerrainVoid.name=Void World 4 | 5 | # Missing lang entries for Thaumcraft 6 | tile.blockCosmeticDoubleSlabStone.name=Stone Slab 7 | tile.blockCosmeticDoubleSlabWood.name=Wood Slab 8 | 9 | # Missing lang entries for Extra Utilities 10 | tile.dirt.name=Dirt 11 | tile.sand.name=Sand 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/bugtorch/lang/fr_FR.lang: -------------------------------------------------------------------------------- 1 | # Missing lang entries for Mystcraft 2 | myst.symbol.TerrainFlat.name=Monde Plat Normal 3 | myst.symbol.TerrainVoid.name=Monde Vide 4 | 5 | # Missing lang entries for Thaumcraft 6 | tile.blockCosmeticDoubleSlabStone.name=Dalle en pierre 7 | tile.blockCosmeticDoubleSlabWood.name=Dalle en bois 8 | 9 | # Missing lang entries for Extra Utilities 10 | tile.dirt.name=Terre 11 | tile.sand.name=Sable 12 | -------------------------------------------------------------------------------- /src/main/resources/assets/bugtorch/sounds.json: -------------------------------------------------------------------------------- 1 | { 2 | "item.fireCharge.use": { 3 | "category": "block", 4 | "sounds": [ 5 | "mob/ghast/fireball4" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/textures/blocks/farmland_dry_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jss2a98aj/BugTorch/8d3e8225ba614c7fa7619a1c9d47dfdcfe326a76/src/main/resources/assets/minecraft/textures/blocks/farmland_dry_side.png -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/textures/blocks/farmland_wet_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jss2a98aj/BugTorch/8d3e8225ba614c7fa7619a1c9d47dfdcfe326a76/src/main/resources/assets/minecraft/textures/blocks/farmland_wet_side.png -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/textures/blocks/planks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jss2a98aj/BugTorch/8d3e8225ba614c7fa7619a1c9d47dfdcfe326a76/src/main/resources/assets/minecraft/textures/blocks/planks.png -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | { 2 | "modListVersion": 2, 3 | "modList": [{ 4 | "modid": "${modId}", 5 | "name": "${modName}", 6 | "description": "Backports a small handful of features that don't add new things, fixes some bugs, and does other stuff.", 7 | "version": "${modVersion}", 8 | "mcversion": "${minecraftVersion}", 9 | "url": "https://github.com/jss2a98aj/BugTorch", 10 | "updateUrl": "", 11 | "authorList": ["jss2a98aj"], 12 | "credits": "", 13 | "logoFile": "", 14 | "screenshots": [], 15 | "parent": "" 16 | }] 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/mixins.bugtorch.early.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.7.11", 4 | "package": "jss.bugtorch.mixins.early", 5 | "refmap": "mixins.bugtorch.refmap.json", 6 | "target": "@env(DEFAULT)", 7 | "compatibilityLevel": "JAVA_8", 8 | "mixins": [], 9 | "client": [], 10 | "server": [] 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/mixins.bugtorch.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.7.11", 4 | "package": "jss.bugtorch.mixins", 5 | "refmap": "mixins.bugtorch.refmap.json", 6 | "target": "@env(DEFAULT)", 7 | "compatibilityLevel": "JAVA_8", 8 | "mixins": [], 9 | "client": [], 10 | "server": [] 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/mixins.bugtorch.late.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.7.11", 4 | "package": "jss.bugtorch.mixins.late", 5 | "refmap": "mixins.bugtorch.refmap.json", 6 | "target": "@env(DEFAULT)", 7 | "compatibilityLevel": "JAVA_8", 8 | "mixins": [], 9 | "client": [], 10 | "server": [] 11 | } 12 | --------------------------------------------------------------------------------