├── LICENSE - ART.txt ├── LICENSE - CODE.txt ├── .gitmodules ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── java │ └── cofh │ │ ├── asm │ │ ├── relauncher │ │ │ ├── CoFHSide.java │ │ │ ├── Implementable.java │ │ │ ├── Strippable.java │ │ │ └── Substitutable.java │ │ ├── repack │ │ │ ├── codechicken │ │ │ │ └── lib │ │ │ │ │ └── asm │ │ │ │ │ ├── CC_ClassWriter.java │ │ │ │ │ ├── ImportantInsnVisitor.java │ │ │ │ │ └── LocalVariablesSorterVisitor.java │ │ │ └── immibis │ │ │ │ └── bon │ │ │ │ ├── mcp │ │ │ │ ├── CsvFile.java │ │ │ │ └── SrgFile.java │ │ │ │ └── JoinMapping.java │ │ └── hooks │ │ │ └── ASMHooks.java │ │ ├── core │ │ ├── network │ │ │ ├── ITilePacketHandler.java │ │ │ ├── ITileInfoPacketHandler.java │ │ │ ├── PacketBase.java │ │ │ ├── PacketIndexedChat.java │ │ │ ├── PacketCore.java │ │ │ ├── PacketTileInfo.java │ │ │ ├── PacketTile.java │ │ │ └── PacketSocial.java │ │ ├── util │ │ │ ├── core │ │ │ │ ├── IBakeable.java │ │ │ │ ├── IConfigCallback.java │ │ │ │ └── IInitializer.java │ │ │ ├── tileentity │ │ │ │ ├── IRedstoneCache.java │ │ │ │ ├── IInventoryRetainer.java │ │ │ │ ├── IUpgradeable.java │ │ │ │ ├── ITransferControl.java │ │ │ │ ├── IReconfigurableSides.java │ │ │ │ └── IRedstoneControl.java │ │ │ ├── item │ │ │ │ ├── ISpecialFilterItem.java │ │ │ │ └── ISpecialFilterFluid.java │ │ │ ├── crafting │ │ │ │ ├── RecipeUpgrade.java │ │ │ │ └── RecipeSecure.java │ │ │ ├── StateMapper.java │ │ │ ├── FMLEventHandler.java │ │ │ ├── oredict │ │ │ │ └── OreDictionaryArbiterProxy.java │ │ │ ├── helpers │ │ │ │ ├── AugmentHelper.java │ │ │ │ └── RedstoneControlHelper.java │ │ │ └── RegistrySocial.java │ │ ├── render │ │ │ ├── hitbox │ │ │ │ ├── ICustomHitBox.java │ │ │ │ └── CustomHitBox.java │ │ │ ├── font │ │ │ │ ├── ICustomCharRenderer.java │ │ │ │ ├── RenderSprite.java │ │ │ │ └── RenderIcon.java │ │ │ ├── IModelRegister.java │ │ │ ├── CustomEffectRenderer.java │ │ │ ├── ISidedTexture.java │ │ │ └── IBlockAppearance.java │ │ ├── key │ │ │ ├── IKeyBinding.java │ │ │ ├── KeyBindingPlayerAugments.java │ │ │ ├── PacketKey.java │ │ │ ├── KeyBindingItemMultiMode.java │ │ │ └── KeyHandlerCore.java │ │ ├── item │ │ │ ├── IFOVUpdateItem.java │ │ │ ├── IEnchantableItem.java │ │ │ ├── IAOEBreakItem.java │ │ │ ├── tool │ │ │ │ ├── ItemPickaxeCore.java │ │ │ │ ├── ItemAxeCore.java │ │ │ │ ├── ItemHoeCore.java │ │ │ │ ├── ItemSwordCore.java │ │ │ │ ├── ItemShearsCore.java │ │ │ │ ├── ItemSickleCore.java │ │ │ │ └── ItemShovelCore.java │ │ │ ├── ItemCore.java │ │ │ └── ItemArmorCore.java │ │ ├── fluid │ │ │ ├── FluidCore.java │ │ │ └── BlockFluidInteractive.java │ │ ├── command │ │ │ ├── ISubCommand.java │ │ │ ├── CommandVersion.java │ │ │ ├── CommandReloadWorldgen.java │ │ │ └── CommandUnloadChunk.java │ │ ├── block │ │ │ ├── BlockCore.java │ │ │ ├── IFogOverlay.java │ │ │ └── ItemBlockCore.java │ │ ├── plugins │ │ │ └── jei │ │ │ │ ├── JEIPluginCore.java │ │ │ │ └── SlotMover.java │ │ ├── gui │ │ │ ├── client │ │ │ │ └── GuiAugments.java │ │ │ ├── container │ │ │ │ ├── ContainerFriendsList.java │ │ │ │ └── ContainerAugments.java │ │ │ ├── GuiConfigCoreFactory.java │ │ │ ├── element │ │ │ │ ├── TabInfo.java │ │ │ │ ├── TabTutorial.java │ │ │ │ └── TabEnergy.java │ │ │ ├── GuiLimitedTextField.java │ │ │ ├── slot │ │ │ │ ├── SlotAugment.java │ │ │ │ └── SlotPlayerAugment.java │ │ │ ├── GuiTextEntry.java │ │ │ ├── GuiHandler.java │ │ │ └── GuiConfigCore.java │ │ ├── world │ │ │ ├── feature │ │ │ │ ├── CaveParser.java │ │ │ │ ├── GaussianParser.java │ │ │ │ ├── FractalParser.java │ │ │ │ ├── SurfaceParser.java │ │ │ │ ├── DecorationParser.java │ │ │ │ └── UnderfluidParser.java │ │ │ └── decoration │ │ │ │ ├── LargeVeinParser.java │ │ │ │ ├── ClusterParser.java │ │ │ │ ├── PlateParser.java │ │ │ │ ├── BoulderParser.java │ │ │ │ ├── GeodeParser.java │ │ │ │ ├── LakeParser.java │ │ │ │ ├── SpikeParser.java │ │ │ │ ├── StalagmiteParser.java │ │ │ │ └── SmallTreeParser.java │ │ ├── energy │ │ │ ├── EnergyStorageCore.java │ │ │ └── FurnaceFuelHandler.java │ │ ├── enchantment │ │ │ ├── EnchantmentVorpal.java │ │ │ ├── EnchantmentHolding.java │ │ │ └── EnchantmentMultishot.java │ │ ├── entity │ │ │ ├── EntitySelectorInRangeByType.java │ │ │ └── EntityLightningBoltFake.java │ │ └── init │ │ │ └── CoreEnchantments.java │ │ └── asmhooks │ │ └── world │ │ ├── WorldServerShim.java │ │ └── WorldProxy.java │ └── resources │ ├── assets │ └── cofh │ │ ├── textures │ │ ├── logo.png │ │ ├── gui │ │ │ ├── friend_list.png │ │ │ ├── elements │ │ │ │ ├── buttons.png │ │ │ │ ├── coolant.png │ │ │ │ ├── energy.png │ │ │ │ ├── fluid_tank.png │ │ │ │ ├── info_angle.png │ │ │ │ ├── info_force.png │ │ │ │ ├── info_input.png │ │ │ │ ├── scale_flux.png │ │ │ │ ├── scale_saw.png │ │ │ │ ├── scale_sun.png │ │ │ │ ├── tab_left.png │ │ │ │ ├── tab_right.png │ │ │ │ ├── button_hover.png │ │ │ │ ├── info_output.png │ │ │ │ ├── info_signal.png │ │ │ │ ├── scale_bubble.png │ │ │ │ ├── scale_crush.png │ │ │ │ ├── scale_flame.png │ │ │ │ ├── button_disabled.png │ │ │ │ ├── button_enabled.png │ │ │ │ ├── fluid_tank_thin.png │ │ │ │ ├── info_distance.png │ │ │ │ ├── info_duration.png │ │ │ │ ├── scale_alchemy.png │ │ │ │ ├── scale_compact.png │ │ │ │ ├── scale_snowflake.png │ │ │ │ ├── fluid_tank_short.png │ │ │ │ ├── scale_flame_green.png │ │ │ │ ├── slot_grid_augment.png │ │ │ │ ├── progress_arrow_left.png │ │ │ │ ├── progress_arrow_right.png │ │ │ │ ├── progress_fluid_left.png │ │ │ │ ├── progress_fluid_right.png │ │ │ │ ├── progress_arrow_fluid_left.png │ │ │ │ └── progress_arrow_fluid_right.png │ │ │ └── storage │ │ │ │ ├── storage_1.png │ │ │ │ ├── storage_10.png │ │ │ │ ├── storage_108.png │ │ │ │ ├── storage_117.png │ │ │ │ ├── storage_126.png │ │ │ │ ├── storage_18.png │ │ │ │ ├── storage_27.png │ │ │ │ ├── storage_36.png │ │ │ │ ├── storage_45.png │ │ │ │ ├── storage_5.png │ │ │ │ ├── storage_54.png │ │ │ │ ├── storage_6.png │ │ │ │ ├── storage_63.png │ │ │ │ ├── storage_7.png │ │ │ │ ├── storage_72.png │ │ │ │ ├── storage_8.png │ │ │ │ ├── storage_81.png │ │ │ │ ├── storage_9.png │ │ │ │ ├── storage_90.png │ │ │ │ └── storage_99.png │ │ ├── items │ │ │ └── icons │ │ │ │ ├── icon_accept.png │ │ │ │ ├── icon_button.png │ │ │ │ ├── icon_cancel.png │ │ │ │ ├── icon_config.png │ │ │ │ ├── icon_energy.png │ │ │ │ ├── icon_input.png │ │ │ │ ├── icon_nope.png │ │ │ │ ├── icon_output.png │ │ │ │ ├── icon_arrow_up.png │ │ │ │ ├── icon_augment.png │ │ │ │ ├── icon_tutorial.png │ │ │ │ ├── icon_access_team.png │ │ │ │ ├── icon_arrow_down.png │ │ │ │ ├── icon_information.png │ │ │ │ ├── icon_redstone_on.png │ │ │ │ ├── icon_rs_torch_on.png │ │ │ │ ├── icon_access_public.png │ │ │ │ ├── icon_redstone_off.png │ │ │ │ ├── icon_rs_torch_off.png │ │ │ │ ├── icon_accept_inactive.png │ │ │ │ ├── icon_access_friends.png │ │ │ │ ├── icon_access_private.png │ │ │ │ ├── icon_button_highlight.png │ │ │ │ ├── icon_button_inactive.png │ │ │ │ ├── icon_cancel_inactive.png │ │ │ │ ├── icon_arrow_up_inactive.png │ │ │ │ └── icon_arrow_down_inactive.png │ │ └── misc │ │ │ └── underwater_grayscale.png │ │ ├── lang │ │ ├── fr_FR.lang │ │ ├── es_ES.lang │ │ ├── cs_CZ.lang │ │ ├── zh_TW.lang │ │ ├── pl_PL.lang │ │ ├── hu_HU.lang │ │ ├── ko_KR.lang │ │ ├── ja_JP.lang │ │ └── fr_CA.lang │ │ └── asm │ │ └── hooks.asm │ └── mcmod.info ├── gradlew.bat └── README.md /LICENSE - ART.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/LICENSE - ART.txt -------------------------------------------------------------------------------- /LICENSE - CODE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/LICENSE - CODE.txt -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "CoFHLib"] 2 | path = CoFHLib 3 | url = https://github.com/TheCBProject/CoFHLib 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/java/cofh/asm/relauncher/CoFHSide.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.relauncher; 2 | 3 | public enum CoFHSide { 4 | NONE, CLIENT, SERVER 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/logo.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/friend_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/friend_list.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/buttons.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/coolant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/coolant.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/energy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/energy.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/fluid_tank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/fluid_tank.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_angle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_angle.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_force.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_force.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_input.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_flux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_flux.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_saw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_saw.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_sun.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/tab_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/tab_left.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/tab_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/tab_right.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_10.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_108.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_108.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_117.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_117.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_126.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_126.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_18.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_27.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_36.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_45.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_5.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_54.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_6.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_63.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_63.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_7.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_72.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_8.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_81.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_9.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_90.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/storage/storage_99.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/storage/storage_99.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_accept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_accept.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_button.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_cancel.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_config.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_energy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_energy.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_input.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_nope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_nope.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_output.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/button_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/button_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_output.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_signal.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_bubble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_bubble.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_crush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_crush.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_flame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_flame.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_arrow_up.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_augment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_augment.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_tutorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_tutorial.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/misc/underwater_grayscale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/misc/underwater_grayscale.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/button_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/button_disabled.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/button_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/button_enabled.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/fluid_tank_thin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/fluid_tank_thin.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_distance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_distance.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/info_duration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/info_duration.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_alchemy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_alchemy.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_compact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_compact.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_snowflake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_snowflake.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_access_team.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_access_team.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_arrow_down.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_information.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_redstone_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_redstone_on.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_rs_torch_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_rs_torch_on.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/fluid_tank_short.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/fluid_tank_short.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/scale_flame_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/scale_flame_green.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/slot_grid_augment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/slot_grid_augment.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_access_public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_access_public.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_redstone_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_redstone_off.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_rs_torch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_rs_torch_off.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_left.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_right.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/progress_fluid_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/progress_fluid_left.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/progress_fluid_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/progress_fluid_right.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_accept_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_accept_inactive.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_access_friends.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_access_friends.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_access_private.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_access_private.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_button_highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_button_highlight.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_button_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_button_inactive.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_cancel_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_cancel_inactive.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_arrow_up_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_arrow_up_inactive.png -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/ITilePacketHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | public interface ITilePacketHandler { 4 | 5 | void handleTilePacket(PacketCoFHBase payload, boolean isServer); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_fluid_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_fluid_left.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/items/icons/icon_arrow_down_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/items/icons/icon_arrow_down_inactive.png -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_fluid_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/CoFHCore/master/src/main/resources/assets/cofh/textures/gui/elements/progress_arrow_fluid_right.png -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/core/IBakeable.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.core; 2 | 3 | /** 4 | * Interface which can be put on just about anything to allow for a "baking" action. 5 | */ 6 | public interface IBakeable { 7 | 8 | void bake(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 14 12:28:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip 7 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/ITileInfoPacketHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | 5 | public interface ITileInfoPacketHandler { 6 | 7 | void handleTileInfoPacket(PacketCoFHBase payload, boolean isServer, EntityPlayer thePlayer); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/core/IConfigCallback.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.core; 2 | 3 | /** 4 | * Interface which can be put on just about anything to allow for callbacks when config options are changed, if set up properly. 5 | */ 6 | public interface IConfigCallback { 7 | 8 | void configUpdate(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/hitbox/ICustomHitBox.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render.hitbox; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | 5 | public interface ICustomHitBox { 6 | 7 | boolean shouldRenderCustomHitBox(int subHit, EntityPlayer player); 8 | 9 | CustomHitBox getCustomHitBox(int subHit, EntityPlayer player); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/key/IKeyBinding.java: -------------------------------------------------------------------------------- 1 | package cofh.core.key; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | 5 | public interface IKeyBinding { 6 | 7 | String getUUID(); 8 | 9 | int getKey(); 10 | 11 | boolean hasServerSide(); 12 | 13 | boolean keyPressClient(); 14 | 15 | boolean keyPressServer(EntityPlayer player); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/core/IInitializer.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.core; 2 | 3 | /** 4 | * Interface which can be put on just about anything to allow for iteration during initialization. 5 | * 6 | * @author King Lemming 7 | */ 8 | public interface IInitializer { 9 | 10 | boolean preInit(); 11 | 12 | boolean initialize(); 13 | 14 | boolean postInit(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/IFOVUpdateItem.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.item.ItemStack; 5 | 6 | /** 7 | * Implemented on Items which update/alter FOV under certain conditions. 8 | */ 9 | public interface IFOVUpdateItem { 10 | 11 | float getFOVMod(ItemStack stack, EntityPlayer player); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/font/ICustomCharRenderer.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render.font; 2 | 3 | import cofh.core.render.FontRendererCore; 4 | 5 | public interface ICustomCharRenderer { 6 | 7 | float renderChar(char letter, boolean italicFlag, float x, float y, FontRendererCore fontRenderer); 8 | 9 | int getCharWidth(char letter, FontRendererCore fontRenderer); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/IEnchantableItem.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item; 2 | 3 | import net.minecraft.enchantment.Enchantment; 4 | import net.minecraft.item.ItemStack; 5 | 6 | public interface IEnchantableItem { 7 | 8 | /** 9 | * Simple boolean to determine if an enchantment applies to an ItemStack. 10 | */ 11 | boolean canEnchant(ItemStack stack, Enchantment enchantment); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/IAOEBreakItem.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.util.math.BlockPos; 7 | 8 | public interface IAOEBreakItem { 9 | 10 | ImmutableList getAOEBlocks(ItemStack stack, BlockPos pos, EntityPlayer player); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/tileentity/IRedstoneCache.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.tileentity; 2 | 3 | /** 4 | * Implement this interface on Tile Entities which cache their redstone status. 5 | * 6 | * Note that {@link IRedstoneControl} is an extension of this. 7 | * 8 | * @author King Lemming 9 | */ 10 | public interface IRedstoneCache { 11 | 12 | void setPowered(boolean isPowered); 13 | 14 | boolean isPowered(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/tileentity/IInventoryRetainer.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.tileentity; 2 | 3 | /** 4 | * Marks a Tile Entity which can optionally retain its inventory when broken. 5 | * 6 | * @author King Lemming 7 | */ 8 | public interface IInventoryRetainer { 9 | 10 | /** 11 | * Simple boolean check to see if the Tile is going to keep its inventory at the time of query. 12 | */ 13 | boolean retainInventory(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/IModelRegister.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | 6 | /** 7 | * Interface which can be attached to classes which have to register models. Useful for iteration. 8 | * 9 | * @author King Lemming 10 | */ 11 | public interface IModelRegister { 12 | 13 | @SideOnly (Side.CLIENT) 14 | void registerModels(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/fluid/FluidCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.fluid; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import net.minecraftforge.fluids.Fluid; 5 | 6 | public class FluidCore extends Fluid { 7 | 8 | public FluidCore(String fluidName, String modName) { 9 | 10 | super(fluidName, new ResourceLocation(modName, "blocks/fluid/" + fluidName + "_still"), new ResourceLocation(modName, "blocks/fluid/" + fluidName + "_flow")); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "cofhcore", 4 | "name": "CoFH Core", 5 | "description": "Required for all CoFH Mods. Also provides some customization options for Minecraft.", 6 | "version": "${version}", 7 | "credits": "Team CoFH", 8 | "logoFile": "assets/cofh/textures/logo.png", 9 | "mcversion": "${mc_version}", 10 | "url": "http://www.teamcofh.com", 11 | "updateUrl": "", 12 | "authorList": [ "Team CoFH" ], 13 | "parent": "", 14 | "screenshots": [], 15 | "dependencies": [ 16 | "Forge" 17 | ] 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/relauncher/Implementable.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.relauncher; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Adds an interface to the class when the interface is present at runtime for soft dependencies. 7 | */ 8 | @Documented 9 | @Retention (RetentionPolicy.RUNTIME) 10 | @Target ({ ElementType.TYPE }) 11 | public @interface Implementable { 12 | 13 | String[] value(); 14 | 15 | /** 16 | * The *only* side on which these interfaces will be implemented if present (NONE == BOTH) 17 | */ 18 | CoFHSide side() default CoFHSide.NONE; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/PacketBase.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.channel.ChannelHandlerContext; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | 7 | public abstract class PacketBase { 8 | 9 | public abstract void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer); 10 | 11 | public abstract void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer); 12 | 13 | public abstract void handleClientSide(EntityPlayer player); 14 | 15 | public abstract void handleServerSide(EntityPlayer player); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/command/ISubCommand.java: -------------------------------------------------------------------------------- 1 | package cofh.core.command; 2 | 3 | import net.minecraft.command.CommandException; 4 | import net.minecraft.command.ICommandSender; 5 | import net.minecraft.server.MinecraftServer; 6 | 7 | import java.util.List; 8 | 9 | public interface ISubCommand { 10 | 11 | String getCommandName(); 12 | 13 | int getPermissionLevel(); 14 | 15 | void handleCommand(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException; 16 | 17 | List addTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/CustomEffectRenderer.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.particle.Particle; 5 | import net.minecraft.client.particle.ParticleManager; 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | @SideOnly (Side.CLIENT) 10 | public class CustomEffectRenderer extends ParticleManager { 11 | 12 | public CustomEffectRenderer() { 13 | 14 | super(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().renderEngine); 15 | } 16 | 17 | @Override 18 | public void addEffect(Particle p) { 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/block/BlockCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.block; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.material.Material; 5 | 6 | public class BlockCore extends Block { 7 | 8 | protected String modName; 9 | protected String name; 10 | 11 | public BlockCore(Material material) { 12 | 13 | this(material, "cofh"); 14 | } 15 | 16 | public BlockCore(Material material, String modName) { 17 | 18 | super(material); 19 | this.modName = modName; 20 | } 21 | 22 | @Override 23 | public Block setUnlocalizedName(String name) { 24 | 25 | this.name = name; 26 | name = modName + "." + name; 27 | return super.setUnlocalizedName(name); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/plugins/jei/JEIPluginCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.plugins.jei; 2 | 3 | import mezz.jei.api.*; 4 | import mezz.jei.api.ingredients.IModIngredientRegistration; 5 | 6 | @JEIPlugin 7 | public class JEIPluginCore implements IModPlugin { 8 | 9 | @Override 10 | public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) { 11 | 12 | } 13 | 14 | @Override 15 | public void registerIngredients(IModIngredientRegistration registry) { 16 | 17 | } 18 | 19 | @Override 20 | public void register(IModRegistry registry) { 21 | 22 | registry.addAdvancedGuiHandlers(new SlotMover()); 23 | } 24 | 25 | @Override 26 | public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemPickaxeCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import net.minecraft.block.material.Material; 4 | import net.minecraft.item.ItemPickaxe; 5 | 6 | public class ItemPickaxeCore extends ItemToolCore { 7 | 8 | public ItemPickaxeCore(ToolMaterial toolMaterial) { 9 | 10 | super(2.0F, -2.8F, toolMaterial); 11 | addToolClass("pickaxe"); 12 | 13 | effectiveBlocks.addAll(ItemPickaxe.EFFECTIVE_ON); 14 | 15 | effectiveMaterials.add(Material.IRON); 16 | effectiveMaterials.add(Material.ANVIL); 17 | effectiveMaterials.add(Material.ROCK); 18 | effectiveMaterials.add(Material.ICE); 19 | effectiveMaterials.add(Material.PACKED_ICE); 20 | effectiveMaterials.add(Material.GLASS); 21 | effectiveMaterials.add(Material.REDSTONE_LIGHT); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/client/GuiAugments.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.client; 2 | 3 | import cofh.core.gui.GuiCore; 4 | import cofh.core.gui.container.ContainerAugments; 5 | import cofh.lib.gui.GuiProps; 6 | import net.minecraft.entity.player.InventoryPlayer; 7 | import net.minecraft.util.ResourceLocation; 8 | 9 | public class GuiAugments extends GuiCore { 10 | 11 | public static final ResourceLocation TEXTURE = new ResourceLocation(GuiProps.PATH_GUI + "augments.png"); 12 | 13 | public GuiAugments(InventoryPlayer inventory) { 14 | 15 | super(new ContainerAugments(inventory), TEXTURE); 16 | 17 | // generateInfo("tab.thermalexpansion.device.lexicon", 3); 18 | 19 | ySize = 197; 20 | } 21 | 22 | @Override 23 | public void initGui() { 24 | 25 | super.initGui(); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/container/ContainerFriendsList.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.container; 2 | 3 | import cofh.lib.gui.container.ContainerBase; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.entity.player.InventoryPlayer; 6 | 7 | public class ContainerFriendsList extends ContainerBase { 8 | 9 | public ContainerFriendsList(InventoryPlayer inventory) { 10 | 11 | } 12 | 13 | @Override 14 | public boolean canInteractWith(EntityPlayer player) { 15 | 16 | return true; 17 | } 18 | 19 | @Override 20 | public boolean supportsShiftClick(int slotIndex) { 21 | 22 | return false; 23 | } 24 | 25 | @Override 26 | protected int getPlayerInventoryVerticalOffset() { 27 | 28 | return 0; 29 | } 30 | 31 | @Override 32 | protected int getSizeInventory() { 33 | 34 | return 0; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/ISidedTexture.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render; 2 | 3 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 4 | 5 | /** 6 | * Implement this interface on Tile Entities which can change their block's texture based on the current render pass. The block must defer the call to its Tile Entity. 7 | * 8 | * This is only used in Configuration Tabs and blocks which do not require advanced rendering. :) 9 | * 10 | * @author King Lemming 11 | */ 12 | public interface ISidedTexture { 13 | 14 | int getNumPasses(); 15 | 16 | /** 17 | * Returns the icon to use for a given side and render pass. 18 | * 19 | * @param side Block side to get the texture for. 20 | * @param pass Render pass. 21 | * @return The icon to use. 22 | */ 23 | TextureAtlasSprite getTexture(int side, int pass); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemAxeCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import net.minecraft.block.material.Material; 4 | import net.minecraft.item.ItemAxe; 5 | 6 | public class ItemAxeCore extends ItemToolCore { 7 | 8 | public ItemAxeCore(ToolMaterial toolMaterial) { 9 | 10 | this(-3.2F, toolMaterial); 11 | } 12 | 13 | public ItemAxeCore(float attackSpeed, ToolMaterial toolMaterial) { 14 | 15 | super(3.0F, attackSpeed, toolMaterial); 16 | addToolClass("axe"); 17 | 18 | effectiveBlocks.addAll(ItemAxe.EFFECTIVE_ON); 19 | 20 | effectiveMaterials.add(Material.WOOD); 21 | effectiveMaterials.add(Material.PLANTS); 22 | effectiveMaterials.add(Material.VINE); 23 | effectiveMaterials.add(Material.CACTUS); 24 | effectiveMaterials.add(Material.GOURD); 25 | 26 | damageVsEntity = damageVsEntity + 1; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/GuiConfigCoreFactory.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.gui.GuiScreen; 5 | import net.minecraftforge.fml.client.IModGuiFactory; 6 | 7 | import java.util.Set; 8 | 9 | public class GuiConfigCoreFactory implements IModGuiFactory { 10 | 11 | /* IModGuiFactory */ 12 | @Override 13 | public void initialize(Minecraft minecraftInstance) { 14 | 15 | } 16 | 17 | @Override 18 | public Class mainConfigGuiClass() { 19 | 20 | return GuiConfigCore.class; 21 | } 22 | 23 | @Override 24 | public Set runtimeGuiCategories() { 25 | 26 | return null; 27 | } 28 | 29 | @Override 30 | public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { 31 | 32 | return null; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/item/ISpecialFilterItem.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.item; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | /** 6 | * Implement this interface on subclasses of Item to change how the item works in Thermal Dynamics Itemducts filter slots. 7 | * 8 | * This can be used to create customizable Items which are determined to be "equal" for the purposes of filtering. 9 | */ 10 | public interface ISpecialFilterItem { 11 | 12 | /** 13 | * This method is called to find out if the given ItemStack should be matched by the given Filter ItemStack. 14 | * 15 | * @param filter ItemStack representing the filter. 16 | * @param item ItemStack representing the queried item. 17 | * @return True if the filter should match. False if the default matching should be used. 18 | */ 19 | boolean matchesItem(ItemStack filter, ItemStack item); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/feature/CaveParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.feature; 2 | 3 | import cofh.lib.util.numbers.INumberProvider; 4 | import cofh.lib.world.feature.FeatureBase; 5 | import cofh.lib.world.feature.FeatureBase.GenRestriction; 6 | import cofh.lib.world.feature.FeatureGenCave; 7 | import com.typesafe.config.Config; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | import org.apache.logging.log4j.Logger; 10 | 11 | public class CaveParser extends UniformParser { 12 | 13 | @Override 14 | protected FeatureBase getFeature(String featureName, Config genObject, WorldGenerator gen, INumberProvider numClusters, GenRestriction biomeRes, boolean retrogen, GenRestriction dimRes, Logger log) { 15 | 16 | boolean ceiling = genObject.hasPath("ceiling") && genObject.getBoolean("ceiling"); 17 | return new FeatureGenCave(featureName, gen, ceiling, numClusters, biomeRes, retrogen, dimRes); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/item/ISpecialFilterFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.item; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import net.minecraftforge.fluids.FluidStack; 5 | 6 | /** 7 | * Implement this interface on subclasses of Item to change how the item works in Thermal Dynamics Fluiducts filter slots. 8 | * 9 | * This can be used to create customizable Items which are determined to be "equal" for the purposes of filtering. 10 | */ 11 | public interface ISpecialFilterFluid { 12 | 13 | /** 14 | * This method is called to find out if the given FluidStack should be matched by the given Filter ItemStack. 15 | * 16 | * @param filter ItemStack representing the filter. 17 | * @param fluid FluidStack representing the queried fluid. 18 | * @return True if the filter should match the FluidStack. False if the default matching should be used. 19 | */ 20 | boolean matchesFluid(ItemStack filter, FluidStack fluid); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/cofh/asmhooks/world/WorldServerShim.java: -------------------------------------------------------------------------------- 1 | package cofh.asmhooks.world; 2 | 3 | import net.minecraft.profiler.Profiler; 4 | import net.minecraft.server.MinecraftServer; 5 | import net.minecraft.world.WorldProvider; 6 | import net.minecraft.world.WorldServer; 7 | import net.minecraft.world.storage.ISaveHandler; 8 | import net.minecraft.world.storage.WorldInfo; 9 | 10 | /** 11 | * Do not extend this class directly, extend WorldServerProxy instead.
12 | * This class is never used at runtime, and is simply a compile-time shim. 13 | */ 14 | public abstract class WorldServerShim extends WorldServer { 15 | 16 | public WorldServerShim(MinecraftServer server, ISaveHandler saveHandler, WorldInfo info, WorldProvider provider, Profiler profiler, boolean isRemote) { 17 | 18 | super(server, saveHandler, info, provider.getDimension(), profiler); 19 | throw new IllegalAccessError("WorldServerShim cannot be extended. Extend WorldServerProxy instead."); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/repack/codechicken/lib/asm/CC_ClassWriter.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.repack.codechicken.lib.asm; 2 | 3 | import org.objectweb.asm.ClassWriter; 4 | 5 | public class CC_ClassWriter extends ClassWriter { 6 | 7 | private final boolean runtime; 8 | 9 | public CC_ClassWriter(int flags) { 10 | 11 | this(flags, false); 12 | } 13 | 14 | public CC_ClassWriter(int flags, boolean runtime) { 15 | 16 | super(flags); 17 | this.runtime = runtime; 18 | } 19 | 20 | @Override 21 | protected String getCommonSuperClass(String type1, String type2) { 22 | 23 | String c = type1.replace('/', '.'); 24 | String d = type2.replace('/', '.'); 25 | if (ClassHierarchyManager.classExtends(d, c)) { 26 | return type1; 27 | } 28 | if (ClassHierarchyManager.classExtends(c, d)) { 29 | return type2; 30 | } 31 | do 32 | c = ClassHierarchyManager.getSuperClass(c, runtime); while (!ClassHierarchyManager.classExtends(d, c)); 33 | 34 | return c.replace('.', '/'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/container/ContainerAugments.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.container; 2 | 3 | import cofh.core.gui.slot.SlotPlayerAugment; 4 | import cofh.lib.gui.container.ContainerBase; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.entity.player.InventoryPlayer; 7 | 8 | public class ContainerAugments extends ContainerBase { 9 | 10 | EntityPlayer thePlayer; 11 | 12 | public ContainerAugments(InventoryPlayer inventory) { 13 | 14 | thePlayer = inventory.player; 15 | for (int i = 0; i < 5; i++) { 16 | addSlotToContainer(new SlotPlayerAugment(thePlayer, i, 40 + i * 18 + (i * 2), 26)); 17 | } 18 | bindPlayerInventory(inventory); 19 | } 20 | 21 | @Override 22 | protected int getPlayerInventoryVerticalOffset() { 23 | 24 | return 84; 25 | } 26 | 27 | @Override 28 | public boolean canInteractWith(EntityPlayer player) { 29 | 30 | return true; 31 | } 32 | 33 | @Override 34 | protected int getSizeInventory() { 35 | 36 | return 0; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/key/KeyBindingPlayerAugments.java: -------------------------------------------------------------------------------- 1 | package cofh.core.key; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.core.gui.GuiHandler; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | 7 | public class KeyBindingPlayerAugments implements IKeyBinding { 8 | 9 | public static KeyBindingPlayerAugments instance = new KeyBindingPlayerAugments(); 10 | 11 | @Override 12 | public String getUUID() { 13 | 14 | return "cofh.augments"; 15 | } 16 | 17 | @Override 18 | public int getKey() { 19 | 20 | return CoFHCore.proxy.getKeyBind(getUUID()); 21 | } 22 | 23 | @Override 24 | public boolean hasServerSide() { 25 | 26 | return true; 27 | } 28 | 29 | @Override 30 | public boolean keyPressClient() { 31 | 32 | return true; 33 | } 34 | 35 | @Override 36 | public boolean keyPressServer(EntityPlayer player) { 37 | 38 | player.openGui(CoFHCore.instance, GuiHandler.AUGMENTS_ID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); 39 | return true; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/tileentity/IUpgradeable.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.tileentity; 2 | 3 | import cofh.api.item.IUpgradeItem; 4 | import net.minecraft.item.ItemStack; 5 | 6 | /** 7 | * Implemented on objects which support Upgrades - items which incrementally increase the capabilities of an object, by increasing an internal "level." 8 | * 9 | * Effects of this are determined by the object itself and should be checked vs the Upgrade Type denoted in {@link IUpgradeItem}. 10 | * 11 | * @author King Lemming 12 | */ 13 | public interface IUpgradeable { 14 | 15 | /** 16 | * Returns if an object can be upgraded by a given upgrade item. 17 | */ 18 | boolean canUpgrade(ItemStack upgrade); 19 | 20 | /** 21 | * Attempt to install a specific upgrade in the (Tile) Entity. 22 | * 23 | * Returns TRUE if upgrade was installed properly. 24 | */ 25 | boolean installUpgrade(ItemStack upgrade); 26 | 27 | /** 28 | * Returns the level of an upgradeable object. 29 | */ 30 | int getLevel(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/crafting/RecipeUpgrade.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.crafting; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import net.minecraft.inventory.InventoryCrafting; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraftforge.oredict.ShapedOreRecipe; 7 | 8 | public class RecipeUpgrade extends ShapedOreRecipe { 9 | 10 | int targetSlot = 4; 11 | 12 | public RecipeUpgrade(ItemStack result, Object... recipe) { 13 | 14 | super(result, recipe); 15 | } 16 | 17 | public RecipeUpgrade(int slot, ItemStack result, Object... recipe) { 18 | 19 | super(result, recipe); 20 | targetSlot = slot; 21 | } 22 | 23 | @Override 24 | public ItemStack getCraftingResult(InventoryCrafting craftMatrix) { 25 | 26 | if (craftMatrix.getStackInSlot(targetSlot) == null || craftMatrix.getStackInSlot(targetSlot).getTagCompound() == null) { 27 | return super.getCraftingResult(craftMatrix); 28 | } 29 | return ItemHelper.copyTag(getRecipeOutput().copy(), craftMatrix.getStackInSlot(targetSlot)); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/StateMapper.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.client.renderer.ItemMeshDefinition; 5 | import net.minecraft.client.renderer.block.model.ModelResourceLocation; 6 | import net.minecraft.client.renderer.block.statemap.StateMapperBase; 7 | import net.minecraft.item.ItemStack; 8 | 9 | /** 10 | * Extremely simple StateMapper implementation. 11 | * 12 | * @author King Lemming 13 | */ 14 | public class StateMapper extends StateMapperBase implements ItemMeshDefinition { 15 | 16 | public final ModelResourceLocation location; 17 | 18 | public StateMapper(String modName, String fileName, String modelName) { 19 | 20 | this.location = new ModelResourceLocation(modName + ":" + fileName, modelName); 21 | } 22 | 23 | @Override 24 | protected ModelResourceLocation getModelResourceLocation(IBlockState state) { 25 | 26 | return location; 27 | } 28 | 29 | @Override 30 | public ModelResourceLocation getModelLocation(ItemStack stack) { 31 | 32 | return location; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/plugins/jei/SlotMover.java: -------------------------------------------------------------------------------- 1 | package cofh.core.plugins.jei; 2 | 3 | import cofh.lib.gui.GuiBase; 4 | import cofh.lib.gui.element.TabBase; 5 | import cofh.lib.util.Rectangle4i; 6 | import mezz.jei.api.gui.IAdvancedGuiHandler; 7 | 8 | import javax.annotation.Nullable; 9 | import java.awt.*; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class SlotMover implements IAdvancedGuiHandler { 14 | 15 | @Override 16 | public Class getGuiContainerClass() { 17 | 18 | return GuiBase.class; 19 | } 20 | 21 | @Override 22 | public List getGuiExtraAreas(GuiBase guiContainer) { 23 | 24 | List tabBoxes = new ArrayList<>(); 25 | 26 | for (TabBase tab : guiContainer.tabs) { 27 | Rectangle4i rect = tab.getBounds(); 28 | tabBoxes.add(new Rectangle(rect.x, rect.y, rect.w, rect.h)); 29 | } 30 | return tabBoxes; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public Object getIngredientUnderMouse(GuiBase guiContainer, int mouseX, int mouseY) { 36 | 37 | return null; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/IBlockAppearance.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.util.EnumFacing; 5 | import net.minecraft.util.math.BlockPos; 6 | import net.minecraft.world.IBlockAccess; 7 | 8 | /** 9 | * Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be available server-side, so ensure the code is 10 | * server-safe and doesn't use client-side code. 11 | */ 12 | public interface IBlockAppearance { 13 | 14 | /** 15 | * This function returns the state of the block that is being shown on a given side. 16 | * 17 | * @param world Reference to the world. 18 | * @param pos The Position of the block. 19 | * @param side The side of the block. 20 | */ 21 | IBlockState getVisualState(IBlockAccess world, BlockPos pos, EnumFacing side); 22 | 23 | /** 24 | * This function returns whether the block's renderer will visually connect to other blocks implementing IBlockAppearance. 25 | */ 26 | boolean supportsVisualConnections(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/LargeVeinParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.lib.util.WeightedRandomBlock; 4 | import cofh.lib.world.IGeneratorParser; 5 | import cofh.lib.world.WorldGenMinableLargeVein; 6 | import com.typesafe.config.Config; 7 | import net.minecraft.world.gen.feature.WorldGenerator; 8 | import org.apache.logging.log4j.Logger; 9 | 10 | import java.util.List; 11 | 12 | public class LargeVeinParser implements IGeneratorParser { 13 | 14 | @Override 15 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 16 | 17 | int clusterSize = genObject.getInt("cluster-size"); 18 | if (clusterSize <= 0) { 19 | log.warn("Invalid cluster size for generator '%s'", name); 20 | return null; 21 | } 22 | 23 | boolean sparse = true; 24 | { 25 | sparse = genObject.hasPath("sparse") ? genObject.getBoolean("sparse") : sparse; 26 | } 27 | return new WorldGenMinableLargeVein(resList, clusterSize, matList, sparse); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/block/IFogOverlay.java: -------------------------------------------------------------------------------- 1 | package cofh.core.block; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.entity.Entity; 5 | import net.minecraft.util.math.Vec3d; 6 | 7 | /** 8 | * Implement this on your block to change fog color when the player is submerged. 9 | * Useful for fluids. 10 | * 11 | * @author covers1624 12 | */ 13 | public interface IFogOverlay { 14 | 15 | /** 16 | * This is called AFTER vanilla handles fog color for its fluids in EntityRenderer. 17 | * 18 | * Vanilla handling is between: 19 | * Ln ~1758 -- 1781 20 | * 21 | * @param state The State at the Entities head. 22 | * @param renderViewEntity The entity at the ViewPort. 23 | * @param fogColorRed The current Red fog color. 24 | * @param fogColorGreen The current Green fog color. 25 | * @param fogColorBlue The current Blue fog color. 26 | * @return The modified or new fog color.(x=red, y=green, z=blue) 27 | */ 28 | Vec3d getFog(IBlockState state, Entity renderViewEntity, float fogColorRed, float fogColorGreen, float fogColorBlue); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/hooks/ASMHooks.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.hooks; 2 | 3 | import net.minecraft.world.World; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | public class ASMHooks { 9 | 10 | private static List preGenWorldListeners = new ArrayList<>(); 11 | private static List postGenWorldListeners = new ArrayList<>(); 12 | 13 | public static void registerPreGenHook(IModGenerateHook hook) { 14 | 15 | preGenWorldListeners.add(hook); 16 | } 17 | 18 | public static void registerPostGenHook(IModGenerateHook hook) { 19 | 20 | postGenWorldListeners.add(hook); 21 | } 22 | 23 | public static void preGenerateWorld(World world, int chunkX, int chunkZ) { 24 | 25 | for (IModGenerateHook pre : preGenWorldListeners) { 26 | pre.onGeneration(world, chunkX, chunkZ); 27 | } 28 | } 29 | 30 | public static void postGenerateWorld(World world, int chunkX, int chunkZ) { 31 | 32 | for (IModGenerateHook pre : postGenWorldListeners) { 33 | pre.onGeneration(world, chunkX, chunkZ); 34 | } 35 | } 36 | 37 | public interface IModGenerateHook { 38 | 39 | void onGeneration(World world, int chunkX, int chunkZ); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/key/PacketKey.java: -------------------------------------------------------------------------------- 1 | package cofh.core.key; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.core.network.PacketCoFHBase; 5 | import cofh.core.network.PacketHandler; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | 8 | public class PacketKey extends PacketCoFHBase { 9 | 10 | public static void initialize() { 11 | 12 | PacketHandler.instance.registerPacket(PacketKey.class); 13 | } 14 | 15 | public static void sendToServer(String uuid) { 16 | 17 | PacketHandler.sendToServer(new PacketKey(uuid)); 18 | } 19 | 20 | public PacketKey() { 21 | 22 | } 23 | 24 | protected PacketKey(String uuid) { 25 | 26 | addString(uuid); 27 | } 28 | 29 | @Override 30 | public void handlePacket(EntityPlayer player, boolean isServer) { 31 | 32 | String bindUUID = getString(); 33 | if (KeyHandlerCore.serverBinds.containsKey(bindUUID)) { 34 | KeyHandlerCore.serverBinds.get(bindUUID).keyPressServer(player); 35 | } else { 36 | CoFHCore.LOG.error("Invalid Key Packet! Unregistered Server Key! UUID: " + bindUUID); 37 | } 38 | } 39 | 40 | public void sendKeyPacket(String uuid) { 41 | 42 | addString(uuid); 43 | PacketHandler.sendToServer(this); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/crafting/RecipeSecure.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.crafting; 2 | 3 | import cofh.core.util.helpers.SecurityHelper; 4 | import cofh.lib.util.helpers.ItemHelper; 5 | import net.minecraft.inventory.InventoryCrafting; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraftforge.oredict.ShapedOreRecipe; 8 | 9 | public class RecipeSecure extends ShapedOreRecipe { 10 | 11 | int targetSlot = 4; 12 | 13 | public RecipeSecure(ItemStack result, Object... recipe) { 14 | 15 | super(result, recipe); 16 | } 17 | 18 | public RecipeSecure(int slot, ItemStack result, Object... recipe) { 19 | 20 | super(result, recipe); 21 | targetSlot = slot; 22 | } 23 | 24 | @Override 25 | public ItemStack getCraftingResult(InventoryCrafting craftMatrix) { 26 | 27 | if (SecurityHelper.isSecure(craftMatrix.getStackInSlot(targetSlot))) { 28 | return null; 29 | } 30 | if (craftMatrix.getStackInSlot(targetSlot) == null) { 31 | return super.getCraftingResult(craftMatrix); 32 | } 33 | ItemStack secureStack = ItemHelper.copyTag(getRecipeOutput().copy(), craftMatrix.getStackInSlot(targetSlot)); 34 | return SecurityHelper.setSecure(secureStack); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/energy/EnergyStorageCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.energy; 2 | 3 | import cofh.api.energy.EnergyStorage; 4 | 5 | public class EnergyStorageCore extends EnergyStorage { 6 | 7 | public EnergyStorageCore(int capacity) { 8 | 9 | this(capacity, capacity, capacity); 10 | } 11 | 12 | public EnergyStorageCore(int capacity, int maxTransfer) { 13 | 14 | this(capacity, maxTransfer, maxTransfer); 15 | } 16 | 17 | public EnergyStorageCore(int capacity, int maxReceive, int maxExtract) { 18 | 19 | super(capacity, maxReceive, maxExtract); 20 | } 21 | 22 | public int getSpace() { 23 | 24 | return energy >= capacity ? 0 : capacity - energy; 25 | } 26 | 27 | public int receiveEnergyNoLimit(int maxReceive, boolean simulate) { 28 | 29 | int energyReceived = Math.min(capacity - energy, maxReceive); 30 | 31 | if (!simulate) { 32 | energy += energyReceived; 33 | } 34 | return energyReceived; 35 | } 36 | 37 | public int extractEnergyNoLimit(int maxExtract, boolean simulate) { 38 | 39 | int energyExtracted = Math.min(energy, maxExtract); 40 | 41 | if (!simulate) { 42 | energy -= energyExtracted; 43 | } 44 | return energyExtracted; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/command/CommandVersion.java: -------------------------------------------------------------------------------- 1 | package cofh.core.command; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.lib.util.helpers.StringHelper; 5 | import net.minecraft.command.CommandException; 6 | import net.minecraft.command.ICommandSender; 7 | import net.minecraft.server.MinecraftServer; 8 | import net.minecraft.util.text.TextComponentString; 9 | 10 | import java.util.List; 11 | 12 | public class CommandVersion implements ISubCommand { 13 | 14 | public static CommandVersion instance = new CommandVersion(); 15 | 16 | /* ISubCommand */ 17 | @Override 18 | public String getCommandName() { 19 | 20 | return "version"; 21 | } 22 | 23 | @Override 24 | public int getPermissionLevel() { 25 | 26 | return -1; 27 | } 28 | 29 | @Override 30 | public void handleCommand(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException { 31 | 32 | sender.addChatMessage(new TextComponentString(StringHelper.localize("chat.cofh.command.version.0") + " " + CoFHCore.VERSION + ".")); 33 | } 34 | 35 | @Override 36 | public List addTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args) { 37 | 38 | return null; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/PacketIndexedChat.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.core.util.helpers.ChatHelper; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.util.text.ITextComponent; 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | 10 | public class PacketIndexedChat extends PacketCoFHBase { 11 | 12 | public static void initialize() { 13 | 14 | PacketHandler.instance.registerPacket(PacketIndexedChat.class); 15 | } 16 | 17 | public PacketIndexedChat() { 18 | 19 | } 20 | 21 | public PacketIndexedChat(ITextComponent chat) { 22 | 23 | } 24 | 25 | public PacketIndexedChat(ITextComponent chat, int index) { 26 | 27 | addString(ChatHelper.toJSON(chat)); 28 | addInt(index); 29 | } 30 | 31 | @Override 32 | public void handlePacket(EntityPlayer player, boolean isServer) { 33 | 34 | } 35 | 36 | @Override 37 | @SideOnly (Side.CLIENT) 38 | public void handleClientSide(EntityPlayer player) { 39 | 40 | String string = getString(); 41 | int offset = getInt(); 42 | CoFHCore.proxy.addIndexedChatMessage(ChatHelper.fromJSON(string), offset); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/PacketCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import cofh.CoFHCore; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | 6 | public class PacketCore extends PacketCoFHBase { 7 | 8 | public static void initialize() { 9 | 10 | PacketHandler.instance.registerPacket(PacketCore.class); 11 | } 12 | 13 | public enum PacketTypes { 14 | CONFIG_SYNC 15 | } 16 | 17 | @Override 18 | public void handlePacket(EntityPlayer player, boolean isServer) { 19 | 20 | try { 21 | int type = getByte(); 22 | 23 | switch (PacketTypes.values()[type]) { 24 | case CONFIG_SYNC: 25 | return; 26 | default: 27 | CoFHCore.LOG.error("Unknown Packet! Internal: COFH, ID: " + type); 28 | } 29 | } catch (Exception e) { 30 | CoFHCore.LOG.error("Packet payload failure! Please check your config files!"); 31 | e.printStackTrace(); 32 | } 33 | 34 | } 35 | 36 | public static void sendConfigSyncPacketToClient(EntityPlayer player) { 37 | 38 | // PacketHandler.sendTo(CoFHCore.instance.getConfigSync(), player); 39 | } 40 | 41 | public static PacketCoFHBase getPacket(PacketTypes theType) { 42 | 43 | return new PacketCore().addByte(theType.ordinal()); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/ClusterParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.lib.util.WeightedRandomBlock; 4 | import cofh.lib.world.IGeneratorParser; 5 | import cofh.lib.world.WorldGenMinableCluster; 6 | import cofh.lib.world.WorldGenSparseMinableCluster; 7 | import com.typesafe.config.Config; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | import org.apache.logging.log4j.Logger; 10 | 11 | import java.util.List; 12 | 13 | public class ClusterParser implements IGeneratorParser { 14 | 15 | private final boolean sparse; 16 | 17 | public ClusterParser(boolean sparse) { 18 | 19 | this.sparse = sparse; 20 | } 21 | 22 | @Override 23 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 24 | 25 | int clusterSize = genObject.getInt("cluster-size"); 26 | if (clusterSize <= 0) { 27 | log.warn("Invalid cluster size for generator '%s'", name); 28 | return null; 29 | } 30 | 31 | if (sparse) { 32 | return new WorldGenSparseMinableCluster(resList, clusterSize, matList); 33 | } 34 | return new WorldGenMinableCluster(resList, clusterSize, matList); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/repack/immibis/bon/mcp/CsvFile.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.repack.immibis.bon.mcp; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.Scanner; 10 | 11 | public abstract class CsvFile { 12 | 13 | @SuppressWarnings ("resource") 14 | public static Map read(File f, int[] n_sides) throws IOException { 15 | 16 | Map data = new HashMap<>(); 17 | 18 | try (Scanner in = new Scanner(new BufferedReader(new FileReader(f)))) { 19 | in.useDelimiter(","); 20 | while (in.hasNextLine()) { 21 | String searge = in.next(); 22 | String name = in.next(); 23 | String side = in.next(); 24 | /*String desc =*/ 25 | in.nextLine(); 26 | try { 27 | if (sideIn(Integer.parseInt(side), n_sides)) { 28 | data.put(searge, name); 29 | } 30 | } catch (NumberFormatException e) { 31 | 32 | } 33 | } 34 | } 35 | return data; 36 | } 37 | 38 | private static boolean sideIn(int i, int[] ar) { 39 | 40 | for (int n : ar) { 41 | if (n == i) { 42 | return true; 43 | } 44 | } 45 | return false; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/element/TabInfo.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.element; 2 | 3 | import cofh.core.init.CoreTextures; 4 | import cofh.lib.gui.GuiBase; 5 | import cofh.lib.util.helpers.StringHelper; 6 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 7 | 8 | public class TabInfo extends TabScrolledText { 9 | 10 | public static int defaultSide = 0; 11 | public static int defaultHeaderColor = 0xe1c92f; 12 | public static int defaultSubHeaderColor = 0xaaafb8; 13 | public static int defaultTextColor = 0xffffff; 14 | public static int defaultBackgroundColor = 0x555555; 15 | 16 | public TabInfo(GuiBase gui, String infoString) { 17 | 18 | this(gui, defaultSide, infoString); 19 | } 20 | 21 | public TabInfo(GuiBase gui, int side, String infoString) { 22 | 23 | super(gui, side, infoString); 24 | 25 | headerColor = defaultHeaderColor; 26 | subheaderColor = defaultSubHeaderColor; 27 | textColor = defaultTextColor; 28 | backgroundColor = defaultBackgroundColor; 29 | } 30 | 31 | @Override 32 | public TextureAtlasSprite getIcon() { 33 | 34 | return CoreTextures.ICON_INFORMATION; 35 | } 36 | 37 | @Override 38 | public String getTitle() { 39 | 40 | return StringHelper.localize("info.cofh.information"); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/element/TabTutorial.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.element; 2 | 3 | import cofh.core.init.CoreTextures; 4 | import cofh.lib.gui.GuiBase; 5 | import cofh.lib.util.helpers.StringHelper; 6 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 7 | 8 | public class TabTutorial extends TabScrolledText { 9 | 10 | public static int defaultSide = 0; 11 | public static int defaultHeaderColor = 0xe1c92f; 12 | public static int defaultSubHeaderColor = 0xaaafb8; 13 | public static int defaultTextColor = 0xffffff; 14 | public static int defaultBackgroundColor = 0x5a09bb; 15 | 16 | public TabTutorial(GuiBase gui, String infoString) { 17 | 18 | this(gui, defaultSide, infoString); 19 | } 20 | 21 | public TabTutorial(GuiBase gui, int side, String infoString) { 22 | 23 | super(gui, side, infoString); 24 | 25 | headerColor = defaultHeaderColor; 26 | subheaderColor = defaultSubHeaderColor; 27 | textColor = defaultTextColor; 28 | backgroundColor = defaultBackgroundColor; 29 | } 30 | 31 | @Override 32 | public TextureAtlasSprite getIcon() { 33 | 34 | return CoreTextures.ICON_TUTORIAL; 35 | } 36 | 37 | @Override 38 | public String getTitle() { 39 | 40 | return StringHelper.localize("info.cofh.tutorial"); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/enchantment/EnchantmentVorpal.java: -------------------------------------------------------------------------------- 1 | package cofh.core.enchantment; 2 | 3 | import net.minecraft.enchantment.Enchantment; 4 | import net.minecraft.enchantment.EnumEnchantmentType; 5 | import net.minecraft.inventory.EntityEquipmentSlot; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.item.ItemSword; 8 | 9 | public class EnchantmentVorpal extends Enchantment { 10 | 11 | public EnchantmentVorpal(String id) { 12 | 13 | super(Rarity.RARE, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] { EntityEquipmentSlot.MAINHAND }); 14 | setRegistryName(id); 15 | } 16 | 17 | @Override 18 | public int getMinEnchantability(int level) { 19 | 20 | return 5 + (level - 1) * 10; 21 | } 22 | 23 | @Override 24 | public int getMaxEnchantability(int level) { 25 | 26 | return getMinEnchantability(level) + 15; 27 | } 28 | 29 | @Override 30 | public int getMaxLevel() { 31 | 32 | return 4; 33 | } 34 | 35 | @Override 36 | public String getName() { 37 | 38 | return "enchant.cofh.vorpal"; 39 | } 40 | 41 | @Override 42 | public boolean canApply(ItemStack stack) { 43 | 44 | return (stack.getItem() instanceof ItemSword); 45 | } 46 | 47 | @Override 48 | public boolean isAllowedOnBooks() { 49 | 50 | return false; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/PlateParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.util.helpers.MathHelper; 6 | import cofh.lib.world.IGeneratorParser; 7 | import cofh.lib.world.WorldGenMinablePlate; 8 | import com.typesafe.config.Config; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | import org.apache.logging.log4j.Logger; 11 | 12 | import java.util.List; 13 | 14 | public class PlateParser implements IGeneratorParser { 15 | 16 | @Override 17 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 18 | 19 | int clusterSize = genObject.getInt("radius"); 20 | if (clusterSize <= 0) { 21 | log.warn("Invalid radius for generator '%s'", name); 22 | return null; 23 | } 24 | 25 | WorldGenMinablePlate r = new WorldGenMinablePlate(resList, MathHelper.clamp(clusterSize, 0, 32), matList); 26 | { 27 | if (genObject.hasPath("height")) { 28 | r.setHeight(FeatureParser.parseNumberValue(genObject.root().get("height"), 0, 64)); 29 | } 30 | if (genObject.hasPath("slim")) { 31 | r.setSlim(genObject.getBoolean("slim")); 32 | } 33 | } 34 | return r; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/relauncher/Strippable.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.relauncher; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * This annotation will remove the annotated method, field, or class if the value condition is not met. 7 | *

8 | * When used on a class, methods from referenced interfaces will not be removed
9 | * When using this annotation on methods, ensure you do not switch on an enum inside that method. JavaC implementation details means this will cause crashes. 10 | *

11 | * Takes a class name as the value. e.g., "cofh.lib.network.ByteBufHelper"; requiring that class be available
12 | * Can also substitute on modid using e.g., "mod:CoFHCore" as a value; requiring that mod be available
13 | * Can also substitute on API using e.g., "api:CoFHAPI|energy" as a value; requiring that API be available
14 | * Mod and API values can have a version range associated e.g., "mod:ThermalExpansion@[4.0.0, 4.1.0)" 15 | */ 16 | @Documented 17 | @Retention (RetentionPolicy.RUNTIME) 18 | @Target ({ ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE }) 19 | public @interface Strippable { 20 | 21 | String[] value(); 22 | 23 | /** 24 | * The side from which these interfaces will *always* be stripped. 25 | */ 26 | CoFHSide side() default CoFHSide.NONE; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/tileentity/ITransferControl.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.tileentity; 2 | 3 | /** 4 | * Implement this interface on Tile Entities which have Transfer Control functionality. This means that a tile can be set to automatically transfer things into or out of it. 5 | * 6 | * This is a genericized interface and exactly WHAT is transferred into or out of the tile is up to the tile itself. :) 7 | * 8 | * @author King Lemming 9 | */ 10 | public interface ITransferControl { 11 | 12 | /** 13 | * Returns whether or not a tile is capable of automatic input transfer. 14 | */ 15 | boolean hasTransferIn(); 16 | 17 | /** 18 | * Returns whether or not a tile is capable of automatic output transfer. 19 | */ 20 | boolean hasTransferOut(); 21 | 22 | /** 23 | * Returns current state of automatic input transfer. 24 | */ 25 | boolean getTransferIn(); 26 | 27 | /** 28 | * Returns current state of automatic output transfer. 29 | */ 30 | boolean getTransferOut(); 31 | 32 | /** 33 | * Attempt to enable/disable automatic input transfer. Returns TRUE on successful change. 34 | */ 35 | boolean setTransferIn(boolean input); 36 | 37 | /** 38 | * Attempt to enable/disable automatic output transfer. Returns TRUE on successful change. 39 | */ 40 | boolean setTransferOut(boolean output); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/relauncher/Substitutable.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.relauncher; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * This annotation will replace the bytecode of the annotated method with that of the named method if the value condition is not met. 7 | *

8 | * Ensure the named method has an identical signature (return type & parameters) to the annotated method.
9 | * Ensure you do not switch on an enum inside the annotated method. JavaC implementation details means this will cause crashes. 10 | *

11 | * Takes a class name as the value. e.g., "cofh.lib.network.ByteBufHelper"; requiring that class be available
12 | * Can also substitute on modid using e.g., "mod:CoFHCore" as a value; requiring that mod be available
13 | * Can also substitute on API using e.g., "api:CoFHAPI|energy" as a value; requiring that API be available
14 | * Mod and API values can have a version range associated e.g., "mod:ThermalExpansion@[4.0.0, 4.1.0)" 15 | */ 16 | @Documented 17 | @Retention (RetentionPolicy.RUNTIME) 18 | @Target ({ ElementType.METHOD }) 19 | public @interface Substitutable { 20 | 21 | String[] value(); 22 | 23 | String method(); 24 | 25 | /** 26 | * The side from which this method will *always* be substituted. 27 | */ 28 | CoFHSide side() default CoFHSide.NONE; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/repack/codechicken/lib/asm/ImportantInsnVisitor.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.repack.codechicken.lib.asm; 2 | 3 | import org.objectweb.asm.ClassVisitor; 4 | import org.objectweb.asm.MethodVisitor; 5 | import org.objectweb.asm.Opcodes; 6 | import org.objectweb.asm.tree.MethodNode; 7 | 8 | public class ImportantInsnVisitor extends ClassVisitor { 9 | 10 | public class ImportantInsnMethodVisitor extends MethodVisitor { 11 | 12 | MethodVisitor delegate; 13 | 14 | public ImportantInsnMethodVisitor(int access, String name, String desc, String signature, String[] exceptions) { 15 | 16 | super(Opcodes.ASM4, new MethodNode(access, name, desc, signature, exceptions)); 17 | delegate = cv.visitMethod(access, name, desc, signature, exceptions); 18 | } 19 | 20 | @Override 21 | public void visitEnd() { 22 | 23 | super.visitEnd(); 24 | MethodNode mnode = (MethodNode) mv; 25 | mnode.instructions = InsnComparator.getImportantList(mnode.instructions); 26 | mnode.accept(delegate); 27 | } 28 | } 29 | 30 | public ImportantInsnVisitor(ClassVisitor cv) { 31 | 32 | super(Opcodes.ASM4, cv); 33 | } 34 | 35 | @Override 36 | public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { 37 | 38 | return new ImportantInsnMethodVisitor(access, name, desc, signature, exceptions); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/repack/codechicken/lib/asm/LocalVariablesSorterVisitor.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.repack.codechicken.lib.asm; 2 | 3 | import org.objectweb.asm.ClassVisitor; 4 | import org.objectweb.asm.MethodVisitor; 5 | import org.objectweb.asm.Opcodes; 6 | import org.objectweb.asm.commons.LocalVariablesSorter; 7 | 8 | import java.util.Set; 9 | 10 | public class LocalVariablesSorterVisitor extends ClassVisitor { 11 | 12 | public Set methods; 13 | public String owner; 14 | 15 | public LocalVariablesSorterVisitor(Set methods, ClassVisitor cv) { 16 | 17 | super(Opcodes.ASM4, cv); 18 | this.methods = methods; 19 | } 20 | 21 | public LocalVariablesSorterVisitor(ClassVisitor cv) { 22 | 23 | this(null, cv); 24 | } 25 | 26 | @Override 27 | public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { 28 | 29 | super.visit(version, access, name, signature, superName, interfaces); 30 | owner = name; 31 | } 32 | 33 | @Override 34 | public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { 35 | 36 | MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); 37 | return methods == null || methods.contains(new ObfMapping(owner, name, desc)) ? new LocalVariablesSorter(access, desc, mv) : mv; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/tileentity/IReconfigurableSides.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.tileentity; 2 | 3 | /** 4 | * Implement this interface on Tile Entities which allow for reconfiguration of their sides. 5 | * 6 | * Coordination with the containing block is required. 7 | * 8 | * @author King Lemming 9 | */ 10 | public interface IReconfigurableSides { 11 | 12 | /** 13 | * Decrement the config for a given side. 14 | * 15 | * @param side The side to decrement. 16 | * @return True if config was changed, false otherwise. 17 | */ 18 | boolean decrSide(int side); 19 | 20 | /** 21 | * Increment the config for a given side. 22 | * 23 | * @param side The side to decrement. 24 | * @return True if config was changed, false otherwise. 25 | */ 26 | boolean incrSide(int side); 27 | 28 | /** 29 | * Set the config for a given side. 30 | * 31 | * @param side The side to set. 32 | * @param config The config value to use. 33 | * @return True of config was set, false otherwise. 34 | */ 35 | boolean setSide(int side, int config); 36 | 37 | /** 38 | * Reset configs on all sides to their base values. 39 | * 40 | * @return True if reset was successful, false otherwise. 41 | */ 42 | boolean resetSides(); 43 | 44 | /** 45 | * Returns the number of possible config settings for a given side. 46 | */ 47 | int getNumConfig(int side); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/key/KeyBindingItemMultiMode.java: -------------------------------------------------------------------------------- 1 | package cofh.core.key; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.api.item.IMultiModeItem; 5 | import cofh.core.util.CoreUtils; 6 | import cofh.lib.util.helpers.ItemHelper; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.ItemStack; 9 | 10 | public class KeyBindingItemMultiMode implements IKeyBinding { 11 | 12 | public static KeyBindingItemMultiMode instance = new KeyBindingItemMultiMode(); 13 | 14 | @Override 15 | public String getUUID() { 16 | 17 | return "cofh.multimode"; 18 | } 19 | 20 | @Override 21 | public int getKey() { 22 | 23 | return CoFHCore.proxy.getKeyBind(getUUID()); 24 | } 25 | 26 | @Override 27 | public boolean hasServerSide() { 28 | 29 | return true; 30 | } 31 | 32 | @Override 33 | public boolean keyPressClient() { 34 | 35 | EntityPlayer player = CoreUtils.getClientPlayer(); 36 | return player != null && ItemHelper.isPlayerHoldingMultiModeItem(player); 37 | } 38 | 39 | @Override 40 | public boolean keyPressServer(EntityPlayer player) { 41 | 42 | if (ItemHelper.isPlayerHoldingMultiModeItem(player) && ItemHelper.incrHeldMultiModeItemState(player)) { 43 | ItemStack heldItem = ItemHelper.getHeldStack(player); 44 | ((IMultiModeItem) heldItem.getItem()).onModeChange(player, heldItem); 45 | return true; 46 | } 47 | return false; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemHoeCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import net.minecraft.creativetab.CreativeTabs; 5 | import net.minecraft.item.Item; 6 | import net.minecraft.item.ItemHoe; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import javax.annotation.Nonnull; 12 | import java.util.List; 13 | 14 | public class ItemHoeCore extends ItemHoe { 15 | 16 | public String repairIngot = ""; 17 | 18 | protected boolean showInCreative = true; 19 | 20 | public ItemHoeCore(ToolMaterial toolMaterial) { 21 | 22 | super(toolMaterial); 23 | } 24 | 25 | public ItemHoeCore setRepairIngot(String repairIngot) { 26 | 27 | this.repairIngot = repairIngot; 28 | return this; 29 | } 30 | 31 | public ItemHoeCore setShowInCreative(boolean showInCreative) { 32 | 33 | this.showInCreative = showInCreative; 34 | return this; 35 | } 36 | 37 | @Override 38 | @SideOnly (Side.CLIENT) 39 | public void getSubItems(@Nonnull Item item, CreativeTabs tab, List list) { 40 | 41 | if (showInCreative) { 42 | list.add(new ItemStack(item, 1, 0)); 43 | } 44 | } 45 | 46 | @Override 47 | public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { 48 | 49 | return ItemHelper.isOreNameEqual(stack, repairIngot); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/PacketTileInfo.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.tileentity.TileEntity; 5 | import net.minecraft.util.math.BlockPos; 6 | 7 | public class PacketTileInfo extends PacketCoFHBase { 8 | 9 | public static void initialize() { 10 | 11 | PacketHandler.instance.registerPacket(PacketTileInfo.class); 12 | } 13 | 14 | public PacketTileInfo() { 15 | 16 | } 17 | 18 | public PacketTileInfo(TileEntity tile) { 19 | 20 | addInt(tile.getPos().getX()); 21 | addInt(tile.getPos().getY()); 22 | addInt(tile.getPos().getZ()); 23 | 24 | } 25 | 26 | @Override 27 | public void handleClientSide(EntityPlayer player) { 28 | 29 | handlePacket(player, false); 30 | } 31 | 32 | @Override 33 | public void handleServerSide(EntityPlayer player) { 34 | 35 | handlePacket(player, true); 36 | } 37 | 38 | @Override 39 | public void handlePacket(EntityPlayer player, boolean isServer) { 40 | 41 | TileEntity tile = player.worldObj.getTileEntity(new BlockPos(getInt(), getInt(), getInt())); 42 | 43 | if (tile instanceof ITileInfoPacketHandler) { 44 | ((ITileInfoPacketHandler) tile).handleTileInfoPacket(this, isServer, player); 45 | } else { 46 | // TODO: Throw error, bad packet 47 | } 48 | } 49 | 50 | public static PacketTileInfo newPacket(TileEntity tile) { 51 | 52 | return new PacketTileInfo(tile); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemSwordCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import net.minecraft.creativetab.CreativeTabs; 5 | import net.minecraft.item.Item; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.item.ItemSword; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import javax.annotation.Nonnull; 12 | import java.util.List; 13 | 14 | public class ItemSwordCore extends ItemSword { 15 | 16 | protected String repairIngot = ""; 17 | 18 | protected boolean showInCreative = true; 19 | 20 | public ItemSwordCore(ToolMaterial toolMaterial) { 21 | 22 | super(toolMaterial); 23 | } 24 | 25 | public ItemSwordCore setRepairIngot(String repairIngot) { 26 | 27 | this.repairIngot = repairIngot; 28 | return this; 29 | } 30 | 31 | public ItemSwordCore setShowInCreative(boolean showInCreative) { 32 | 33 | this.showInCreative = showInCreative; 34 | return this; 35 | } 36 | 37 | @Override 38 | @SideOnly (Side.CLIENT) 39 | public void getSubItems(@Nonnull Item item, CreativeTabs tab, List list) { 40 | 41 | if (showInCreative) { 42 | list.add(new ItemStack(item, 1, 0)); 43 | } 44 | } 45 | 46 | @Override 47 | public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { 48 | 49 | return ItemHelper.isOreNameEqual(stack, repairIngot); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/PacketTile.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.tileentity.TileEntity; 6 | import net.minecraft.util.math.BlockPos; 7 | 8 | public class PacketTile extends PacketCoFHBase { 9 | 10 | public static void initialize() { 11 | 12 | PacketHandler.instance.registerPacket(PacketTile.class); 13 | } 14 | 15 | public PacketTile() { 16 | 17 | } 18 | 19 | public PacketTile(TileEntity tile) { 20 | 21 | addInt(tile.getPos().getX()); 22 | addInt(tile.getPos().getY()); 23 | addInt(tile.getPos().getZ()); 24 | 25 | } 26 | 27 | @Override 28 | public void handlePacket(EntityPlayer player, boolean isServer) { 29 | 30 | TileEntity tile = player.worldObj.getTileEntity(new BlockPos(getInt(), getInt(), getInt())); 31 | 32 | if (tile instanceof ITilePacketHandler) { 33 | ((ITilePacketHandler) tile).handleTilePacket(this, isServer); 34 | IBlockState state = tile.getWorld().getBlockState(tile.getPos()); 35 | tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 3); 36 | if (isServer) { 37 | tile.getWorld().updateComparatorOutputLevel(tile.getPos(), tile.getBlockType()); 38 | } 39 | } else { 40 | // TODO: Throw error, bad packet 41 | } 42 | } 43 | 44 | public static PacketTile newPacket(TileEntity tile) { 45 | 46 | return new PacketTile(tile); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/network/PacketSocial.java: -------------------------------------------------------------------------------- 1 | package cofh.core.network; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.core.util.RegistrySocial; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.entity.player.EntityPlayerMP; 7 | 8 | import java.util.LinkedList; 9 | 10 | public class PacketSocial extends PacketCoFHBase { 11 | 12 | public static void initialize() { 13 | 14 | PacketHandler.instance.registerPacket(PacketSocial.class); 15 | } 16 | 17 | public enum PacketTypes { 18 | FRIEND_LIST, ADD_FRIEND, REMOVE_FRIEND 19 | } 20 | 21 | @Override 22 | public void handlePacket(EntityPlayer player, boolean isServer) { 23 | 24 | switch (PacketTypes.values()[getByte()]) { 25 | case FRIEND_LIST: 26 | int size = getInt(); 27 | RegistrySocial.clientPlayerFriends = new LinkedList<>(); 28 | for (int i = 0; i < size; i++) { 29 | RegistrySocial.clientPlayerFriends.add(getString()); 30 | } 31 | java.util.Collections.sort(RegistrySocial.clientPlayerFriends); 32 | CoFHCore.proxy.updateFriendListGui(); 33 | return; 34 | case ADD_FRIEND: 35 | RegistrySocial.addFriend(((EntityPlayerMP) player).getGameProfile(), getString()); 36 | RegistrySocial.sendFriendsToPlayer((EntityPlayerMP) player); 37 | return; 38 | case REMOVE_FRIEND: 39 | RegistrySocial.removeFriend(((EntityPlayerMP) player).getGameProfile(), getString()); 40 | RegistrySocial.sendFriendsToPlayer((EntityPlayerMP) player); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/command/CommandReloadWorldgen.java: -------------------------------------------------------------------------------- 1 | package cofh.core.command; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.core.world.WorldHandler; 5 | import cofh.lib.world.IFeatureGenerator; 6 | import com.google.common.base.Throwables; 7 | import net.minecraft.command.CommandException; 8 | import net.minecraft.command.ICommandSender; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | import java.util.List; 12 | 13 | public class CommandReloadWorldgen implements ISubCommand { 14 | 15 | public static ISubCommand instance = new CommandReloadWorldgen(); 16 | 17 | @Override 18 | public String getCommandName() { 19 | 20 | return "reloadworldgen"; 21 | } 22 | 23 | @Override 24 | public int getPermissionLevel() { 25 | 26 | return 3; 27 | } 28 | 29 | @Override 30 | public void handleCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { 31 | 32 | for (IFeatureGenerator g : FeatureParser.parsedFeatures) { 33 | WorldHandler.instance.removeFeature(g); 34 | } 35 | FeatureParser.parsedFeatures.clear(); 36 | 37 | try { 38 | FeatureParser.parseGenerationFiles(); 39 | } catch (Throwable t) { 40 | Throwables.propagate(t); 41 | } 42 | CommandHandler.logAdminCommand(sender, this, "chat.cofh.command.reloadworldgen.success"); 43 | } 44 | 45 | @Override 46 | public List addTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args) { 47 | 48 | return null; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/enchantment/EnchantmentHolding.java: -------------------------------------------------------------------------------- 1 | package cofh.core.enchantment; 2 | 3 | import cofh.core.init.CoreEnchantments; 4 | import cofh.core.item.IEnchantableItem; 5 | import net.minecraft.enchantment.Enchantment; 6 | import net.minecraft.inventory.EntityEquipmentSlot; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class EnchantmentHolding extends Enchantment { 10 | 11 | public static boolean enable = true; 12 | 13 | public EnchantmentHolding(String id) { 14 | 15 | super(Rarity.RARE, CoreEnchantments.ENCHANTMENT_TYPE_STORAGE, EntityEquipmentSlot.values()); 16 | setRegistryName(id); 17 | } 18 | 19 | @Override 20 | public int getMinEnchantability(int level) { 21 | 22 | return 1 + (level - 1) * 10; 23 | } 24 | 25 | @Override 26 | public int getMaxEnchantability(int level) { 27 | 28 | return getMinEnchantability(level) + 15; 29 | } 30 | 31 | @Override 32 | public int getMaxLevel() { 33 | 34 | return 4; 35 | } 36 | 37 | @Override 38 | public String getName() { 39 | 40 | return "enchant.cofh.holding"; 41 | } 42 | 43 | @Override 44 | public boolean canApply(ItemStack stack) { 45 | 46 | return enable && stack.getItem() instanceof IEnchantableItem && ((IEnchantableItem) stack.getItem()).canEnchant(stack, this); 47 | } 48 | 49 | @Override 50 | public boolean canApplyAtEnchantingTable(ItemStack stack) { 51 | 52 | return canApply(stack); 53 | } 54 | 55 | @Override 56 | public boolean isAllowedOnBooks() { 57 | 58 | return false; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/GuiLimitedTextField.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui; 2 | 3 | import net.minecraft.client.gui.FontRenderer; 4 | import net.minecraft.client.gui.GuiTextField; 5 | 6 | public class GuiLimitedTextField extends GuiTextField { 7 | 8 | public String listOfValidCharacters = ""; 9 | 10 | public GuiLimitedTextField(FontRenderer fontRenderer, int xPos, int yPos, int width, int height, String validChars) { 11 | 12 | super(0, fontRenderer, xPos, yPos, width, height); 13 | listOfValidCharacters = validChars; 14 | } 15 | 16 | @Override 17 | public boolean textboxKeyTyped(char par1, int par2) { 18 | 19 | switch (par1) { 20 | case 1: 21 | return super.textboxKeyTyped(par1, par2); 22 | case 3: 23 | return super.textboxKeyTyped(par1, par2); 24 | case 22: 25 | return false; 26 | case 24: 27 | return super.textboxKeyTyped(par1, par2); 28 | default: 29 | switch (par2) { 30 | case 14: 31 | return super.textboxKeyTyped(par1, par2); 32 | case 199: 33 | return super.textboxKeyTyped(par1, par2); 34 | case 203: 35 | return super.textboxKeyTyped(par1, par2); 36 | case 205: 37 | return super.textboxKeyTyped(par1, par2); 38 | case 207: 39 | return super.textboxKeyTyped(par1, par2); 40 | case 211: 41 | return super.textboxKeyTyped(par1, par2); 42 | default: 43 | if (listOfValidCharacters.indexOf(par1) >= 0) { 44 | return super.textboxKeyTyped(par1, par2); 45 | } 46 | return false; 47 | } 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/enchantment/EnchantmentMultishot.java: -------------------------------------------------------------------------------- 1 | package cofh.core.enchantment; 2 | 3 | import cofh.core.item.IEnchantableItem; 4 | import net.minecraft.enchantment.Enchantment; 5 | import net.minecraft.enchantment.EnumEnchantmentType; 6 | import net.minecraft.inventory.EntityEquipmentSlot; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class EnchantmentMultishot extends Enchantment { 10 | 11 | public static boolean enable = true; 12 | 13 | public EnchantmentMultishot(String id) { 14 | 15 | super(Rarity.UNCOMMON, EnumEnchantmentType.BOW, new EntityEquipmentSlot[] { EntityEquipmentSlot.MAINHAND }); 16 | setRegistryName(id); 17 | } 18 | 19 | @Override 20 | public int getMinEnchantability(int level) { 21 | 22 | return 5 + (level - 1) * 10; 23 | } 24 | 25 | @Override 26 | public int getMaxEnchantability(int level) { 27 | 28 | return getMinEnchantability(level) + 15; 29 | } 30 | 31 | @Override 32 | public int getMaxLevel() { 33 | 34 | return 4; 35 | } 36 | 37 | @Override 38 | public String getName() { 39 | 40 | return "enchant.cofh.multishot"; 41 | } 42 | 43 | @Override 44 | public boolean canApply(ItemStack stack) { 45 | 46 | return enable && stack.getItem() instanceof IEnchantableItem && ((IEnchantableItem) stack.getItem()).canEnchant(stack, this); 47 | } 48 | 49 | @Override 50 | public boolean canApplyAtEnchantingTable(ItemStack stack) { 51 | 52 | return canApply(stack); 53 | } 54 | 55 | @Override 56 | public boolean isAllowedOnBooks() { 57 | 58 | return false; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/entity/EntitySelectorInRangeByType.java: -------------------------------------------------------------------------------- 1 | package cofh.core.entity; 2 | 3 | import com.google.common.base.Predicate; 4 | import net.minecraft.entity.Entity; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | public class EntitySelectorInRangeByType implements Predicate { 9 | 10 | private final double origX; 11 | private final double origY; 12 | private final double origZ; 13 | private final double distance; 14 | private final Class types[]; 15 | 16 | public EntitySelectorInRangeByType(Entity origin, double distance, Class... types) { 17 | 18 | this(origin.posX, origin.posY, origin.posZ, distance, types); 19 | } 20 | 21 | public EntitySelectorInRangeByType(double originX, double originY, double originZ, double distance, Class... types) { 22 | 23 | origX = originX; 24 | origY = originY; 25 | origZ = originZ; 26 | this.distance = distance; 27 | this.types = types; 28 | } 29 | 30 | @Override 31 | public boolean apply(@Nullable Entity entity) { 32 | // Out of range? Not applicable. 33 | if (entity == null) { 34 | return false; 35 | } 36 | if (entity.getDistanceSq(origX, origY, origZ) > distance * distance) { 37 | return false; 38 | } 39 | // No specific types to check for? Applicable. 40 | if (types == null) { 41 | return true; 42 | } 43 | // Check types. Applicable if found and assignable... 44 | for (Class type : types) { 45 | if (type.isAssignableFrom(entity.getClass())) { 46 | return true; 47 | } 48 | } 49 | // ...otherwise, not. 50 | return false; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemShearsCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import net.minecraft.creativetab.CreativeTabs; 5 | import net.minecraft.item.Item; 6 | import net.minecraft.item.ItemShears; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import javax.annotation.Nonnull; 12 | import java.util.List; 13 | 14 | public class ItemShearsCore extends ItemShears { 15 | 16 | protected String repairIngot = ""; 17 | protected ToolMaterial toolMaterial; 18 | 19 | protected boolean showInCreative = true; 20 | 21 | public ItemShearsCore(ToolMaterial toolMaterial) { 22 | 23 | super(); 24 | this.toolMaterial = toolMaterial; 25 | this.setMaxDamage(toolMaterial.getMaxUses() - 12); 26 | } 27 | 28 | public ItemShearsCore setRepairIngot(String repairIngot) { 29 | 30 | this.repairIngot = repairIngot; 31 | return this; 32 | } 33 | 34 | public ItemShearsCore setShowInCreative(boolean showInCreative) { 35 | 36 | this.showInCreative = showInCreative; 37 | return this; 38 | } 39 | 40 | @Override 41 | @SideOnly (Side.CLIENT) 42 | public void getSubItems(@Nonnull Item item, CreativeTabs tab, List list) { 43 | 44 | if (showInCreative) { 45 | list.add(new ItemStack(item, 1, 0)); 46 | } 47 | } 48 | 49 | @Override 50 | public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { 51 | 52 | return ItemHelper.isOreNameEqual(stack, repairIngot); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/ItemCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item; 2 | 3 | import cofh.core.render.FontRendererCore; 4 | import cofh.core.util.helpers.SecurityHelper; 5 | import net.minecraft.client.gui.FontRenderer; 6 | import net.minecraft.entity.Entity; 7 | import net.minecraft.entity.item.EntityItem; 8 | import net.minecraft.item.Item; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.world.World; 11 | import net.minecraftforge.fml.relauncher.Side; 12 | import net.minecraftforge.fml.relauncher.SideOnly; 13 | 14 | public class ItemCore extends Item { 15 | 16 | protected String name; 17 | protected String modName; 18 | 19 | public ItemCore() { 20 | 21 | this("cofh"); 22 | } 23 | 24 | public ItemCore(String modName) { 25 | 26 | this.modName = modName; 27 | setHasSubtypes(true); 28 | } 29 | 30 | /* STANDARD METHODS */ 31 | @Override 32 | public boolean hasCustomEntity(ItemStack stack) { 33 | 34 | return SecurityHelper.isSecure(stack); 35 | } 36 | 37 | @Override 38 | public boolean isItemTool(ItemStack stack) { 39 | 40 | return false; 41 | } 42 | 43 | @Override 44 | public Entity createEntity(World world, Entity location, ItemStack stack) { 45 | 46 | if (SecurityHelper.isSecure(stack)) { 47 | location.invulnerable = true; 48 | location.isImmuneToFire = true; 49 | ((EntityItem) location).lifespan = Integer.MAX_VALUE; 50 | } 51 | return null; 52 | } 53 | 54 | @Override 55 | @SideOnly (Side.CLIENT) 56 | public FontRenderer getFontRenderer(ItemStack stack) { 57 | 58 | return FontRendererCore.loadFontRendererStack(stack); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/feature/GaussianParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.feature; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.numbers.ConstantProvider; 5 | import cofh.lib.util.numbers.INumberProvider; 6 | import cofh.lib.world.feature.FeatureBase; 7 | import cofh.lib.world.feature.FeatureBase.GenRestriction; 8 | import cofh.lib.world.feature.FeatureGenGaussian; 9 | import com.typesafe.config.Config; 10 | import com.typesafe.config.ConfigObject; 11 | import net.minecraft.world.gen.feature.WorldGenerator; 12 | import org.apache.logging.log4j.Logger; 13 | 14 | public class GaussianParser extends UniformParser { 15 | 16 | @Override 17 | protected FeatureBase getFeature(String featureName, Config genObject, WorldGenerator gen, INumberProvider numClusters, GenRestriction biomeRes, boolean retrogen, GenRestriction dimRes, Logger log) { 18 | 19 | if (!(genObject.hasPath("center-height") && genObject.hasPath("spread"))) { 20 | log.error("Height parameters for 'normal' template not specified in \"" + featureName + "\""); 21 | return null; 22 | } 23 | ConfigObject genData = genObject.root(); 24 | INumberProvider centerHeight = FeatureParser.parseNumberValue(genData.get("center-height")); 25 | INumberProvider spread = FeatureParser.parseNumberValue(genData.get("spread")); 26 | INumberProvider rolls = genObject.hasPath("smoothness") ? FeatureParser.parseNumberValue(genData.get("smoothness")) : new ConstantProvider(2); 27 | 28 | return new FeatureGenGaussian(featureName, gen, numClusters, rolls, centerHeight, spread, biomeRes, retrogen, dimRes); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/energy/FurnaceFuelHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.core.energy; 2 | 3 | import cofh.lib.util.ItemWrapper; 4 | import gnu.trove.map.hash.THashMap; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraftforge.fml.common.IFuelHandler; 7 | import net.minecraftforge.fml.common.registry.GameRegistry; 8 | 9 | import java.util.Map.Entry; 10 | 11 | public class FurnaceFuelHandler implements IFuelHandler { 12 | 13 | public static FurnaceFuelHandler instance = new FurnaceFuelHandler(); 14 | private static THashMap fuels = new THashMap<>(); 15 | 16 | public static void initialize() { 17 | 18 | GameRegistry.registerFuelHandler(instance); 19 | } 20 | 21 | private FurnaceFuelHandler() { 22 | 23 | } 24 | 25 | @Override 26 | public int getBurnTime(ItemStack fuel) { 27 | 28 | if (fuel == null || !fuels.containsKey(new ItemWrapper(fuel))) { 29 | return 0; 30 | } 31 | return fuels.get(new ItemWrapper(fuel)); 32 | } 33 | 34 | public static boolean registerFuel(ItemStack fuel, int burnTime) { 35 | 36 | if (fuel == null || burnTime <= 0 || fuels.containsKey(new ItemWrapper(fuel))) { 37 | return false; 38 | } 39 | fuels.put(new ItemWrapper(fuel), burnTime); 40 | return true; 41 | } 42 | 43 | public static void refresh() { 44 | 45 | THashMap tempMap = new THashMap<>(); 46 | 47 | for (Entry entry : fuels.entrySet()) { 48 | ItemWrapper tempItem = new ItemWrapper(entry.getKey().item, entry.getKey().metadata); 49 | tempMap.put(tempItem, entry.getValue()); 50 | } 51 | fuels.clear(); 52 | fuels = tempMap; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/BoulderParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.lib.util.WeightedRandomBlock; 4 | import cofh.lib.world.IGeneratorParser; 5 | import cofh.lib.world.WorldGenBoulder; 6 | import com.typesafe.config.Config; 7 | import net.minecraft.world.gen.feature.WorldGenerator; 8 | import org.apache.logging.log4j.Logger; 9 | 10 | import java.util.List; 11 | 12 | public class BoulderParser implements IGeneratorParser { 13 | 14 | @Override 15 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 16 | 17 | int clusterSize = genObject.getInt("diameter"); 18 | if (clusterSize <= 0) { 19 | log.warn("Invalid diameter for generator '%s'", name); 20 | return null; 21 | } 22 | 23 | WorldGenBoulder r = new WorldGenBoulder(resList, clusterSize, matList); 24 | { 25 | if (genObject.hasPath("size-variance")) { 26 | r.sizeVariance = genObject.getInt("size-variance"); 27 | } 28 | if (genObject.hasPath("count")) { 29 | r.clusters = genObject.getInt("count"); 30 | } 31 | if (genObject.hasPath("count-variance")) { 32 | r.clusterVariance = genObject.getInt("count-variance"); 33 | } 34 | if (genObject.hasPath("hollow")) { 35 | r.hollow = genObject.getBoolean("hollow"); 36 | } 37 | if (genObject.hasPath("hollow-size")) { 38 | r.hollowAmt = (float) genObject.getDouble("hollow-size"); 39 | } 40 | if (genObject.hasPath("hollow-variance")) { 41 | r.hollowVar = (float) genObject.getDouble("hollow-variance"); 42 | } 43 | } 44 | return r; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/slot/SlotAugment.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.slot; 2 | 3 | import cofh.api.core.IAugmentable; 4 | import net.minecraft.inventory.IInventory; 5 | import net.minecraft.inventory.Slot; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.tileentity.TileEntity; 8 | 9 | public class SlotAugment extends Slot { 10 | 11 | IAugmentable myTile; 12 | 13 | public SlotAugment(IAugmentable tile, IInventory inventory, int slotIndex, int x, int y) { 14 | 15 | super(inventory, slotIndex, x, y); 16 | myTile = tile; 17 | } 18 | 19 | @Override 20 | public boolean isItemValid(ItemStack stack) { 21 | 22 | return stack != null && myTile.isValidAugment(stack); 23 | } 24 | 25 | @Override 26 | public ItemStack getStack() { 27 | 28 | return myTile.getAugmentSlots()[getSlotIndex()]; 29 | } 30 | 31 | @Override 32 | public void putStack(ItemStack stack) { 33 | 34 | myTile.getAugmentSlots()[getSlotIndex()] = stack; 35 | onSlotChanged(); 36 | } 37 | 38 | @Override 39 | public void onSlotChanged() { 40 | 41 | myTile.updateAugmentStatus(); 42 | ((TileEntity) myTile).markDirty(); 43 | } 44 | 45 | @Override 46 | public int getSlotStackLimit() { 47 | 48 | return 1; 49 | } 50 | 51 | @Override 52 | public ItemStack decrStackSize(int amount) { 53 | 54 | if (myTile.getAugmentSlots()[getSlotIndex()] == null) { 55 | return null; 56 | } 57 | ItemStack stack = myTile.getAugmentSlots()[getSlotIndex()].splitStack(1); 58 | myTile.getAugmentSlots()[getSlotIndex()] = null; 59 | 60 | return stack; 61 | } 62 | 63 | @Override 64 | public boolean isHere(IInventory inventory, int slot) { 65 | 66 | return false; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/hitbox/CustomHitBox.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render.hitbox; 2 | 3 | public class CustomHitBox { 4 | 5 | public boolean drawSide[] = { false, false, false, false, false, false }; 6 | public double sideLength[] = { 0, 0, 0, 0, 0, 0 }; 7 | public double middleHeight = 0; 8 | public double middleWidth = 0; 9 | public double middleDepth = 0; 10 | public double minX = 0; 11 | public double minY = 0; 12 | public double minZ = 0; 13 | 14 | public CustomHitBox(double middleHeight, double middleWidth, double middleDepth, double minX, double minY, double minZ) { 15 | 16 | this.middleDepth = middleDepth; 17 | this.middleHeight = middleHeight; 18 | this.middleWidth = middleWidth; 19 | this.minX = minX; 20 | this.minY = minY; 21 | this.minZ = minZ; 22 | } 23 | 24 | public CustomHitBox drawSide(int side, boolean draw) { 25 | 26 | if (drawSide.length > side) { 27 | drawSide[side] = draw; 28 | } 29 | return this; 30 | } 31 | 32 | public CustomHitBox setSideLength(int side, double length) { 33 | 34 | if (sideLength.length > side) { 35 | sideLength[side] = length; 36 | } 37 | return this; 38 | } 39 | 40 | public CustomHitBox offsetForDraw(double x, double y, double z) { 41 | 42 | minX += x; 43 | minY += y; 44 | minZ += z; 45 | return this; 46 | } 47 | 48 | public CustomHitBox addExtraSpace(double extraSpace) { 49 | 50 | minX -= extraSpace; 51 | minY -= extraSpace; 52 | minZ -= extraSpace; 53 | middleDepth += extraSpace; 54 | middleHeight += extraSpace; 55 | middleWidth += extraSpace; 56 | 57 | for (int i = 0; i < sideLength.length; i++) { 58 | sideLength[i] += extraSpace; 59 | } 60 | return this; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/tileentity/IRedstoneControl.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.tileentity; 2 | 3 | /** 4 | * Implement this interface on Tile Entities which have Redstone Control functionality. This means that a tile can be set to ignore redstone entirely, or respond to a low or high redstone state. 5 | * 6 | * @author King Lemming 7 | */ 8 | public interface IRedstoneControl extends IRedstoneCache { 9 | 10 | /** 11 | * Enum for Control Modes - Disabled (Ignored), Low (False), High (True). 12 | * 13 | * @author King Lemming 14 | */ 15 | enum ControlMode { 16 | 17 | DISABLED(true), LOW(false), HIGH(true); 18 | 19 | private final boolean state; 20 | 21 | ControlMode(boolean state) { 22 | 23 | this.state = state; 24 | } 25 | 26 | public boolean isDisabled() { 27 | 28 | return this == DISABLED; 29 | } 30 | 31 | public boolean isLow() { 32 | 33 | return this == LOW; 34 | } 35 | 36 | public boolean isHigh() { 37 | 38 | return this == HIGH; 39 | } 40 | 41 | public boolean getState() { 42 | 43 | return state; 44 | } 45 | 46 | public static ControlMode stepForward(ControlMode curControl) { 47 | 48 | return curControl == DISABLED ? LOW : curControl == HIGH ? DISABLED : HIGH; 49 | } 50 | 51 | public static ControlMode stepBackward(ControlMode curControl) { 52 | 53 | return curControl == DISABLED ? HIGH : curControl == HIGH ? LOW : DISABLED; 54 | } 55 | } 56 | 57 | /** 58 | * Attempt to set the Control Mode of a Tile Entity. Returns TRUE on successful change. 59 | */ 60 | boolean setControl(ControlMode control); 61 | 62 | /** 63 | * Gets the current Control Mode of a Tile Entity. 64 | */ 65 | ControlMode getControl(); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/fr_FR.lang: -------------------------------------------------------------------------------- 1 | #fr_FR 2 | 3 | info.cofh.access=Accès 4 | info.cofh.accessMode=Mode d'accès 5 | info.cofh.accessPrivate=Propriétaire Seulement 6 | info.cofh.accessPublic=Public 7 | info.cofh.accessRestricted=Restreint 8 | info.cofh.all=Tous 9 | info.cofh.amount=Montant 10 | info.cofh.blank=Vierge 11 | info.cofh.contents=Contenu 12 | info.cofh.controlStatus=Statut de Control 13 | info.cofh.damageAttack=Dommage d'attaque 14 | info.cofh.damageFlux=Dommage de Flux 15 | info.cofh.disabled=Désactivé 16 | info.cofh.empty=Vide 17 | info.cofh.enabled=Activé 18 | info.cofh.energy=Énergie 19 | info.cofh.energyConsume=Consommation d'énergie 20 | info.cofh.energyProduce=Énergie produite 21 | info.cofh.energyStored=Énergie Stockée 22 | info.cofh.fluid=Fluide 23 | info.cofh.frequency=Fréquence 24 | info.cofh.high=État Haut 25 | info.cofh.ignored=Ignoré 26 | info.cofh.infinite=Infini 27 | info.cofh.item=Objet 28 | info.cofh.items=Objets 29 | info.cofh.level=Niveau 30 | info.cofh.locked=Fermé 31 | info.cofh.low=État Bas 32 | info.cofh.maxPower=Énergie Maximale 33 | info.cofh.none=Aucune 34 | info.cofh.owner=Propriétaire 35 | info.cofh.press=Presser 36 | info.cofh.receive=Recevoir 37 | info.cofh.receiving=Reçoit 38 | info.cofh.redstoneControl=Contrôle de Redstone 39 | info.cofh.security=Sécurité 40 | info.cofh.send=Envoyer 41 | info.cofh.sending=Envoie 42 | info.cofh.signalRequired=Signal nécessaire 43 | info.cofh.tutorial.fluxRequired=A besoin d'un signal de redstone pour fonctionner. 44 | info.cofh.tutorial.tabRedstone=L'onglet de Contrôle Redstone configure la façon dont cette machine réagit à la Redstone. 45 | info.cofh.tutorial=Tutoriel 46 | info.cofh.unlocked=Déverrouillé 47 | 48 | item.invalid.name=Objet Invalide (Détruire) 49 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/FMLEventHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util; 2 | 3 | import cofh.core.energy.FurnaceFuelHandler; 4 | import cofh.core.init.CoreProps; 5 | import cofh.core.network.PacketCore; 6 | import cofh.core.util.oredict.OreDictionaryArbiter; 7 | import cofh.lib.util.helpers.ServerHelper; 8 | import cofh.lib.util.helpers.StringHelper; 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.util.text.TextComponentString; 11 | import net.minecraft.util.text.TextComponentTranslation; 12 | import net.minecraftforge.common.MinecraftForge; 13 | import net.minecraftforge.fml.common.Mod.EventHandler; 14 | import net.minecraftforge.fml.common.event.FMLModIdMappingEvent; 15 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 16 | import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; 17 | 18 | public class FMLEventHandler { 19 | 20 | public static FMLEventHandler instance = new FMLEventHandler(); 21 | 22 | public static void initialize() { 23 | 24 | MinecraftForge.EVENT_BUS.register(instance); 25 | } 26 | 27 | @SubscribeEvent 28 | public void onPlayerLogin(PlayerLoggedInEvent event) { 29 | 30 | EntityPlayer player = event.player; 31 | if (ServerHelper.isMultiPlayerServer() && CoreProps.enableOpSecureAccess && CoreProps.enableOpSecureAccessWarning) { 32 | player.addChatMessage(new TextComponentString(StringHelper.YELLOW + "[CoFH] ").appendSibling(new TextComponentTranslation("chat.cofh.secure.notice"))); 33 | } 34 | PacketCore.sendConfigSyncPacketToClient(event.player); 35 | handleIdMappingEvent(null); 36 | } 37 | 38 | @EventHandler 39 | public void handleIdMappingEvent(FMLModIdMappingEvent event) { 40 | 41 | FurnaceFuelHandler.refresh(); 42 | OreDictionaryArbiter.initialize(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/es_ES.lang: -------------------------------------------------------------------------------- 1 | #es_ES 2 | 3 | info.cofh.access=Acceso 4 | info.cofh.accessMode=Modo de Acceso 5 | info.cofh.accessPrivate=Solo su Dueño 6 | info.cofh.accessPublic=Acceso Público 7 | info.cofh.accessRestricted=Restringido 8 | info.cofh.all=Todo 9 | info.cofh.amount=Cantidad 10 | info.cofh.blank=en Blanco 11 | info.cofh.charge=Carga 12 | info.cofh.contents=Contenidos 13 | info.cofh.controlStatus=Control de Estado 14 | info.cofh.damageAttack=Daño de Ataque 15 | info.cofh.damageFlux=Daño de Flujo 16 | info.cofh.disabled=Desabilitado 17 | info.cofh.empty=Vacio 18 | info.cofh.enabled=Habilitado 19 | info.cofh.energy=Energía 20 | info.cofh.energyConsume=Energía Consumida 21 | info.cofh.energyProduce=Energía Producida 22 | info.cofh.energyStored=Energía Almacenada 23 | info.cofh.fluid=Fluido 24 | info.cofh.frequency=Frecuencia 25 | info.cofh.high=Alta 26 | info.cofh.ignored=Ignorada 27 | info.cofh.infinite=Infinito 28 | info.cofh.information=Información 29 | info.cofh.item=Objeto 30 | info.cofh.items=Objetos 31 | info.cofh.level=Nivel 32 | info.cofh.locked=Bloqueado 33 | info.cofh.low=Baja 34 | info.cofh.maxPower=Potencia Máxica 35 | info.cofh.owner=Dueño 36 | info.cofh.press=Presionar 37 | info.cofh.receive=Recivir 38 | info.cofh.receiving=Reciviendo 39 | info.cofh.redstoneControl=Control de Redstone 40 | info.cofh.security=Seguridad 41 | info.cofh.send=Enviar 42 | info.cofh.sending=Enviando 43 | info.cofh.signal=Señal 44 | info.cofh.signalRequired=Señal Requerida 45 | info.cofh.source=Origen 46 | info.cofh.tutorial.fluxRequired=Necesita un flujo de redstone para funcionar. 47 | info.cofh.tutorial.tabRedstone=La pestaña de control de redstone configura cómo este dispositivo reacciona a las señales de redstone. 48 | info.cofh.unlocked=Desbloqueado 49 | 50 | item.invalid.name=Objeto Invalido (Destruir) 51 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/GeodeParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.world.IGeneratorParser; 6 | import cofh.lib.world.WorldGenGeode; 7 | import com.typesafe.config.Config; 8 | import net.minecraft.init.Blocks; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | import org.apache.logging.log4j.Logger; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class GeodeParser implements IGeneratorParser { 16 | 17 | @Override 18 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 19 | 20 | ArrayList list = new ArrayList<>(); 21 | if (!genObject.hasPath("crust")) { 22 | log.info("Entry does not specify crust for 'geode' generator. Using stone."); 23 | list.add(new WeightedRandomBlock(Blocks.STONE)); 24 | } else { 25 | if (!FeatureParser.parseResList(genObject.root().get("crust"), list, true)) { 26 | log.warn("Entry specifies invalid crust for 'geode' generator! Using obsidian!"); 27 | list.clear(); 28 | list.add(new WeightedRandomBlock(Blocks.OBSIDIAN)); 29 | } 30 | } 31 | WorldGenGeode r = new WorldGenGeode(resList, matList, list); 32 | { 33 | if (genObject.hasPath("hollow")) { 34 | r.setHollow(genObject.getBoolean("hollow")); 35 | } 36 | if (genObject.hasPath("filler")) { 37 | list = new ArrayList<>(); 38 | if (!FeatureParser.parseResList(genObject.getValue("filler"), list, true)) { 39 | log.warn("Entry specifies invalid filler for 'geode' generator! Not filling!"); 40 | } else { 41 | r.setFillBlock(list); 42 | } 43 | } 44 | } 45 | return r; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/block/ItemBlockCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.block; 2 | 3 | import cofh.core.render.FontRendererCore; 4 | import cofh.core.util.helpers.SecurityHelper; 5 | import cofh.lib.util.helpers.StringHelper; 6 | import net.minecraft.block.Block; 7 | import net.minecraft.client.gui.FontRenderer; 8 | import net.minecraft.entity.Entity; 9 | import net.minecraft.entity.item.EntityItem; 10 | import net.minecraft.item.ItemBlock; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraft.world.World; 13 | import net.minecraftforge.fml.relauncher.Side; 14 | import net.minecraftforge.fml.relauncher.SideOnly; 15 | 16 | public class ItemBlockCore extends ItemBlock { 17 | 18 | public ItemBlockCore(Block block) { 19 | 20 | super(block); 21 | setHasSubtypes(true); 22 | setMaxDamage(0); 23 | setNoRepair(); 24 | } 25 | 26 | @Override 27 | public String getItemStackDisplayName(ItemStack stack) { 28 | 29 | return StringHelper.localize(getUnlocalizedName(stack)); 30 | } 31 | 32 | @Override 33 | public int getMetadata(int i) { 34 | 35 | return i; 36 | } 37 | 38 | @Override 39 | public boolean hasCustomEntity(ItemStack stack) { 40 | 41 | return SecurityHelper.isSecure(stack); 42 | } 43 | 44 | @Override 45 | public boolean isItemTool(ItemStack stack) { 46 | 47 | return false; 48 | } 49 | 50 | @Override 51 | public Entity createEntity(World world, Entity location, ItemStack stack) { 52 | 53 | if (SecurityHelper.isSecure(stack)) { 54 | location.invulnerable = true; 55 | location.isImmuneToFire = true; 56 | ((EntityItem) location).lifespan = Integer.MAX_VALUE; 57 | } 58 | return null; 59 | } 60 | 61 | @Override 62 | @SideOnly (Side.CLIENT) 63 | public FontRenderer getFontRenderer(ItemStack stack) { 64 | 65 | return FontRendererCore.loadFontRendererStack(stack); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/repack/immibis/bon/mcp/SrgFile.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.repack.immibis.bon.mcp; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.Scanner; 10 | 11 | public class SrgFile { 12 | 13 | public Map classes = new HashMap<>(); // name -> name 14 | public Map fields = new HashMap<>(); // owner/name -> name 15 | public Map methods = new HashMap<>(); // owner/namedesc -> name 16 | 17 | public static String getLastComponent(String s) { 18 | 19 | String[] parts = s.split("/"); 20 | return parts[parts.length - 1]; 21 | } 22 | 23 | public SrgFile(File f, boolean reverse) throws IOException { 24 | 25 | try (Scanner in = new Scanner(new BufferedReader(new FileReader(f)))) { 26 | while (in.hasNextLine()) { 27 | if (in.hasNext("CL:")) { 28 | in.next(); 29 | String obf = in.next(); 30 | String deobf = in.next(); 31 | if (reverse) { 32 | classes.put(deobf, obf); 33 | } else { 34 | classes.put(obf, deobf); 35 | } 36 | } else if (in.hasNext("FD:")) { 37 | in.next(); 38 | String obf = in.next(); 39 | String deobf = in.next(); 40 | if (reverse) { 41 | fields.put(deobf, getLastComponent(obf)); 42 | } else { 43 | fields.put(obf, getLastComponent(deobf)); 44 | } 45 | } else if (in.hasNext("MD:")) { 46 | in.next(); 47 | String obf = in.next(); 48 | String obfdesc = in.next(); 49 | String deobf = in.next(); 50 | String deobfdesc = in.next(); 51 | if (reverse) { 52 | methods.put(deobf + deobfdesc, getLastComponent(obf)); 53 | } else { 54 | methods.put(obf + obfdesc, getLastComponent(deobf)); 55 | } 56 | } else { 57 | in.nextLine(); 58 | } 59 | } 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/oredict/OreDictionaryArbiterProxy.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.oredict; 2 | 3 | import cofh.lib.util.OreDictionaryProxy; 4 | import cofh.lib.util.helpers.ItemHelper; 5 | import net.minecraft.item.ItemStack; 6 | 7 | /** 8 | * If CoFHCore is present, an instance of this class is initialized by the OreDictionaryArbiter and the functionality in ItemHelper is much improved. 9 | *

10 | * Translation: Don't touch. 11 | * 12 | * @author King Lemming 13 | */ 14 | public class OreDictionaryArbiterProxy extends OreDictionaryProxy { 15 | 16 | @Override 17 | public final ItemStack getOre(String oreName) { 18 | 19 | if (OreDictionaryArbiter.getOres(oreName) == null) { 20 | return null; 21 | } 22 | return ItemHelper.cloneStack(OreDictionaryArbiter.getOres(oreName).get(0), 1); 23 | } 24 | 25 | @Override 26 | public final int getOreID(ItemStack stack) { 27 | 28 | return OreDictionaryArbiter.getOreID(stack); 29 | } 30 | 31 | @Override 32 | public final int getOreID(String oreName) { 33 | 34 | return OreDictionaryArbiter.getOreID(oreName); 35 | } 36 | 37 | @Override 38 | public final String getOreName(ItemStack stack) { 39 | 40 | return OreDictionaryArbiter.getOreName(OreDictionaryArbiter.getOreID(stack)); 41 | } 42 | 43 | @Override 44 | public final String getOreName(int oreID) { 45 | 46 | return OreDictionaryArbiter.getOreName(oreID); 47 | } 48 | 49 | @Override 50 | public final boolean isOreIDEqual(ItemStack stack, int oreID) { 51 | 52 | return OreDictionaryArbiter.getOreID(stack) == oreID; 53 | } 54 | 55 | @Override 56 | public final boolean isOreNameEqual(ItemStack stack, String oreName) { 57 | 58 | return OreDictionaryArbiter.getOreName(OreDictionaryArbiter.getOreID(stack)).equals(oreName); 59 | } 60 | 61 | @Override 62 | public final boolean oreNameExists(String oreName) { 63 | 64 | return OreDictionaryArbiter.getOres(oreName) != null; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/GuiTextEntry.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui; 2 | 3 | import net.minecraft.client.gui.FontRenderer; 4 | import net.minecraft.client.gui.Gui; 5 | import net.minecraftforge.fml.relauncher.Side; 6 | import net.minecraftforge.fml.relauncher.SideOnly; 7 | 8 | @SideOnly (Side.CLIENT) 9 | public class GuiTextEntry extends Gui { 10 | 11 | public static final int X_OFFSET = 4; 12 | public static final int Y_OFFSET = 2; 13 | 14 | protected final FontRenderer fRend; 15 | public int xPos = 0; 16 | public int yPos = 0; 17 | 18 | public int width = 12; 19 | public int height = 12; 20 | 21 | public boolean drawBackground = true; 22 | public boolean drawBorder = true; 23 | public boolean isEnabled = true; 24 | public boolean isFocused = false; 25 | 26 | /** 27 | * Color Configuration 28 | */ 29 | public int borderColor = -6250336; 30 | public int backgroundColor = -16777216; 31 | public int selectedLineColor = -16777216; 32 | public int textColor = 14737632; 33 | public int selectedTextColor = 14737632; 34 | 35 | public GuiTextEntry(FontRenderer fontRenderer, int x, int y, int w, int h) { 36 | 37 | fRend = fontRenderer; 38 | 39 | xPos = x; 40 | yPos = y; 41 | width = w; 42 | height = h; 43 | } 44 | 45 | public void drawBackground() { 46 | 47 | if (drawBorder) { 48 | drawRect(xPos - 1, yPos - 1, xPos + width + 1, yPos + height + 1, borderColor); 49 | } 50 | if (drawBackground) { 51 | drawRect(xPos, yPos, xPos + width, yPos + height, backgroundColor); 52 | } 53 | } 54 | 55 | public void drawText() { 56 | 57 | } 58 | 59 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 60 | 61 | } 62 | 63 | public void setEnabled(boolean enable) { 64 | 65 | isEnabled = enable; 66 | } 67 | 68 | public void setFocused(boolean focus) { 69 | 70 | isFocused = focus; 71 | } 72 | 73 | public boolean keyTyped(char par1, int par2) { 74 | 75 | return true; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/asm/hooks.asm: -------------------------------------------------------------------------------- 1 | list i_preGenWorld 2 | ALOAD 2 3 | ILOAD 0 4 | ILOAD 1 5 | INVOKESTATIC cofh/asm/hooks/ASMHooks.preGenerateWorld(Lnet/minecraft/world/World;II)V 6 | 7 | list i_postGenWorld 8 | ALOAD 2 9 | ILOAD 0 10 | ILOAD 1 11 | INVOKESTATIC cofh/asm/hooks/ASMHooks.postGenerateWorld(Lnet/minecraft/world/World;II)V 12 | 13 | list n_fogColor 14 | ALOAD 0 15 | GETFIELD net/minecraft/client/renderer/EntityRenderer.field_78535_ad : F 16 | ALOAD 0 17 | GETFIELD net/minecraft/client/renderer/EntityRenderer.field_78539_ae : F 18 | ALOAD 0 19 | GETFIELD net/minecraft/client/renderer/EntityRenderer.field_78535_ad : F 20 | 21 | list i_fogColor 22 | ALOAD 12 23 | INVOKEINTERFACE net/minecraft/block/state/IBlockState.func_177230_c ()Lnet/minecraft/block/Block; 24 | INSTANCEOF cofh/core/block/IFogOverlay 25 | IFEQ LEND 26 | ALOAD 12 27 | INVOKEINTERFACE net/minecraft/block/state/IBlockState.func_177230_c ()Lnet/minecraft/block/Block; 28 | ALOAD 12 29 | ALOAD 3 30 | ALOAD 0 31 | GETFIELD net/minecraft/client/renderer/EntityRenderer.field_175080_Q : F 32 | ALOAD 0 33 | GETFIELD net/minecraft/client/renderer/EntityRenderer.field_175082_R : F 34 | ALOAD 0 35 | GETFIELD net/minecraft/client/renderer/EntityRenderer.field_175081_S : F 36 | INVOKEINTERFACE cofh/core/block/IFogOverlay.getFog (Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/Entity;FFF)Lnet/minecraft/util/math/Vec3d; 37 | ASTORE 13 38 | ALOAD 0 39 | ALOAD 13 40 | GETFIELD net/minecraft/util/math/Vec3d.field_72450_a : D 41 | D2F 42 | PUTFIELD net/minecraft/client/renderer/EntityRenderer.field_175080_Q : F 43 | ALOAD 0 44 | ALOAD 13 45 | GETFIELD net/minecraft/util/math/Vec3d.field_72448_b : D 46 | D2F 47 | PUTFIELD net/minecraft/client/renderer/EntityRenderer.field_175082_R : F 48 | ALOAD 0 49 | ALOAD 13 50 | GETFIELD net/minecraft/util/math/Vec3d.field_72449_c : D 51 | D2F 52 | PUTFIELD net/minecraft/client/renderer/EntityRenderer.field_175081_S : F 53 | GOTO LEND 54 | LEND 55 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/helpers/AugmentHelper.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.helpers; 2 | 3 | import cofh.api.core.IAugmentable; 4 | import cofh.api.item.IAugmentItem; 5 | import cofh.api.item.IAugmentItem.AugmentType; 6 | import cofh.api.item.IUpgradeItem; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.nbt.NBTTagCompound; 9 | import net.minecraft.nbt.NBTTagList; 10 | 11 | public class AugmentHelper { 12 | 13 | private AugmentHelper() { 14 | 15 | } 16 | 17 | /* NBT TAG HELPERS */ 18 | public static NBTTagCompound setItemStackTagAugments(NBTTagCompound tag, IAugmentable tile) { 19 | 20 | if (tile == null) { 21 | return null; 22 | } 23 | if (tag == null) { 24 | tag = new NBTTagCompound(); 25 | } 26 | writeAugmentsToNBT(tag, tile.getAugmentSlots()); 27 | return tag; 28 | } 29 | 30 | public static void writeAugmentsToNBT(NBTTagCompound nbt, ItemStack[] augments) { 31 | 32 | if (augments.length <= 0) { 33 | return; 34 | } 35 | NBTTagList list = new NBTTagList(); 36 | for (int i = 0; i < augments.length; i++) { 37 | if (augments[i] != null) { 38 | NBTTagCompound tag = new NBTTagCompound(); 39 | tag.setInteger("Slot", i); 40 | augments[i].writeToNBT(tag); 41 | list.appendTag(tag); 42 | } 43 | } 44 | nbt.setTag("Augments", list); 45 | } 46 | 47 | /* ITEM HELPERS */ 48 | public static boolean isAugmentItem(ItemStack stack) { 49 | 50 | return stack != null && stack.getItem() instanceof IAugmentItem; 51 | } 52 | 53 | public static AugmentType getAugmentType(ItemStack stack) { 54 | 55 | return ((IAugmentItem) stack.getItem()).getAugmentType(stack); 56 | } 57 | 58 | public static String getAugmentIdentifier(ItemStack stack) { 59 | 60 | return ((IAugmentItem) stack.getItem()).getAugmentIdentifier(stack); 61 | } 62 | 63 | public static boolean isUpgradeItem(ItemStack stack) { 64 | 65 | return stack != null && stack.getItem() instanceof IUpgradeItem; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/LakeParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.world.IGeneratorParser; 6 | import cofh.lib.world.WorldGenAdvLakes; 7 | import com.typesafe.config.Config; 8 | import net.minecraft.world.gen.feature.WorldGenerator; 9 | import org.apache.logging.log4j.Logger; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public class LakeParser implements IGeneratorParser { 15 | 16 | @Override 17 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 18 | 19 | boolean useMaterial = false; 20 | { 21 | useMaterial = genObject.hasPath("use-material") ? genObject.getBoolean("use-material") : useMaterial; 22 | } 23 | WorldGenAdvLakes r = new WorldGenAdvLakes(resList, useMaterial ? matList : null); 24 | { 25 | ArrayList list = new ArrayList<>(); 26 | if (genObject.hasPath("outline-block")) { 27 | if (!FeatureParser.parseResList(genObject.root().get("outline-block"), list, true)) { 28 | log.warn("Entry specifies invalid outline-block for 'lake' generator! Not outlining!"); 29 | } else { 30 | r.setOutlineBlock(list); 31 | } 32 | list = new ArrayList<>(); 33 | } 34 | if (genObject.hasPath("gap-block")) { 35 | if (!FeatureParser.parseResList(genObject.getValue("gap-block"), list, true)) { 36 | log.warn("Entry specifies invalid gap block for 'lake' generator! Not filling!"); 37 | } else { 38 | r.setGapBlock(list); 39 | } 40 | } 41 | if (genObject.hasPath("solid-outline")) { 42 | r.setSolidOutline(genObject.getBoolean("solid-outline")); 43 | } 44 | if (genObject.hasPath("total-outline")) { 45 | r.setTotalOutline(genObject.getBoolean("total-outline")); 46 | } 47 | } 48 | return r; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui; 2 | 3 | import cofh.core.block.TileCore; 4 | import cofh.core.gui.client.GuiAugments; 5 | import cofh.core.gui.client.GuiFriendList; 6 | import cofh.core.gui.container.ContainerAugments; 7 | import cofh.core.gui.container.ContainerFriendsList; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | import net.minecraft.tileentity.TileEntity; 10 | import net.minecraft.util.math.BlockPos; 11 | import net.minecraft.world.World; 12 | import net.minecraftforge.fml.common.network.IGuiHandler; 13 | 14 | @SuppressWarnings ({ "rawtypes", "unchecked" }) 15 | public class GuiHandler implements IGuiHandler { 16 | 17 | public static final int TILE_ID = 0; 18 | public static final int FRIENDS_ID = 1; 19 | public static final int AUGMENTS_ID = 2; 20 | 21 | @Override 22 | public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { 23 | 24 | switch (id) { 25 | case TILE_ID: 26 | TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); 27 | if (tile instanceof TileCore) { 28 | return ((TileCore) tile).getGuiClient(player.inventory); 29 | } 30 | return null; 31 | case FRIENDS_ID: 32 | return new GuiFriendList(player.inventory); 33 | case AUGMENTS_ID: 34 | return new GuiAugments(player.inventory); 35 | default: 36 | return null; 37 | } 38 | } 39 | 40 | @Override 41 | public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { 42 | 43 | switch (id) { 44 | case TILE_ID: 45 | TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); 46 | if (tile instanceof TileCore) { 47 | return ((TileCore) tile).getGuiServer(player.inventory); 48 | } 49 | return null; 50 | case FRIENDS_ID: 51 | return new ContainerFriendsList(player.inventory); 52 | case AUGMENTS_ID: 53 | return new ContainerAugments(player.inventory); 54 | default: 55 | return null; 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/SpikeParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.lib.util.WeightedRandomBlock; 4 | import cofh.lib.world.IGeneratorParser; 5 | import cofh.lib.world.WorldGenSpike; 6 | import com.typesafe.config.Config; 7 | import net.minecraft.world.gen.feature.WorldGenerator; 8 | import org.apache.logging.log4j.Logger; 9 | 10 | import java.util.List; 11 | 12 | public class SpikeParser implements IGeneratorParser { 13 | 14 | @Override 15 | public WorldGenerator parseGenerator(String generatorName, Config genObject, Logger log, List resList, List matList) { 16 | 17 | WorldGenSpike r = new WorldGenSpike(resList, matList); 18 | { 19 | if (genObject.hasPath("min-height")) { 20 | r.minHeight = genObject.getInt("min-height"); 21 | } 22 | if (genObject.hasPath("height-variance")) { 23 | r.heightVariance = genObject.getInt("height-variance"); 24 | } 25 | if (genObject.hasPath("size-variance")) { 26 | r.sizeVariance = genObject.getInt("size-variance"); 27 | } 28 | if (genObject.hasPath("position-variance")) { 29 | r.positionVariance = genObject.getInt("position-variance"); 30 | } 31 | // TODO: these fields need addressed. combined into a sub-object? 32 | if (genObject.hasPath("large-spikes")) { 33 | r.largeSpikes = genObject.getBoolean("large-spikes"); 34 | } 35 | if (genObject.hasPath("large-spike-chance")) { 36 | r.largeSpikeChance = genObject.getInt("large-spike-chance"); 37 | } 38 | if (genObject.hasPath("min-large-spike-height-gain")) { 39 | r.minLargeSpikeHeightGain = genObject.getInt("min-large-spike-height-gain"); 40 | } 41 | if (genObject.hasPath("large-spike-height-variance")) { 42 | r.largeSpikeHeightVariance = genObject.getInt("large-spike-height-variance"); 43 | } 44 | if (genObject.hasPath("large-spike-filler-size")) { 45 | r.largeSpikeFillerSize = genObject.getInt("large-spike-filler-size"); 46 | } 47 | } 48 | return r; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/fluid/BlockFluidInteractive.java: -------------------------------------------------------------------------------- 1 | package cofh.core.fluid; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraftforge.fluids.Fluid; 7 | 8 | import java.util.HashMap; 9 | 10 | public class BlockFluidInteractive extends BlockFluidCore { 11 | 12 | private final HashMap collisionMap = new HashMap<>(); 13 | private final HashMap anyState = new HashMap<>(); 14 | 15 | public BlockFluidInteractive(Fluid fluid, Material material, String name) { 16 | 17 | super(fluid, material, name); 18 | } 19 | 20 | public BlockFluidInteractive(Fluid fluid, Material material, String modName, String name) { 21 | 22 | super(fluid, material, modName, name); 23 | } 24 | 25 | public boolean addInteraction(Block preBlock, Block postBlock) { 26 | 27 | if (preBlock == null || postBlock == null) { 28 | return false; 29 | } 30 | return addInteraction(preBlock.getDefaultState(), postBlock.getDefaultState(), true); 31 | } 32 | 33 | public boolean addInteraction(IBlockState pre, IBlockState post) { 34 | 35 | return addInteraction(pre, post, false); 36 | } 37 | 38 | public boolean addInteraction(IBlockState pre, IBlockState post, boolean anyState) { 39 | 40 | if (pre == null || post == null) { 41 | return false; 42 | } 43 | if (anyState) { 44 | this.anyState.put(pre.getBlock(), post); 45 | } else { 46 | collisionMap.put(pre, post); 47 | } 48 | return true; 49 | } 50 | 51 | public boolean addInteraction(IBlockState pre, Block postBlock) { 52 | 53 | return addInteraction(pre, postBlock.getDefaultState(), false); 54 | } 55 | 56 | public boolean hasInteraction(IBlockState state) { 57 | 58 | return collisionMap.containsKey(state) || anyState.containsKey(state.getBlock()); 59 | } 60 | 61 | public IBlockState getInteraction(IBlockState state) { 62 | 63 | if (collisionMap.containsKey(state)) { 64 | return collisionMap.get(state); 65 | } 66 | return anyState.get(state.getBlock()); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemSickleCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.world.World; 11 | 12 | public class ItemSickleCore extends ItemToolCore { 13 | 14 | protected int radius = 3; 15 | 16 | public ItemSickleCore(ToolMaterial toolMaterial) { 17 | 18 | super(3.0F, -2.6F, toolMaterial); 19 | addToolClass("sickle"); 20 | 21 | setMaxDamage(toolMaterial.getMaxUses() * 4); 22 | 23 | effectiveBlocks.add(Blocks.WEB); 24 | effectiveBlocks.add(Blocks.VINE); 25 | effectiveBlocks.add(Blocks.LEAVES); 26 | effectiveBlocks.add(Blocks.LEAVES2); 27 | 28 | effectiveMaterials.add(Material.LEAVES); 29 | effectiveMaterials.add(Material.PLANTS); 30 | effectiveMaterials.add(Material.VINE); 31 | effectiveMaterials.add(Material.WEB); 32 | } 33 | 34 | public ItemSickleCore setRadius(int radius) { 35 | 36 | this.radius = radius; 37 | return this; 38 | } 39 | 40 | @Override 41 | public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player) { 42 | 43 | World world = player.worldObj; 44 | IBlockState state = world.getBlockState(pos); 45 | 46 | if (!canHarvestBlock(state, stack)) { 47 | if (!player.capabilities.isCreativeMode) { 48 | stack.damageItem(1, player); 49 | } 50 | return false; 51 | } 52 | int x = pos.getX(); 53 | // int y = pos.getY(); 54 | int z = pos.getZ(); 55 | 56 | int used = 0; 57 | world.playEvent(2001, pos, Block.getStateId(state)); 58 | 59 | for (int i = x - radius; i <= x + radius; i++) { 60 | for (int k = z - radius; k <= z + radius; k++) { 61 | if (harvestBlock(world, new BlockPos(i, pos.getY(), k), player)) { 62 | used++; 63 | } 64 | } 65 | } 66 | if (used > 0 && !player.capabilities.isCreativeMode) { 67 | stack.damageItem(used, player); 68 | } 69 | return false; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/slot/SlotPlayerAugment.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.slot; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.inventory.Slot; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | 8 | public class SlotPlayerAugment extends Slot { 9 | 10 | public static final String AUGMENT_KEY = "cofhAugment"; 11 | EntityPlayer thePlayer; 12 | 13 | public SlotPlayerAugment(EntityPlayer thePlayer, int slotIndex, int x, int y) { 14 | 15 | super(null, slotIndex, x, y); 16 | this.thePlayer = thePlayer; 17 | 18 | } 19 | 20 | @Override 21 | public boolean isItemValid(ItemStack stack) { 22 | 23 | return stack != null; 24 | } 25 | 26 | @Override 27 | public ItemStack getStack() { 28 | 29 | if (thePlayer.getEntityData().hasKey(AUGMENT_KEY + getSlotIndex())) { 30 | return ItemStack.loadItemStackFromNBT(thePlayer.getEntityData().getCompoundTag("cofhAugment" + getSlotIndex())); 31 | } 32 | 33 | return null; 34 | } 35 | 36 | @Override 37 | public void putStack(ItemStack newStack) { 38 | 39 | if (newStack == null || newStack.stackSize <= 0) { 40 | thePlayer.getEntityData().removeTag(AUGMENT_KEY + getSlotIndex()); 41 | } else { 42 | NBTTagCompound temp = new NBTTagCompound(); 43 | newStack.writeToNBT(temp); 44 | thePlayer.getEntityData().setTag(AUGMENT_KEY + getSlotIndex(), temp); 45 | } 46 | this.onSlotChanged(); 47 | } 48 | 49 | @Override 50 | public void onSlotChanged() { 51 | 52 | } 53 | 54 | @Override 55 | public int getSlotStackLimit() { 56 | 57 | return 1; 58 | } 59 | 60 | @Override 61 | public ItemStack decrStackSize(int amt) { 62 | 63 | ItemStack tempStack = getStack(); 64 | if (tempStack != null) { 65 | ItemStack itemstack; 66 | 67 | if (tempStack.stackSize <= amt) { 68 | putStack(null); 69 | return tempStack; 70 | } else { 71 | itemstack = tempStack.splitStack(amt); 72 | 73 | if (tempStack.stackSize == 0) { 74 | putStack(null); 75 | } else { 76 | putStack(tempStack); 77 | } 78 | 79 | return itemstack; 80 | } 81 | } else { 82 | return null; 83 | } 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/font/RenderSprite.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render.font; 2 | 3 | import cofh.core.render.FontRendererCore; 4 | import net.minecraft.util.ResourceLocation; 5 | import org.lwjgl.opengl.GL11; 6 | 7 | public class RenderSprite implements ICustomCharRenderer { 8 | 9 | public final char underlyingCharacter; 10 | private final ResourceLocation textureSheet; 11 | 12 | private final float u, v, w, h, sw, rw; 13 | private final int bw; 14 | 15 | public RenderSprite(char underlyingCharacter, ResourceLocation textureSheet, float u, float v, float w, float h) { 16 | 17 | this.underlyingCharacter = underlyingCharacter; 18 | this.textureSheet = textureSheet; 19 | this.u = u; 20 | this.v = v; 21 | this.w = w; 22 | this.h = h; 23 | 24 | this.sw = w / h * 7.99F; 25 | this.rw = w / h * 8.02F; 26 | this.bw = (int) Math.ceil(w / h * 8 - 0.0002f); 27 | } 28 | 29 | @Override 30 | public float renderChar(char letter, boolean italicFlag, float x, float y, FontRendererCore fontRenderer) { 31 | 32 | GL11.glColor4f(1, 1, 1, 1); 33 | fontRenderer.bindTexture(textureSheet); 34 | 35 | float italicOffset = italicFlag ? 1.0F : 0.0F; 36 | GL11.glBegin(GL11.GL_TRIANGLE_STRIP); 37 | GL11.glTexCoord2f(u / 256.0F, v / 256.0F); 38 | GL11.glVertex3f(x + italicOffset, y, 0.0F); 39 | GL11.glTexCoord2f(u / 256.0F, (v + h) / 256.0F); 40 | GL11.glVertex3f(x - italicOffset, y + 7.99F, 0.0F); 41 | GL11.glTexCoord2f((u + w) / 256.0F, v / 256.0F); 42 | GL11.glVertex3f(x + sw + italicOffset, y, 0.0F); 43 | GL11.glTexCoord2f((u + w) / 256.0F, (v + h) / 256.0F); 44 | GL11.glVertex3f(x + sw - italicOffset, y + 7.99F, 0.0F); 45 | GL11.glEnd(); 46 | 47 | fontRenderer.resetColor(); 48 | 49 | return rw; 50 | } 51 | 52 | @Override 53 | public int getCharWidth(char letter, FontRendererCore fontRenderer) { 54 | 55 | return bw; 56 | } 57 | 58 | public static char addRenderer(char c, ResourceLocation texture, int u, int v, int w, int h, FontRendererCore fontRenderer) { 59 | 60 | RenderSprite renderSprite = new RenderSprite(c, texture, u, v, w, h); 61 | fontRenderer.renderOverrides.put(c, renderSprite); 62 | return c; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/tool/ItemShovelCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item.tool; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.init.SoundEvents; 9 | import net.minecraft.item.ItemSpade; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.util.EnumActionResult; 12 | import net.minecraft.util.EnumFacing; 13 | import net.minecraft.util.EnumHand; 14 | import net.minecraft.util.SoundCategory; 15 | import net.minecraft.util.math.BlockPos; 16 | import net.minecraft.world.World; 17 | 18 | public class ItemShovelCore extends ItemToolCore { 19 | 20 | public ItemShovelCore(ToolMaterial toolMaterial) { 21 | 22 | super(1.0F, -3.0F, toolMaterial); 23 | addToolClass("shovel"); 24 | 25 | effectiveBlocks.addAll(ItemSpade.EFFECTIVE_ON); 26 | 27 | effectiveMaterials.add(Material.GROUND); 28 | effectiveMaterials.add(Material.GRASS); 29 | effectiveMaterials.add(Material.SAND); 30 | effectiveMaterials.add(Material.SNOW); 31 | effectiveMaterials.add(Material.CRAFTED_SNOW); 32 | effectiveMaterials.add(Material.CLAY); 33 | } 34 | 35 | public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { 36 | 37 | if (!playerIn.canPlayerEdit(pos.offset(facing), facing, stack)) { 38 | return EnumActionResult.FAIL; 39 | } else { 40 | IBlockState state = worldIn.getBlockState(pos); 41 | Block block = state.getBlock(); 42 | 43 | if (facing != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR && block == Blocks.GRASS) { 44 | worldIn.playSound(playerIn, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F); 45 | 46 | if (!worldIn.isRemote) { 47 | worldIn.setBlockState(pos, Blocks.GRASS_PATH.getDefaultState(), 11); 48 | stack.damageItem(1, playerIn); 49 | } 50 | return EnumActionResult.SUCCESS; 51 | } else { 52 | return EnumActionResult.PASS; 53 | } 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/feature/FractalParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.feature; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.numbers.INumberProvider; 5 | import cofh.lib.world.feature.FeatureBase; 6 | import cofh.lib.world.feature.FeatureBase.GenRestriction; 7 | import cofh.lib.world.feature.FeatureGenLargeVein; 8 | import com.typesafe.config.Config; 9 | import com.typesafe.config.ConfigObject; 10 | import net.minecraft.world.gen.feature.WorldGenerator; 11 | import org.apache.logging.log4j.Logger; 12 | 13 | public class FractalParser extends UniformParser { 14 | 15 | @Override 16 | protected FeatureBase getFeature(String featureName, Config genObject, WorldGenerator gen, INumberProvider numClusters, GenRestriction biomeRes, boolean retrogen, GenRestriction dimRes, Logger log) { 17 | 18 | if (!(genObject.hasPath("min-height") && genObject.hasPath("vein-height"))) { 19 | log.error("Height parameters for 'fractal' template not specified in \"" + featureName + "\""); 20 | return null; 21 | } 22 | if (!(genObject.hasPath("vein-diameter"))) { 23 | log.error("veinDiameter parameter for 'fractal' template not specified in \"" + featureName + "\""); 24 | return null; 25 | } 26 | if (!(genObject.hasPath("vertical-density") && genObject.hasPath("horizontal-density"))) { 27 | log.error("Density parameters for 'fractal' template not specified in \"" + featureName + "\""); 28 | return null; 29 | } 30 | ConfigObject genData = genObject.root(); 31 | INumberProvider minY = FeatureParser.parseNumberValue(genData.get("min-height")); 32 | INumberProvider h = FeatureParser.parseNumberValue(genData.get("vein-height")); 33 | INumberProvider d = FeatureParser.parseNumberValue(genData.get("vein-diameter")); 34 | INumberProvider vD = FeatureParser.parseNumberValue(genData.get("vertical-density"), 0, 100); 35 | INumberProvider hD = FeatureParser.parseNumberValue(genData.get("horizontal-density"), 0, 100); 36 | 37 | return new FeatureGenLargeVein(featureName, gen, numClusters, minY, biomeRes, retrogen, dimRes, h, d, vD, hD); 38 | } 39 | 40 | @Override 41 | protected String getDefaultGenerator() { 42 | 43 | return "large-vein"; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/render/font/RenderIcon.java: -------------------------------------------------------------------------------- 1 | package cofh.core.render.font; 2 | 3 | import cofh.core.render.FontRendererCore; 4 | import cofh.lib.util.helpers.RenderHelper; 5 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 6 | import org.lwjgl.opengl.GL11; 7 | 8 | public class RenderIcon implements ICustomCharRenderer { 9 | 10 | public final char underlyingCharacter; 11 | private final TextureAtlasSprite icon; 12 | 13 | public RenderIcon(char underlyingCharacter, TextureAtlasSprite icon) { 14 | 15 | this.underlyingCharacter = underlyingCharacter; 16 | this.icon = icon; 17 | } 18 | 19 | @Override 20 | public float renderChar(char letter, boolean italicFlag, float x, float y, FontRendererCore fontRenderer) { 21 | 22 | if (icon == null) { 23 | return 0; 24 | } 25 | 26 | GL11.glColor4f(1, 1, 1, 1); 27 | RenderHelper.setBlockTextureSheet(); 28 | 29 | float u = this.icon.getMinU(); 30 | float v = this.icon.getMinV(); 31 | float w = this.icon.getMaxU() - u; 32 | float h = this.icon.getMaxV() - v; 33 | 34 | float rw = w / h * 8.02F; 35 | 36 | float italicOffset = italicFlag ? 1.0F : 0.0F; 37 | GL11.glBegin(GL11.GL_TRIANGLE_STRIP); 38 | GL11.glTexCoord2f(u, v); 39 | GL11.glVertex3f(x + italicOffset, y, 0.0F); 40 | GL11.glTexCoord2f(u, (v + h)); 41 | GL11.glVertex3f(x - italicOffset, y + 7.99F, 0.0F); 42 | GL11.glTexCoord2f((u + w), v); 43 | GL11.glVertex3f(x + w / h * 7.99F + italicOffset, y, 0.0F); 44 | GL11.glTexCoord2f((u + w), (v + h)); 45 | GL11.glVertex3f(x + w / h * 7.99F - italicOffset, y + 7.99F, 0.0F); 46 | GL11.glEnd(); 47 | 48 | fontRenderer.resetColor(); 49 | 50 | return rw; 51 | } 52 | 53 | @Override 54 | public int getCharWidth(char letter, FontRendererCore fontRenderer) { 55 | 56 | if (this.icon == null) { 57 | return 0; 58 | } 59 | 60 | float w = this.icon.getMaxU() - this.icon.getMinU(); 61 | float h = this.icon.getMaxV() - this.icon.getMinV(); 62 | 63 | return (int) Math.ceil(w / h * 8 - 0.0002f); 64 | } 65 | 66 | public static void addRenderer(char c, TextureAtlasSprite icon, FontRendererCore fontRenderer) { 67 | 68 | fontRenderer.renderOverrides.put(c, new RenderIcon(c, icon)); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/cs_CZ.lang: -------------------------------------------------------------------------------- 1 | #cs_CZ 2 | 3 | enchant.cofh.holding=Držení 4 | 5 | fluid.tile.lava=Láva 6 | fluid.tile.water=Voda 7 | 8 | info.cofh.access=Přístup 9 | info.cofh.accessMode=Přístupový mód 10 | info.cofh.accessPrivate=Pouze majitel 11 | info.cofh.accessPublic=Veřejný přístup 12 | info.cofh.accessRestricted=Omezený 13 | info.cofh.all=Všichni 14 | info.cofh.amount=Množství 15 | info.cofh.augmentation=Navýšení 16 | info.cofh.blank=Prázdný 17 | info.cofh.capacity=Kapacita 18 | info.cofh.charge=Nabití 19 | info.cofh.contents=Obsahy 20 | info.cofh.controlStatus=Stav řízení 21 | info.cofh.damageAttack=Útočné poškození 22 | info.cofh.damageFlux=Fluxové poškození 23 | info.cofh.disabled=Zakázáno 24 | info.cofh.dry=Mokrý 25 | info.cofh.empty=Prázdný 26 | info.cofh.enabled=Povoleno 27 | info.cofh.energy=Energie 28 | info.cofh.energyConsume=Využití energie 29 | info.cofh.energyProduce=Výstup energie 30 | info.cofh.energyStored=Uloženo energie 31 | info.cofh.fluid=Tekutina 32 | info.cofh.forDetails=pro více informací 33 | info.cofh.frequency=Frekvence 34 | info.cofh.hasInfo=Má informace 35 | info.cofh.high=Výška 36 | info.cofh.hold=Držet 37 | info.cofh.ignored=Ignorovaný 38 | info.cofh.infinite=Neomezený 39 | info.cofh.information=Informace 40 | info.cofh.item=Předmět 41 | info.cofh.items=Předměty 42 | info.cofh.legacy=Legacy 43 | info.cofh.level=Úroveň 44 | info.cofh.locked=Uzamčeno 45 | info.cofh.low=Slabý 46 | info.cofh.maxPower=Maximální síla 47 | info.cofh.none=Nic 48 | info.cofh.owner=Majitel 49 | info.cofh.perUse=Za užití 50 | info.cofh.receive=Získat 51 | info.cofh.redstoneControl=Ruditové ovládání 52 | info.cofh.security=Bezpečnost 53 | info.cofh.send=Odeslat 54 | info.cofh.signalRequired=Potřebný signál 55 | info.cofh.tutorial.fluxRequired=Potřebuje ruditový flux pro funkci. 56 | info.cofh.tutorial.tabAugment=Panel rozšíření umožňuje modulární přídavky. 57 | info.cofh.tutorial.tabRedstone=Ruditový ovládací panel nastavuje, jak reaguje toto zařízení na ruditové signály. 58 | info.cofh.tutorial.tabSecurity=Bezpečnostní panel umožňuje majiteli nastavit kdo bude mít přístup do tohoto zařízení. 59 | info.cofh.tutorial=Tutoriál 60 | info.cofh.unlocked=Odemčené 61 | 62 | item.invalid.name=Nesprávný předmět (Zničit) 63 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/command/CommandUnloadChunk.java: -------------------------------------------------------------------------------- 1 | package cofh.core.command; 2 | 3 | import cofh.lib.util.RayTracer; 4 | import com.google.common.base.Throwables; 5 | import net.minecraft.command.CommandException; 6 | import net.minecraft.command.ICommandSender; 7 | import net.minecraft.entity.player.EntityPlayerMP; 8 | import net.minecraft.server.MinecraftServer; 9 | import net.minecraft.util.math.ChunkPos; 10 | import net.minecraft.util.math.RayTraceResult; 11 | import net.minecraft.world.chunk.Chunk; 12 | import net.minecraft.world.gen.ChunkProviderServer; 13 | import net.minecraftforge.fml.relauncher.ReflectionHelper; 14 | 15 | import java.lang.reflect.Field; 16 | import java.util.List; 17 | import java.util.Set; 18 | 19 | public class CommandUnloadChunk implements ISubCommand { 20 | 21 | public static ISubCommand instance = new CommandUnloadChunk(); 22 | 23 | @Override 24 | public String getCommandName() { 25 | 26 | return "unloadchunk"; 27 | } 28 | 29 | @Override 30 | public int getPermissionLevel() { 31 | 32 | return 4; 33 | } 34 | 35 | Field chunksToUnload; 36 | 37 | @Override 38 | public void handleCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { 39 | 40 | if (!(sender instanceof EntityPlayerMP)) { 41 | return; 42 | } 43 | 44 | if (chunksToUnload == null) { 45 | chunksToUnload = ReflectionHelper.findField(ChunkProviderServer.class, "field_73248_b", "chunksToUnload"); 46 | } 47 | 48 | EntityPlayerMP player = (EntityPlayerMP) sender; 49 | RayTraceResult trace = RayTracer.retrace(player, 100); 50 | Chunk chunk = player.worldObj.getChunkFromBlockCoords(trace.getBlockPos()); 51 | 52 | Set o; 53 | try { 54 | o = (Set) chunksToUnload.get(player.getServerWorld().getChunkProvider()); 55 | } catch (IllegalAccessException e) { 56 | throw Throwables.propagate(e); 57 | } 58 | 59 | o.add(ChunkPos.asLong(chunk.xPosition, chunk.zPosition)); 60 | CommandHandler.logAdminCommand(sender, this, "chat.cofh.command.unloadchunk.success", chunk.xPosition, chunk.zPosition); 61 | } 62 | 63 | @Override 64 | public List addTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args) { 65 | 66 | return null; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/feature/SurfaceParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.feature; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.util.numbers.INumberProvider; 6 | import cofh.lib.world.feature.FeatureBase; 7 | import cofh.lib.world.feature.FeatureBase.GenRestriction; 8 | import cofh.lib.world.feature.FeatureGenSurface; 9 | import cofh.lib.world.feature.FeatureGenTopBlock; 10 | import com.typesafe.config.Config; 11 | import net.minecraft.init.Blocks; 12 | import net.minecraft.world.gen.feature.WorldGenerator; 13 | import org.apache.logging.log4j.Logger; 14 | 15 | import java.util.ArrayList; 16 | import java.util.Arrays; 17 | import java.util.List; 18 | 19 | public class SurfaceParser extends UniformParser { 20 | 21 | @Override 22 | protected List generateDefaultMaterial() { 23 | 24 | return Arrays.asList(new WeightedRandomBlock(Blocks.STONE, -1), new WeightedRandomBlock(Blocks.DIRT, -1), new WeightedRandomBlock(Blocks.GRASS, -1), new WeightedRandomBlock(Blocks.SAND, -1), new WeightedRandomBlock(Blocks.GRAVEL, -1), new WeightedRandomBlock(Blocks.SNOW, -1), new WeightedRandomBlock(Blocks.AIR, -1), new WeightedRandomBlock(Blocks.WATER, -1)); 25 | } 26 | 27 | @Override 28 | protected FeatureBase getFeature(String featureName, Config genObject, WorldGenerator gen, INumberProvider numClusters, GenRestriction biomeRes, boolean retrogen, GenRestriction dimRes, Logger log) { 29 | 30 | // TODO: WorldGeneratorAdv that allows access to its material list 31 | List matList = defaultMaterial; 32 | if (genObject.hasPath("material")) { 33 | matList = new ArrayList<>(); 34 | if (!FeatureParser.parseResList(genObject.root().get("material"), matList, false)) { 35 | log.warn("Invalid material list! Using default list."); 36 | matList = defaultMaterial; 37 | } 38 | } 39 | // TODO: clarity on follow-terrain field 40 | if (genObject.hasPath("follow-terrain") && genObject.getBoolean("follow-terrain")) { 41 | return new FeatureGenTopBlock(featureName, gen, matList, numClusters, biomeRes, retrogen, dimRes); 42 | } else { 43 | return new FeatureGenSurface(featureName, gen, matList, numClusters, biomeRes, retrogen, dimRes); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/zh_TW.lang: -------------------------------------------------------------------------------- 1 | #zh_TW 2 | 3 | config.client.tooltip=設定客戶端的唯一選擇. 4 | config.common.tooltip=設定一般選項. 5 | config.core.tooltip=設定核心模組選項. 6 | config.loot.tooltip=設定戰利品模組選項. 7 | 8 | enchant.cofh.holding=保持 9 | enchant.cofh.multishot=多重射擊 10 | 11 | fluid.tile.lava=岩漿 12 | fluid.tile.water=水 13 | 14 | info.cofh.access=訪問 15 | info.cofh.accessPrivate=私有 16 | info.cofh.accessPublic=公開 17 | info.cofh.accessRestricted=受限 18 | info.cofh.all=全部 19 | info.cofh.amount=數量 20 | info.cofh.angle=角度 21 | info.cofh.anotherplayer=另一個玩家 22 | info.cofh.augmentation=擴充 23 | info.cofh.blank=空白 24 | info.cofh.capacity=容量 25 | info.cofh.charge=充能 26 | info.cofh.contents=目錄 27 | info.cofh.controlStatus=控制狀態 28 | info.cofh.damageAttack=攻擊傷害 29 | info.cofh.damageFlux=RF傷害 30 | info.cofh.disabled=不允許 31 | info.cofh.distance=距離 32 | info.cofh.dry=乾的 33 | info.cofh.duration=時間 34 | info.cofh.empty=空 35 | info.cofh.enabled=允許 36 | info.cofh.energy=能量 37 | info.cofh.energyConsume=消耗功率 38 | info.cofh.energyProduce=輸出功率 39 | info.cofh.energyStored=存儲能量 40 | info.cofh.fluid=流體 41 | info.cofh.fluids=流體 42 | info.cofh.force=力道 43 | info.cofh.forDetails=得到詳細資料 44 | info.cofh.frequency=頻率 45 | info.cofh.hasInfo=的資料 46 | info.cofh.high=高 47 | info.cofh.hold=按著 48 | info.cofh.idle=Idle 49 | info.cofh.ignored=忽略 50 | info.cofh.infinite=無限 51 | info.cofh.information=資訊 52 | info.cofh.item=物品 53 | info.cofh.items=物品 54 | info.cofh.level=等級 55 | info.cofh.locked=鎖定 56 | info.cofh.low=低 57 | info.cofh.maxPower=最大功率 58 | info.cofh.none=無 59 | info.cofh.owner=主人 60 | info.cofh.perUse=每次使用 61 | info.cofh.press=按下 62 | info.cofh.receive=接收 63 | info.cofh.receiving=接收中 64 | info.cofh.redstoneControl=紅石控制 65 | info.cofh.security=安全 66 | info.cofh.send=發送 67 | info.cofh.sending=發送中 68 | info.cofh.shift=Shift 69 | info.cofh.signal=信號 70 | info.cofh.signalRequired=需要信號 71 | info.cofh.soaked=浸泡過的 72 | info.cofh.source=資源 73 | info.cofh.stored=儲存 74 | info.cofh.strength=強度 75 | info.cofh.success=成功! 76 | info.cofh.transfer=傳輸 77 | info.cofh.tutorial.fluxRequired=需要RF能量來驅動. 78 | info.cofh.tutorial.tabAugment=擴充欄允許模組化機器. 79 | info.cofh.tutorial.tabRedstone=紅石控制欄用來設定設備對紅石信號的反應. 80 | info.cofh.tutorial.tabSecurity=安全欄允許主人來決定誰可以使用該設備。 81 | info.cofh.tutorial=教學 82 | info.cofh.unlocked=解鎖 83 | 84 | item.invalid.name=無效物品 (請移除) 85 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/helpers/RedstoneControlHelper.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util.helpers; 2 | 3 | import cofh.core.util.tileentity.IRedstoneControl; 4 | import cofh.core.util.tileentity.IRedstoneControl.ControlMode; 5 | import cofh.lib.util.helpers.StringHelper; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.nbt.NBTTagCompound; 8 | 9 | import java.util.List; 10 | 11 | public class RedstoneControlHelper { 12 | 13 | private RedstoneControlHelper() { 14 | 15 | } 16 | 17 | /* NBT TAG HELPERS */ 18 | public static NBTTagCompound setItemStackTagRS(NBTTagCompound tag, IRedstoneControl tile) { 19 | 20 | if (tile == null) { 21 | return null; 22 | } 23 | if (tag == null) { 24 | tag = new NBTTagCompound(); 25 | } 26 | tag.setByte("RSControl", (byte) tile.getControl().ordinal()); 27 | return tag; 28 | } 29 | 30 | public static ControlMode getControlFromNBT(NBTTagCompound tag) { 31 | 32 | return tag == null ? ControlMode.DISABLED : ControlMode.values()[tag.getByte("RSControl")]; 33 | } 34 | 35 | /** 36 | * Adds Redstone Control information to ItemStacks. 37 | */ 38 | public static void addRSControlInformation(ItemStack stack, List list) { 39 | 40 | if (hasRSControl(stack)) { 41 | switch (stack.getTagCompound().getByte("RSControl")) { 42 | case 0: 43 | list.add(StringHelper.localize("info.cofh.signalDisabled")); 44 | return; 45 | case 1: 46 | list.add(StringHelper.localize("info.cofh.signalEnabledLow")); 47 | return; 48 | case 2: 49 | list.add(StringHelper.localize("info.cofh.signalEnabledHigh")); 50 | return; 51 | } 52 | } 53 | } 54 | 55 | /* ITEM HELPERS */ 56 | public static boolean hasRSControl(ItemStack stack) { 57 | 58 | return stack.getTagCompound() != null && stack.getTagCompound().hasKey("RSControl"); 59 | } 60 | 61 | public static boolean setControl(ItemStack stack, ControlMode control) { 62 | 63 | if (stack.getTagCompound() == null) { 64 | stack.setTagCompound(new NBTTagCompound()); 65 | } 66 | stack.getTagCompound().setByte("RSControl", (byte) control.ordinal()); 67 | return true; 68 | } 69 | 70 | public static ControlMode getControl(ItemStack stack) { 71 | 72 | return stack.getTagCompound() == null ? ControlMode.DISABLED : ControlMode.values()[stack.getTagCompound().getByte("RSControl")]; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/key/KeyHandlerCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.key; 2 | 3 | import gnu.trove.map.TMap; 4 | import gnu.trove.map.hash.THashMap; 5 | import net.minecraftforge.common.MinecraftForge; 6 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 7 | import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; 8 | import net.minecraftforge.fml.common.gameevent.InputEvent.MouseInputEvent; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | import org.lwjgl.input.Keyboard; 12 | import org.lwjgl.input.Mouse; 13 | 14 | import java.util.ArrayList; 15 | 16 | public class KeyHandlerCore { 17 | 18 | private static TMap clientBinds = new THashMap<>(); 19 | static TMap serverBinds = new THashMap<>(); 20 | private static ArrayList keys = new ArrayList<>(); 21 | 22 | static { 23 | MinecraftForge.EVENT_BUS.register(new KeyHandlerCore()); 24 | } 25 | 26 | public static boolean addClientKeyBind(IKeyBinding binding) { 27 | 28 | if (!clientBinds.containsKey(binding.getUUID())) { 29 | keys.add(binding); 30 | clientBinds.put(binding.getUUID(), binding); 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | public static boolean addServerKeyBind(IKeyBinding binding) { 37 | 38 | if (!serverBinds.containsKey(binding.getUUID())) { 39 | serverBinds.put(binding.getUUID(), binding); 40 | return true; 41 | } 42 | return false; 43 | } 44 | 45 | /* EVENT HANDLING */ 46 | @SubscribeEvent 47 | @SideOnly (Side.CLIENT) 48 | public void handleKeyInputEvent(KeyInputEvent event) { 49 | 50 | for (IKeyBinding key : keys) { 51 | int button = key.getKey(); 52 | if (button > 0 && Keyboard.isKeyDown(button)) { 53 | if (key.keyPressClient() && key.hasServerSide()) { 54 | PacketKey.sendToServer(key.getUUID()); 55 | } 56 | } 57 | } 58 | } 59 | 60 | @SubscribeEvent 61 | @SideOnly (Side.CLIENT) 62 | public void handleMouseInputEvent(MouseInputEvent event) { 63 | 64 | for (IKeyBinding key : keys) { 65 | int button = key.getKey(); // value saved as button - 100 instead of -button because moderp 66 | if (button < 0 && Mouse.isButtonDown(button + 100)) { 67 | if (key.keyPressClient() && key.hasServerSide()) { 68 | PacketKey.sendToServer(key.getUUID()); 69 | } 70 | } 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/GuiConfigCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui; 2 | 3 | import cofh.CoFHCore; 4 | import net.minecraft.client.gui.GuiScreen; 5 | import net.minecraftforge.common.config.ConfigElement; 6 | import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement; 7 | import net.minecraftforge.fml.client.config.GuiConfig; 8 | import net.minecraftforge.fml.client.config.IConfigElement; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | @SuppressWarnings ({ "unchecked", "rawtypes" }) 14 | public class GuiConfigCore extends GuiConfig { 15 | 16 | public GuiConfigCore(GuiScreen parentScreen) { 17 | 18 | super(parentScreen, getConfigElements(parentScreen), CoFHCore.MOD_ID, false, false, CoFHCore.MOD_NAME); 19 | } 20 | 21 | public static final String[] CATEGORIES_CLIENT = { "General", "Global", "Interface", "Security", "Tab" }; 22 | public static final String[] CATEGORIES_CORE = {}; 23 | public static final String[] CATEGORIES_LOOT = { "General", "Heads" }; 24 | 25 | private static List getConfigElements(GuiScreen parent) { 26 | 27 | List list = new ArrayList<>(); 28 | 29 | list.add(new DummyCategoryElement("Client", "config.client", getClientConfigElements())); 30 | list.add(new DummyCategoryElement("Core", "config.core", getCoreModuleConfigElements())); 31 | list.add(new DummyCategoryElement("Loot", "config.loot", getLootModuleConfigElements())); 32 | 33 | return list; 34 | } 35 | 36 | private static List getClientConfigElements() { 37 | 38 | List list = new ArrayList<>(); 39 | 40 | for (String category : CATEGORIES_CLIENT) { 41 | list.add(new ConfigElement(CoFHCore.CONFIG_CLIENT.getCategory(category))); 42 | } 43 | return list; 44 | } 45 | 46 | private static List getCoreModuleConfigElements() { 47 | 48 | List list = new ArrayList<>(); 49 | 50 | for (String category : CATEGORIES_CORE) { 51 | list.add(new ConfigElement(CoFHCore.CONFIG_CORE.getCategory(category))); 52 | } 53 | return list; 54 | } 55 | 56 | private static List getLootModuleConfigElements() { 57 | 58 | List list = new ArrayList<>(); 59 | 60 | for (String category : CATEGORIES_LOOT) { 61 | list.add(new ConfigElement(CoFHCore.CONFIG_LOOT.getCategory(category))); 62 | } 63 | return list; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/pl_PL.lang: -------------------------------------------------------------------------------- 1 | #pl_PL 2 | 3 | enchant.cofh.holding=Trzymanie 4 | enchant.cofh.multishot=Multishot 5 | 6 | fluid.tile.lava=Lawa 7 | fluid.tile.water=Woda 8 | 9 | info.cofh.access=Dostęp 10 | info.cofh.accessMode=Tryb dostępu 11 | info.cofh.accessPrivate=Tylko właściciel 12 | info.cofh.accessRestricted=Ograniczony 13 | info.cofh.all=Wszystko 14 | info.cofh.amount=Ilość 15 | info.cofh.augmentation=Zwiększanie 16 | info.cofh.blank=Czyste 17 | info.cofh.capacity=Pojemność 18 | info.cofh.controlStatus=Status kontrolowania 19 | info.cofh.damageAttack=Obrażenia ataku 20 | info.cofh.damageFlux=Obrażenia flux'owe 21 | info.cofh.disabled=Wyłączone 22 | info.cofh.dry=Suche 23 | info.cofh.empty=Puste 24 | info.cofh.enable=Enable 25 | info.cofh.enabled=Włączone 26 | info.cofh.energy=Energia 27 | info.cofh.energyConsume=Użytek mocy 28 | info.cofh.energyProduce=Wyjście mocy 29 | info.cofh.energyStored=Przechowywana energia 30 | info.cofh.fluid=Ciecz 31 | info.cofh.forDetails=dla detali 32 | info.cofh.frequency=Częstotliwość 33 | info.cofh.hasInfo=Ma informacje 34 | info.cofh.high=Wysoki 35 | info.cofh.hold=Trzyma 36 | info.cofh.ignored=Ignorowane 37 | info.cofh.infinite=Nieskończone 38 | info.cofh.information=Informacje 39 | info.cofh.item=Przedmiot 40 | info.cofh.items=Przedmioty 41 | info.cofh.level=Przedmiot 42 | info.cofh.locked=Zablokowane 43 | info.cofh.low=Niski 44 | info.cofh.maxPower=Maksymalna moc 45 | info.cofh.none=Żadne 46 | info.cofh.owner=Właściciel 47 | info.cofh.perUse=Na użycie 48 | info.cofh.press=Naciśnij 49 | info.cofh.receive=Otrzymaj 50 | info.cofh.redstoneControl=Kontrola redstone'em 51 | info.cofh.security=Bezpieczeństwo 52 | info.cofh.send=Wyślij 53 | info.cofh.sending=Wysyłanie 54 | info.cofh.shift=Przesunięcie 55 | info.cofh.signal=Sygnał 56 | info.cofh.signalRequired=Sygnał wymagany 57 | info.cofh.soaked=Mokry 58 | info.cofh.source=Źródło 59 | info.cofh.tutorial.fluxRequired=Wymaga redstone'owego flux'u do operacji. 60 | info.cofh.tutorial.tabAugment=Karta powiększeń zezwala na modularne dodatki. 61 | info.cofh.tutorial.tabConfiguration=The Configuration tab determines input and output parameters for this block. 62 | info.cofh.tutorial.tabRedstone=Karta kontroli redstone'a konfiguruje to, jak to urządzenie reaguje na sygnały redstone'a. 63 | info.cofh.tutorial.tabSecurity=Karta bezpieczeństwa zezwala na kontrolowanie tego, kto ma prawo dostępu do tego urządzenia. 64 | info.cofh.unlocked=Odblokowany 65 | 66 | item.invalid.name=Niepoprawny przedmiot (zniszcz) 67 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/entity/EntityLightningBoltFake.java: -------------------------------------------------------------------------------- 1 | package cofh.core.entity; 2 | 3 | import net.minecraft.entity.effect.EntityWeatherEffect; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.init.SoundEvents; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | import net.minecraft.util.SoundCategory; 8 | import net.minecraft.world.World; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | 12 | public class EntityLightningBoltFake extends EntityWeatherEffect { 13 | 14 | private int lightningState; 15 | private int boltLivingTime; 16 | public long boltVertex = 0L; 17 | 18 | public EntityLightningBoltFake(World world, double x, double y, double z) { 19 | 20 | super(world); 21 | this.setLocationAndAngles(x, y, z, 0.0F, 0.0F); 22 | this.lightningState = 2; 23 | this.boltVertex = this.rand.nextLong(); 24 | this.boltLivingTime = this.rand.nextInt(3) + 1; 25 | } 26 | 27 | /** 28 | * Called to update the entity's position/logic. 29 | */ 30 | @Override 31 | public void onUpdate() { 32 | 33 | super.onUpdate(); 34 | 35 | if (this.lightningState == 2) { 36 | this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F); 37 | this.worldObj.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_LIGHTNING_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.rand.nextFloat() * 0.2F); 38 | } 39 | 40 | --this.lightningState; 41 | 42 | if (this.lightningState < 0) { 43 | if (this.boltLivingTime == 0) { 44 | this.setDead(); 45 | } else if (this.lightningState < -this.rand.nextInt(10)) { 46 | --this.boltLivingTime; 47 | this.lightningState = 1; 48 | this.boltVertex = this.rand.nextLong(); 49 | } 50 | } 51 | } 52 | 53 | @Override 54 | protected void entityInit() { 55 | 56 | } 57 | 58 | /** 59 | * (abstract) Protected helper method to read subclass entity data from NBT. 60 | */ 61 | @Override 62 | protected void readEntityFromNBT(NBTTagCompound nbt) { 63 | 64 | } 65 | 66 | /** 67 | * (abstract) Protected helper method to write subclass entity data to NBT. 68 | */ 69 | @Override 70 | protected void writeEntityToNBT(NBTTagCompound nbt) { 71 | 72 | } 73 | 74 | @Override 75 | @SideOnly (Side.CLIENT) 76 | public boolean isInRangeToRenderDist(double par1) { 77 | 78 | return this.lightningState >= 0; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/hu_HU.lang: -------------------------------------------------------------------------------- 1 | #hu_HU 2 | 3 | fluid.tile.lava=Láva 4 | fluid.tile.water=Víz 5 | 6 | info.cofh.access=Hozzáférés 7 | info.cofh.accessMode=Hozzáférés módja 8 | info.cofh.accessPrivate=Csak tulajdonos 9 | info.cofh.accessPublic=Nyilvános 10 | info.cofh.accessRestricted=Korlátozott 11 | info.cofh.amount=Mennyiség 12 | info.cofh.augmentation=Kiegészítők 13 | info.cofh.blank=Üres 14 | info.cofh.capacity=Kapacitás 15 | info.cofh.charge=Töltöttség 16 | info.cofh.contents=Tartalom 17 | info.cofh.controlStatus=Vezérlés állapota 18 | info.cofh.damageAttack=Okozott sebzés 19 | info.cofh.damageFlux=Flux támadás 20 | info.cofh.disable=Disable 21 | info.cofh.disabled=Letiltva 22 | info.cofh.dry=Száraz 23 | info.cofh.empty=Üres 24 | info.cofh.enabled=Engedélyezve 25 | info.cofh.energy=Energia 26 | info.cofh.energyConsume=Fogyasztás 27 | info.cofh.energyProduce=Termelés 28 | info.cofh.energyStored=Tárolt energia 29 | info.cofh.fluid=Folyadék 30 | info.cofh.frequency=Frekvencia 31 | info.cofh.high=Magas 32 | info.cofh.ignored=Mellőzve 33 | info.cofh.infinite=Végtelen 34 | info.cofh.information=Információ 35 | info.cofh.item=Tárgy 36 | info.cofh.items=Tárgyak 37 | info.cofh.legacy=Legacy 38 | info.cofh.level=Szint 39 | info.cofh.locked=Zárolva 40 | info.cofh.loot=Loot 41 | info.cofh.low=Alacsony 42 | info.cofh.maxPower=Legnagyobb áram 43 | info.cofh.modeChange=to Change Mode 44 | info.cofh.none=Semmi 45 | info.cofh.owner=Tulajdonos 46 | info.cofh.perUse=használatonként 47 | info.cofh.press=Nyomd 48 | info.cofh.receive=Fogad 49 | info.cofh.receiving=Fogadás 50 | info.cofh.redstoneControl=Vöröskő vezérlés 51 | info.cofh.removeDestination=Remove Destination 52 | info.cofh.removeFrequency=Remove Frequency 53 | info.cofh.security=Biztonság 54 | info.cofh.send=Küld 55 | info.cofh.sending=Küldés 56 | info.cofh.shift=Eltolás 57 | info.cofh.signal=Jel 58 | info.cofh.signalRequired=Jel szükséges 59 | info.cofh.soaked=Átázott 60 | info.cofh.source=Forrás 61 | info.cofh.transfer=Átvitel 62 | info.cofh.tutorial.fluxRequired=Redstone Flux kell a működéséhez. 63 | info.cofh.tutorial.tabAugment=A Kiegészítők fül lehetővé teszi a moduláris kiegészítők telepítését. 64 | info.cofh.tutorial.tabRedstone=A Vöröskő vezérlés fülön beállíthatod, hogyan reagáljon az eszköz a vöröskő jelre. 65 | info.cofh.tutorial.tabSecurity=A Biztonság fül lehetőséget ad a tulajdonosnak, hogy megadja: mások milyen módon férhetnek hozzá az eszközhöz. 66 | info.cofh.tutorial=Bevezető 67 | info.cofh.unlocked=Feloldva 68 | 69 | item.invalid.name=Hibás tárgy (érvénytelen) 70 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/ko_KR.lang: -------------------------------------------------------------------------------- 1 | #ko_KR 2 | 3 | config.Client.tooltip=클라이언트 전용 옵션 4 | config.Common.tooltip=일반 옵션 5 | config.Core.tooltip=코어 모듈 옵션 6 | config.Loot.tooltip=루트 모듈 옵션 7 | 8 | enchant.cofh.holding=수송량증가 9 | enchant.cofh.multishot=다중슬롯 10 | 11 | fluid.tile.lava=용암 12 | fluid.tile.water=물 13 | 14 | info.cofh.access=보안 15 | info.cofh.accessMode=보안 설정 16 | info.cofh.accessPrivate=비공개 17 | info.cofh.accessPublic=공개 18 | info.cofh.accessRestricted=한정됨 19 | info.cofh.addFrequency=주파수 추가 20 | info.cofh.all=모두 21 | info.cofh.amount=수량 22 | info.cofh.angle=각도 23 | info.cofh.anotherplayer=다른 플레이어 24 | info.cofh.augmentation=강화 25 | info.cofh.blank=비어있음 26 | info.cofh.capacity=용량 27 | info.cofh.charge=충전량 28 | info.cofh.contents=내용 29 | info.cofh.controlStatus=활성화 상태 30 | info.cofh.damageAttack=공격 피해 31 | info.cofh.damageFlux=플럭스 피해 32 | info.cofh.disable=비활성화 33 | info.cofh.disabled=비활성화 34 | info.cofh.distance=거리 35 | info.cofh.dry=마른 36 | info.cofh.duration=지속 시간 37 | info.cofh.empty=비어있음 38 | info.cofh.enable=활성화 39 | info.cofh.enabled=활성화 40 | info.cofh.energy=에너지 41 | info.cofh.energyConsume=현재 소모량 42 | info.cofh.energyProduce=현재 발전량 43 | info.cofh.energyStored=에너지 저장량 44 | info.cofh.fluid=액체 45 | info.cofh.fluids=액체 46 | info.cofh.force=세기 47 | info.cofh.forDetails=로 자세한 정보 보기 48 | info.cofh.frequency=주파수 49 | info.cofh.hasInfo=가지고 있는 정보 50 | info.cofh.high=높음 51 | info.cofh.ignored=신호 무시 52 | info.cofh.infinite=무한 53 | info.cofh.information=정보 54 | info.cofh.item=아이템 55 | info.cofh.items=아이템 56 | info.cofh.level=단계 57 | info.cofh.locked=잠김 58 | info.cofh.low=낮음 59 | info.cofh.maxPower=최대 전력 60 | info.cofh.modeChange=로 모드 변경 61 | info.cofh.none=없음 62 | info.cofh.owner=소유주 63 | info.cofh.perUse=소모 64 | info.cofh.receive=출력량 65 | info.cofh.receiving=받기 66 | info.cofh.redstoneControl=레드스톤 제어 67 | info.cofh.removeFrequency=주파수 제거 68 | info.cofh.security=보안 69 | info.cofh.send=입력량 70 | info.cofh.sending=보내기 71 | info.cofh.setFrequency=주파수 설정 72 | info.cofh.signal=신호 73 | info.cofh.signalRequired=요구 신호 세기 74 | info.cofh.soaked=빨아들임 75 | info.cofh.source=소스 76 | info.cofh.strength=신호 세기 77 | info.cofh.success=성공! 78 | info.cofh.transfer=전송 79 | info.cofh.tutorial.fluxRequired=기계가 동작하는데 RF가 필요합니다. 80 | info.cofh.tutorial.tabAugment=강화 탭에서 모듈을 통해서 기기를 업그레이드 할 수있습니다. 81 | info.cofh.tutorial.tabRedstone=레드스톤 제어 탭에서 레드스톤 신호 세기에따른 동작 여부를 설정할 수 있습니다. 82 | info.cofh.tutorial.tabSecurity=보안 탭에서 블록에 접근 가능한 사용자를 설정할 수 있습니다. 83 | info.cofh.tutorial=도움말 84 | info.cofh.unlocked=잠김해제 85 | 86 | item.invalid.name=사용불가 아이템 87 | 88 | key.cofh.multimode=아이템 모드 전환 89 | -------------------------------------------------------------------------------- /src/main/java/cofh/asm/repack/immibis/bon/JoinMapping.java: -------------------------------------------------------------------------------- 1 | package cofh.asm.repack.immibis.bon; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class JoinMapping extends Mapping { 7 | 8 | private final Mapping a, b; 9 | 10 | public JoinMapping(Mapping a, Mapping b) { 11 | 12 | this.a = a; 13 | this.b = b; 14 | } 15 | 16 | @Override 17 | public String getClass(String in) { 18 | 19 | return b.getClass(a.getClass(in)); 20 | } 21 | 22 | @Override 23 | public String getField(String clazz, String name, String desc) { 24 | 25 | return b.getField(a.getClass(clazz), a.getField(clazz, name, desc), a.mapTypeDescriptor(desc)); 26 | } 27 | 28 | @Override 29 | public String getMethod(String clazz, String name, String desc) { 30 | 31 | return b.getMethod(a.getClass(clazz), a.getMethod(clazz, name, desc), a.mapMethodDescriptor(desc)); 32 | } 33 | 34 | @Override 35 | public List getExceptions(String clazz, String method, String desc) { 36 | 37 | List rv = new ArrayList<>(); 38 | rv.addAll(a.getExceptions(clazz, method, desc)); 39 | rv.addAll(b.getExceptions(a.getClass(clazz), a.getMethod(clazz, method, desc), a.mapMethodDescriptor(desc))); 40 | return rv; 41 | } 42 | 43 | @Override 44 | public String mapMethodDescriptor(String desc) { 45 | 46 | return b.mapMethodDescriptor(a.mapMethodDescriptor(desc)); 47 | } 48 | 49 | @Override 50 | public String mapTypeDescriptor(String in) { 51 | 52 | return b.mapTypeDescriptor(a.mapTypeDescriptor(in)); 53 | } 54 | 55 | @Override 56 | public void addPrefix(String old, String new_) { 57 | 58 | throw new UnsupportedOperationException("Mapping is unmodifiable"); 59 | } 60 | 61 | @Override 62 | public void setClass(String in, String out) { 63 | 64 | throw new UnsupportedOperationException("Mapping is unmodifiable"); 65 | } 66 | 67 | @Override 68 | public void setDefaultPackage(String p) { 69 | 70 | throw new UnsupportedOperationException("Mapping is unmodifiable"); 71 | } 72 | 73 | @Override 74 | public void setExceptions(String clazz, String method, String desc, List exc) { 75 | 76 | throw new UnsupportedOperationException("Mapping is unmodifiable"); 77 | } 78 | 79 | @Override 80 | public void setField(String clazz, String name, String out) { 81 | 82 | throw new UnsupportedOperationException("Mapping is unmodifiable"); 83 | } 84 | 85 | @Override 86 | public void setMethod(String clazz, String name, String desc, String out) { 87 | 88 | throw new UnsupportedOperationException("Mapping is unmodifiable"); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/StalagmiteParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.world.IGeneratorParser; 6 | import cofh.lib.world.WorldGenStalactite; 7 | import cofh.lib.world.WorldGenStalagmite; 8 | import com.typesafe.config.Config; 9 | import net.minecraft.init.Blocks; 10 | import net.minecraft.world.gen.feature.WorldGenerator; 11 | import org.apache.logging.log4j.Logger; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class StalagmiteParser implements IGeneratorParser { 17 | 18 | private final boolean stalactite; 19 | 20 | public StalagmiteParser(boolean stalactite) { 21 | 22 | this.stalactite = stalactite; 23 | } 24 | 25 | @Override 26 | public WorldGenerator parseGenerator(String generatorName, Config genObject, Logger log, List resList, List matList) { 27 | 28 | // TODO: these names need revised 29 | ArrayList list = new ArrayList<>(); 30 | if (!genObject.hasPath("gen-body")) { 31 | log.info("Entry does not specify gen body for 'stalagmite' generator. Using air."); 32 | list.add(new WeightedRandomBlock(Blocks.AIR)); 33 | } else { 34 | if (!FeatureParser.parseResList(genObject.root().get("gen-body"), list, false)) { 35 | log.warn("Entry specifies invalid gen body for 'stalagmite' generator! Using air!"); 36 | list.clear(); 37 | list.add(new WeightedRandomBlock(Blocks.AIR)); 38 | } 39 | } 40 | WorldGenStalagmite r = stalactite ? new WorldGenStalactite(resList, matList, list) : new WorldGenStalagmite(resList, matList, list); 41 | { 42 | if (genObject.hasPath("min-height")) { 43 | r.minHeight = genObject.getInt("min-height"); 44 | } 45 | if (genObject.hasPath("height-variance")) { 46 | r.heightVariance = genObject.getInt("height-variance"); 47 | } 48 | if (genObject.hasPath("size-variance")) { 49 | r.sizeVariance = genObject.getInt("size-variance"); 50 | } 51 | if (genObject.hasPath("height-mod")) { 52 | r.heightMod = genObject.getInt("height-mod"); 53 | } 54 | if (genObject.hasPath("gen-size")) { 55 | r.genSize = genObject.getInt("gen-size"); 56 | } 57 | if (genObject.hasPath("smooth")) { 58 | r.smooth = genObject.getBoolean("smooth"); 59 | } 60 | if (genObject.hasPath("fat")) { 61 | r.fat = genObject.getBoolean("fat"); 62 | } 63 | if (genObject.hasPath("alt-sinc")) { 64 | r.altSinc = genObject.getBoolean("alt-sinc"); 65 | } 66 | } 67 | return r; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/util/RegistrySocial.java: -------------------------------------------------------------------------------- 1 | package cofh.core.util; 2 | 3 | import cofh.core.init.CoreProps; 4 | import cofh.core.network.PacketHandler; 5 | import cofh.core.network.PacketSocial; 6 | import cofh.core.network.PacketSocial.PacketTypes; 7 | import com.mojang.authlib.GameProfile; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraftforge.common.config.Configuration; 10 | 11 | import java.io.File; 12 | import java.util.LinkedList; 13 | import java.util.List; 14 | import java.util.Locale; 15 | 16 | public class RegistrySocial { 17 | 18 | public static void initialize() { 19 | 20 | friendConf = new Configuration(new File(CoreProps.configDir, "/cofh/core/friends.cfg")); 21 | friendConf.load(); 22 | } 23 | 24 | public static Configuration friendConf; 25 | public static List clientPlayerFriends = new LinkedList<>(); 26 | 27 | public synchronized static boolean addFriend(GameProfile owner, String friendName) { 28 | 29 | if (owner == null || friendName == null) { 30 | return false; 31 | } 32 | friendConf.get(owner.getId().toString(), friendName.toLowerCase(Locale.US), 1); 33 | friendConf.save(); 34 | return true; 35 | } 36 | 37 | public synchronized static boolean removeFriend(GameProfile owner, String friendName) { 38 | 39 | if (owner == null || friendName == null) { 40 | return false; 41 | } 42 | String id = owner.getId().toString(); 43 | friendName = friendName.toLowerCase(Locale.US); 44 | if (friendConf.hasCategory(id)) { 45 | if (friendConf.getCategory(id).containsKey(friendName)) { 46 | friendConf.getCategory(id).remove(friendName); 47 | friendConf.save(); 48 | return true; 49 | } 50 | } 51 | return false; 52 | } 53 | 54 | public static boolean playerHasAccess(String playerName, GameProfile owner) { 55 | 56 | if (owner == null || playerName == null) { 57 | return false; 58 | } 59 | if (playerName.equals(owner.getName())) { 60 | return true; 61 | } 62 | String id = owner.getId().toString(); 63 | return (friendConf.hasCategory(id) && friendConf.getCategory(id).containsKey(playerName.toLowerCase(Locale.US))); 64 | } 65 | 66 | public synchronized static void sendFriendsToPlayer(EntityPlayerMP thePlayer) { 67 | 68 | PacketSocial aPacket = new PacketSocial(); 69 | aPacket.addByte(PacketTypes.FRIEND_LIST.ordinal()); 70 | String id = thePlayer.getGameProfile().getId().toString(); 71 | aPacket.addInt(friendConf.getCategory(id).keySet().size()); 72 | for (String theName : friendConf.getCategory(id).keySet()) { 73 | aPacket.addString(theName); 74 | } 75 | PacketHandler.sendTo(aPacket, thePlayer); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/decoration/SmallTreeParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.decoration; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.world.IGeneratorParser; 6 | import cofh.lib.world.WorldGenSmallTree; 7 | import com.typesafe.config.Config; 8 | import net.minecraft.init.Blocks; 9 | import net.minecraft.world.gen.feature.WorldGenerator; 10 | import org.apache.logging.log4j.Logger; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class SmallTreeParser implements IGeneratorParser { 16 | 17 | @Override 18 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 19 | 20 | ArrayList list = new ArrayList<>(); 21 | ArrayList blocks = new ArrayList<>(); 22 | if (genObject.hasPath("surface")) { 23 | if (!FeatureParser.parseResList(genObject.root().get("surface"), blocks, false)) { 24 | log.warn("Entry specifies invalid surface for 'smalltree' generator! Using dirt!"); 25 | blocks.clear(); 26 | blocks.add(new WeightedRandomBlock(Blocks.GRASS)); 27 | blocks.add(new WeightedRandomBlock(Blocks.DIRT)); 28 | } 29 | } 30 | 31 | if (genObject.hasPath("leaves")) { 32 | list = new ArrayList<>(); 33 | if (!FeatureParser.parseResList(genObject.root().get("leaves"), list, true)) { 34 | log.warn("Entry specifies invalid leaves for 'smalltree' generator!"); 35 | list.clear(); 36 | } 37 | } else { 38 | log.info("Entry does not specify leaves for 'smalltree' generator! There are none!"); 39 | } 40 | 41 | WorldGenSmallTree r = new WorldGenSmallTree(resList, list, matList); 42 | { 43 | if (blocks.size() > 0) { 44 | r.genSurface = blocks.toArray(new WeightedRandomBlock[blocks.size()]); 45 | } 46 | 47 | if (genObject.hasPath("min-height")) { 48 | r.minHeight = genObject.getInt("min-height"); 49 | } 50 | if (genObject.hasPath("height-variance")) { 51 | r.heightVariance = genObject.getInt("height-variance"); 52 | } 53 | 54 | if (genObject.hasPath("tree-checks")) { 55 | r.treeChecks = genObject.getBoolean("tree-checks"); 56 | } 57 | if (genObject.hasPath("relaxed-growth")) { 58 | r.relaxedGrowth = genObject.getBoolean("relaxed-growth"); 59 | } 60 | if (genObject.hasPath("water-loving")) { 61 | r.waterLoving = genObject.getBoolean("water-loving"); 62 | } 63 | if (genObject.hasPath("leaf-variance")) { 64 | r.leafVariance = genObject.getBoolean("leaf-variance"); 65 | } 66 | } 67 | return r; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 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 %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="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 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/init/CoreEnchantments.java: -------------------------------------------------------------------------------- 1 | package cofh.core.init; 2 | 3 | import cofh.core.enchantment.EnchantmentHolding; 4 | import cofh.core.enchantment.EnchantmentMultishot; 5 | import net.minecraft.enchantment.Enchantment; 6 | import net.minecraft.enchantment.EnumEnchantmentType; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.nbt.NBTTagCompound; 9 | import net.minecraft.nbt.NBTTagList; 10 | import net.minecraftforge.common.util.EnumHelper; 11 | import net.minecraftforge.fml.common.registry.GameRegistry; 12 | 13 | public class CoreEnchantments { 14 | 15 | private CoreEnchantments() { 16 | 17 | } 18 | 19 | /* INIT */ 20 | public static void preInit() { 21 | 22 | holding = new EnchantmentHolding("cofhcore:holding"); 23 | multishot = new EnchantmentMultishot("cofhcore:multishot"); 24 | // vorpal = new EnchantmentVorpal("cofhcore:vorpal"); 25 | 26 | GameRegistry.register(holding); 27 | GameRegistry.register(multishot); 28 | } 29 | 30 | /* HELPERS */ 31 | public static void addEnchantment(ItemStack stack, Enchantment ench, int level) { 32 | 33 | addEnchantment(stack.getTagCompound(), Enchantment.getEnchantmentID(ench), level); 34 | } 35 | 36 | public static void addEnchantment(NBTTagCompound nbt, Enchantment ench, int level) { 37 | 38 | addEnchantment(nbt, Enchantment.getEnchantmentID(ench), level); 39 | } 40 | 41 | public static void addEnchantment(ItemStack stack, int id, int level) { 42 | 43 | addEnchantment(stack.getTagCompound(), id, level); 44 | } 45 | 46 | public static void addEnchantment(NBTTagCompound nbt, int id, int level) { 47 | 48 | if (nbt == null) { 49 | nbt = new NBTTagCompound(); 50 | } 51 | NBTTagList list = getEnchantmentTagList(nbt); 52 | 53 | boolean found = false; 54 | for (int i = 0; i < list.tagCount() && !found; i++) { 55 | NBTTagCompound tag = list.getCompoundTagAt(i); 56 | if (tag.getShort("id") == id) { 57 | tag.setShort("id", (short) id); 58 | tag.setShort("lvl", (short) level); 59 | found = true; 60 | } 61 | } 62 | if (!found) { 63 | NBTTagCompound tag = new NBTTagCompound(); 64 | tag.setShort("id", (short) id); 65 | tag.setShort("lvl", (short) level); 66 | list.appendTag(tag); 67 | } 68 | nbt.setTag("ench", list); 69 | } 70 | 71 | private static NBTTagList getEnchantmentTagList(NBTTagCompound nbt) { 72 | 73 | return nbt.getTagList("ench", 10); 74 | } 75 | 76 | /* REFERENCES */ 77 | public static Enchantment holding; 78 | public static Enchantment multishot; 79 | public static Enchantment vorpal; 80 | 81 | /* TYPES */ 82 | public static final EnumEnchantmentType ENCHANTMENT_TYPE_STORAGE = EnumHelper.addEnchantmentType("COFH:STORAGE"); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/ja_JP.lang: -------------------------------------------------------------------------------- 1 | #ja_JP 2 | 3 | enchant.cofh.holding=拡張スロット 4 | enchant.cofh.multishot=多重射撃 5 | 6 | fluid.tile.lava=溶岩 7 | fluid.tile.water=水 8 | 9 | info.cofh.access=アクセス 10 | info.cofh.accessMode=アクセス権限 11 | info.cofh.accessPrivate=所持者のみ 12 | info.cofh.accessPublic=公開 13 | info.cofh.accessRestricted=制限あり 14 | info.cofh.addDestination=宛先追加 15 | info.cofh.addFrequency=周波数追加 16 | info.cofh.all=すべて 17 | info.cofh.amount=数値 18 | info.cofh.angle=角度 19 | info.cofh.augmentation=アップグレード 20 | info.cofh.blank=情報なし 21 | info.cofh.buffer=バッファ 22 | info.cofh.capacity=保有量 23 | info.cofh.charge=充電 24 | info.cofh.contents=内容 25 | info.cofh.controlStatus=レッドストーン制御 26 | info.cofh.damageAttack=攻撃力 27 | info.cofh.damageFlux=追加攻撃力 28 | info.cofh.disable=無効 29 | info.cofh.disabled=無効 30 | info.cofh.distance=距離 31 | info.cofh.dry=乾いた 32 | info.cofh.duration=持続時間 33 | info.cofh.efficiency=効率 34 | info.cofh.empty=空 35 | info.cofh.enable=有効 36 | info.cofh.enabled=有効 37 | info.cofh.energy=エネルギー 38 | info.cofh.energyConsume=エネルギー消費 39 | info.cofh.energyProduce=エネルギー生産 40 | info.cofh.energyStored=充電量 41 | info.cofh.filter=フィルター 42 | info.cofh.fluid=液体 43 | info.cofh.fluids=液体 44 | info.cofh.force=強さ 45 | info.cofh.forDetails=キーを押すと詳細を表示します。 46 | info.cofh.frequency=周波数 47 | info.cofh.hasInfo=情報あり 48 | info.cofh.high=高 49 | info.cofh.idle=非稼働 50 | info.cofh.ignored=なし 51 | info.cofh.infinite=無限 52 | info.cofh.information=情報 53 | info.cofh.item=アイテム 54 | info.cofh.items=アイテム 55 | info.cofh.level=レベル 56 | info.cofh.locked=ロック 57 | info.cofh.low=低 58 | info.cofh.maxPower=最大エネルギー消費 59 | info.cofh.modeChange=キーでモードチェンジします。 60 | info.cofh.none=なし 61 | info.cofh.output=搬出 62 | info.cofh.owner=所有者 63 | info.cofh.perUse=/1回の使用 64 | info.cofh.receive=受信 65 | info.cofh.receiving=受信中 66 | info.cofh.redstoneControl=レッドストーン制御 67 | info.cofh.removeDestination=送信先の登録解除 68 | info.cofh.removeFrequency=周波数登録解除 69 | info.cofh.security=セキュリティ 70 | info.cofh.send=送信 71 | info.cofh.sending=送信中 72 | info.cofh.setDestination=送信先の登録 73 | info.cofh.setFrequency=周波数登録 74 | info.cofh.signal=レッドストーン制御 75 | info.cofh.signalRequired=レッドストーン入力 76 | info.cofh.soaked=濡れた 77 | info.cofh.strength=強度 78 | info.cofh.success=完了しました。 79 | info.cofh.template=テンプレート 80 | info.cofh.transfer=移送 81 | info.cofh.tutorial.fluxRequired=機械の稼働にはRFが必要です。 82 | info.cofh.tutorial.tabAugment=アップグレードタブにて、機械にいろいろな機能を追加や取り外しができます。 83 | info.cofh.tutorial.tabConfiguration=The Configuration tab determines input and output parameters for this block. 84 | info.cofh.tutorial.tabRedstone=レッドストーン制御タブにて、レッドストーン信号による稼働制御を設定できます。 85 | info.cofh.tutorial.tabSecurity=セキュリティタブにて、誰がこのマシンを扱えるかを設定できます。 86 | info.cofh.tutorial=使い方 87 | info.cofh.unlocked=未ロック 88 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/item/ItemArmorCore.java: -------------------------------------------------------------------------------- 1 | package cofh.core.item; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import com.google.common.collect.HashMultimap; 5 | import com.google.common.collect.Multimap; 6 | import net.minecraft.creativetab.CreativeTabs; 7 | import net.minecraft.entity.Entity; 8 | import net.minecraft.entity.ai.attributes.AttributeModifier; 9 | import net.minecraft.inventory.EntityEquipmentSlot; 10 | import net.minecraft.item.Item; 11 | import net.minecraft.item.ItemArmor; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraftforge.fml.relauncher.Side; 14 | import net.minecraftforge.fml.relauncher.SideOnly; 15 | 16 | import javax.annotation.Nonnull; 17 | import java.util.List; 18 | 19 | public class ItemArmorCore extends ItemArmor { 20 | 21 | protected String repairIngot = ""; 22 | protected String[] textures = new String[2]; 23 | 24 | protected boolean showInCreative = true; 25 | 26 | protected Multimap properties = HashMultimap.create(); 27 | 28 | public ItemArmorCore(ArmorMaterial material, EntityEquipmentSlot type) { 29 | 30 | super(material, 0, type); 31 | } 32 | 33 | public ItemArmorCore putAttribute(String attribute, AttributeModifier modifier) { 34 | 35 | properties.put(attribute, modifier); 36 | return this; 37 | } 38 | 39 | public ItemArmorCore setArmorTextures(String[] textures) { 40 | 41 | this.textures = textures; 42 | return this; 43 | } 44 | 45 | public ItemArmorCore setRepairIngot(String repairIngot) { 46 | 47 | this.repairIngot = repairIngot; 48 | return this; 49 | } 50 | 51 | public ItemArmorCore setShowInCreative(boolean showInCreative) { 52 | 53 | this.showInCreative = showInCreative; 54 | return this; 55 | } 56 | 57 | @Override 58 | @SideOnly (Side.CLIENT) 59 | public void getSubItems(@Nonnull Item item, CreativeTabs tab, List list) { 60 | 61 | if (showInCreative) { 62 | list.add(new ItemStack(item, 1, 0)); 63 | } 64 | } 65 | 66 | @Override 67 | public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { 68 | 69 | return ItemHelper.isOreNameEqual(stack, repairIngot); 70 | } 71 | 72 | @Override 73 | public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { 74 | 75 | if (slot == EntityEquipmentSlot.LEGS) { 76 | return textures[1]; 77 | } 78 | return textures[0]; 79 | } 80 | 81 | @Override 82 | public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) { 83 | 84 | if (slot == armorType) { 85 | Multimap map = super.getAttributeModifiers(slot, stack); 86 | map.putAll(properties); 87 | return map; 88 | } 89 | return super.getAttributeModifiers(slot, stack); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/resources/assets/cofh/lang/fr_CA.lang: -------------------------------------------------------------------------------- 1 | #fr_CA 2 | 3 | config.Client.tooltip=Configurer les options du côté client seulement. 4 | config.Common.tooltip=Configurer les options générales. 5 | config.Core.tooltip=Configurer les options du module du noyau. 6 | config.Loot.tooltip=Configurer les options du module du loot. 7 | 8 | enchant.cofh.holding=Contenu 9 | enchant.cofh.multishot=Multi-tirs 10 | 11 | fluid.tile.lava=Lave 12 | fluid.tile.water=Eau 13 | 14 | info.cofh.access=Accès 15 | info.cofh.accessMode=Mode d'accès 16 | info.cofh.accessPrivate=Privé 17 | info.cofh.accessPublic=Public 18 | info.cofh.accessRestricted=Restreint 19 | info.cofh.all=Tout 20 | info.cofh.amount=Quantité 21 | info.cofh.anotherplayer=Un autre joueur 22 | info.cofh.blank=Vierge 23 | info.cofh.capacity=Capacité 24 | info.cofh.contents=Contenu 25 | info.cofh.controlStatus=Statut de contrôle 26 | info.cofh.damageAttack=Dégâts d'attaque 27 | info.cofh.damageFlux=Dégâts de flux 28 | info.cofh.disabled=Désactivé 29 | info.cofh.dry=Sèche 30 | info.cofh.duration=Durée 31 | info.cofh.empty=Vide 32 | info.cofh.enabled=Activé 33 | info.cofh.energy=Énergie 34 | info.cofh.energyConsume=Consommation 35 | info.cofh.energyProduce=Production 36 | info.cofh.energyStored=Énergie stockée 37 | info.cofh.fluid=Fluide 38 | info.cofh.fluids=Fluides 39 | info.cofh.forDetails=pour avoir des détails 40 | info.cofh.frequency=Fréquence 41 | info.cofh.hasInfo=Contient de l'information 42 | info.cofh.high=Fort 43 | info.cofh.hold=Maintenez 44 | info.cofh.ignored=Ignoré 45 | info.cofh.item=Objet 46 | info.cofh.items=Objets 47 | info.cofh.level=Niveau 48 | info.cofh.locked=Verrouillée 49 | info.cofh.low=Faible 50 | info.cofh.maxPower=Énergie maximum 51 | info.cofh.none=Rien 52 | info.cofh.owner=Propriétaire 53 | info.cofh.perUse=par utilisation 54 | info.cofh.press=Appuyez sur 55 | info.cofh.receive=Reçoit 56 | info.cofh.receiving=Reçoit 57 | info.cofh.redstoneControl=Ctrl. de redstone 58 | info.cofh.security=Securité 59 | info.cofh.send=Envoie 60 | info.cofh.sending=Envoie 61 | info.cofh.shift=Maj 62 | info.cofh.signalRequired=Signal requis 63 | info.cofh.soaked=Mouillée 64 | info.cofh.source=infinie 65 | info.cofh.stored=Stocké 66 | info.cofh.strength=Force 67 | info.cofh.success=Succès ! 68 | info.cofh.transfer=Transférer 69 | info.cofh.tutorial.fluxRequired=Requiert un flux de redstone pour fonctionner. 70 | info.cofh.tutorial.tabAugment=L'onglet Augmentation permet des ajouts de modules. 71 | info.cofh.tutorial.tabRedstone=L'onglet Contrôle de redstone configure comment cet appareil réagit aux signaux de redstone. 72 | info.cofh.tutorial.tabSecurity=L'onglet Sécurité permet au propriétaire de contrôler qui peut accéder à l'appareil. 73 | info.cofh.tutorial=Tutoriel 74 | info.cofh.unlocked=Déverouillée 75 | 76 | item.invalid.name=Objet invalide (détruire) 77 | -------------------------------------------------------------------------------- /src/main/java/cofh/asmhooks/world/WorldProxy.java: -------------------------------------------------------------------------------- 1 | package cofh.asmhooks.world; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.world.World; 5 | import net.minecraft.world.WorldSettings; 6 | import net.minecraft.world.chunk.IChunkProvider; 7 | import net.minecraftforge.fml.relauncher.ReflectionHelper; 8 | 9 | public abstract class WorldProxy extends World { 10 | 11 | protected World proxiedWorld; 12 | 13 | private static String getWorldName(World world) { 14 | 15 | return world.getWorldInfo().getWorldName(); 16 | } 17 | 18 | private static WorldSettings getWorldSettings(World world) { 19 | 20 | return new WorldSettings(world.getWorldInfo()); 21 | } 22 | 23 | public WorldProxy(World world) { 24 | 25 | super(world.getSaveHandler(), world.getWorldInfo(), world.provider, world.theProfiler, world.isRemote); 26 | this.proxiedWorld = world; 27 | 28 | ReflectionHelper.setPrivateValue(World.class, this, world.getPerWorldStorage(), "perWorldStorage"); // forge-added, no reobf 29 | ReflectionHelper.setPrivateValue(World.class, this, world.capturedBlockSnapshots, "capturedBlockSnapshots"); // forge-added, no reobf 30 | ReflectionHelper.setPrivateValue(World.class, this, world.loadedEntityList, "field_72996_f", "loadedEntityList"); 31 | ReflectionHelper.setPrivateValue(World.class, this, world.loadedTileEntityList, "field_147482_g", "loadedTileEntityList"); 32 | ReflectionHelper.setPrivateValue(World.class, this, world.playerEntities, "field_73010_i", "playerEntities"); 33 | ReflectionHelper.setPrivateValue(World.class, this, world.weatherEffects, "field_73007_j", "weatherEffects"); 34 | ReflectionHelper.setPrivateValue(World.class, this, world.rand, "field_75169_l", "rand"); 35 | 36 | mapStorage = world.getMapStorage(); 37 | cofh_updateProps(); 38 | } 39 | 40 | protected void cofh_updateProps() { 41 | 42 | scheduledUpdatesAreImmediate = proxiedWorld.scheduledUpdatesAreImmediate; 43 | skylightSubtracted = proxiedWorld.skylightSubtracted; 44 | prevRainingStrength = proxiedWorld.prevRainingStrength; 45 | rainingStrength = proxiedWorld.rainingStrength; 46 | prevThunderingStrength = proxiedWorld.prevThunderingStrength; 47 | thunderingStrength = proxiedWorld.thunderingStrength; 48 | getWorldInfo().setDifficulty(proxiedWorld.getDifficulty()); 49 | lastLightningBolt = proxiedWorld.lastLightningBolt; 50 | chunkProvider = proxiedWorld.getChunkProvider(); 51 | captureBlockSnapshots = proxiedWorld.captureBlockSnapshots; 52 | restoringBlockSnapshots = proxiedWorld.restoringBlockSnapshots; 53 | villageCollectionObj = proxiedWorld.villageCollectionObj; 54 | } 55 | 56 | @Override 57 | public IChunkProvider createChunkProvider() { 58 | 59 | return null; 60 | } 61 | 62 | @Override 63 | public Entity getEntityByID(int id) { 64 | 65 | return null; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/feature/DecorationParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.feature; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.world.IGeneratorParser; 6 | import cofh.lib.world.WorldGenDecoration; 7 | import com.typesafe.config.Config; 8 | import com.typesafe.config.ConfigObject; 9 | import net.minecraft.init.Blocks; 10 | import net.minecraft.world.gen.feature.WorldGenerator; 11 | import org.apache.logging.log4j.Logger; 12 | 13 | import java.util.ArrayList; 14 | import java.util.Collections; 15 | import java.util.List; 16 | 17 | public class DecorationParser extends SurfaceParser implements IGeneratorParser { 18 | 19 | @Override 20 | public WorldGenerator parseGenerator(String name, Config genObject, Logger log, List resList, List matList) { 21 | 22 | int clusterSize = genObject.getInt("cluster-size"); // TODO: another name? 23 | if (clusterSize <= 0) { 24 | log.warn("Invalid cluster size for generator '%s'", name); 25 | return null; 26 | } 27 | 28 | ArrayList list = new ArrayList<>(); 29 | ConfigObject genData = genObject.root(); 30 | if (!genObject.hasPath("surface")) { 31 | log.info("Entry does not specify surface for 'decoration' generator. Using grass."); 32 | list.add(new WeightedRandomBlock(Blocks.GRASS)); 33 | } else { 34 | if (!FeatureParser.parseResList(genData.get("surface"), list, false)) { 35 | log.warn("Entry specifies invalid surface for 'decoration' generator! Using grass!"); 36 | list.clear(); 37 | list.add(new WeightedRandomBlock(Blocks.GRASS)); 38 | } 39 | } 40 | WorldGenDecoration r = new WorldGenDecoration(resList, clusterSize, matList, list); 41 | if (genObject.hasPath("see-sky")) { 42 | r.setSeeSky(genObject.getBoolean("see-sky")); 43 | } 44 | if (genObject.hasPath("check-stay")) { 45 | r.setCheckStay(genObject.getBoolean("check-stay")); 46 | } 47 | if (genObject.hasPath("stack-height")) { 48 | r.setStackHeight(FeatureParser.parseNumberValue(genData.get("stack-height"))); 49 | } 50 | if (genObject.hasPath("x-variance")) { 51 | r.setXVar(FeatureParser.parseNumberValue(genData.get("x-variance"), 1, 15)); 52 | } 53 | if (genObject.hasPath("y-variance")) { 54 | r.setYVar(FeatureParser.parseNumberValue(genData.get("y-variance"), 0, 15)); 55 | } 56 | if (genObject.hasPath("z-variance")) { 57 | r.setZVar(FeatureParser.parseNumberValue(genData.get("z-variance"), 1, 15)); 58 | } 59 | return r; 60 | } 61 | 62 | @Override 63 | protected List generateDefaultMaterial() { 64 | 65 | return Collections.singletonList(new WeightedRandomBlock(Blocks.GRASS, -1)); 66 | } 67 | 68 | @Override 69 | protected String getDefaultGenerator() { 70 | 71 | return "decoration"; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/gui/element/TabEnergy.java: -------------------------------------------------------------------------------- 1 | package cofh.core.gui.element; 2 | 3 | import cofh.api.tileentity.IEnergyInfo; 4 | import cofh.core.init.CoreTextures; 5 | import cofh.lib.gui.GuiBase; 6 | import cofh.lib.gui.element.TabBase; 7 | import cofh.lib.util.helpers.StringHelper; 8 | import net.minecraft.client.renderer.GlStateManager; 9 | 10 | import java.util.List; 11 | 12 | public class TabEnergy extends TabBase { 13 | 14 | public static int defaultSide = 0; 15 | public static int defaultHeaderColor = 0xe1c92f; 16 | public static int defaultSubHeaderColor = 0xaaafb8; 17 | public static int defaultTextColor = 0x000000; 18 | public static int defaultBackgroundColorOut = 0xd0650b; 19 | public static int defaultBackgroundColorIn = 0x0a76d0; 20 | 21 | private IEnergyInfo myContainer; 22 | private boolean isProducer; 23 | 24 | public TabEnergy(GuiBase gui, IEnergyInfo container, boolean isProducer) { 25 | 26 | this(gui, defaultSide, container, isProducer); 27 | } 28 | 29 | public TabEnergy(GuiBase gui, int side, IEnergyInfo container, boolean producer) { 30 | 31 | super(gui, side); 32 | 33 | headerColor = defaultHeaderColor; 34 | subheaderColor = defaultSubHeaderColor; 35 | textColor = defaultTextColor; 36 | backgroundColor = producer ? defaultBackgroundColorOut : defaultBackgroundColorIn; 37 | 38 | maxHeight = 92; 39 | maxWidth = 100; 40 | myContainer = container; 41 | isProducer = producer; 42 | } 43 | 44 | @Override 45 | protected void drawForeground() { 46 | 47 | drawTabIcon(CoreTextures.ICON_ENERGY); 48 | if (!isFullyOpened()) { 49 | return; 50 | } 51 | String powerDirection = isProducer ? "info.cofh.energyProduce" : "info.cofh.energyConsume"; 52 | 53 | getFontRenderer().drawStringWithShadow(StringHelper.localize("info.cofh.energy"), posXOffset() + 20, posY + 6, headerColor); 54 | getFontRenderer().drawStringWithShadow(StringHelper.localize(powerDirection) + ":", posXOffset() + 6, posY + 18, subheaderColor); 55 | getFontRenderer().drawString(myContainer.getInfoEnergyPerTick() + " RF/t", posXOffset() + 14, posY + 30, textColor); 56 | getFontRenderer().drawStringWithShadow(StringHelper.localize("info.cofh.maxPower") + ":", posXOffset() + 6, posY + 42, subheaderColor); 57 | getFontRenderer().drawString(myContainer.getInfoMaxEnergyPerTick() + " RF/t", posXOffset() + 14, posY + 54, textColor); 58 | getFontRenderer().drawStringWithShadow(StringHelper.localize("info.cofh.energyStored") + ":", posXOffset() + 6, posY + 66, subheaderColor); 59 | getFontRenderer().drawString(myContainer.getInfoEnergyStored() + " RF", posXOffset() + 14, posY + 78, textColor); 60 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 61 | } 62 | 63 | @Override 64 | public void addTooltip(List list) { 65 | 66 | if (!isFullyOpened()) { 67 | list.add(myContainer.getInfoEnergyPerTick() + " RF/t"); 68 | return; 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CoFH "Don't Be a Jerk" License 2 | ==================================== 3 | #### Okay, so here's the deal. 4 | 5 | You'll notice that this repository does not have a license! By default, that means "All Rights Reserved." 6 | 7 | That is indeed the case. All rights reserved, as far as the code is concerned. 8 | 9 | Art and sound assets are released under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0), a summary of which can be found at: https://creativecommons.org/licenses/by-sa/4.0/ 10 | 11 | ©2012-2017 Cult of the Full Hub / Team CoFH / CoFH 12 | 13 | #### Homepage 14 | 15 | [TeamCoFH Home Page](http://teamcofh.com/) 16 | 17 | [IRC #ThermalExpansion on esper.net](http://webchat.esper.net/?nick=ThermalWiki....&channels=ThermalExpansion) 18 | 19 | #### Notice 20 | 21 | Contribution to this repository means that you are granting us rights over the code that you choose to contribute. If you do not agree with that, do not contribute. 22 | 23 | So, why is this here? Well, the rights are reserved, but what that really means is that we choose what to do with the rights. So here you go. 24 | 25 | #### You CAN 26 | - Fork and modify the code. 27 | - Submit Pull Requests to this repository. 28 | - Copy portions of this code for use in other projects. 29 | - Write your own code that uses this code as a dependency. (addon mods!) 30 | 31 | #### You CANNOT 32 | - Redistribute this in its entirety as source or compiled code. 33 | - Create or distribute code which contains 50% or more Functionally Equivalent Statements* from this repository. 34 | 35 | #### You MUST 36 | - Maintain a visible repository of your code which is inspired by, derived from, or copied from this code. Basically, if you use it, pay it forward. You keep rights to your OWN code, but you still must make your source visible. 37 | - Not be a jerk**. Seriously, if you're a jerk, you can't use this code. That's part of the agreement. 38 | 39 | #### Notes, License & Copyright 40 | 41 | *A Functionally Equivalent Statement is a code fragment which, regardless of whitespace and object names, achieves the same result within the context of a Minecraft mod or addon. Basically you can't copy the code, rename the variables, add whitespace and say it's different. It's not. 42 | 43 | **A jerk is anyone who attempts to or intends to claim partial or total ownership of the original or repackaged code and/or attempts to or intends to redistribute original or repackaged code without prior express written permission from the owners (CoFH). 44 | 45 | Essentially, take this and learn from it! Create addon mods that depend on it! If you see something we can improve, tell us. Submit a Pull Request. The one catch: don't steal! A lot of effort has gone into this, and if you were to take this and call it your own, you'd basically be a big jerk. 46 | 47 | Don't be a jerk. 48 | 49 | See LICENSE-CODE.txt and LICENSE-ART.txt for license information. 50 | 51 | ©2012-2017 Cult of the Full Hub / Team CoFH / CoFH 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/core/world/feature/UnderfluidParser.java: -------------------------------------------------------------------------------- 1 | package cofh.core.world.feature; 2 | 3 | import cofh.core.world.FeatureParser; 4 | import cofh.lib.util.WeightedRandomBlock; 5 | import cofh.lib.util.numbers.INumberProvider; 6 | import cofh.lib.world.feature.FeatureBase; 7 | import cofh.lib.world.feature.FeatureBase.GenRestriction; 8 | import cofh.lib.world.feature.FeatureGenUnderfluid; 9 | import com.typesafe.config.Config; 10 | import gnu.trove.set.hash.TIntHashSet; 11 | import net.minecraft.init.Blocks; 12 | import net.minecraft.world.gen.feature.WorldGenerator; 13 | import net.minecraftforge.common.DungeonHooks.DungeonMob; 14 | import net.minecraftforge.fluids.Fluid; 15 | import net.minecraftforge.fluids.FluidRegistry; 16 | import org.apache.logging.log4j.Logger; 17 | 18 | import java.util.ArrayList; 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | public class UnderfluidParser extends UniformParser { 23 | 24 | private boolean isUnderwater; 25 | 26 | public UnderfluidParser(boolean water) { 27 | 28 | isUnderwater = water; 29 | } 30 | 31 | @Override 32 | protected List generateDefaultMaterial() { 33 | 34 | return Arrays.asList(new WeightedRandomBlock(Blocks.DIRT, -1), new WeightedRandomBlock(Blocks.GRASS, -1)); 35 | } 36 | 37 | @Override 38 | protected FeatureBase getFeature(String featureName, Config genObject, WorldGenerator gen, INumberProvider numClusters, GenRestriction biomeRes, boolean retrogen, GenRestriction dimRes, Logger log) { 39 | 40 | boolean water = true; 41 | int[] fluidList = null; 42 | l: 43 | if (genObject.hasPath("fluid")) { 44 | ArrayList list = new ArrayList<>(); 45 | if (!FeatureParser.parseWeightedStringList(genObject.root().get("fluid"), list)) { 46 | break l; 47 | } 48 | water = false; 49 | TIntHashSet ints = new TIntHashSet(); 50 | for (DungeonMob str : list) { 51 | // ints.add(FluidRegistry.getFluidID(str.type)); 52 | // NOPE. this NPEs. 53 | Fluid fluid = FluidRegistry.getFluid(str.type); 54 | if (fluid != null) { 55 | ints.add(FluidRegistry.getFluidID(fluid)); 56 | } 57 | } 58 | fluidList = ints.toArray(); 59 | } 60 | 61 | // TODO: WorldGeneratorAdv that allows access to its material list 62 | List matList = defaultMaterial; 63 | if (genObject.hasPath("material")) { 64 | matList = new ArrayList<>(); 65 | if (!FeatureParser.parseResList(genObject.root().get("material"), matList, false)) { 66 | log.warn("Invalid material list! Using default list."); 67 | matList = defaultMaterial; 68 | } 69 | } 70 | if (water) { 71 | return new FeatureGenUnderfluid(featureName, gen, matList, numClusters, biomeRes, retrogen, dimRes); 72 | } else { 73 | return new FeatureGenUnderfluid(featureName, gen, matList, fluidList, numClusters, biomeRes, retrogen, dimRes); 74 | } 75 | } 76 | 77 | @Override 78 | protected String getDefaultGenerator() { 79 | 80 | return isUnderwater ? "plate" : super.getDefaultGenerator(); 81 | } 82 | 83 | } 84 | --------------------------------------------------------------------------------