├── jitpack.yml ├── CODEOWNERS ├── src └── main │ ├── resources │ ├── logo.png │ ├── assets │ │ └── appliedcooking │ │ │ ├── textures │ │ │ ├── kitchen_station_keyboard.png │ │ │ └── kitchen_station_screen.png │ │ │ ├── lang │ │ │ ├── zh_CN.lang │ │ │ └── en_US.lang │ │ │ └── models │ │ │ ├── kitchen_station.mtl │ │ │ ├── kitchen_station_connected.mtl │ │ │ ├── kitchen_station.obj │ │ │ └── kitchen_station_connected.obj │ ├── mixins.appliedcooking.json │ ├── mixins.late.json │ ├── mcmod.info │ └── LICENSE │ └── java │ └── com │ └── asdflj │ └── appliedcooking │ ├── loader │ ├── IRegister.java │ ├── ItemAndBlockHolder.java │ ├── RenderLoader.java │ └── RecipeLoader.java │ ├── inventory │ ├── IWirelessObject.java │ └── AppEngInternalInventoryBridge.java │ ├── util │ ├── NameConst.java │ ├── Util.java │ └── WirelessObject.java │ ├── proxy │ ├── ClientProxy.java │ └── CommonProxy.java │ ├── mixins │ ├── LatePlugin.java │ ├── MixinContainerRecipeBook.java │ ├── MixinCookingRegistry.java │ └── MixinInventoryCraftBook.java │ ├── common │ ├── block │ │ ├── BaseBlockContainer.java │ │ └── BlockKitchenStation.java │ ├── item │ │ └── ItemKitchenStation.java │ └── tile │ │ └── TileKitchenStation.java │ ├── AppliedCooking.java │ └── client │ └── render │ ├── RenderBlockKitchenStation.java │ └── ItemKitchenStationRender.java ├── README.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── repositories.gradle ├── gtnhShared ├── spotless.importorder ├── spotless.gradle └── spotless.eclipseformat.xml ├── .github ├── workflows │ ├── release-tags.yml │ └── build-and-test.yml └── scripts │ └── update_version ├── .editorconfig ├── docs ├── FAQ.md ├── migration.md └── porting.md ├── settings.gradle ├── .gitignore ├── LICENSE ├── LICENSE-template ├── .gitattributes ├── gradlew.bat ├── dependencies.gradle ├── gradlew └── gradle.properties /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - ./gradlew setupCIWorkspace -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Any Github changes require admin approval 2 | /.github/** @GTNewHorizons/admin 3 | 4 | -------------------------------------------------------------------------------- /src/main/resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asdflj/AppliedCooking/HEAD/src/main/resources/logo.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AppliedCooking 2 | 3 | A Minecraft mod to bridge Cooking For Blockheads with Applied Energistics 2 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asdflj/AppliedCooking/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /repositories.gradle: -------------------------------------------------------------------------------- 1 | // Add any additional repositories for your dependencies here. 2 | 3 | repositories { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /gtnhShared/spotless.importorder: -------------------------------------------------------------------------------- 1 | #Organize Import Order 2 | #Sat Jan 28 17:57:48 GMT 2023 3 | 0=java 4 | 1=javax 5 | 2=net 6 | 3=org 7 | 4=com 8 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/loader/IRegister.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.loader; 2 | 3 | public interface IRegister { 4 | 5 | T register(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/textures/kitchen_station_keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asdflj/AppliedCooking/HEAD/src/main/resources/assets/appliedcooking/textures/kitchen_station_keyboard.png -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/textures/kitchen_station_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asdflj/AppliedCooking/HEAD/src/main/resources/assets/appliedcooking/textures/kitchen_station_screen.png -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/lang/zh_CN.lang: -------------------------------------------------------------------------------- 1 | tile.kitchen_station.name=厨房站 2 | 3 | appliedcooking.tooltip.connected=已连接 4 | appliedcooking.tooltip.shift_for_more=§r> 按 §3Shift§r 显示更多信息 5 | appliedcooking.tooltip.kitchen_station=使用连接了的无线终端右击厨房站使其连接网络 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/models/kitchen_station.mtl: -------------------------------------------------------------------------------- 1 | # Made in Blockbench 4.9.4 2 | newmtl m_15938b12-ceed-22c7-2344-fcf24be14c73 3 | map_Kd kitchen_station_screen.png 4 | newmtl m_b97f4b49-ef3f-0840-c06c-b86ec4edb70d 5 | map_Kd kitchen_station_keyboard.png 6 | newmtl none -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/models/kitchen_station_connected.mtl: -------------------------------------------------------------------------------- 1 | # Made in Blockbench 4.9.4 2 | newmtl m_d8b8890d-a4ad-3788-aa6e-d59906971540 3 | map_Kd kitchen_station_screen.png 4 | newmtl m_4677e6ad-df3f-c966-f581-5b6108663eea 5 | map_Kd kitchen_station_keyboard.png 6 | newmtl none -------------------------------------------------------------------------------- /src/main/resources/mixins.appliedcooking.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0", 4 | "refmap": "mixins.appliedcooking.refmap.json", 5 | "target": "@env(DEFAULT)", 6 | "compatibilityLevel": "JAVA_8", 7 | "mixins": [], 8 | "client": [], 9 | "server": [] 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /.github/workflows/release-tags.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Release tagged build 3 | 4 | on: 5 | push: 6 | tags: [ '*' ] 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release-tags: 13 | uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master 14 | secrets: inherit 15 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/loader/ItemAndBlockHolder.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.loader; 2 | 3 | import com.asdflj.appliedcooking.common.block.BlockKitchenStation; 4 | 5 | public class ItemAndBlockHolder { 6 | 7 | public static BlockKitchenStation KITCHEN_STATION = new BlockKitchenStation().register(); 8 | } 9 | -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Build and test 3 | 4 | on: 5 | pull_request: 6 | branches: [ master, main ] 7 | push: 8 | branches: [ master, main ] 9 | 10 | jobs: 11 | build-and-test: 12 | uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master 13 | secrets: inherit 14 | -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | tile.kitchen_station.name=Kitchen Station 2 | 3 | appliedcooking.tooltip.connected=Connected 4 | appliedcooking.tooltip.shift_for_more=§r> Hold §3Shift§r for more information 5 | appliedcooking.tooltip.kitchen_station=use connected wireless terminal right click Kitchen Station to connect network 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/loader/RenderLoader.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.loader; 2 | 3 | import com.asdflj.appliedcooking.client.render.ItemKitchenStationRender; 4 | 5 | public class RenderLoader implements Runnable { 6 | 7 | @Override 8 | public void run() { 9 | new ItemKitchenStationRender(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/scripts/update_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! git diff --name-only HEAD HEAD~1 | grep -qF 'build.gradle'; then 4 | new_version="$(date +%s)" 5 | sed --in-place "s!^//version:.*!//version: $new_version!g" build.gradle 6 | git add build.gradle 7 | git commit -m "[ci skip] update build script version to $new_version" 8 | git push 9 | printf 'Updated buildscript version to %s\n' "$new_version" 10 | else 11 | printf 'Ignored buildscript version update: no changes detected\n' 12 | fi 13 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /docs/FAQ.md: -------------------------------------------------------------------------------- 1 | # Things we cannot protect you from (yet) 2 | 3 | ### Select an mcp conf dir for the deobfuscator 4 | 5 | You may or may not run into this popup. For now, the only solution is to point the deopfuscator into the right direction. 6 | 7 | ![](http://i.imgur.com/gzBMLrr.png) 8 | 9 | Solution: Point it to `~/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.4.1614-1.7.10/unpacked/conf`. On Windows, please use `%USERPROFILE%/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.4.1614-1.7.10/unpacked/conf`. 10 | -------------------------------------------------------------------------------- /src/main/resources/mixins.late.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0", 4 | "package": "com.asdflj.appliedcooking.mixins", 5 | "refmap": "mixins.appliedcooking.refmap.json", 6 | "target": "@env(DEFAULT)", 7 | "compatibilityLevel": "JAVA_8", 8 | "mixins": [ 9 | ], 10 | "client": [ 11 | "MixinCookingRegistry", 12 | "MixinInventoryCraftBook", 13 | "MixinContainerRecipeBook" 14 | ], 15 | "server": [ 16 | "MixinCookingRegistry", 17 | "MixinInventoryCraftBook", 18 | "MixinContainerRecipeBook" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/inventory/IWirelessObject.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.inventory; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | 5 | import appeng.api.networking.security.IActionHost; 6 | import appeng.api.storage.IMEMonitor; 7 | import appeng.api.storage.ITerminalHost; 8 | import appeng.api.storage.data.IAEItemStack; 9 | import appeng.tile.inventory.IAEAppEngInventory; 10 | 11 | public interface IWirelessObject extends ITerminalHost, IMEMonitor, IAEAppEngInventory, IActionHost { 12 | 13 | IInventory getInventory(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/util/NameConst.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.util; 2 | 3 | import com.asdflj.appliedcooking.AppliedCooking; 4 | 5 | public class NameConst { 6 | 7 | public static final String BLOCK_KITCHEN_STATION = "kitchen_station"; 8 | public static final String TT_KEY = AppliedCooking.MODID + ".tooltip."; 9 | public static final String TT_SHIFT_FOR_MORE = TT_KEY + "shift_for_more"; 10 | public static final String TT_CONNECTED = TT_KEY + "connected"; 11 | public static final String TT_KITCHEN_STATION = TT_KEY + "kitchen_station"; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | { 2 | "modListVersion": 2, 3 | "modList": [{ 4 | "modid": "${modId}", 5 | "name": "${modName}", 6 | "description": "A Minecraft mod to bridge Cooking For Blockheads with Applied Energistics 2", 7 | "version": "${modVersion}", 8 | "mcversion": "${minecraftVersion}", 9 | "url": "", 10 | "updateUrl": "", 11 | "authorList": ["asdflj"], 12 | "credits": "", 13 | "logoFile": "", 14 | "screenshots": [], 15 | "parent": "", 16 | "requiredMods": [], 17 | "dependencies": [], 18 | "dependants": [], 19 | "useDependencyInformation": false 20 | }] 21 | } 22 | -------------------------------------------------------------------------------- /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.33' 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/util/Util.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.util; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | 5 | import appeng.api.AEApi; 6 | import appeng.api.features.ILocatable; 7 | import appeng.tile.inventory.AppEngInternalInventory; 8 | 9 | public class Util { 10 | 11 | public static IInventory EmptyInventory = new AppEngInternalInventory(null, 0); 12 | 13 | public static ILocatable getSecurityStation(long key) { 14 | return AEApi.instance() 15 | .registries() 16 | .locatable() 17 | .getLocatableBy(key); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/proxy/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.proxy; 2 | 3 | import com.asdflj.appliedcooking.loader.RenderLoader; 4 | 5 | import cpw.mods.fml.common.event.FMLInitializationEvent; 6 | 7 | public class ClientProxy extends CommonProxy { 8 | 9 | // Override CommonProxy methods here, if you want a different behaviour on the client (e.g. registering renders). 10 | // Don't forget to call the super methods as well. 11 | @Override 12 | public void init(FMLInitializationEvent event) { 13 | super.init(event); 14 | (new RenderLoader()).run(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/mixins/LatePlugin.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.mixins; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | import com.gtnewhorizon.gtnhmixins.ILateMixinLoader; 8 | import com.gtnewhorizon.gtnhmixins.LateMixin; 9 | 10 | @LateMixin 11 | public class LatePlugin implements ILateMixinLoader { 12 | 13 | @Override 14 | public String getMixinConfig() { 15 | return "mixins.late.json"; 16 | } 17 | 18 | @Override 19 | public List getMixins(Set loadedMods) { 20 | return Collections.emptyList(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/common/block/BaseBlockContainer.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.common.block; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.block.BlockContainer; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.ItemStack; 9 | 10 | public abstract class BaseBlockContainer extends BlockContainer { 11 | 12 | public BaseBlockContainer(Material material) { 13 | super(material); 14 | } 15 | 16 | public void addInformation(ItemStack itemStack, EntityPlayer player, List toolTip, 17 | boolean advancedToolTips) {} 18 | 19 | public ItemStack stack() { 20 | return new ItemStack(this, 1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/common/item/ItemKitchenStation.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.common.item; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.item.ItemBlock; 8 | import net.minecraft.item.ItemStack; 9 | 10 | import com.asdflj.appliedcooking.common.block.BaseBlockContainer; 11 | 12 | import cpw.mods.fml.relauncher.Side; 13 | import cpw.mods.fml.relauncher.SideOnly; 14 | 15 | public class ItemKitchenStation extends ItemBlock { 16 | 17 | private final BaseBlockContainer blockType; 18 | 19 | public ItemKitchenStation(Block id) { 20 | super(id); 21 | this.blockType = (BaseBlockContainer) id; 22 | } 23 | 24 | @Override 25 | @SideOnly(Side.CLIENT) 26 | @SuppressWarnings("unchecked") 27 | public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List toolTip, 28 | final boolean advancedToolTips) { 29 | blockType.addInformation(itemStack, player, toolTip, advancedToolTips); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gtnhShared/spotless.gradle: -------------------------------------------------------------------------------- 1 | 2 | apply plugin: 'com.diffplug.spotless' 3 | 4 | // Spotless autoformatter 5 | // See https://github.com/diffplug/spotless/tree/main/plugin-gradle 6 | // Can be locally toggled via spotless:off/spotless:on comments 7 | spotless { 8 | encoding 'UTF-8' 9 | 10 | format 'misc', { 11 | target '.gitignore' 12 | 13 | trimTrailingWhitespace() 14 | indentWithSpaces(4) 15 | endWithNewline() 16 | } 17 | java { 18 | target 'src/*/java/**/*.java', 'src/*/scala/**/*.java' 19 | 20 | toggleOffOn() 21 | importOrderFile(Blowdryer.file('spotless.importorder')) 22 | removeUnusedImports() 23 | eclipse('4.19.0').configFile(Blowdryer.file('spotless.eclipseformat.xml')) 24 | } 25 | kotlin { 26 | target 'src/*/kotlin/**/*.kt' 27 | 28 | toggleOffOn() 29 | ktfmt('0.39') 30 | 31 | trimTrailingWhitespace() 32 | indentWithSpaces(4) 33 | endWithNewline() 34 | } 35 | scala { 36 | target 'src/*/scala/**/*.scala' 37 | 38 | scalafmt('3.7.1') 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Johann Bernhardt 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 | -------------------------------------------------------------------------------- /src/main/resources/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 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. -------------------------------------------------------------------------------- /LICENSE-template: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 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 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/inventory/AppEngInternalInventoryBridge.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.inventory; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | 6 | import com.asdflj.appliedcooking.util.WirelessObject; 7 | 8 | import appeng.tile.inventory.AppEngInternalInventory; 9 | 10 | public class AppEngInternalInventoryBridge extends AppEngInternalInventory { 11 | 12 | private final WirelessObject obj; 13 | 14 | public AppEngInternalInventoryBridge(WirelessObject obj) { 15 | super(obj, 0, 64, true); 16 | this.obj = obj; 17 | } 18 | 19 | @Override 20 | public void setInventorySlotContents(final int slot, final ItemStack newItemStack) {} 21 | 22 | public WirelessObject getWirelessObject() { 23 | return this.obj; 24 | } 25 | 26 | @Override 27 | public ItemStack getStackInSlot(int slot) { 28 | return null; 29 | } 30 | 31 | @Override 32 | public void readFromNBT(final NBTTagCompound data, final String name) { 33 | 34 | } 35 | 36 | @Override 37 | public void readFromNBT(final NBTTagCompound target) { 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/proxy/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.proxy; 2 | 3 | import com.asdflj.appliedcooking.loader.RecipeLoader; 4 | 5 | import cpw.mods.fml.common.event.FMLInitializationEvent; 6 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 7 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 8 | import cpw.mods.fml.common.event.FMLServerStartingEvent; 9 | 10 | public class CommonProxy { 11 | 12 | // preInit "Run before anything else. Read your config, create blocks, items, etc, and register them with the 13 | // GameRegistry." (Remove if not needed) 14 | public void preInit(FMLPreInitializationEvent event) { 15 | 16 | } 17 | 18 | // load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed) 19 | public void init(FMLInitializationEvent event) {} 20 | 21 | // postInit "Handle interaction with other mods, complete your setup based on this." (Remove if not needed) 22 | public void postInit(FMLPostInitializationEvent event) { 23 | RecipeLoader.INSTANCE.run(); 24 | } 25 | 26 | // register server commands in this event handler (Remove if not needed) 27 | public void serverStarting(FMLServerStartingEvent event) {} 28 | } 29 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /docs/migration.md: -------------------------------------------------------------------------------- 1 | # Migration guides 2 | 3 | ## Generic migration 4 | Migration for the typical mod which doesn't use anything special but Minecraft forge and some library dependencies. 5 | For core plugin, Mixins, shadowing, access transformers, ASM or etc. you'll need to do some extra steps. 6 | If they are missing in this document - we will gladly receive your suggestions/contribution. 7 | 8 | 1. Copy and replace all files from [template](https://github.com/GTNewHorizons/ExampleMod1.7.10/releases/download/master-packages/migration.zip) to your repository, but `build.gradle` 9 | 2. Copy all repositories from your `build.gradle(.kts)` to `repositories.gradle` 10 | 3. Copy all dependencies from your `build.gradle(.kts)` to `dependecies.gradle` 11 | 4. replace your `build.gradle(.kts)` with `build.gradle` from template. In case you have written some custom tasks/configurations not present in the template - move them into `addon.gradle`. It will automatically be integrated if present. 12 | 5. Adapt `gradle.properties` to your mod 13 | 6. Ensure `src/main/resources/mcmod.info` contains `${modId}`, `${modName}`. `${modVersion}` and `${minecraftVersion}` 14 | 7. Re-import the project to your IDE (e.g. restart with clean caches in IntelliJ IDEA) 15 | 8. Run `./gradlew clean setupDecompWorkspace` 16 | 17 | ## Mixin configuration 18 | For the reference checkout the [example mixin configuration branch](https://github.com/GTNewHorizons/ExampleMod1.7.10/tree/example-mixins) of the template. 19 | 20 | 1. Extract mixins package and plugin configuration from `mixins.yourModId.json` to `gradle.properties` 21 | 2. Implement MixinPlugin according to example from the reference 22 | 3. Remove mixins.mymodid.json 23 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/loader/RecipeLoader.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.loader; 2 | 3 | import static com.asdflj.appliedcooking.loader.ItemAndBlockHolder.KITCHEN_STATION; 4 | import static net.blay09.mods.cookingforblockheads.CookingForBlockheads.*; 5 | 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraftforge.oredict.ShapedOreRecipe; 8 | 9 | import cpw.mods.fml.common.registry.GameRegistry; 10 | 11 | public class RecipeLoader implements Runnable { 12 | 13 | public static final RecipeLoader INSTANCE = new RecipeLoader(); 14 | public static final ItemStack TOASTER = new ItemStack(blockToaster, 1); 15 | public static final ItemStack OVEN = new ItemStack(blockOven, 1); 16 | public static final ItemStack BOOK_TIER1 = new ItemStack(itemRecipeBook, 1); 17 | public static final ItemStack BOOK_TIER2 = new ItemStack(itemRecipeBook, 1, 1); 18 | public static final ItemStack AE2_ME_CHEST = GameRegistry 19 | .findItemStack("appliedenergistics2", "tile.BlockChest", 1); 20 | 21 | public static final ItemStack AE2_GLASS_CABLE = new ItemStack( 22 | GameRegistry.findItem("appliedenergistics2", "item.ItemMultiPart"), 23 | 1, 24 | 16); 25 | public static final ItemStack AE2_PROCESS_ENG = new ItemStack( 26 | GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"), 27 | 1, 28 | 24); 29 | public static final ItemStack AE2_CELL_16K = new ItemStack( 30 | GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"), 31 | 1, 32 | 37); 33 | 34 | @Override 35 | public void run() { 36 | GameRegistry.addRecipe( 37 | new ShapedOreRecipe( 38 | KITCHEN_STATION.stack(), 39 | "TCO", 40 | "GKG", 41 | "BPN", 42 | 'T', 43 | TOASTER, 44 | 'C', 45 | AE2_ME_CHEST, 46 | 'O', 47 | OVEN, 48 | 'G', 49 | AE2_GLASS_CABLE, 50 | 'K', 51 | AE2_CELL_16K, 52 | 'B', 53 | BOOK_TIER1, 54 | 'P', 55 | AE2_PROCESS_ENG, 56 | 'N', 57 | BOOK_TIER2)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/AppliedCooking.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | import com.asdflj.appliedcooking.proxy.CommonProxy; 6 | 7 | import cpw.mods.fml.common.Mod; 8 | import cpw.mods.fml.common.SidedProxy; 9 | import cpw.mods.fml.common.event.FMLInitializationEvent; 10 | import cpw.mods.fml.common.event.FMLPostInitializationEvent; 11 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 12 | import cpw.mods.fml.common.event.FMLServerStartingEvent; 13 | 14 | @Mod( 15 | modid = AppliedCooking.MODID, 16 | version = AppliedCooking.VERSION, 17 | name = AppliedCooking.MODNAME, 18 | dependencies = "required-after:appliedenergistics2;required-after:cookingforblockheads") 19 | public class AppliedCooking { 20 | 21 | public static final String MODID = "appliedcooking"; 22 | public static final String VERSION = Tags.VERSION; 23 | public static final String MODNAME = "AppliedCooking"; 24 | 25 | @SidedProxy( 26 | clientSide = "com.asdflj.appliedcooking.proxy.ClientProxy", 27 | serverSide = "com.asdflj.appliedcooking.proxy.CommonProxy") 28 | public static CommonProxy proxy; 29 | 30 | @Mod.EventHandler 31 | // preInit "Run before anything else. Read your config, create blocks, items, etc, and register them with the 32 | // GameRegistry." (Remove if not needed) 33 | public void preInit(FMLPreInitializationEvent event) { 34 | proxy.preInit(event); 35 | } 36 | 37 | @Mod.EventHandler 38 | // load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed) 39 | public void init(FMLInitializationEvent event) { 40 | proxy.init(event); 41 | } 42 | 43 | @Mod.EventHandler 44 | // postInit "Handle interaction with other mods, complete your setup based on this." (Remove if not needed) 45 | public void postInit(FMLPostInitializationEvent event) { 46 | proxy.postInit(event); 47 | } 48 | 49 | @Mod.EventHandler 50 | // register server commands in this event handler (Remove if not needed) 51 | public void serverStarting(FMLServerStartingEvent event) { 52 | proxy.serverStarting(event); 53 | } 54 | 55 | public static ResourceLocation resource(String path) { 56 | return new ResourceLocation(MODID, path); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/client/render/RenderBlockKitchenStation.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.client.render; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; 5 | import net.minecraft.tileentity.TileEntity; 6 | import net.minecraft.util.ResourceLocation; 7 | import net.minecraftforge.client.model.AdvancedModelLoader; 8 | import net.minecraftforge.client.model.IModelCustom; 9 | 10 | import org.lwjgl.opengl.GL11; 11 | 12 | import com.asdflj.appliedcooking.AppliedCooking; 13 | import com.asdflj.appliedcooking.common.tile.TileKitchenStation; 14 | 15 | public class RenderBlockKitchenStation extends TileEntitySpecialRenderer { 16 | 17 | public final ResourceLocation keyboard = new ResourceLocation( 18 | AppliedCooking.MODID, 19 | "textures/kitchen_station_keyboard.png"); 20 | public final ResourceLocation screen = new ResourceLocation( 21 | AppliedCooking.MODID, 22 | "textures/kitchen_station_screen.png"); 23 | IModelCustom modelKitchenStation = AdvancedModelLoader 24 | .loadModel(AppliedCooking.resource("models/kitchen_station.obj")); 25 | IModelCustom modelKitchenStationConnected = AdvancedModelLoader 26 | .loadModel(AppliedCooking.resource("models/kitchen_station_connected.obj")); 27 | 28 | @Override 29 | public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) { 30 | GL11.glPushMatrix(); 31 | GL11.glTranslated(x + 0.5f, y + 0.6f, z + 0.5f); 32 | int orientation = tileentity.getBlockMetadata(); 33 | if (orientation == 4) { 34 | GL11.glRotatef(90, 0, 1, 0); 35 | } else if (orientation == 5) { 36 | GL11.glRotatef(-90, 0, 1, 0); 37 | } else if (orientation == 3) { 38 | GL11.glRotatef(180, 0, 1, 0); 39 | } 40 | IModelCustom model; 41 | if (((TileKitchenStation) tileentity).isActive()) { 42 | model = modelKitchenStationConnected; 43 | } else { 44 | model = modelKitchenStation; 45 | } 46 | Minecraft.getMinecraft().renderEngine.bindTexture(screen); 47 | model.renderPart("screen"); 48 | Minecraft.getMinecraft().renderEngine.bindTexture(keyboard); 49 | model.renderPart("keyboard"); 50 | model.renderPart("pillar"); 51 | model.renderPart("power_button"); 52 | GL11.glPopMatrix(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/client/render/ItemKitchenStationRender.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.client.render; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.item.Item; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.util.ResourceLocation; 7 | import net.minecraftforge.client.IItemRenderer; 8 | import net.minecraftforge.client.MinecraftForgeClient; 9 | import net.minecraftforge.client.model.AdvancedModelLoader; 10 | import net.minecraftforge.client.model.IModelCustom; 11 | 12 | import org.lwjgl.opengl.GL11; 13 | 14 | import com.asdflj.appliedcooking.AppliedCooking; 15 | import com.asdflj.appliedcooking.common.tile.TileKitchenStation; 16 | import com.asdflj.appliedcooking.loader.ItemAndBlockHolder; 17 | 18 | import cpw.mods.fml.client.registry.ClientRegistry; 19 | 20 | public class ItemKitchenStationRender implements IItemRenderer { 21 | 22 | public final ResourceLocation keyboard = new ResourceLocation( 23 | AppliedCooking.MODID, 24 | "textures/kitchen_station_keyboard.png"); 25 | public final ResourceLocation screen = new ResourceLocation( 26 | AppliedCooking.MODID, 27 | "textures/kitchen_station_screen.png"); 28 | 29 | public static IModelCustom modelKitchenStation = AdvancedModelLoader 30 | .loadModel(AppliedCooking.resource("models/kitchen_station.obj")); 31 | 32 | public ItemKitchenStationRender() { 33 | ClientRegistry.bindTileEntitySpecialRenderer(TileKitchenStation.class, new RenderBlockKitchenStation()); 34 | MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ItemAndBlockHolder.KITCHEN_STATION), this); 35 | } 36 | 37 | @Override 38 | public boolean handleRenderType(ItemStack item, ItemRenderType type) { 39 | return true; 40 | } 41 | 42 | @Override 43 | public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { 44 | return true; 45 | } 46 | 47 | @Override 48 | public void renderItem(ItemRenderType type, ItemStack item, Object... data) { 49 | GL11.glPushMatrix(); 50 | GL11.glScalef(1.7f, 1.7f, 1.7f); 51 | GL11.glRotated(180, 0, 1, 0); 52 | switch (type) { 53 | case EQUIPPED_FIRST_PERSON: 54 | GL11.glTranslatef(-0.2f, 0.8f, -0.4f); 55 | GL11.glRotated(-90, 0, 1, 0); 56 | break; 57 | case INVENTORY: 58 | GL11.glTranslatef(0F, 0.3F, 0F); 59 | break; 60 | default: 61 | GL11.glTranslatef(0, 0.7F, -0.5F); 62 | break; 63 | } 64 | Minecraft.getMinecraft().renderEngine.bindTexture(screen); 65 | modelKitchenStation.renderPart("screen"); 66 | Minecraft.getMinecraft().renderEngine.bindTexture(keyboard); 67 | modelKitchenStation.renderPart("keyboard"); 68 | modelKitchenStation.renderPart("pillar"); 69 | modelKitchenStation.renderPart("power_button"); 70 | GL11.glPopMatrix(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /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 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /dependencies.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Add your dependencies here. Supported configurations: 3 | * - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod 4 | * Available at runtime and compiletime for mods depending on this mod 5 | * - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API 6 | * Available at runtime but not compiletime for mods depending on this mod 7 | * - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods 8 | * Not available at all for mods depending on this mod, only visible at compiletime for this mod 9 | * - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod 10 | * Available at compiletime but not runtime for mods depending on this mod 11 | * - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency 12 | * Not available at all for mods depending on this mod, only visible at runtime for this mod 13 | * - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime, 14 | * but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing 15 | * - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime 16 | * Available at runtime for mods depending on this mod 17 | * - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry 18 | * - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main 19 | * 20 | * - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name 21 | * Requires you to enable usesShadowedDependencies in gradle.properties 22 | * 23 | * - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient) 24 | * 25 | * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed, 26 | * but use this sparingly as it can break using your mod as another mod's dependency if you're not careful. 27 | * 28 | * To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven, 29 | * or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file. 30 | * 31 | * Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not. 32 | * The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published. 33 | * 34 | * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph 35 | */ 36 | dependencies { 37 | api("com.github.GTNewHorizons:AppleCore:3.3.4:dev") 38 | api('com.github.GTNewHorizons:NotEnoughItems:2.7.29-GTNH:dev') 39 | api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-484-GTNH:dev') 40 | api("com.github.GTNewHorizons:CookingForBlockheads:1.3.7-GTNH:dev") {transitive=false} 41 | compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.103:dev') 42 | // compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.41:dev") 43 | runtimeOnlyNonPublishable("com.github.GTNewHorizons:waila:1.6.5:dev") 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/common/tile/TileKitchenStation.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.common.tile; 2 | 3 | import net.blay09.mods.cookingforblockheads.api.kitchen.IKitchenStorageProvider; 4 | import net.minecraft.block.Block; 5 | import net.minecraft.inventory.IInventory; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | import net.minecraft.network.NetworkManager; 8 | import net.minecraft.network.Packet; 9 | import net.minecraft.network.play.server.S35PacketUpdateTileEntity; 10 | import net.minecraft.world.World; 11 | 12 | import com.asdflj.appliedcooking.util.Util; 13 | import com.asdflj.appliedcooking.util.WirelessObject; 14 | 15 | import appeng.api.implementations.IPowerChannelState; 16 | import appeng.tile.AEBaseTile; 17 | import appeng.tile.TileEvent; 18 | import appeng.tile.events.TileEventType; 19 | import appeng.util.Platform; 20 | 21 | public class TileKitchenStation extends AEBaseTile implements IKitchenStorageProvider, IPowerChannelState { 22 | 23 | private long securityKey; 24 | private final WirelessObject wirelessObject; 25 | private boolean isPowered; 26 | 27 | public TileKitchenStation() { 28 | this.wirelessObject = new WirelessObject(this); 29 | } 30 | 31 | public void setKey(long key) { 32 | this.securityKey = key; 33 | } 34 | 35 | public long getKey() { 36 | return this.securityKey; 37 | } 38 | 39 | @Override 40 | public IInventory getInventory() { 41 | if (this.wirelessObject.reCheckIsConnect()) { 42 | return this.wirelessObject.getInventory(); 43 | } 44 | return Util.EmptyInventory; 45 | } 46 | 47 | @TileEvent(TileEventType.WORLD_NBT_READ) 48 | public void readFromNBTEvent(NBTTagCompound data) { 49 | this.setKey(data.getLong("key")); 50 | } 51 | 52 | @TileEvent(TileEventType.WORLD_NBT_WRITE) 53 | public NBTTagCompound writeToNBTEvent(NBTTagCompound data) { 54 | data.setLong("key", this.getKey()); 55 | return data; 56 | } 57 | 58 | private void onComparatorUpdate(World world, int x, int y, int z, Block block) { 59 | world.func_147453_f(x, y, z, block); 60 | } 61 | 62 | private void updatePowerState() { 63 | boolean newState = this.wirelessObject.reCheckIsConnect(); 64 | if (newState != this.isPowered) { 65 | this.isPowered = newState; 66 | this.onComparatorUpdate(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); 67 | this.markForUpdate(); 68 | } 69 | } 70 | 71 | @TileEvent(TileEventType.TICK) 72 | public void update() { 73 | if (Platform.isClient()) return; 74 | this.updatePowerState(); 75 | } 76 | 77 | @Override 78 | public Packet getDescriptionPacket() { 79 | NBTTagCompound nbtTag = new NBTTagCompound(); 80 | writeToNBTWithoutCoords(nbtTag); 81 | return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag); 82 | } 83 | 84 | @Override 85 | public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { 86 | super.onDataPacket(net, packet); 87 | this.readFromNBTWithoutCoords(packet.func_148857_g()); 88 | } 89 | 90 | private void writeToNBTWithoutCoords(NBTTagCompound tag) { 91 | tag.setBoolean("powered", this.isPowered); 92 | } 93 | 94 | public void readFromNBTWithoutCoords(NBTTagCompound tag) { 95 | this.isPowered = tag.getBoolean("powered"); 96 | } 97 | 98 | @Override 99 | public boolean isPowered() { 100 | return isPowered; 101 | } 102 | 103 | @Override 104 | public boolean isActive() { 105 | return isPowered; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/models/kitchen_station.obj: -------------------------------------------------------------------------------- 1 | # Made in Blockbench 4.9.4 2 | mtllib kitchen_station.mtl 3 | 4 | o screen 5 | v 0.3125 -0.08628764609022288 0.3070885726140905 6 | v 0.3125 -0.03845221704458668 0.19160363105017963 7 | v 0.3125 -0.375 0.1875 8 | v 0.3125 -0.3271645709543638 0.07201505843608913 9 | v -0.3125 -0.03845221704458668 0.19160363105017963 10 | v -0.3125 -0.08628764609022288 0.3070885726140905 11 | v -0.3125 -0.3271645709543638 0.07201505843608913 12 | v -0.3125 -0.375 0.1875 13 | vt 0 0.78125 14 | vt 0.5 0.78125 15 | vt 0.5 0.53125 16 | vt 0 0.53125 17 | vt 0.4375 0.96875 18 | vt 0.0625 0.96875 19 | vt 0.0625 0.84375 20 | vt 0.4375 0.84375 21 | vt 0 1 22 | vt 0.5 1 23 | vt 0.5 0.75 24 | vt 0 0.75 25 | vt 0 0.9375 26 | vt 0.0625 0.9375 27 | vt 0.0625 0.84375 28 | vt 0 0.84375 29 | vt 0.40625 0.5 30 | vt 0.09375 0.5 31 | vt 0.09375 0.5625 32 | vt 0.40625 0.5625 33 | vt 0.40625 0.5 34 | vt 0.09375 0.5 35 | vt 0.09375 0.5625 36 | vt 0.40625 0.5625 37 | vn 0 0.3826834323650897 -0.9238795325112867 38 | vn 1 0 0 39 | vn 0 -0.3826834323650897 0.9238795325112867 40 | vn -1 0 0 41 | vn 0 0.9238795325112867 0.3826834323650897 42 | vn 0 -0.9238795325112867 -0.3826834323650897 43 | usemtl m_15938b12-ceed-22c7-2344-fcf24be14c73 44 | f 4/4/1 7/3/1 5/2/1 2/1/1 45 | f 3/8/2 4/7/2 2/6/2 1/5/2 46 | f 8/12/3 3/11/3 1/10/3 6/9/3 47 | f 7/16/4 8/15/4 6/14/4 5/13/4 48 | f 6/20/5 1/19/5 2/18/5 5/17/5 49 | f 7/24/6 4/23/6 3/22/6 8/21/6 50 | o pillar 51 | v 0.25 -0.34375 0.25 52 | v 0.25 -0.34375 0.125 53 | v 0.25 -0.46875 0.25 54 | v 0.25 -0.46875 0.125 55 | v 0.1875 -0.34375 0.125 56 | v 0.1875 -0.34375 0.25 57 | v 0.1875 -0.46875 0.125 58 | v 0.1875 -0.46875 0.25 59 | vt 0.125 0.25 60 | vt 0.1875 0.25 61 | vt 0.1875 0.125 62 | vt 0.125 0.125 63 | vt 0.125 0.125 64 | vt 0.25 0.125 65 | vt 0.25 0 66 | vt 0.125 0 67 | vt 0.125 0.25 68 | vt 0.1875 0.25 69 | vt 0.1875 0.125 70 | vt 0.125 0.125 71 | vt 0 0.25 72 | vt 0.125 0.25 73 | vt 0.125 0.125 74 | vt 0 0.125 75 | vt 0.0625 0 76 | vt 0 0 77 | vt 0 0.125 78 | vt 0.0625 0.125 79 | vt 0.125 0 80 | vt 0.0625 0 81 | vt 0.0625 0.125 82 | vt 0.125 0.125 83 | vn 0 0 -1 84 | vn 1 0 0 85 | vn 0 0 1 86 | vn -1 0 0 87 | vn 0 1 0 88 | vn 0 -1 0 89 | usemtl m_b97f4b49-ef3f-0840-c06c-b86ec4edb70d 90 | f 12/28/7 15/27/7 13/26/7 10/25/7 91 | f 11/32/8 12/31/8 10/30/8 9/29/8 92 | f 16/36/9 11/35/9 9/34/9 14/33/9 93 | f 15/40/10 16/39/10 14/38/10 13/37/10 94 | f 14/44/11 9/43/11 10/42/11 13/41/11 95 | f 15/48/12 12/47/12 11/46/12 16/45/12 96 | o power_button 97 | v -0.1875 -0.34375 0.25 98 | v -0.1875 -0.34375 0.125 99 | v -0.1875 -0.46875 0.25 100 | v -0.1875 -0.46875 0.125 101 | v -0.25 -0.34375 0.125 102 | v -0.25 -0.34375 0.25 103 | v -0.25 -0.46875 0.125 104 | v -0.25 -0.46875 0.25 105 | vt 0.1875 0.25 106 | vt 0.25 0.25 107 | vt 0.25 0.125 108 | vt 0.1875 0.125 109 | vt 0 0.25 110 | vt 0.125 0.25 111 | vt 0.125 0.125 112 | vt 0 0.125 113 | vt 0.125 0.25 114 | vt 0.1875 0.25 115 | vt 0.1875 0.125 116 | vt 0.125 0.125 117 | vt 0.125 0.125 118 | vt 0.25 0.125 119 | vt 0.25 0 120 | vt 0.125 0 121 | vt 0.0625 0 122 | vt 0 0 123 | vt 0 0.125 124 | vt 0.0625 0.125 125 | vt 0.125 0 126 | vt 0.0625 0 127 | vt 0.0625 0.125 128 | vt 0.125 0.125 129 | vn 0 0 -1 130 | vn 1 0 0 131 | vn 0 0 1 132 | vn -1 0 0 133 | vn 0 1 0 134 | vn 0 -1 0 135 | usemtl m_b97f4b49-ef3f-0840-c06c-b86ec4edb70d 136 | f 20/52/13 23/51/13 21/50/13 18/49/13 137 | f 19/56/14 20/55/14 18/54/14 17/53/14 138 | f 24/60/15 19/59/15 17/58/15 22/57/15 139 | f 23/64/16 24/63/16 22/62/16 21/61/16 140 | f 22/68/17 17/67/17 18/66/17 21/65/17 141 | f 23/72/18 20/71/18 19/70/18 24/69/18 142 | o keyboard 143 | v 0.3125 -0.4375 0.1875 144 | v 0.3125 -0.4375 -0.125 145 | v 0.3125 -0.5625 0.1875 146 | v 0.3125 -0.5625 -0.125 147 | v -0.3125 -0.4375 -0.125 148 | v -0.3125 -0.4375 0.1875 149 | v -0.3125 -0.5625 -0.125 150 | v -0.3125 -0.5625 0.1875 151 | vt 0 0.625 152 | vt 0.875 0.625 153 | vt 0.875 0.5625 154 | vt 0 0.5625 155 | vt 0 0.625 156 | vt 0.375 0.625 157 | vt 0.375 0.5625 158 | vt 0 0.5625 159 | vt 0 0.625 160 | vt 0.875 0.625 161 | vt 0.875 0.5625 162 | vt 0 0.5625 163 | vt 0 0.625 164 | vt 0.375 0.625 165 | vt 0.375 0.5625 166 | vt 0 0.5625 167 | vt 0.875 0.625 168 | vt 0 0.625 169 | vt 0 1 170 | vt 0.875 1 171 | vt 0.875 0.25 172 | vt 0 0.25 173 | vt 0 0.625 174 | vt 0.875 0.625 175 | vn 0 0 -1 176 | vn 1 0 0 177 | vn 0 0 1 178 | vn -1 0 0 179 | vn 0 1 0 180 | vn 0 -1 0 181 | usemtl m_b97f4b49-ef3f-0840-c06c-b86ec4edb70d 182 | f 28/76/19 31/75/19 29/74/19 26/73/19 183 | f 27/80/20 28/79/20 26/78/20 25/77/20 184 | f 32/84/21 27/83/21 25/82/21 30/81/21 185 | f 31/88/22 32/87/22 30/86/22 29/85/22 186 | f 30/92/23 25/91/23 26/90/23 29/89/23 187 | f 31/96/24 28/95/24 27/94/24 32/93/24 -------------------------------------------------------------------------------- /src/main/resources/assets/appliedcooking/models/kitchen_station_connected.obj: -------------------------------------------------------------------------------- 1 | # Made in Blockbench 4.9.4 2 | mtllib kitchen_station_connected.mtl 3 | 4 | o screen 5 | v 0.3125 -0.08628764609022288 0.3070885726140905 6 | v 0.3125 -0.03845221704458668 0.19160363105017963 7 | v 0.3125 -0.375 0.1875 8 | v 0.3125 -0.3271645709543638 0.07201505843608913 9 | v -0.3125 -0.03845221704458668 0.19160363105017963 10 | v -0.3125 -0.08628764609022288 0.3070885726140905 11 | v -0.3125 -0.3271645709543638 0.07201505843608913 12 | v -0.3125 -0.375 0.1875 13 | vt 0.5 0.78125 14 | vt 1 0.78125 15 | vt 1 0.53125 16 | vt 0.5 0.53125 17 | vt 0.4375 0.96875 18 | vt 0.0625 0.96875 19 | vt 0.0625 0.84375 20 | vt 0.4375 0.84375 21 | vt 0 1 22 | vt 0.5 1 23 | vt 0.5 0.75 24 | vt 0 0.75 25 | vt 0 0.9375 26 | vt 0.0625 0.9375 27 | vt 0.0625 0.84375 28 | vt 0 0.84375 29 | vt 0.40625 0.5 30 | vt 0.09375 0.5 31 | vt 0.09375 0.5625 32 | vt 0.40625 0.5625 33 | vt 0.40625 0.5 34 | vt 0.09375 0.5 35 | vt 0.09375 0.5625 36 | vt 0.40625 0.5625 37 | vn 0 0.3826834323650897 -0.9238795325112867 38 | vn 1 0 0 39 | vn 0 -0.3826834323650897 0.9238795325112867 40 | vn -1 0 0 41 | vn 0 0.9238795325112867 0.3826834323650897 42 | vn 0 -0.9238795325112867 -0.3826834323650897 43 | usemtl m_d8b8890d-a4ad-3788-aa6e-d59906971540 44 | f 4/4/1 7/3/1 5/2/1 2/1/1 45 | f 3/8/2 4/7/2 2/6/2 1/5/2 46 | f 8/12/3 3/11/3 1/10/3 6/9/3 47 | f 7/16/4 8/15/4 6/14/4 5/13/4 48 | f 6/20/5 1/19/5 2/18/5 5/17/5 49 | f 7/24/6 4/23/6 3/22/6 8/21/6 50 | o pillar 51 | v 0.25 -0.34375 0.25 52 | v 0.25 -0.34375 0.125 53 | v 0.25 -0.46875 0.25 54 | v 0.25 -0.46875 0.125 55 | v 0.1875 -0.34375 0.125 56 | v 0.1875 -0.34375 0.25 57 | v 0.1875 -0.46875 0.125 58 | v 0.1875 -0.46875 0.25 59 | vt 0.125 0.25 60 | vt 0.1875 0.25 61 | vt 0.1875 0.125 62 | vt 0.125 0.125 63 | vt 0.125 0.125 64 | vt 0.25 0.125 65 | vt 0.25 0 66 | vt 0.125 0 67 | vt 0.125 0.25 68 | vt 0.1875 0.25 69 | vt 0.1875 0.125 70 | vt 0.125 0.125 71 | vt 0 0.25 72 | vt 0.125 0.25 73 | vt 0.125 0.125 74 | vt 0 0.125 75 | vt 0.0625 0 76 | vt 0 0 77 | vt 0 0.125 78 | vt 0.0625 0.125 79 | vt 0.125 0 80 | vt 0.0625 0 81 | vt 0.0625 0.125 82 | vt 0.125 0.125 83 | vn 0 0 -1 84 | vn 1 0 0 85 | vn 0 0 1 86 | vn -1 0 0 87 | vn 0 1 0 88 | vn 0 -1 0 89 | usemtl m_4677e6ad-df3f-c966-f581-5b6108663eea 90 | f 12/28/7 15/27/7 13/26/7 10/25/7 91 | f 11/32/8 12/31/8 10/30/8 9/29/8 92 | f 16/36/9 11/35/9 9/34/9 14/33/9 93 | f 15/40/10 16/39/10 14/38/10 13/37/10 94 | f 14/44/11 9/43/11 10/42/11 13/41/11 95 | f 15/48/12 12/47/12 11/46/12 16/45/12 96 | o power_button 97 | v -0.1875 -0.34375 0.25 98 | v -0.1875 -0.34375 0.125 99 | v -0.1875 -0.46875 0.25 100 | v -0.1875 -0.46875 0.125 101 | v -0.25 -0.34375 0.125 102 | v -0.25 -0.34375 0.25 103 | v -0.25 -0.46875 0.125 104 | v -0.25 -0.46875 0.25 105 | vt 0.25 0.25 106 | vt 0.3125 0.25 107 | vt 0.3125 0.125 108 | vt 0.25 0.125 109 | vt 0 0.25 110 | vt 0.125 0.25 111 | vt 0.125 0.125 112 | vt 0 0.125 113 | vt 0.125 0.25 114 | vt 0.1875 0.25 115 | vt 0.1875 0.125 116 | vt 0.125 0.125 117 | vt 0.125 0.125 118 | vt 0.25 0.125 119 | vt 0.25 0 120 | vt 0.125 0 121 | vt 0.0625 0 122 | vt 0 0 123 | vt 0 0.125 124 | vt 0.0625 0.125 125 | vt 0.125 0 126 | vt 0.0625 0 127 | vt 0.0625 0.125 128 | vt 0.125 0.125 129 | vn 0 0 -1 130 | vn 1 0 0 131 | vn 0 0 1 132 | vn -1 0 0 133 | vn 0 1 0 134 | vn 0 -1 0 135 | usemtl m_4677e6ad-df3f-c966-f581-5b6108663eea 136 | f 20/52/13 23/51/13 21/50/13 18/49/13 137 | f 19/56/14 20/55/14 18/54/14 17/53/14 138 | f 24/60/15 19/59/15 17/58/15 22/57/15 139 | f 23/64/16 24/63/16 22/62/16 21/61/16 140 | f 22/68/17 17/67/17 18/66/17 21/65/17 141 | f 23/72/18 20/71/18 19/70/18 24/69/18 142 | o keyboard 143 | v 0.3125 -0.4375 0.1875 144 | v 0.3125 -0.4375 -0.125 145 | v 0.3125 -0.5625 0.1875 146 | v 0.3125 -0.5625 -0.125 147 | v -0.3125 -0.4375 -0.125 148 | v -0.3125 -0.4375 0.1875 149 | v -0.3125 -0.5625 -0.125 150 | v -0.3125 -0.5625 0.1875 151 | vt 0 0.625 152 | vt 0.875 0.625 153 | vt 0.875 0.5625 154 | vt 0 0.5625 155 | vt 0 0.625 156 | vt 0.375 0.625 157 | vt 0.375 0.5625 158 | vt 0 0.5625 159 | vt 0 0.625 160 | vt 0.875 0.625 161 | vt 0.875 0.5625 162 | vt 0 0.5625 163 | vt 0 0.625 164 | vt 0.375 0.625 165 | vt 0.375 0.5625 166 | vt 0 0.5625 167 | vt 0.875 0.625 168 | vt 0 0.625 169 | vt 0 1 170 | vt 0.875 1 171 | vt 0.875 0.25 172 | vt 0 0.25 173 | vt 0 0.625 174 | vt 0.875 0.625 175 | vn 0 0 -1 176 | vn 1 0 0 177 | vn 0 0 1 178 | vn -1 0 0 179 | vn 0 1 0 180 | vn 0 -1 0 181 | usemtl m_4677e6ad-df3f-c966-f581-5b6108663eea 182 | f 28/76/19 31/75/19 29/74/19 26/73/19 183 | f 27/80/20 28/79/20 26/78/20 25/77/20 184 | f 32/84/21 27/83/21 25/82/21 30/81/21 185 | f 31/88/22 32/87/22 30/86/22 29/85/22 186 | f 30/92/23 25/91/23 26/90/23 29/89/23 187 | f 31/96/24 28/95/24 27/94/24 32/93/24 -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/mixins/MixinContainerRecipeBook.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.mixins; 2 | 3 | import java.util.List; 4 | 5 | import net.blay09.mods.cookingforblockheads.KitchenMultiBlock; 6 | import net.blay09.mods.cookingforblockheads.container.ContainerRecipeBook; 7 | import net.blay09.mods.cookingforblockheads.registry.CookingRegistry; 8 | import net.blay09.mods.cookingforblockheads.registry.food.FoodRecipe; 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.entity.player.EntityPlayerMP; 11 | import net.minecraft.inventory.Container; 12 | import net.minecraft.inventory.IInventory; 13 | import net.minecraft.item.ItemStack; 14 | 15 | import org.spongepowered.asm.mixin.Mixin; 16 | import org.spongepowered.asm.mixin.Shadow; 17 | import org.spongepowered.asm.mixin.injection.At; 18 | import org.spongepowered.asm.mixin.injection.Inject; 19 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 20 | 21 | import com.asdflj.appliedcooking.inventory.AppEngInternalInventoryBridge; 22 | 23 | import appeng.api.config.Actionable; 24 | import appeng.api.storage.data.IAEItemStack; 25 | import appeng.util.item.AEItemStack; 26 | 27 | @Mixin(ContainerRecipeBook.class) 28 | public abstract class MixinContainerRecipeBook extends Container { 29 | 30 | @Shadow(remap = false) 31 | private KitchenMultiBlock kitchenMultiBlock; 32 | 33 | @Inject(method = "trySmelt", at = @At("HEAD"), cancellable = true, remap = false) 34 | private void trySmelt(EntityPlayer player, FoodRecipe recipe, boolean isShiftDown, CallbackInfo ci) { 35 | if (!recipe.isSmeltingRecipe()) { 36 | return; 37 | } 38 | List sourceInventories = kitchenMultiBlock.getSourceInventories(player.inventory); 39 | for (int i = 0; i < sourceInventories.size(); i++) { 40 | if (sourceInventories.get(i) instanceof AppEngInternalInventoryBridge aeInv) { 41 | for (ItemStack ingredientStack : recipe.getCraftMatrix() 42 | .get(0) 43 | .getItemStacks()) { 44 | IAEItemStack storedItem = aeInv.getWirelessObject() 45 | .getStorageList() 46 | .findPrecise(AEItemStack.create(ingredientStack)); 47 | if (storedItem != null) { 48 | int count = isShiftDown 49 | ? Math.min(storedItem.getItemStack().stackSize, ingredientStack.getMaxStackSize()) 50 | : 1; 51 | IAEItemStack requestExtractItem = storedItem.copy(); 52 | requestExtractItem.setStackSize(count); 53 | IAEItemStack result = aeInv.getWirelessObject() 54 | .extractItems( 55 | requestExtractItem, 56 | Actionable.MODULATE, 57 | aeInv.getWirelessObject() 58 | .getSource()); 59 | kitchenMultiBlock.smeltItem(result.getItemStack(), result.getItemStack().stackSize); 60 | ci.cancel(); 61 | return; 62 | } 63 | } 64 | } else { 65 | for (int j = 0; j < sourceInventories.get(i) 66 | .getSizeInventory(); j++) { 67 | ItemStack itemStack = sourceInventories.get(i) 68 | .getStackInSlot(j); 69 | if (itemStack != null) { 70 | for (ItemStack ingredientStack : recipe.getCraftMatrix() 71 | .get(0) 72 | .getItemStacks()) { 73 | if (CookingRegistry.areItemStacksEqualWithWildcard(itemStack, ingredientStack)) { 74 | int count = isShiftDown 75 | ? Math.min(itemStack.stackSize, ingredientStack.getMaxStackSize()) 76 | : 1; 77 | ItemStack restStack = kitchenMultiBlock.smeltItem(itemStack, count); 78 | sourceInventories.get(i) 79 | .setInventorySlotContents(j, restStack); 80 | if (i == 0) { // Player Inventory 81 | if (j < 9) { 82 | ((EntityPlayerMP) player).sendSlotContents(this, 48 + j, restStack); 83 | } else { 84 | ((EntityPlayerMP) player).sendSlotContents(this, 21 + j - 9, restStack); 85 | } 86 | } 87 | player.inventory.markDirty(); 88 | ci.cancel(); 89 | return; 90 | } 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /docs/porting.md: -------------------------------------------------------------------------------- 1 | # Porting guidelines 2 | 3 | This is a list of steps which should help you on your probably not so easy journey of porting some mod: 4 | 5 | ### 1. Setting up repository and build system 6 | 1. Checkout any information in mod REAMDE/Wiki/Docs to find out if there are any special tasks/configs that need to be applied to the build 7 | 2. Fork original repository to preserve commit history 8 | 3. Apply build migration as explained in [migration guidelines](migration.md) on your fork 9 | 10 | ### 2. Refining the fork 11 | Try to get rid of dependencies on concrete jars (usually in the `lib` folder) if any present. This way it will be much easier to change (upgrade/downgrade) your project dependencies, when needed. 12 | 13 | Check if they are in maven repository (usually authors put such information in the project readme), if it isn't accessible but project is open source with permissive enough license (e.g., MIT) - you still can publish them yourselves: 14 | 1. Fork the repository 15 | 2. Drop `jitpack.yml` and `.github/workflows/gradle.yml` in project root. You can find this file in this repository root. 16 | 3. Make sure everything builds from console by running `./gradlew clean setupCIWorkspace` 17 | 4. If all is fine/after fixing the errors - make a tag on Github or using console, this should trigger Github build hook and generate a release 18 | 4. Lookup forked repository on `https://jitpack.io/` 19 | 5. Find your release and click "Get it", which should scroll you down to the example of how to add the dependency (make sure you have jitpack repository in mod you are porting) 20 | 6. Checkout build log beside button you clicked to make sure it succeeds 21 | 22 | Now when you are sure dependency is available in maven repository - just add it as a normal gradle dependency in `dependencies.gradle`. 23 | 24 | If there is not online dependency available, you may upload it as a jar to jitpack, see [jitpack single file publishing thread](https://gist.github.com/jitpack-io/f928a858aa5da08ad9d9662f982da983). Please ensure, that you have the rights to do so! 25 | 26 | There may also be a case where mods depend on another mods - then you'll need to port any dependencies first. (Yay, dependency hell! :D) 27 | 28 | ### 3. Preparing for porting 29 | Try to build the project and see check what types of errors are you getting. Generally, there should be 2 types of errors you encounter: 30 | - Missing references to packages/classes/methods/fields/parameters. Things get renamed, moved, restructured, removed or even not yet exist. That's the straightforward part - you'll need to adjust references and way things are invoked. 31 | In case of missing things, you'll either need to implement something that's imitates missing parts or resign from some functionality 32 | - Build related errors (e.g., something that is a part of the mod in never versions previously was an external library - you'll need to add it as a dependencies) 33 | 34 | Fix all build related errors (so build system won't get in your way) 35 | 36 | ### 4. Porting the mod 37 | After all these preparations nothing should be in the way of porting the mod, the only thing left is the actual code to change, which probably is a most tedious part of this process. 38 | 39 | Good approach is to start working with smaller things first, building up your confidence in how the mod works and gradually approaching more complex stuff, here is a general algorithm: 40 | 1. Begin with fixing moved/renamed things by deleting all bad imports and with help of the IDE re-import equivalents if present. 41 | IntelliJ IDEA has settings for unambiguous auto-import and import optimization on the fly, which can greatly speedup the process. Just pay attention to what is actually imported. 42 | 2. Remove all nonworking code which is not easily fixable (e.g., class only introduced in newer forge) and provide stubs in its place. 43 | For example, replace reference to method of non existing class with your method in your class, it can have an empty body and mocked return so the code can compile and run without issues. 44 | Do not forget to track all things you've stubbed, if you are working on port alone - TODOs should be sufficient (most IDEs have a built in TODO browser). 45 | 3. Build the project and attempt to run it 46 | 4. If there were any critical errors which cause Minecraft to crash or mod to not work - try fixing them first, so you can test your changes 47 | 5. Start fixing small things, ones that you think you have most chances to fix and work your way up 48 | 6. If any there is any feature that is not worth it's time or you simply don't know how to do it - consider dropping it entirely and open an issue in your repository where you'll explain your findings and blockers. 49 | Maybe somebody with greater knowledge/more time/motivation will try to take bite at it. 50 | 9. Fix bugs you've introduced when porting. 51 | It is uncommon for mods to have lots of workarounds and hidden connections. 52 | You'll need to test things and check if they work as intended (gl;hf ;p) 53 | 54 | ### 5. Final words 55 | 56 | If after reading this, you are not discouraged and still want to port it - good luck porting it! You'll definitively need it. 57 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/common/block/BlockKitchenStation.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.common.block; 2 | 3 | import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown; 4 | 5 | import java.util.List; 6 | 7 | import net.blay09.mods.cookingforblockheads.CookingForBlockheads; 8 | import net.minecraft.block.material.Material; 9 | import net.minecraft.client.resources.I18n; 10 | import net.minecraft.entity.EntityLivingBase; 11 | import net.minecraft.entity.player.EntityPlayer; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraft.tileentity.TileEntity; 14 | import net.minecraft.util.ChatComponentTranslation; 15 | import net.minecraft.util.MathHelper; 16 | import net.minecraft.world.World; 17 | 18 | import com.asdflj.appliedcooking.common.item.ItemKitchenStation; 19 | import com.asdflj.appliedcooking.common.tile.TileKitchenStation; 20 | import com.asdflj.appliedcooking.loader.IRegister; 21 | import com.asdflj.appliedcooking.util.NameConst; 22 | import com.asdflj.appliedcooking.util.Util; 23 | 24 | import appeng.api.AEApi; 25 | import appeng.api.features.ILocatable; 26 | import appeng.api.features.IWirelessTermHandler; 27 | import appeng.api.features.IWirelessTermRegistry; 28 | import appeng.core.localization.PlayerMessages; 29 | import appeng.items.tools.powered.ToolWirelessTerminal; 30 | import appeng.util.Platform; 31 | import cpw.mods.fml.common.registry.GameRegistry; 32 | import cpw.mods.fml.relauncher.Side; 33 | import cpw.mods.fml.relauncher.SideOnly; 34 | 35 | public class BlockKitchenStation extends BaseBlockContainer implements IRegister { 36 | 37 | public BlockKitchenStation() { 38 | super(Material.iron); 39 | this.setBlockName(NameConst.BLOCK_KITCHEN_STATION); 40 | this.setHardness(2.0f); 41 | this.setResistance(10.0f); 42 | } 43 | 44 | @Override 45 | public boolean renderAsNormalBlock() { 46 | return false; 47 | } 48 | 49 | @Override 50 | public boolean isOpaqueCube() { 51 | return false; 52 | } 53 | 54 | @Override 55 | public int getRenderType() { 56 | return -1; 57 | } 58 | 59 | @Override 60 | public BlockKitchenStation register() { 61 | GameRegistry.registerBlock(this, ItemKitchenStation.class, NameConst.BLOCK_KITCHEN_STATION); 62 | GameRegistry.registerTileEntity(TileKitchenStation.class, NameConst.BLOCK_KITCHEN_STATION); 63 | setCreativeTab(CookingForBlockheads.creativeTab); 64 | return this; 65 | } 66 | 67 | public TileEntity getTileEntity(World worldObj, int x, int y, int z) { 68 | return worldObj.getTileEntity(x, y, z); 69 | } 70 | 71 | @Override 72 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, 73 | float hitY, float hitZ) { 74 | if (Platform.isClient()) return true; 75 | TileKitchenStation tile = (TileKitchenStation) getTileEntity(world, x, y, z); 76 | if (tile == null) return false; 77 | IWirelessTermRegistry term = AEApi.instance() 78 | .registries() 79 | .wireless(); 80 | ItemStack is = player.getCurrentEquippedItem(); 81 | if (is != null && is.getItem() instanceof ToolWirelessTerminal) { 82 | final IWirelessTermHandler handler = term.getWirelessTerminalHandler(is); 83 | final String unparsedKey = handler.getEncryptionKey(is); 84 | if (unparsedKey.equals("")) { 85 | player.addChatMessage(PlayerMessages.DeviceNotLinked.get()); 86 | return false; 87 | } 88 | final long parsedKey = Long.parseLong(unparsedKey); 89 | final ILocatable securityStation = Util.getSecurityStation(parsedKey); 90 | if (securityStation == null) { 91 | player.addChatMessage(PlayerMessages.StationCanNotBeLocated.get()); 92 | return false; 93 | } 94 | tile.setKey(parsedKey); 95 | } else { 96 | final ILocatable securityStation = Util.getSecurityStation(tile.getKey()); 97 | if (securityStation != null) { 98 | player.addChatMessage(new ChatComponentTranslation(NameConst.TT_CONNECTED)); 99 | } else { 100 | player.addChatMessage(PlayerMessages.StationCanNotBeLocated.get()); 101 | return false; 102 | } 103 | } 104 | return true; 105 | } 106 | 107 | @Override 108 | public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { 109 | int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; 110 | 111 | if (l == 0) { 112 | world.setBlockMetadataWithNotify(x, y, z, 2, 2); 113 | } 114 | 115 | if (l == 1) { 116 | world.setBlockMetadataWithNotify(x, y, z, 5, 2); 117 | } 118 | 119 | if (l == 2) { 120 | world.setBlockMetadataWithNotify(x, y, z, 3, 2); 121 | } 122 | 123 | if (l == 3) { 124 | world.setBlockMetadataWithNotify(x, y, z, 4, 2); 125 | } 126 | } 127 | 128 | @Override 129 | @SideOnly(Side.CLIENT) 130 | public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List toolTip, 131 | final boolean advancedToolTips) { 132 | if (isShiftKeyDown()) { 133 | toolTip.add(I18n.format(NameConst.TT_KITCHEN_STATION)); 134 | } else { 135 | toolTip.add(I18n.format(NameConst.TT_SHIFT_FOR_MORE)); 136 | } 137 | 138 | } 139 | 140 | @Override 141 | public TileEntity createNewTileEntity(World worldIn, int meta) { 142 | return new TileKitchenStation(); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/mixins/MixinCookingRegistry.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.mixins; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import net.blay09.mods.cookingforblockheads.api.kitchen.IKitchenItemProvider; 7 | import net.blay09.mods.cookingforblockheads.registry.CookingRegistry; 8 | import net.blay09.mods.cookingforblockheads.registry.food.FoodIngredient; 9 | import net.minecraft.inventory.IInventory; 10 | import net.minecraft.item.ItemStack; 11 | 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | import org.spongepowered.asm.mixin.injection.Inject; 15 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 16 | 17 | import com.asdflj.appliedcooking.inventory.AppEngInternalInventoryBridge; 18 | 19 | import appeng.api.AEApi; 20 | import appeng.api.config.FuzzyMode; 21 | import appeng.api.storage.data.IAEItemStack; 22 | import appeng.api.storage.data.IItemList; 23 | import appeng.util.item.AEItemStack; 24 | 25 | @Mixin(CookingRegistry.class) 26 | public abstract class MixinCookingRegistry { 27 | 28 | @Inject(method = "areIngredientsAvailableFor", at = @At("HEAD"), remap = false, cancellable = true) 29 | private static void onMatrixLoopCompletion(List craftMatrix, List inventories, 30 | List itemProviders, CallbackInfoReturnable cir) { 31 | int[][] usedStackSize = new int[inventories.size()][]; 32 | for (int i = 0; i < usedStackSize.length; i++) { 33 | usedStackSize[i] = new int[inventories.get(i) 34 | .getSizeInventory()]; 35 | } 36 | boolean[] itemFound = new boolean[craftMatrix.size()]; 37 | IItemList usedStacks = AEApi.instance() 38 | .storage() 39 | .createItemList(); 40 | 41 | matrixLoop: for (int i = 0; i < craftMatrix.size(); i++) { 42 | if (craftMatrix.get(i) == null || craftMatrix.get(i) 43 | .isToolItem()) { 44 | itemFound[i] = true; 45 | continue; 46 | } 47 | for (IKitchenItemProvider itemProvider : itemProviders) { 48 | itemProvider.clearCraftingBuffer(); 49 | for (ItemStack providedStack : itemProvider.getProvidedItemStacks()) { 50 | if (craftMatrix.get(i) 51 | .isValidItem(providedStack)) { 52 | if (itemProvider.addToCraftingBuffer(providedStack)) { 53 | itemFound[i] = true; 54 | continue matrixLoop; 55 | } 56 | } 57 | } 58 | } 59 | for (int j = 0; j < inventories.size(); j++) { 60 | if (inventories.get(j) instanceof AppEngInternalInventoryBridge aeInv) { 61 | for (ItemStack item : craftMatrix.get(i) 62 | .getItemStacks()) { 63 | IAEItemStack requestItem = AEItemStack.create(item); 64 | if (requestItem == null) continue; 65 | IAEItemStack usedItem = usedStacks.findPrecise(requestItem); 66 | if (usedItem != null) { 67 | requestItem.add(usedItem); 68 | } 69 | Collection results = aeInv.getWirelessObject() 70 | .getStorageList() 71 | .findFuzzy(requestItem, FuzzyMode.IGNORE_ALL); 72 | for (IAEItemStack result : results) { 73 | if (craftMatrix.get(i) 74 | .isValidItem(result.getItemStack())) { 75 | if (usedItem == null) { 76 | usedStacks.add(requestItem); 77 | } else { 78 | usedStacks.findPrecise(requestItem) 79 | .incStackSize(1); 80 | } 81 | if (checkHasEnoughItem( 82 | usedStacks, 83 | aeInv.getWirelessObject() 84 | .getStorageList())) { 85 | itemFound[i] = true; 86 | continue matrixLoop; 87 | } 88 | } 89 | } 90 | } 91 | } else { 92 | for (int k = 0; k < inventories.get(j) 93 | .getSizeInventory(); k++) { 94 | ItemStack itemStack = inventories.get(j) 95 | .getStackInSlot(k); 96 | if (itemStack != null && craftMatrix.get(i) 97 | .isValidItem(itemStack) && itemStack.stackSize - usedStackSize[j][k] > 0) { 98 | usedStackSize[j][k]++; 99 | itemFound[i] = true; 100 | continue matrixLoop; 101 | } 102 | } 103 | } 104 | 105 | } 106 | } 107 | for (int i = 0; i < itemFound.length; i++) { 108 | if (!itemFound[i]) { 109 | cir.setReturnValue(false); 110 | return; 111 | } 112 | } 113 | cir.setReturnValue(true); 114 | } 115 | 116 | private static boolean checkHasEnoughItem(IItemList list, IItemList storedItems) { 117 | for (IAEItemStack item : list) { 118 | IAEItemStack stored = storedItems.findPrecise(item); 119 | if (stored == null || stored.getStackSize() < item.getStackSize()) return false; 120 | } 121 | return true; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/util/WirelessObject.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.util; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.server.MinecraftServer; 6 | import net.minecraftforge.common.util.ForgeDirection; 7 | 8 | import com.asdflj.appliedcooking.common.tile.TileKitchenStation; 9 | import com.asdflj.appliedcooking.inventory.AppEngInternalInventoryBridge; 10 | import com.asdflj.appliedcooking.inventory.IWirelessObject; 11 | 12 | import appeng.api.AEApi; 13 | import appeng.api.config.AccessRestriction; 14 | import appeng.api.config.Actionable; 15 | import appeng.api.features.ILocatable; 16 | import appeng.api.networking.IGrid; 17 | import appeng.api.networking.IGridHost; 18 | import appeng.api.networking.IGridNode; 19 | import appeng.api.networking.security.BaseActionSource; 20 | import appeng.api.networking.security.MachineSource; 21 | import appeng.api.networking.storage.IStorageGrid; 22 | import appeng.api.storage.IMEMonitor; 23 | import appeng.api.storage.IMEMonitorHandlerReceiver; 24 | import appeng.api.storage.StorageChannel; 25 | import appeng.api.storage.data.IAEFluidStack; 26 | import appeng.api.storage.data.IAEItemStack; 27 | import appeng.api.storage.data.IItemList; 28 | import appeng.api.util.AECableType; 29 | import appeng.api.util.IConfigManager; 30 | import appeng.tile.inventory.InvOperation; 31 | 32 | public class WirelessObject implements IWirelessObject { 33 | 34 | private IStorageGrid sg; 35 | private IGrid targetGrid; 36 | private IGridNode iGridNode; 37 | private IMEMonitor itemStorage; 38 | private final TileKitchenStation tile; 39 | private AppEngInternalInventoryBridge inv; 40 | private final MachineSource source; 41 | private long lastKey; 42 | private int lastTickCount = 0; 43 | 44 | public WirelessObject(TileKitchenStation tile) { 45 | this.tile = tile; 46 | this.source = new MachineSource(this); 47 | this.reinitialize(); 48 | } 49 | 50 | public BaseActionSource getSource() { 51 | return source; 52 | } 53 | 54 | public boolean reCheckIsConnect() { 55 | if (lastKey != tile.getKey()) { 56 | this.reinitialize(); 57 | } 58 | ILocatable obj = null; 59 | try { 60 | obj = AEApi.instance() 61 | .registries() 62 | .locatable() 63 | .getLocatableBy(tile.getKey()); 64 | 65 | } catch (final NumberFormatException err) { 66 | // :P 67 | } 68 | if (obj instanceof IGridHost ig) { 69 | final IGridNode n = ig.getGridNode(ForgeDirection.UNKNOWN); 70 | return n.isActive(); 71 | } 72 | return false; 73 | } 74 | 75 | public void reinitialize() { 76 | ILocatable obj = null; 77 | 78 | try { 79 | obj = AEApi.instance() 80 | .registries() 81 | .locatable() 82 | .getLocatableBy(tile.getKey()); 83 | } catch (final NumberFormatException err) { 84 | // :P 85 | } 86 | if (obj instanceof IGridHost) { 87 | final IGridNode n = ((IGridHost) obj).getGridNode(ForgeDirection.UNKNOWN); 88 | if (n != null) { 89 | this.iGridNode = n; 90 | this.targetGrid = n.getGrid(); 91 | if (targetGrid != null) { 92 | this.lastKey = this.tile.getKey(); 93 | this.sg = targetGrid.getCache(IStorageGrid.class); 94 | if (this.sg != null) { 95 | this.itemStorage = this.sg.getItemInventory(); 96 | } 97 | } 98 | } 99 | } 100 | } 101 | 102 | @Override 103 | public IMEMonitor getItemInventory() { 104 | if (this.sg == null) { 105 | return null; 106 | } 107 | return this.sg.getItemInventory(); 108 | } 109 | 110 | @Override 111 | public IMEMonitor getFluidInventory() { 112 | if (this.sg == null) { 113 | return null; 114 | } 115 | return this.sg.getFluidInventory(); 116 | } 117 | 118 | @Override 119 | public IConfigManager getConfigManager() { 120 | return null; 121 | } 122 | 123 | @Override 124 | public IItemList getAvailableItems(IItemList out) { 125 | if (this.itemStorage != null) { 126 | return this.itemStorage.getAvailableItems(out); 127 | } 128 | return out; 129 | } 130 | 131 | @Override 132 | public IItemList getStorageList() { 133 | if (this.itemStorage != null) { 134 | return this.itemStorage.getStorageList(); 135 | } 136 | return null; 137 | } 138 | 139 | @Override 140 | public void addListener(IMEMonitorHandlerReceiver l, Object verificationToken) { 141 | if (this.itemStorage != null) { 142 | this.itemStorage.addListener(l, verificationToken); 143 | } 144 | } 145 | 146 | @Override 147 | public void removeListener(IMEMonitorHandlerReceiver l) { 148 | if (this.itemStorage != null) { 149 | this.itemStorage.removeListener(l); 150 | } 151 | } 152 | 153 | @Override 154 | public AccessRestriction getAccess() { 155 | if (this.itemStorage != null) { 156 | return this.itemStorage.getAccess(); 157 | } 158 | return AccessRestriction.NO_ACCESS; 159 | } 160 | 161 | @Override 162 | public boolean isPrioritized(IAEItemStack input) { 163 | if (this.itemStorage != null) { 164 | return this.itemStorage.isPrioritized(input); 165 | } 166 | return false; 167 | } 168 | 169 | @Override 170 | public boolean canAccept(IAEItemStack input) { 171 | if (this.itemStorage != null) { 172 | return this.itemStorage.canAccept(input); 173 | } 174 | return false; 175 | } 176 | 177 | @Override 178 | public int getPriority() { 179 | if (this.itemStorage != null) { 180 | return this.itemStorage.getPriority(); 181 | } 182 | return 0; 183 | } 184 | 185 | @Override 186 | public int getSlot() { 187 | if (this.itemStorage != null) { 188 | return this.itemStorage.getSlot(); 189 | } 190 | return 0; 191 | } 192 | 193 | @Override 194 | public boolean validForPass(int i) { 195 | return this.itemStorage.validForPass(i); 196 | } 197 | 198 | @Override 199 | public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) { 200 | if (this.itemStorage != null) { 201 | return this.itemStorage.injectItems(input, type, src); 202 | } 203 | return input; 204 | } 205 | 206 | @Override 207 | public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) { 208 | if (this.itemStorage != null) { 209 | return this.itemStorage.extractItems(request, mode, src); 210 | } 211 | return null; 212 | } 213 | 214 | @Override 215 | public StorageChannel getChannel() { 216 | if (this.itemStorage != null) { 217 | return this.itemStorage.getChannel(); 218 | } 219 | return StorageChannel.ITEMS; 220 | } 221 | 222 | @Override 223 | public IInventory getInventory() { 224 | if (this.inv == null) { 225 | this.inv = new AppEngInternalInventoryBridge(this); 226 | } 227 | if (MinecraftServer.getServer() 228 | .getTickCounter() != lastTickCount) { 229 | this.reinitialize(); 230 | lastTickCount = MinecraftServer.getServer() 231 | .getTickCounter(); 232 | } 233 | 234 | return inv; 235 | } 236 | 237 | @Override 238 | public void saveChanges() { 239 | 240 | } 241 | 242 | @Override 243 | public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack resultStack, 244 | ItemStack oldStack) {} 245 | 246 | @Override 247 | public IGridNode getActionableNode() { 248 | return this.iGridNode; 249 | } 250 | 251 | @Override 252 | public IGridNode getGridNode(ForgeDirection dir) { 253 | return this.iGridNode; 254 | } 255 | 256 | @Override 257 | public AECableType getCableConnectionType(ForgeDirection dir) { 258 | return null; 259 | } 260 | 261 | @Override 262 | public void securityBreak() { 263 | 264 | } 265 | 266 | public IMEMonitor getItemStorage() { 267 | return this.itemStorage; 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /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 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /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 = AppliedCooking 7 | 8 | # Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation. 9 | # Conventionally lowercase. 10 | modId = appliedcooking 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 = com.asdflj.appliedcooking 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 = com.asdflj.appliedcooking.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 = 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 = 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 | -------------------------------------------------------------------------------- /src/main/java/com/asdflj/appliedcooking/mixins/MixinInventoryCraftBook.java: -------------------------------------------------------------------------------- 1 | package com.asdflj.appliedcooking.mixins; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import net.blay09.mods.cookingforblockheads.api.kitchen.IKitchenItemProvider; 7 | import net.blay09.mods.cookingforblockheads.container.ContainerRecipeBook; 8 | import net.blay09.mods.cookingforblockheads.container.inventory.InventoryCraftBook; 9 | import net.blay09.mods.cookingforblockheads.registry.CookingRegistry; 10 | import net.blay09.mods.cookingforblockheads.registry.food.FoodIngredient; 11 | import net.blay09.mods.cookingforblockheads.registry.food.FoodRecipe; 12 | import net.minecraft.entity.player.EntityPlayer; 13 | import net.minecraft.init.Items; 14 | import net.minecraft.inventory.Container; 15 | import net.minecraft.inventory.IInventory; 16 | import net.minecraft.inventory.InventoryCrafting; 17 | import net.minecraft.item.ItemStack; 18 | import net.minecraft.item.crafting.IRecipe; 19 | import net.minecraft.stats.AchievementList; 20 | import net.minecraftforge.common.MinecraftForge; 21 | import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; 22 | 23 | import org.spongepowered.asm.mixin.Final; 24 | import org.spongepowered.asm.mixin.Mixin; 25 | import org.spongepowered.asm.mixin.Shadow; 26 | import org.spongepowered.asm.mixin.injection.At; 27 | import org.spongepowered.asm.mixin.injection.Inject; 28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 29 | 30 | import com.asdflj.appliedcooking.inventory.AppEngInternalInventoryBridge; 31 | 32 | import appeng.api.AEApi; 33 | import appeng.api.config.Actionable; 34 | import appeng.api.config.FuzzyMode; 35 | import appeng.api.storage.data.IAEItemStack; 36 | import appeng.api.storage.data.IItemList; 37 | import appeng.util.item.AEItemStack; 38 | import cpw.mods.fml.common.FMLCommonHandler; 39 | 40 | @Mixin(InventoryCraftBook.class) 41 | public abstract class MixinInventoryCraftBook extends InventoryCrafting { 42 | 43 | @Shadow(remap = false) 44 | private List inventories; 45 | 46 | @Shadow(remap = false) 47 | @Final 48 | private int[] sourceInventories; 49 | 50 | @Shadow(remap = false) 51 | @Final 52 | private int[] sourceInventorySlots; 53 | 54 | @Shadow(remap = false) 55 | @Final 56 | private List sourceProviders; 57 | 58 | @Shadow(remap = false) 59 | private List itemProviders; 60 | 61 | @Shadow(remap = false) 62 | private IRecipe currentRecipe; 63 | 64 | @Shadow(remap = false) 65 | public abstract IRecipe prepareRecipe(EntityPlayer player, FoodRecipe recipe); 66 | 67 | @Shadow(remap = false) 68 | @Final 69 | private ContainerRecipeBook containerRecipeBook; 70 | 71 | public MixinInventoryCraftBook(Container p_i1807_1_, int p_i1807_2_, int p_i1807_3_) { 72 | super(p_i1807_1_, p_i1807_2_, p_i1807_3_); 73 | } 74 | 75 | @Inject(method = "prepareRecipe", at = @At("HEAD"), remap = false, cancellable = true) 76 | public void _prepareRecipe(EntityPlayer player, FoodRecipe recipe, CallbackInfoReturnable cir) { 77 | List ingredients = recipe.getCraftMatrix(); 78 | IItemList usedStacks = AEApi.instance() 79 | .storage() 80 | .createItemList(); 81 | int[][] usedStackSize = new int[inventories.size()][]; 82 | for (int i = 0; i < usedStackSize.length; i++) { 83 | usedStackSize[i] = new int[inventories.get(i) 84 | .getSizeInventory()]; 85 | } 86 | for (int i = 0; i < getSizeInventory(); i++) { 87 | setInventorySlotContents(i, null); 88 | sourceInventories[i] = -1; 89 | sourceInventorySlots[i] = -1; 90 | } 91 | ingredientLoop: for (int i = 0; i < ingredients.size(); i++) { 92 | int origX = i % recipe.getRecipeWidth(); 93 | int origY = i / recipe.getRecipeWidth(); 94 | int targetIdx = origY * 3 + origX; 95 | 96 | if (ingredients.get(i) != null) { 97 | sourceProviders.clear(); 98 | for (IKitchenItemProvider itemProvider : itemProviders) { 99 | itemProvider.clearCraftingBuffer(); 100 | for (ItemStack providedStack : itemProvider.getProvidedItemStacks()) { 101 | if (ingredients.get(i) 102 | .isValidItem(providedStack)) { 103 | ItemStack itemStack = providedStack.copy(); 104 | if (itemProvider.addToCraftingBuffer(itemStack)) { 105 | sourceProviders.add(itemProvider); 106 | setInventorySlotContents(targetIdx, itemStack); 107 | continue ingredientLoop; 108 | } 109 | } 110 | } 111 | } 112 | for (int j = 0; j < inventories.size(); j++) { 113 | if (inventories.get(j) instanceof AppEngInternalInventoryBridge aeInv) { 114 | for (ItemStack item : ingredients.get(i) 115 | .getItemStacks()) { 116 | IAEItemStack requestItem = AEItemStack.create(item); 117 | if (requestItem == null) continue; 118 | IAEItemStack usedItem = usedStacks.findPrecise(requestItem); 119 | if (usedItem != null) { 120 | requestItem.add(usedItem); 121 | } 122 | Collection results = aeInv.getWirelessObject() 123 | .getStorageList() 124 | .findFuzzy(requestItem, FuzzyMode.IGNORE_ALL); 125 | for (IAEItemStack result : results) { 126 | IAEItemStack extracted = aeInv.getWirelessObject() 127 | .getItemStorage() 128 | .extractItems( 129 | result, 130 | Actionable.MODULATE, 131 | aeInv.getWirelessObject() 132 | .getSource()); 133 | if (extracted == null) continue; 134 | extracted = extracted.copy(); 135 | extracted.setCraftable(false); 136 | aeInv.getWirelessObject() 137 | .getItemStorage() 138 | .injectItems( 139 | extracted, 140 | Actionable.MODULATE, 141 | aeInv.getWirelessObject() 142 | .getSource()); 143 | if (ingredients.get(i) 144 | .isValidItem(extracted.getItemStack())) { 145 | extracted.setStackSize(1); 146 | usedStacks.add(extracted); 147 | if (checkHasEnoughItem( 148 | usedStacks, 149 | aeInv.getWirelessObject() 150 | .getStorageList())) { 151 | sourceInventories[targetIdx] = j; 152 | setInventorySlotContents(targetIdx, extracted.getItemStack()); 153 | continue ingredientLoop; 154 | } 155 | } 156 | 157 | } 158 | } 159 | } else { 160 | for (int k = 0; k < inventories.get(j) 161 | .getSizeInventory(); k++) { 162 | ItemStack itemStack = inventories.get(j) 163 | .getStackInSlot(k); 164 | if (itemStack != null && ingredients.get(i) 165 | .isValidItem(itemStack) && itemStack.stackSize - usedStackSize[j][k] > 0) { 166 | usedStackSize[j][k]++; 167 | setInventorySlotContents(targetIdx, itemStack); 168 | sourceInventories[targetIdx] = j; 169 | sourceInventorySlots[targetIdx] = k; 170 | continue ingredientLoop; 171 | } 172 | } 173 | } 174 | 175 | } 176 | } 177 | } 178 | currentRecipe = CookingRegistry.findMatchingFoodRecipe((InventoryCraftBook) (Object) this, player.worldObj); 179 | cir.setReturnValue(currentRecipe); 180 | } 181 | 182 | private static boolean checkHasEnoughItem(IItemList list, IItemList storedItems) { 183 | for (IAEItemStack item : list) { 184 | IAEItemStack stored = storedItems.findPrecise(item); 185 | if (stored == null || stored.getStackSize() < item.getStackSize()) return false; 186 | } 187 | return true; 188 | } 189 | 190 | @Inject(method = "craft", at = @At("HEAD"), remap = false, cancellable = true) 191 | public void craft(EntityPlayer player, FoodRecipe recipe, CallbackInfoReturnable cir) { 192 | prepareRecipe(player, recipe); 193 | if (currentRecipe == null) { 194 | // Recipe was not found. This is probably caused by missing tool. 195 | // In case the tool has just been depleted after initial recipe selection, update tooltip. 196 | containerRecipeBook.markSelectionDirty(); 197 | cir.setReturnValue(null); 198 | return; 199 | } 200 | if (currentRecipe.matches(this, player.worldObj)) { 201 | ItemStack craftingResult = currentRecipe.getCraftingResult(this); 202 | if (craftingResult != null) { 203 | // Fire FML Events 204 | FMLCommonHandler.instance() 205 | .firePlayerCraftingEvent(player, craftingResult, this); 206 | craftingResult.onCrafting(player.worldObj, player, 1); 207 | // Handle Vanilla Achievements 208 | if (craftingResult.getItem() == Items.bread) { 209 | player.addStat(AchievementList.makeBread, 1); 210 | } else if (craftingResult.getItem() == Items.cake) { 211 | player.addStat(AchievementList.bakeCake, 1); 212 | } 213 | // Kill ingredients 214 | for (int i = 0; i < getSizeInventory(); i++) { 215 | ItemStack itemStack = getStackInSlot(i); 216 | if (itemStack != null) { 217 | if (!extractItemStackFromAE(itemStack)) decrStackSize(i, 1); 218 | if (itemStack.getItem() 219 | .hasContainerItem(itemStack) && sourceInventories[i] != -1) { 220 | // Fire PlayerDestroyItem event 221 | ItemStack containerItem = itemStack.getItem() 222 | .getContainerItem(itemStack); 223 | if (containerItem != null && containerItem.isItemStackDamageable() 224 | && itemStack.getItemDamage() > itemStack.getMaxDamage()) { 225 | MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, containerItem)); 226 | continue; 227 | } 228 | // Put container item back into crafting grid or drop it 229 | if (!itemStack.getItem() 230 | .doesContainerItemLeaveCraftingGrid(itemStack) 231 | || !player.inventory.addItemStackToInventory(containerItem)) { 232 | if (getStackInSlot(i) == null) { 233 | setInventorySlotContents(i, containerItem); 234 | } else if (!tryInjectContainerItemToAE(containerItem)) { 235 | player.dropPlayerItemWithRandomChoice(containerItem, false); 236 | } 237 | } 238 | } 239 | 240 | if (sourceInventories[i] != -1 && sourceInventorySlots[i] != -1) { 241 | inventories.get(sourceInventories[i]) 242 | .setInventorySlotContents(sourceInventorySlots[i], this.getStackInSlot(i)); 243 | } 244 | } 245 | } 246 | for (IKitchenItemProvider itemProvider : sourceProviders) { 247 | itemProvider.craftingComplete(); 248 | } 249 | } 250 | cir.setReturnValue(craftingResult); 251 | return; 252 | } 253 | cir.setReturnValue(null); 254 | } 255 | 256 | private boolean tryInjectContainerItemToAE(ItemStack what) { 257 | for (IInventory inv : inventories) { 258 | if (inv instanceof AppEngInternalInventoryBridge aeInv) { 259 | IAEItemStack injected = aeInv.getWirelessObject() 260 | .injectItems( 261 | AEItemStack.create(what), 262 | Actionable.MODULATE, 263 | aeInv.getWirelessObject() 264 | .getSource()); 265 | if (injected == null) return true; 266 | } 267 | } 268 | return false; 269 | } 270 | 271 | private boolean extractItemStackFromAE(ItemStack what) { 272 | for (IInventory inv : inventories) { 273 | if (inv instanceof AppEngInternalInventoryBridge aeInv) { 274 | ItemStack extractItem = what.copy(); 275 | extractItem.stackSize = 1; 276 | IAEItemStack extracted = aeInv.getWirelessObject() 277 | .extractItems( 278 | AEItemStack.create(extractItem), 279 | Actionable.MODULATE, 280 | aeInv.getWirelessObject() 281 | .getSource()); 282 | if (extracted != null) return true; 283 | } 284 | } 285 | return false; 286 | } 287 | 288 | } 289 | -------------------------------------------------------------------------------- /gtnhShared/spotless.eclipseformat.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | --------------------------------------------------------------------------------