├── README.txt ├── gradle ├── scripts │ ├── mc.gradle │ ├── version.gradle │ ├── getbuildnumber.gradle │ └── jars.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── gradle.properties ├── src └── main │ ├── resources │ ├── assets │ │ └── libvulpes │ │ │ ├── textures │ │ │ ├── fx │ │ │ │ └── x.png │ │ │ ├── gui │ │ │ │ ├── null.png │ │ │ │ ├── GuiScan.png │ │ │ │ ├── maingui.png │ │ │ │ ├── starryBg.png │ │ │ │ ├── GuiArrowDown.png │ │ │ │ ├── GuiArrowLeft.png │ │ │ │ ├── GuiButtonRed.png │ │ │ │ ├── buttonSquare.png │ │ │ │ ├── slotDisabled.png │ │ │ │ ├── GuiArrowRight.png │ │ │ │ ├── GuiScan_hover.png │ │ │ │ ├── GuiScan_press.png │ │ │ │ ├── coalGenerator.png │ │ │ │ ├── buttons │ │ │ │ │ ├── switchOff.png │ │ │ │ │ ├── switchOn.png │ │ │ │ │ ├── buttonRedstoneAllowed.png │ │ │ │ │ ├── buttonRedstoneInverted.png │ │ │ │ │ ├── buttonRedstoneNotAllowed.png │ │ │ │ │ ├── buttonRedstoneAllowed_hover.png │ │ │ │ │ ├── buttonRedstoneInverted_hover.png │ │ │ │ │ └── buttonRedstoneNotAllowed_hover.png │ │ │ │ ├── GuiArrowDown_hover.png │ │ │ │ ├── GuiArrowLeft_hover.png │ │ │ │ ├── GuiArrowRight_hover.png │ │ │ │ ├── GuiButtonRed_hover.png │ │ │ │ ├── GuiButtonRed_press.png │ │ │ │ ├── buttonSquare_hover.png │ │ │ │ ├── GuiArrowDown_pressed.png │ │ │ │ ├── GuiArrowLeft_pressed.png │ │ │ │ ├── GuiArrowRight_pressed.png │ │ │ │ └── GuiButtonRed_disabled.png │ │ │ ├── items │ │ │ │ ├── boule.png │ │ │ │ ├── dust.png │ │ │ │ ├── fan.png │ │ │ │ ├── gear.png │ │ │ │ ├── ingot.png │ │ │ │ ├── plate.png │ │ │ │ ├── sheet.png │ │ │ │ ├── stick.png │ │ │ │ ├── Linker.png │ │ │ │ ├── crystal.png │ │ │ │ ├── nugget.png │ │ │ │ ├── battery0.png │ │ │ │ ├── battery1.png │ │ │ │ └── holoProjector.png │ │ │ └── blocks │ │ │ │ ├── oreTin.png │ │ │ │ ├── IC2Plug.png │ │ │ │ ├── batteryRF.png │ │ │ │ ├── coilPole.png │ │ │ │ ├── coilSide.png │ │ │ │ ├── oreCopper.png │ │ │ │ ├── oreRutile.png │ │ │ │ ├── fluidInput.png │ │ │ │ ├── fluidOutput.png │ │ │ │ ├── inputHatch.png │ │ │ │ ├── oreAluminum.png │ │ │ │ ├── oreIridium.png │ │ │ │ ├── oreTemplate.xcf │ │ │ │ ├── outputHatch.png │ │ │ │ ├── machineGeneric.png │ │ │ │ ├── oreDilithium.png │ │ │ │ ├── structureBlock.png │ │ │ │ └── advStructureBlock.png │ │ │ ├── defaultrecipe.xml │ │ │ └── lang │ │ │ ├── zh_CN.lang │ │ │ ├── ru_RU.lang │ │ │ ├── es_ES.lang │ │ │ ├── en_US.lang │ │ │ └── fr_FR.lang │ └── mcmod.info │ └── java │ ├── zmaster587 │ └── libVulpes │ │ ├── Configuration.java │ │ ├── api │ │ ├── IToggleableMachine.java │ │ ├── LibVulpesItems.java │ │ ├── IDismountHandler.java │ │ ├── IUniversalEnergy.java │ │ ├── IJetPack.java │ │ ├── material │ │ │ ├── MixedMaterial.java │ │ │ └── AllowedProducts.java │ │ ├── IUniversalEnergyTransmitter.java │ │ ├── IModularArmor.java │ │ ├── LibVulpesBlocks.java │ │ └── IArmorComponent.java │ │ ├── block │ │ ├── INamedMetaBlock.java │ │ ├── BlockAlphaTexture.java │ │ ├── BlockMeta.java │ │ ├── BlockMetalBlock.java │ │ ├── BlockCoil.java │ │ ├── multiblock │ │ │ ├── BlockMultiMachineBattery.java │ │ │ ├── BlockMultiBlockComponentVisible.java │ │ │ ├── BlockMultiblockStructure.java │ │ │ └── BlockMultiblockMachine.java │ │ ├── BlockOre.java │ │ ├── BlockMulti.java │ │ ├── BlockFullyRotatable.java │ │ ├── RotatableBlock.java │ │ └── BlockPhantom.java │ │ ├── tile │ │ ├── IInventoryMultiblock.java │ │ ├── IMultiblock.java │ │ ├── multiblock │ │ │ ├── hatch │ │ │ │ ├── TileInputHatch.java │ │ │ │ └── TileOutputHatch.java │ │ │ └── TilePlaceholder.java │ │ ├── energy │ │ │ ├── TilePlugInputRF.java │ │ │ ├── TilePlugOutputRF.java │ │ │ ├── TilePlugInputIC2.java │ │ │ └── TileCoalGenerator.java │ │ ├── TileEntityItemFueledMachine.java │ │ ├── TileMaterial.java │ │ ├── TileEntityRFMachine.java │ │ ├── TileEntityPowerMachine.java │ │ ├── TileInventoriedRFConsumerTank.java │ │ ├── TileInventoriedRFConsumer.java │ │ ├── TileInventoriedForgePowerMachine.java │ │ ├── TileEntityRFConsumer.java │ │ ├── TileInventoriedForgeProducer.java │ │ └── TileSchematic.java │ │ ├── util │ │ ├── IAdjBlockUpdate.java │ │ ├── Vector3F.java │ │ ├── ItemStackMapping.java │ │ ├── PoweredTimedItemStack.java │ │ ├── INetworkMachine.java │ │ ├── IconResource.java │ │ ├── SingleEntry.java │ │ ├── VulpineMath.java │ │ ├── BlockPosition.java │ │ ├── UniversalBattery.java │ │ ├── MultiBattery.java │ │ ├── MultiInventory.java │ │ └── InputSyncHandler.java │ │ ├── PacketID.java │ │ ├── gui │ │ ├── IlimitedItemSlotEntity.java │ │ ├── SlotMachineOutput.java │ │ ├── SlotLimitedItem.java │ │ ├── SlotListAllowed.java │ │ ├── SlotOreDict.java │ │ ├── SlotOreDictList.java │ │ ├── SlotSingleItem.java │ │ ├── CommonResources.java │ │ └── GuiToggleButtonImage.java │ │ ├── interfaces │ │ ├── INetworkEntity.java │ │ ├── IRecipe.java │ │ └── ILinkableTile.java │ │ ├── inventory │ │ ├── modules │ │ │ ├── IGuiCallback.java │ │ │ ├── ISelectionNotify.java │ │ │ ├── IToggleButton.java │ │ │ ├── ISliderBar.java │ │ │ ├── IButtonInventory.java │ │ │ ├── IModularInventory.java │ │ │ ├── IDataSync.java │ │ │ ├── ModuleOutputSlotArray.java │ │ │ ├── ModuleLimitedSlotArray.java │ │ │ ├── ModuleSync.java │ │ │ ├── ModuleTexturedSlotArray.java │ │ │ ├── IProgressBar.java │ │ │ ├── ModuleImage.java │ │ │ ├── ModuleNumericTextbox.java │ │ │ ├── ModuleSlotArray.java │ │ │ ├── ModuleSlider.java │ │ │ ├── ModuleSlotArmor.java │ │ │ ├── ModuleRedstoneOutputButton.java │ │ │ ├── ModuleText.java │ │ │ ├── ModuleDualProgressBar.java │ │ │ ├── ModuleTextBox.java │ │ │ ├── ModuleTab.java │ │ │ └── ModuleScaledImage.java │ │ ├── GuiModularFullScreen.java │ │ ├── slot │ │ │ └── SlotArmor.java │ │ ├── GuiHandler.java │ │ └── TextureResources.java │ │ ├── render │ │ └── TextPart.java │ │ ├── recipe │ │ └── NumberedOreDictStack.java │ │ ├── items │ │ ├── ItemBlockMeta.java │ │ ├── ItemOre.java │ │ ├── ItemIngredient.java │ │ ├── ItemMaterialBlock.java │ │ └── ItemOreProduct.java │ │ ├── common │ │ └── CommonProxy.java │ │ ├── NEILibVulpesConfig.java │ │ ├── network │ │ ├── INetworkItem.java │ │ ├── PacketChangeKeyState.java │ │ ├── BasePacket.java │ │ └── PacketMachine.java │ │ ├── client │ │ ├── RepeatingSound.java │ │ ├── ClientProxy.java │ │ ├── ResourceIcon.java │ │ └── util │ │ │ └── IndicatorBarImage.java │ │ ├── compat │ │ └── InventoryCompat.java │ │ └── entity │ │ └── fx │ │ └── FxErrorBlock.java │ └── cofh │ └── api │ └── energy │ ├── IEnergyConnection.java │ ├── IEnergyReceiver.java │ ├── IEnergyProvider.java │ └── IEnergyHandler.java ├── .gitignore ├── Jenkinsfile ├── .github └── workflows │ └── gradle.yml └── gradlew.bat /README.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/scripts/mc.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'libVulpes' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version_major=0 2 | version_minor=1 3 | version_revis=20 4 | archivebase=libVulpes 5 | groupid=libvulpes 6 | org=zmaster 7 | url="" 8 | 0.0.8 -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/fx/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/fx/x.png -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/Configuration.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes; 2 | 3 | public class Configuration { 4 | 5 | public static double EUMult; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/null.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/null.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiScan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiScan.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/maingui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/maingui.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/boule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/boule.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/dust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/dust.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/fan.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/gear.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/ingot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/ingot.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/plate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/plate.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/sheet.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/stick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/stick.png -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IToggleableMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | public interface IToggleableMachine { 4 | public boolean isRunning(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreTin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreTin.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/starryBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/starryBg.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/Linker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/Linker.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/crystal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/crystal.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/nugget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/nugget.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/IC2Plug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/IC2Plug.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/batteryRF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/batteryRF.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/coilPole.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/coilPole.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/coilSide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/coilSide.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreCopper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreCopper.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreRutile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreRutile.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowDown.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowLeft.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttonSquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttonSquare.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/slotDisabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/slotDisabled.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/battery0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/battery0.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/battery1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/battery1.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/fluidInput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/fluidInput.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/fluidOutput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/fluidOutput.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/inputHatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/inputHatch.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreAluminum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreAluminum.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreIridium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreIridium.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreTemplate.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreTemplate.xcf -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/outputHatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/outputHatch.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowRight.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiScan_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiScan_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiScan_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiScan_press.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/coalGenerator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/coalGenerator.png -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/INamedMetaBlock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | public interface INamedMetaBlock { 4 | public String getUnlocalizedName(int damage); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/machineGeneric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/machineGeneric.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/oreDilithium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/oreDilithium.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/structureBlock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/structureBlock.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/switchOff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/switchOff.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/switchOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/switchOn.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/items/holoProjector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/items/holoProjector.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowDown_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowDown_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowLeft_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowLeft_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowRight_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowRight_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed_press.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttonSquare_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttonSquare_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/blocks/advStructureBlock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/blocks/advStructureBlock.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowDown_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowDown_pressed.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowLeft_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowLeft_pressed.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiArrowRight_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiArrowRight_pressed.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/GuiButtonRed_disabled.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneAllowed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneAllowed.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneInverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneInverted.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneNotAllowed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneNotAllowed.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneAllowed_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneAllowed_hover.png -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneInverted_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneInverted_hover.png -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/IInventoryMultiblock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | 5 | public interface IInventoryMultiblock extends IMultiblock, IInventory { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneNotAllowed_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Advanced-Rocketry/libVulpes/HEAD/src/main/resources/assets/libvulpes/textures/gui/buttons/buttonRedstoneNotAllowed_hover.png -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/IAdjBlockUpdate.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | public interface IAdjBlockUpdate { 4 | /** 5 | * Called when an adjacent block is updated 6 | */ 7 | public void onAdjacentBlockUpdated(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/PacketID.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PacketID { 6 | ArrayList idNum; 7 | 8 | public PacketID() { 9 | idNum = new ArrayList(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/Vector3F.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | public class Vector3F { 4 | public E x,y,z; 5 | 6 | 7 | public Vector3F(E x, E y,E z){ 8 | this.x = x; 9 | this.y = y; 10 | this.z = z; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/IlimitedItemSlotEntity.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public interface IlimitedItemSlotEntity { 6 | public boolean isItemValidForLimitedSlot(int slot, ItemStack itemstack); 7 | } 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Apr 15 18:06:47 EDT 2016 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.12-bin.zip 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/interfaces/INetworkEntity.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.interfaces; 2 | 3 | import zmaster587.libVulpes.util.INetworkMachine; 4 | 5 | public interface INetworkEntity extends INetworkMachine { 6 | 7 | //Cannot overwrite Entity 8 | public int getEntityId(); 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .gradle/ 3 | libVulpes.txt 4 | output/ 5 | /asm 6 | /blueprints 7 | /build 8 | /config 9 | /gradle 10 | /logs 11 | /mods 12 | /resourcepacks 13 | /saves 14 | screenshots 15 | /gradle 16 | /asm 17 | /blueprints 18 | *.png 19 | *.obj 20 | *.ogg 21 | *.xcf 22 | /libs 23 | /models 24 | /crash-reports 25 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | 4 | stages { 5 | stage('Build') { 6 | steps { 7 | sh 'gradle clean' 8 | sh 'gradle build' 9 | archiveArtifacts artifacts: '**output/*.jar', fingerprint: true 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/IGuiCallback.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | public interface IGuiCallback { 4 | /** 5 | * Some Modules alert the sending host for callbacks 6 | * @param module module sending a callback 7 | */ 8 | void onModuleUpdated(ModuleBase module); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ISelectionNotify.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | public interface ISelectionNotify { 4 | public void onSelected(Object sender); 5 | 6 | public void onSelectionConfirmed(Object sender); 7 | 8 | public void onSystemFocusChanged(Object sender); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/LibVulpesItems.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import net.minecraft.item.Item; 4 | 5 | public class LibVulpesItems { 6 | 7 | public static Item itemBattery; 8 | public static Item itemHoloProjector; 9 | public static Item itemLinker; 10 | public static Item[] itemOreProduct; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/IToggleButton.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | public interface IToggleButton extends IButtonInventory { 4 | /** 5 | * Called when a module is toggled 6 | * @param module module that was toggled 7 | */ 8 | public void stateUpdated(ModuleBase module); 9 | } 10 | -------------------------------------------------------------------------------- /gradle/scripts/version.gradle: -------------------------------------------------------------------------------- 1 | version = "${project.minecraft.version}-${version_major}.${version_minor}.${version_revis}" + project.getBuildNumber() 2 | 3 | //prints the version to the console 4 | println "version = "+ version 5 | 6 | //Grabs the archivebase and prints the version to the root of the project directory. 7 | file("${archivebase}.txt").text = version; -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IDismountHandler.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import net.minecraft.entity.Entity; 4 | 5 | public interface IDismountHandler { 6 | /** 7 | * Called when a player entity attempts to dismount from this entity 8 | * @param entity 9 | */ 10 | public void handleDismount(Entity entity); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/render/TextPart.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.render; 2 | 3 | public class TextPart { 4 | public String text; 5 | public double size; 6 | public int colorRGBA; 7 | public double offsetX; 8 | public double offsetY; 9 | 10 | public TextPart(String txt, double sze, int color) { 11 | text = txt; 12 | size = sze; 13 | colorRGBA = color; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockAlphaTexture.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.material.Material; 5 | 6 | public class BlockAlphaTexture extends Block { 7 | 8 | public BlockAlphaTexture(Material mat) { 9 | super(mat); 10 | } 11 | 12 | @Override 13 | public boolean isOpaqueCube() { 14 | return false; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ISliderBar.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | public interface ISliderBar extends IProgressBar { 4 | 5 | /** 6 | * Called on the client when a Slider is changed 7 | * @param id id of the progress bar to update 8 | * @param progress progress data received from the server 9 | */ 10 | public void setProgressByUser(int id, int progress); 11 | } 12 | -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - 1.16 5 | 6 | jobs: 7 | build: 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v1 13 | - name: Set up JDK 1.8 14 | uses: actions/setup-java@v1 15 | with: 16 | java-version: 1.8 17 | - name: Chmod gradlew 18 | run: chmod a+x ./gradlew 19 | - name: Build with Gradle 20 | run: ./gradlew clean build -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/IMultiblock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import net.minecraft.tileentity.TileEntity; 4 | 5 | public interface IMultiblock { 6 | 7 | public boolean hasMaster(); 8 | 9 | public TileEntity getMasterBlock(); 10 | 11 | public void setComplete(int x, int y, int z); 12 | 13 | public void setIncomplete(); 14 | 15 | public void setMasterBlock(int x, int y, int z); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/IButtonInventory.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import cpw.mods.fml.relauncher.Side; 4 | import cpw.mods.fml.relauncher.SideOnly; 5 | 6 | public interface IButtonInventory { 7 | 8 | /** 9 | * Called on the client when a user presses a button 10 | * @param buttonId id of the button pressed 11 | */ 12 | @SideOnly(Side.CLIENT) 13 | public void onInventoryButtonPressed(int buttonId); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "libVulpes", 4 | "name": "libVulpes", 5 | "description": "A Library containing code for multiblocks and ore/item registration and access", 6 | "version": "${version}", 7 | "mcversion": "1.7.10", 8 | "url": "http://minecraft.curseforge.com/projects/libvulpes", 9 | "updateUrl": "", 10 | "authorList": ["zmaster587"], 11 | "credits": "", 12 | "logoFile": "", 13 | "screenshots": [], 14 | "dependencies": [] 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/SlotMachineOutput.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import net.minecraft.inventory.SlotFurnace; 5 | import net.minecraft.item.ItemStack; 6 | 7 | public class SlotMachineOutput extends SlotFurnace { 8 | 9 | public SlotMachineOutput(IInventory inv, int slot, int x, int y) { 10 | super(null,inv,slot,x,y); 11 | } 12 | 13 | //TODO: somthing here 14 | @Override 15 | protected void onCrafting(ItemStack par1ItemStack) {} 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/recipe/NumberedOreDictStack.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.recipe; 2 | 3 | public class NumberedOreDictStack { 4 | 5 | String ore; 6 | int number; 7 | 8 | public NumberedOreDictStack(String ore, int number) { 9 | this.ore = ore; 10 | this.number = number; 11 | } 12 | 13 | public String getOre() { 14 | return ore; 15 | } 16 | 17 | public int getNumber() { 18 | return number; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return ore + "x" + number; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/IModularInventory.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.entity.player.EntityPlayer; 6 | 7 | public interface IModularInventory { 8 | 9 | /** 10 | * @return a list of modules to add to the inventory 11 | */ 12 | public List getModules(int id, EntityPlayer player); 13 | 14 | public String getModularInventoryName(); 15 | 16 | public boolean canInteractWithContainer(EntityPlayer entity); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/IDataSync.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | public interface IDataSync { 4 | /** 5 | * Called when an update is received from the server 6 | * @param id assigned id of the data module 7 | * @param value value recieved from the server 8 | */ 9 | public void setData(int id, int value); 10 | 11 | /** 12 | * 13 | * @param id id of the module sync 14 | * @return the data associated with a moduleSync with the passed id 15 | */ 16 | public int getData(int id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/ItemStackMapping.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public class ItemStackMapping { 6 | ItemStack stack; 7 | public ItemStackMapping(ItemStack stack) { 8 | this.stack = stack; 9 | } 10 | 11 | @Override 12 | public String toString() { 13 | return stack.toString(); 14 | } 15 | 16 | @Override 17 | public boolean equals(Object obj) { 18 | if(obj instanceof ItemStack) 19 | return stack.isItemEqual((ItemStack) obj); 20 | return super.equals(obj); 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/items/ItemBlockMeta.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.items; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.item.ItemBlockWithMetadata; 5 | import net.minecraft.item.ItemStack; 6 | 7 | public class ItemBlockMeta extends ItemBlockWithMetadata { 8 | 9 | public ItemBlockMeta(Block p_i45326_1_) { 10 | super(p_i45326_1_, p_i45326_1_); 11 | } 12 | 13 | @Override 14 | public String getUnlocalizedName(ItemStack stack) { 15 | return super.getUnlocalizedName(stack) + "." + stack.getItemDamage(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/PoweredTimedItemStack.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public class PoweredTimedItemStack { 6 | ItemStack storedItem; 7 | int storedPower, storedTime; 8 | public PoweredTimedItemStack(ItemStack item, int power, int time) { 9 | storedItem = item; 10 | storedPower = power; 11 | storedTime = time; 12 | } 13 | 14 | public ItemStack getItemStack() { return storedItem; } 15 | public int getTime() { return storedTime;} 16 | public int getPower() { return storedPower; } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IUniversalEnergy.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import cofh.api.energy.IEnergyHandler; 4 | import cpw.mods.fml.common.Optional.Interface; 5 | 6 | @Interface(iface="ic2.api.energy.tile.IEnergySink",modid="IndustrialCraft") 7 | public interface IUniversalEnergy { 8 | public void setEnergyStored(int amt); 9 | 10 | int extractEnergy(int amt, boolean simulate); 11 | 12 | int getEnergyStored(); 13 | 14 | int getMaxEnergyStored(); 15 | 16 | int acceptEnergy(int amt, boolean simulate); 17 | 18 | void setMaxEnergyStored(int max); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/interfaces/IRecipe.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.interfaces; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraftforge.fluids.FluidStack; 8 | 9 | public interface IRecipe { 10 | public List getOutput(); 11 | 12 | public List getFluidOutputs(); 13 | 14 | public LinkedList> getIngredients(); 15 | 16 | public List getFluidIngredients(); 17 | 18 | public int getTime(); 19 | 20 | public int getPower(); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/SlotLimitedItem.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import net.minecraft.inventory.Slot; 5 | import net.minecraft.item.ItemStack; 6 | 7 | public class SlotLimitedItem extends Slot { 8 | 9 | IInventory tile; 10 | 11 | public SlotLimitedItem(IInventory inventory, int slotIndex, int x, int y) { 12 | super(inventory, slotIndex, x, y); 13 | this.tile = inventory; 14 | } 15 | 16 | @Override 17 | public boolean isItemValid(ItemStack stack) 18 | { 19 | return tile.isItemValidForSlot(this.slotNumber, stack); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/common/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.common; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import net.minecraft.world.World; 5 | 6 | public class CommonProxy { 7 | public String getLocalizedString(String str) { 8 | return str; 9 | } 10 | 11 | public void registerEventHandlers() { 12 | 13 | } 14 | 15 | public void spawnParticle(String particle, World world, double x, double y, 16 | double z, double motionX, double motionY, double motionZ) { 17 | // TODO Auto-generated method stub 18 | 19 | } 20 | 21 | public void playSound(Object resource) { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IJetPack.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.inventory.IInventory; 5 | import net.minecraft.item.ItemStack; 6 | 7 | public interface IJetPack { 8 | public boolean isActive(ItemStack stack, EntityPlayer player); 9 | 10 | public boolean isEnabled(ItemStack stack); 11 | 12 | public void setEnabledState(ItemStack stack, boolean state); 13 | 14 | public void onAccelerate(ItemStack stack, IInventory inv, EntityPlayer player); 15 | 16 | public void changeMode(ItemStack stack, IInventory modules, EntityPlayer player); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/multiblock/hatch/TileInputHatch.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.multiblock.hatch; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public class TileInputHatch extends TileInventoryHatch { 6 | 7 | 8 | 9 | public TileInputHatch() { 10 | super(); 11 | } 12 | 13 | public TileInputHatch(int size) { 14 | super(size); 15 | } 16 | 17 | @Override 18 | public String getModularInventoryName() { 19 | return "tile.hatch.0.name"; 20 | } 21 | 22 | @Override 23 | public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, 24 | int p_102008_3_) { 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/material/MixedMaterial.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api.material; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | //TODO: needs work 6 | public class MixedMaterial { 7 | 8 | ItemStack[] product; 9 | Object input; 10 | Class process; 11 | 12 | public MixedMaterial(Class process, Object input, ItemStack[] product) { 13 | this.product = product; 14 | this.process = process; 15 | this.input = input; 16 | } 17 | 18 | public ItemStack[] getProducts() { 19 | return product; 20 | } 21 | 22 | public Object getInput() { 23 | return input; 24 | } 25 | 26 | public Class getMachine() { 27 | return process; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/cofh/api/energy/IEnergyConnection.java: -------------------------------------------------------------------------------- 1 | package cofh.api.energy; 2 | 3 | import net.minecraftforge.common.util.ForgeDirection; 4 | 5 | /** 6 | * Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not 7 | * accept it; otherwise just use IEnergyHandler. 8 | *

9 | * Note that {@link IEnergyHandler} is an extension of this. 10 | * 11 | * @author King Lemming 12 | * 13 | */ 14 | public interface IEnergyConnection { 15 | 16 | /** 17 | * Returns TRUE if the TileEntity can connect on a given side. 18 | */ 19 | boolean canConnectEnergy(ForgeDirection from); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/NEILibVulpesConfig.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import zmaster587.libVulpes.api.LibVulpesBlocks; 5 | import codechicken.nei.api.API; 6 | import codechicken.nei.api.IConfigureNEI; 7 | 8 | public class NEILibVulpesConfig implements IConfigureNEI { 9 | 10 | 11 | @Override 12 | public String getName() { 13 | return "LibVulpesConfig"; 14 | } 15 | 16 | @Override 17 | public String getVersion() { 18 | return "0.0.1"; 19 | } 20 | 21 | @Override 22 | public void loadConfig() { 23 | //Hide stuff from NEI 24 | API.hideItem(new ItemStack(LibVulpesBlocks.blockPlaceHolder)); 25 | API.hideItem(new ItemStack(LibVulpesBlocks.blockPhantom)); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/SlotListAllowed.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import java.util.Set; 4 | 5 | import net.minecraft.inventory.IInventory; 6 | import net.minecraft.inventory.Slot; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class SlotListAllowed extends Slot { 10 | 11 | Set allowedItems; 12 | 13 | public SlotListAllowed(IInventory inventory, int slotIndex, int x, int y, Set allowedItems) { 14 | super(inventory, slotIndex, x, y); 15 | this.allowedItems = allowedItems; 16 | } 17 | 18 | @Override 19 | public boolean isItemValid(ItemStack stack) 20 | { 21 | for(ItemStack i : allowedItems){ 22 | if(i.isItemEqual(stack)) 23 | return true; 24 | } 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/INetworkMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.nbt.NBTTagCompound; 6 | 7 | import cpw.mods.fml.relauncher.Side; 8 | 9 | public interface INetworkMachine { 10 | 11 | //Writes data to the network given an id of what type of packet to write 12 | public void writeDataToNetwork(ByteBuf out, byte id); 13 | 14 | //Reads data, stores read data to nbt to be passed to useNetworkData 15 | public void readDataFromNetwork(ByteBuf in, byte packetId, NBTTagCompound nbt); 16 | 17 | //Applies changes from network 18 | public void useNetworkData(EntityPlayer player, Side side, byte id, NBTTagCompound nbt); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IUniversalEnergyTransmitter.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import net.minecraftforge.common.util.ForgeDirection; 4 | 5 | public interface IUniversalEnergyTransmitter { 6 | 7 | /** 8 | * @param side side requesting energy, UNKNOWN for internal tranmission or for teleportation 9 | * @return max energy units that can be transmitted 10 | */ 11 | public int getEnergyMTU(ForgeDirection side); 12 | 13 | /** 14 | * @param side side requesting energy, UNKNOWN for internal tranmission or for teleportation 15 | * @param simulate false to commit the change, true to only simulate 16 | * @return amount of energy actually transmitted 17 | */ 18 | public int transmitEnergy(ForgeDirection side, boolean simulate); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/SlotOreDict.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import net.minecraft.inventory.Slot; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraftforge.oredict.OreDictionary; 7 | 8 | public class SlotOreDict extends Slot { 9 | 10 | String acceptedNames; 11 | 12 | public SlotOreDict(IInventory par1iInventory, int par2, int par3, int par4, String allowedNames) { 13 | super(par1iInventory, par2, par3, par4); 14 | acceptedNames = allowedNames; 15 | } 16 | 17 | @Override 18 | public boolean isItemValid(ItemStack stack) 19 | { 20 | int stackId = OreDictionary.getOreID(stack); 21 | if(stackId == -1) 22 | return false; 23 | 24 | return OreDictionary.getOreName(stackId).contains(acceptedNames); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IModularArmor.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.inventory.IInventory; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.world.World; 8 | 9 | public interface IModularArmor { 10 | 11 | public void addArmorComponent(World world, ItemStack armor, ItemStack componentStack, int slot); 12 | 13 | public ItemStack removeComponent(World world, ItemStack armor, int index); 14 | 15 | public List getComponents(ItemStack armor); 16 | 17 | public ItemStack getComponentInSlot(ItemStack stack, int slot); 18 | 19 | public int getNumSlots(ItemStack stack); 20 | 21 | public IInventory loadModuleInventory(ItemStack stack); 22 | 23 | public void saveModuleInventory(ItemStack stack, IInventory inv); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/IconResource.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | public class IconResource { 6 | int xLoc, yLoc, xSize, ySize; 7 | ResourceLocation resource; 8 | 9 | public IconResource(int xLoc, int yLoc, int xSize, int ySize, ResourceLocation resource) { 10 | this.xLoc = xLoc; 11 | this.yLoc = yLoc; 12 | this.xSize = xSize; 13 | this.ySize = ySize; 14 | this.resource = resource; 15 | } 16 | 17 | public ResourceLocation getResourceLocation() { 18 | return resource; 19 | } 20 | 21 | public int getxLoc() { 22 | return xLoc; 23 | } 24 | 25 | public int getxSize() { 26 | return xSize; 27 | } 28 | 29 | public int getyLoc() { 30 | return yLoc; 31 | } 32 | 33 | public int getySize() { 34 | return ySize; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/network/INetworkItem.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.network; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | import cpw.mods.fml.relauncher.Side; 8 | 9 | public interface INetworkItem { 10 | 11 | //Writes data to the network given an id of what type of packet to write 12 | public void writeDataToNetwork(ByteBuf out, byte id, ItemStack stack); 13 | 14 | //Reads data, stores read data to nbt to be passed to useNetworkData 15 | public void readDataFromNetwork(ByteBuf in, byte packetId, NBTTagCompound nbt, ItemStack stack); 16 | 17 | //Applies changes from network 18 | public void useNetworkData(EntityPlayer player, Side side, byte id, NBTTagCompound nbt, ItemStack stack); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/defaultrecipe.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FLUID NAME SIZE 5 | ITEM_NAME SIZE META 6 | OREDICT_NAME SIZE 7 | 8 | 9 | FLUID_NAME SIZE 10 | ITEM_NAME SIZE META 11 | OREDICT_NAME SIZE 12 | 13 | 14 | 15 | Can have Multiple In/Outputs 16 | Some Machines can only Accept either Fluids or Items 17 | 18 | timeRequired="NUMBER" how long a Recipe takes, Unit is in Ticks. 19 | power="NUMBER" how much Power the Recipes takes per Tick. Unit is in RF. 20 | 21 | The "useDefault" attribute will prevent loading of recipes if set to "false" 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/SlotOreDictList.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import java.util.Set; 4 | 5 | import net.minecraft.inventory.IInventory; 6 | import net.minecraft.inventory.Slot; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraftforge.oredict.OreDictionary; 9 | 10 | public class SlotOreDictList extends Slot { 11 | 12 | Set allowed; 13 | 14 | public SlotOreDictList(IInventory inv, int slot, int x, int y, Set set) { 15 | super(inv, slot, x, y); 16 | allowed = set; 17 | } 18 | 19 | @Override 20 | public boolean isItemValid(ItemStack stack) 21 | { 22 | int stackId = OreDictionary.getOreID(stack); 23 | if(stackId == -1) 24 | return false; 25 | 26 | for(String str : allowed) { 27 | if(OreDictionary.getOreName(stackId).contains(str)) 28 | return true; 29 | } 30 | 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/interfaces/ILinkableTile.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.interfaces; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.tileentity.TileEntity; 6 | import net.minecraft.world.World; 7 | 8 | public interface ILinkableTile { 9 | 10 | /** 11 | * Called when the linker has no coords set and user rightclicks an ILinkableTile 12 | * @param item Itemstack (the ItemLinker Object more likely than not) 13 | * @param entity TileEntity at the coords being rightclicked 14 | * @param player the player 15 | * @param world the world 16 | * @return true If link is allowed 17 | */ 18 | public boolean onLinkStart(ItemStack item, TileEntity entity, EntityPlayer player, World world); 19 | 20 | public boolean onLinkComplete(ItemStack item, TileEntity entity,EntityPlayer player, World world); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/LibVulpesBlocks.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import net.minecraft.block.Block; 7 | import net.minecraft.item.Item; 8 | 9 | public class LibVulpesBlocks { 10 | public static Block blockHatch; 11 | public static Block blockPhantom; 12 | public static Block blockPlaceHolder; 13 | public static Block blockRFBattery; 14 | public static Block blockIC2Plug; 15 | public static Block blockRFOutput; 16 | public static Block blockStructureBlock; 17 | public static Block blockAdvStructureBlock; 18 | //public static List blockOre = new ArrayList(); 19 | //public static List blockMetal = new ArrayList(); 20 | public static Item[] itemOreProduct; 21 | //public static List blockCoil = new ArrayList(); 22 | public static Block blockCoalGenerator; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /gradle/scripts/getbuildnumber.gradle: -------------------------------------------------------------------------------- 1 | //Adds variable for getting build numbers 2 | ext.getBuildNumber = { 3 | //Jenkins support 4 | if (System.getenv("BUILD_NUMBER") != null) 5 | { 6 | return "-${System.getenv("BUILD_NUMBER")}" 7 | } 8 | else if (project.hasProperty("bambooBuildNumber")) 9 | { 10 | return "-" + project.bambooBuildNumber 11 | } 12 | //Drone IO support 13 | else if (System.getenv("DRONE_BUILD_NUMBER") != null) 14 | { 15 | return "-${System.getenv("DRONE_BUILD_NUMBER")}" 16 | } 17 | //Travis-CI support 18 | else if (System.getenv("TRAVIS_BUILD_NUMBER") != null) 19 | { 20 | return "-${System.getenv("TRAVIS_BUILD_NUMBER")}" 21 | } 22 | else if (project.hasProperty("sbmBuild")) 23 | { 24 | return "-" + project.sbmBuild 25 | } 26 | return getDate() 27 | } 28 | 29 | def getDate() { 30 | return "" 31 | } -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockMeta.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import net.minecraft.block.Block; 4 | 5 | public class BlockMeta { 6 | Block block; 7 | int meta; 8 | public static final int WILDCARD = -1; 9 | 10 | public BlockMeta(Block block, int meta) { 11 | this.block = block; 12 | this.meta = meta; 13 | } 14 | 15 | 16 | public BlockMeta(Block block) { 17 | this.block = block; 18 | this.meta = WILDCARD; 19 | } 20 | 21 | @Override 22 | public boolean equals(Object obj) { 23 | 24 | if(obj instanceof BlockMeta) { 25 | return ((BlockMeta)obj).block == block && ( meta == -1 || ((BlockMeta)obj).meta == -1 || ((BlockMeta)obj).meta == meta); 26 | } 27 | return super.equals(obj); 28 | } 29 | 30 | public Block getBlock() { 31 | return block; 32 | } 33 | 34 | public byte getMeta() { 35 | if(meta != WILDCARD) 36 | return (byte) meta; 37 | return 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleOutputSlotArray.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.List; 4 | 5 | import zmaster587.libVulpes.gui.SlotMachineOutput; 6 | import net.minecraft.inventory.Container; 7 | import net.minecraft.inventory.IInventory; 8 | import net.minecraft.inventory.Slot; 9 | 10 | public class ModuleOutputSlotArray extends ModuleSlotArray { 11 | 12 | public ModuleOutputSlotArray(int offsetX, int offsetY, 13 | IInventory container, int startSlot, int endSlot) { 14 | super(offsetX, offsetY, container, startSlot, endSlot); 15 | } 16 | 17 | 18 | @Override 19 | public List getSlots(Container container) { 20 | //this.container = container; 21 | 22 | for(int i = 0; i + startSlot < endSlot; i++) { 23 | slotList.add(new SlotMachineOutput(inventory, i+startSlot, offsetX + 18* (i % 9), offsetY + 18*(i/9))); 24 | } 25 | return slotList; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockMetalBlock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import net.minecraft.client.renderer.texture.IIconRegister; 4 | import net.minecraft.util.IIcon; 5 | import net.minecraft.world.IBlockAccess; 6 | 7 | public class BlockMetalBlock extends BlockOre { 8 | 9 | public BlockMetalBlock(net.minecraft.block.material.Material mat) { 10 | super(mat); 11 | } 12 | 13 | @Override 14 | public int getRenderColor(int meta) { 15 | if(ores[meta] != null) 16 | return ores[meta].getColor(); 17 | return 0x0; 18 | } 19 | 20 | @Override 21 | public int colorMultiplier(IBlockAccess access, int x, int y, int z) { 22 | return getRenderColor(access.getBlockMetadata(x, y, z)); 23 | } 24 | 25 | @Override 26 | public void registerBlockIcons(IIconRegister register) { 27 | blockIcon = register.registerIcon("minecraft:iron_block"); 28 | } 29 | 30 | @Override 31 | public IIcon getIcon(int side, int meta) { 32 | return blockIcon; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/lang/zh_CN.lang: -------------------------------------------------------------------------------- 1 | tile.hatch.0.name=输入口 2 | tile.hatch.1.name=输出口 3 | tile.hatch.2.name=液体输入口 4 | tile.hatch.3.name=液体输出口 5 | tile.rfBattery.name=RF能量输入口 6 | tile.IC2Plug.name=IC2能量输入口 7 | tile.structureMachine.name=机器结构方块 8 | tile.Copper.name=铜矿 9 | tile.Tin.name=锡矿 10 | tile.Rutile.name=金红石矿(钛) 11 | tile.coil.silicon.name=硅线圈 12 | tile.coil.copper.name=铜线圈 13 | tile.coil.tin.name=锡线圈 14 | tile.coil.steel.name=钢线圈 15 | tile.coil=线圈 16 | 17 | item.holoProjector.name=全息投影器 18 | 19 | material.Gold.name=金 20 | material.Iron.name=铁 21 | material.Silicon.name=硅 22 | material.Copper.name=铜 23 | material.Tin.name=锡 24 | material.Steel.name=钢 25 | material.Titanium.name=钛 26 | material.Rutile.name=金红石 27 | 28 | type.crystal.name=晶体 29 | type.dust.name=粉 30 | type.boule.name=球 31 | type.ingot.name=锭 32 | type.nugget.name=粒 33 | type.stick.name=棒 34 | type.plate.name=板 35 | type.ore.name=矿 36 | type.block.name=方块 37 | type.coil.name=线圈 38 | type.fan.name=扇子 39 | type.sheet.name=片 -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/SingleEntry.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import java.util.Map.Entry; 4 | 5 | public class SingleEntry implements Entry { 6 | 7 | K key; 8 | V value; 9 | 10 | public SingleEntry(K key, V value) { 11 | this.key = key; 12 | this.value = value; 13 | } 14 | 15 | @Override 16 | public K getKey() { 17 | // TODO Auto-generated method stub 18 | return key; 19 | } 20 | 21 | @Override 22 | public V getValue() { 23 | // TODO Auto-generated method stub 24 | return value; 25 | } 26 | 27 | @Override 28 | public V setValue(V value) { 29 | V ret = this.value; 30 | this.value = value; 31 | return ret; 32 | } 33 | @Override 34 | public boolean equals(Object paramObject) { 35 | if(paramObject instanceof SingleEntry) { 36 | return ((SingleEntry) paramObject).getKey().equals(this.getKey()) && ((SingleEntry) paramObject).getValue().equals(this.getValue()); 37 | } 38 | return super.equals(paramObject); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockCoil.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import zmaster587.libVulpes.api.material.MaterialRegistry; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.client.renderer.texture.IIconRegister; 6 | import net.minecraft.util.IIcon; 7 | import net.minecraftforge.common.util.ForgeDirection; 8 | 9 | public class BlockCoil extends BlockMetalBlock { 10 | String side, poles; 11 | IIcon sideIcon, polesIcon; 12 | 13 | public BlockCoil(Material mat, String side, String poles) { 14 | super(mat); 15 | this.side = side; 16 | this.poles = poles; 17 | } 18 | 19 | @Override 20 | public void registerBlockIcons(IIconRegister register) { 21 | sideIcon = register.registerIcon(side); 22 | polesIcon = register.registerIcon(poles); 23 | } 24 | 25 | @Override 26 | public IIcon getIcon(int side, int meta) { 27 | return (ForgeDirection.getOrientation(side) == ForgeDirection.UP || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) ? polesIcon : sideIcon; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/client/RepeatingSound.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.client; 2 | 3 | import cpw.mods.fml.relauncher.Side; 4 | import cpw.mods.fml.relauncher.SideOnly; 5 | import zmaster587.libVulpes.api.IToggleableMachine; 6 | import net.minecraft.client.audio.MovingSound; 7 | import net.minecraft.tileentity.TileEntity; 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | @SideOnly(Side.CLIENT) 11 | public class RepeatingSound extends MovingSound { 12 | 13 | TileEntity tile; 14 | IToggleableMachine toggle; 15 | 16 | public RepeatingSound(ResourceLocation location, TileEntity tile) { 17 | super(location); 18 | this.tile = tile; 19 | this.repeat = true; 20 | xPosF = tile.xCoord; 21 | yPosF = tile.yCoord; 22 | zPosF = tile.zCoord; 23 | 24 | if(tile instanceof IToggleableMachine) 25 | toggle = (IToggleableMachine)tile; 26 | } 27 | 28 | @Override 29 | public void update() { 30 | if(tile.isInvalid()) 31 | this.donePlaying = true; 32 | if(toggle != null) 33 | this.volume = toggle.isRunning() ? 1f : 0f; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/VulpineMath.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | public class VulpineMath { 4 | public static double log2 = Math.log(2); 5 | 6 | public static double log2(double in) {return Math.log(in)/log2;} 7 | 8 | public static int greatestCommonFactor(int num[]) { 9 | int largestGCF = greatestCommonFactor(num[0], num[1]); 10 | 11 | for(int i = 2; i < num.length; i++){ 12 | int gcf = greatestCommonFactor(num[i], largestGCF); 13 | if(largestGCF < gcf) 14 | largestGCF = gcf; 15 | } 16 | 17 | return largestGCF; 18 | } 19 | 20 | public static boolean isBetween(int number, int A, int B) { 21 | if(A > B) { 22 | int buffer = A; 23 | A = B; 24 | B = buffer; 25 | } 26 | return A <= number && number <= B; 27 | } 28 | 29 | public static boolean isBetween(double number, double A, double B) { 30 | return A <= number && number <= B; 31 | } 32 | 33 | public static int greatestCommonFactor(int numA, int numB) { 34 | if(numB == 0) return numA; 35 | return greatestCommonFactor(numB, numA % numB); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleLimitedSlotArray.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.inventory.Container; 6 | import net.minecraft.inventory.IInventory; 7 | import net.minecraft.inventory.Slot; 8 | import zmaster587.libVulpes.gui.SlotLimitedItem; 9 | import zmaster587.libVulpes.inventory.ContainerModular; 10 | 11 | public class ModuleLimitedSlotArray extends ModuleSlotArray { 12 | 13 | public ModuleLimitedSlotArray(int offsetX, int offsetY, 14 | IInventory container, int startSlot, int endSlot) { 15 | super(offsetX, offsetY, container, startSlot, endSlot); 16 | } 17 | 18 | @Override 19 | public List getSlots(Container container) { 20 | 21 | //Get the reference to the container 22 | this.container = (ContainerModular)container; 23 | 24 | for(int i = 0; i + startSlot < endSlot; i++) { 25 | Slot slot; 26 | slot = new SlotLimitedItem(inventory, i+startSlot, offsetX + 18* (i % 9), offsetY + 18*(i/9)); 27 | 28 | slotList.add(slot); 29 | } 30 | return slotList; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/items/ItemOre.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.items; 2 | 3 | import java.util.Locale; 4 | 5 | import zmaster587.libVulpes.block.BlockOre; 6 | import zmaster587.libVulpes.block.INamedMetaBlock; 7 | import net.minecraft.block.Block; 8 | import net.minecraft.item.ItemBlockWithMetadata; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.util.StatCollector; 11 | 12 | public class ItemOre extends ItemBlockWithMetadata { 13 | 14 | public ItemOre(Block p_i45326_1_) { 15 | super(p_i45326_1_, p_i45326_1_); 16 | } 17 | 18 | @Override 19 | public String getUnlocalizedName(ItemStack stack) { 20 | return ((INamedMetaBlock)this.field_150939_a).getUnlocalizedName(stack.getItemDamage()); 21 | } 22 | 23 | @Override 24 | public String getItemStackDisplayName(ItemStack stack) 25 | { 26 | return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name") + " " + StatCollector.translateToLocal("type." + ((BlockOre)this.field_150939_a).getProduct().name().toLowerCase(Locale.ENGLISH) + ".name")).trim(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleSync.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import net.minecraft.inventory.Container; 4 | import net.minecraft.inventory.ICrafting; 5 | 6 | public class ModuleSync extends ModuleBase { 7 | 8 | IDataSync tile; 9 | int id, prevData; 10 | public ModuleSync(int id, IDataSync tile) { 11 | super(0, 0); 12 | this.tile = tile; 13 | this.id = id; 14 | prevData = -1; 15 | } 16 | 17 | @Override 18 | public boolean needsUpdate(int localId) { 19 | return tile.getData(id) != prevData; 20 | } 21 | 22 | @Override 23 | protected void updatePreviousState(int localId) { 24 | prevData = tile.getData(id); 25 | } 26 | 27 | @Override 28 | public void onChangeRecieved(int slot, int value) { 29 | tile.setData(id, value); 30 | } 31 | 32 | @Override 33 | public void sendChanges(Container container, ICrafting crafter, 34 | int variableId, int localId) { 35 | crafter.sendProgressBarUpdate(container, variableId, tile.getData(id)); 36 | } 37 | 38 | @Override 39 | public int numberOfChangesToSend() { 40 | return 1; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleTexturedSlotArray.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import zmaster587.libVulpes.util.IconResource; 4 | import net.minecraft.client.gui.FontRenderer; 5 | import net.minecraft.client.gui.inventory.GuiContainer; 6 | import net.minecraft.inventory.IInventory; 7 | import net.minecraft.inventory.Slot; 8 | 9 | public class ModuleTexturedSlotArray extends ModuleSlotArray { 10 | 11 | IconResource iconResource; 12 | 13 | public ModuleTexturedSlotArray(int offsetX, int offsetY, IInventory container, int startSlot, int endSlot, IconResource iconResource) { 14 | super(offsetX, offsetY, container, startSlot, endSlot); 15 | this.iconResource = iconResource; 16 | } 17 | 18 | @Override 19 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, int mouseY, 20 | FontRenderer font) { 21 | for(Slot slot : slotList) { 22 | gui.drawTexturedModalRect(x + slot.xDisplayPosition - 1, y + slot.yDisplayPosition - 1, iconResource.getxLoc(), iconResource.getyLoc(), iconResource.getxSize(), iconResource.getySize()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/SlotSingleItem.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.inventory.IInventory; 5 | import net.minecraft.inventory.Slot; 6 | import net.minecraft.item.Item; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class SlotSingleItem extends Slot { 10 | 11 | private ItemStack acceptedItem; 12 | 13 | 14 | public SlotSingleItem(IInventory par1iInventory, int par2, int par3, int par4, Item item) { 15 | super(par1iInventory, par2, par3, par4); 16 | acceptedItem = new ItemStack(item); 17 | } 18 | 19 | public SlotSingleItem(IInventory par1iInventory, int par2, int par3, int par4, Block item) { 20 | super(par1iInventory, par2, par3, par4); 21 | acceptedItem = new ItemStack(item); 22 | } 23 | 24 | public SlotSingleItem(IInventory par1iInventory, int par2, int par3, int par4, ItemStack item) { 25 | super(par1iInventory, par2, par3, par4); 26 | acceptedItem = item; 27 | } 28 | 29 | 30 | @Override 31 | public boolean isItemValid(ItemStack stack) 32 | { 33 | return acceptedItem.isItemEqual(stack); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/CommonResources.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | public class CommonResources { 6 | public static final ResourceLocation genericBackground = new ResourceLocation("libvulpes:textures/gui/maingui.png"); 7 | 8 | public static final ResourceLocation rightArrow = new ResourceLocation("advancedrocketry", "textures/gui/GuiArrowRight.png"); 9 | public static final ResourceLocation rightArrow_hover = new ResourceLocation("advancedrocketry", "textures/gui/GuiArrowRight_hover.png"); 10 | public static final ResourceLocation rightArrow_pressed = new ResourceLocation("advancedrocketry", "textures/gui/GuiArrowRight_pressed.png"); 11 | 12 | public static final ResourceLocation leftArrow = new ResourceLocation("advancedrocketry", "textures/gui/GuiArrowLeft.png"); 13 | public static final ResourceLocation leftArrow_hover = new ResourceLocation("advancedrocketry", "textures/gui/GuiArrowLeft_hover.png"); 14 | public static final ResourceLocation leftArrow_pressed = new ResourceLocation("advancedrocketry", "textures/gui/GuiArrowLeft_pressed.png"); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/network/PacketChangeKeyState.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.network; 2 | 3 | import zmaster587.libVulpes.util.InputSyncHandler; 4 | import io.netty.buffer.ByteBuf; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.entity.player.EntityPlayerMP; 7 | 8 | public class PacketChangeKeyState extends BasePacket { 9 | 10 | int key; 11 | boolean state; 12 | 13 | public PacketChangeKeyState(int key, boolean state) { 14 | this.key = key; 15 | this.state = state; 16 | } 17 | 18 | public PacketChangeKeyState() {}; 19 | 20 | @Override 21 | public void write(ByteBuf out) { 22 | out.writeInt(key); 23 | out.writeBoolean(state); 24 | } 25 | 26 | @Override 27 | public void readClient(ByteBuf in) { 28 | 29 | } 30 | 31 | @Override 32 | public void read(ByteBuf in) { 33 | key = in.readInt(); 34 | state = in.readBoolean(); 35 | } 36 | 37 | @Override 38 | public void executeClient(EntityPlayer thePlayer) { 39 | 40 | } 41 | 42 | @Override 43 | public void executeServer(EntityPlayerMP player) { 44 | InputSyncHandler.updateKeyPress(player, key, state); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/multiblock/hatch/TileOutputHatch.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.multiblock.hatch; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.item.ItemStack; 8 | import zmaster587.libVulpes.inventory.modules.ModuleBase; 9 | import zmaster587.libVulpes.inventory.modules.ModuleOutputSlotArray; 10 | 11 | public class TileOutputHatch extends TileInventoryHatch { 12 | 13 | 14 | 15 | public TileOutputHatch() { 16 | super(); 17 | } 18 | 19 | public TileOutputHatch(int size) { 20 | super(size); 21 | } 22 | 23 | @Override 24 | public String getModularInventoryName() { 25 | return "tile.hatch.1.name"; 26 | } 27 | 28 | @Override 29 | public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, 30 | int p_102007_3_) { 31 | return false; 32 | } 33 | 34 | @Override 35 | public List getModules(int ID, EntityPlayer player) { 36 | LinkedList modules = new LinkedList(); 37 | modules.add(new ModuleOutputSlotArray(8, 18, this, 0, this.getSizeInventory())); 38 | return modules; 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/BlockPosition.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | public class BlockPosition { 4 | public int x,z; 5 | public short y; 6 | 7 | 8 | public BlockPosition(int x, int y,int z) { 9 | this.x = x; 10 | this.y = (short)y; 11 | this.z = z; 12 | } 13 | 14 | /** 15 | * @param dx x offset 16 | * @param dy y offset 17 | * @param dz z offset 18 | * @return a new object containing the coordinates of that offset 19 | */ 20 | public BlockPosition getPositionAtOffset(int dx, int dy, int dz) { 21 | return new BlockPosition(dx + x, dy + y, dz + z); 22 | } 23 | 24 | public double getDistance(BlockPosition otherPos) { 25 | return Math.sqrt(Math.pow(x-otherPos.x, 2) + Math.pow(y-otherPos.y, 2) + Math.pow(z-otherPos.z, 2)); 26 | } 27 | 28 | @Override 29 | public int hashCode() { 30 | return (x*179425423) ^ (z*179426549) ^ (y*179424691); 31 | } 32 | 33 | @Override 34 | public boolean equals(Object obj) { 35 | 36 | if(obj instanceof BlockPosition) { 37 | return this.x == ((BlockPosition) obj).x && this.y == ((BlockPosition) obj).y && this.z == ((BlockPosition) obj).z; 38 | } 39 | 40 | return super.equals(obj); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/IProgressBar.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | public interface IProgressBar { 4 | 5 | /** 6 | * @param id id of the progress bar 7 | * @return progress from 0 to 1 8 | */ 9 | public float getNormallizedProgress(int id); 10 | 11 | /** 12 | * Called on the client to sync information with the server 13 | * @param id id of the progress bar to update 14 | * @param progress progress data received from the server 15 | */ 16 | public void setProgress(int id, int progress); 17 | 18 | /** 19 | * @param id id of the progress bar 20 | * @return amount much progress 21 | */ 22 | public int getProgress(int id); 23 | 24 | /** 25 | * Gets the total progress, usually compared with getProgress to determine percent complete 26 | * @param id id of the progress bar 27 | * @return maximum amount of progress for this object 28 | */ 29 | public int getTotalProgress(int id); 30 | 31 | /** 32 | * Called on the client to sync total progress with the server 33 | * @param id id of the progress bar to sync 34 | * @param progress progress received from the server 35 | */ 36 | public void setTotalProgress(int id, int progress); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleImage.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import cpw.mods.fml.relauncher.Side; 6 | import cpw.mods.fml.relauncher.SideOnly; 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraft.client.gui.FontRenderer; 9 | import net.minecraft.client.gui.inventory.GuiContainer; 10 | import zmaster587.libVulpes.util.IconResource; 11 | 12 | @SideOnly(Side.CLIENT) 13 | public class ModuleImage extends ModuleBase { 14 | 15 | IconResource icon; 16 | 17 | public ModuleImage(int offsetX, int offsetY, IconResource icon) { 18 | super(offsetX, offsetY); 19 | this.icon = icon; 20 | } 21 | 22 | @Override 23 | @SideOnly(Side.CLIENT) 24 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, int mouseY, 25 | FontRenderer font) { 26 | super.renderBackground(gui, x, y, mouseX, mouseY, font); 27 | 28 | GL11.glEnable(GL11.GL_BLEND); 29 | Minecraft.getMinecraft().getTextureManager().bindTexture(icon.getResourceLocation()); 30 | gui.drawTexturedModalRect(x + offsetX, y + offsetY, icon.getxLoc(), icon.getyLoc(), icon.getxSize(), icon.getySize()); 31 | GL11.glDisable(GL11.GL_BLEND); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleNumericTextbox.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import org.lwjgl.input.Keyboard; 4 | 5 | public class ModuleNumericTextbox extends ModuleTextBox { 6 | 7 | public ModuleNumericTextbox(IGuiCallback tile, int offsetX, int offsetY, 8 | int sizeX, int sizeY, int maxStrLen) { 9 | super(tile, offsetX, offsetY, sizeX, sizeY, maxStrLen); 10 | } 11 | 12 | public ModuleNumericTextbox(IGuiCallback tile, int offsetX, int offsetY, String initialString) { 13 | super(tile, offsetX, offsetY, initialString); 14 | } 15 | 16 | @Override 17 | public boolean keyTyped(char chr, int t) { 18 | 19 | if(textBox.isFocused()) { 20 | if(Keyboard.KEY_ESCAPE == t) 21 | textBox.setFocused(false); 22 | else if(Character.isDigit(chr) || chr == '-' || t == Keyboard.KEY_BACK || t == Keyboard.KEY_DELETE || t == Keyboard.KEY_LEFT || t == Keyboard.KEY_RIGHT) { 23 | if((chr != '-' || (textBox.getCursorPosition() == 0 && !textBox.getText().startsWith("-")))) { 24 | textBox.textboxKeyTyped(chr, t); 25 | 26 | //Make callback to calling tile 27 | tile.onModuleUpdated(this); 28 | return false; 29 | } 30 | } 31 | } 32 | 33 | return true; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/client/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.client; 2 | 3 | import zmaster587.libVulpes.api.LibVulpesItems; 4 | import zmaster587.libVulpes.common.CommonProxy; 5 | import zmaster587.libVulpes.entity.fx.FxErrorBlock; 6 | import net.minecraft.client.Minecraft; 7 | import net.minecraft.client.audio.ISound; 8 | import net.minecraft.client.resources.I18n; 9 | import net.minecraft.world.World; 10 | import net.minecraftforge.common.MinecraftForge; 11 | 12 | public class ClientProxy extends CommonProxy { 13 | @Override 14 | public String getLocalizedString(String str) { 15 | return I18n.format(str); 16 | } 17 | 18 | @Override 19 | public void registerEventHandlers() { 20 | MinecraftForge.EVENT_BUS.register(LibVulpesItems.itemHoloProjector); 21 | } 22 | @Override 23 | public void spawnParticle(String particle, World world, double x, double y, double z, double motionX, double motionY, double motionZ) { 24 | 25 | if(particle == "errorBox") { 26 | FxErrorBlock fx = new FxErrorBlock(world, x, y, z); 27 | Minecraft.getMinecraft().effectRenderer.addEffect(fx); 28 | } 29 | } 30 | 31 | @Override 32 | public void playSound(Object resource) { 33 | Minecraft.getMinecraft().getSoundHandler().playSound((ISound)resource); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/GuiModularFullScreen.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory; 2 | 3 | import java.util.List; 4 | 5 | import zmaster587.libVulpes.inventory.modules.IModularInventory; 6 | import zmaster587.libVulpes.inventory.modules.ModuleBase; 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | 10 | public class GuiModularFullScreen extends GuiModular { 11 | 12 | public GuiModularFullScreen(EntityPlayer playerInv, 13 | List modules, IModularInventory modularInv, 14 | boolean includePlayerInv, boolean includeHotBar, String name) { 15 | super(playerInv, modules, modularInv, includePlayerInv,includeHotBar, name); 16 | 17 | this.xSize = Minecraft.getMinecraft().displayWidth; 18 | this.ySize = Minecraft.getMinecraft().displayHeight; 19 | this.width = Minecraft.getMinecraft().displayWidth; 20 | this.height = Minecraft.getMinecraft().displayHeight; 21 | } 22 | 23 | @Override 24 | public void initGui() { 25 | this.xSize = Minecraft.getMinecraft().displayWidth; 26 | this.ySize = Minecraft.getMinecraft().displayHeight; 27 | this.width = Minecraft.getMinecraft().displayWidth; 28 | this.height = Minecraft.getMinecraft().displayHeight; 29 | 30 | super.initGui(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/cofh/api/energy/IEnergyReceiver.java: -------------------------------------------------------------------------------- 1 | package cofh.api.energy; 2 | 3 | import net.minecraftforge.common.util.ForgeDirection; 4 | 5 | /** 6 | * Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects. 7 | *

8 | * A reference implementation is provided {@link TileEnergyHandler}. 9 | * 10 | * @author King Lemming 11 | * 12 | */ 13 | public interface IEnergyReceiver extends IEnergyConnection { 14 | 15 | /** 16 | * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. 17 | * 18 | * @param from 19 | * Orientation the energy is received from. 20 | * @param maxReceive 21 | * Maximum amount of energy to receive. 22 | * @param simulate 23 | * If TRUE, the charge will only be simulated. 24 | * @return Amount of energy that was (or would have been, if simulated) received. 25 | */ 26 | int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); 27 | 28 | /** 29 | * Returns the amount of energy currently stored. 30 | */ 31 | int getEnergyStored(ForgeDirection from); 32 | 33 | /** 34 | * Returns the maximum amount of energy that can be stored. 35 | */ 36 | int getMaxEnergyStored(ForgeDirection from); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/energy/TilePlugInputRF.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.energy; 2 | 3 | import cofh.api.energy.IEnergyHandler; 4 | import zmaster587.libVulpes.util.UniversalBattery; 5 | import net.minecraftforge.common.util.ForgeDirection; 6 | 7 | public class TilePlugInputRF extends TilePlugBase implements IEnergyHandler { 8 | 9 | UniversalBattery storage; 10 | int teir; 11 | 12 | public TilePlugInputRF() { 13 | super(1); 14 | } 15 | 16 | @Override 17 | public int extractEnergy(ForgeDirection dir, int amt, boolean sim) { 18 | return extractEnergy(amt, sim); 19 | } 20 | 21 | @Override 22 | public int getEnergyStored(ForgeDirection arg0) { 23 | return getEnergyStored(); 24 | } 25 | 26 | @Override 27 | public int getMaxEnergyStored(ForgeDirection arg0) { 28 | return getMaxEnergyStored(); 29 | } 30 | 31 | @Override 32 | public int receiveEnergy(ForgeDirection arg0, int maxReceive, boolean simulate) { 33 | return acceptEnergy(maxReceive, simulate); 34 | } 35 | 36 | @Override 37 | public boolean canConnectEnergy(ForgeDirection arg0) { 38 | return true; 39 | } 40 | 41 | 42 | @Override 43 | public String getModularInventoryName() { 44 | return "tile.rfBattery.name"; 45 | } 46 | 47 | @Override 48 | public String getInventoryName() { 49 | return null; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/cofh/api/energy/IEnergyProvider.java: -------------------------------------------------------------------------------- 1 | package cofh.api.energy; 2 | 3 | import net.minecraftforge.common.util.ForgeDirection; 4 | 5 | /** 6 | * Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects. 7 | *

8 | * A reference implementation is provided {@link TileEnergyHandler}. 9 | * 10 | * @author King Lemming 11 | * 12 | */ 13 | public interface IEnergyProvider extends IEnergyConnection { 14 | 15 | /** 16 | * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. 17 | * 18 | * @param from 19 | * Orientation the energy is extracted from. 20 | * @param maxExtract 21 | * Maximum amount of energy to extract. 22 | * @param simulate 23 | * If TRUE, the extraction will only be simulated. 24 | * @return Amount of energy that was (or would have been, if simulated) extracted. 25 | */ 26 | int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); 27 | 28 | /** 29 | * Returns the amount of energy currently stored. 30 | */ 31 | int getEnergyStored(ForgeDirection from); 32 | 33 | /** 34 | * Returns the maximum amount of energy that can be stored. 35 | */ 36 | int getMaxEnergyStored(ForgeDirection from); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/lang/ru_RU.lang: -------------------------------------------------------------------------------- 1 | tile.hatch.0.name=Входной люк 2 | tile.hatch.1.name=Выходной люк 3 | tile.hatch.2.name=Элемен приёма жидкостей 4 | tile.hatch.3.name=Элемент вывода жидкостей 5 | tile.rfBattery.name=RF-разъём 6 | tile.IC2Plug.name=IC2(EU)-разъём 7 | tile.structureMachine.name=Структурный блок 8 | tile.blockGenericMachine.name=Блок контроллера 9 | tile.coil.silicon.name=Кремниевая катушка 10 | tile.coil.copper.name=Медная катушка 11 | tile.coil.tin.name=Оловянная катушка 12 | tile.coil.steel.name=Стальная катушка 13 | tile.coil=Катушка 14 | tile.Copper.name=Медная руда 15 | tile.Tin.name=Оловянная руда 16 | tile.Rutile.name=Руда рутила 17 | 18 | item.holoProjector.name=Голо-проектор 19 | 20 | material.Gold.name=Золотой 21 | material.Iron.name=Железный 22 | material.Silicon.name=Кремниевый 23 | material.Copper.name=Медный 24 | material.Tin.name=Оловянный 25 | material.Steel.name=Стальной 26 | material.Titanium.name=Титановый 27 | material.Rutile.name=Рутиловый 28 | 29 | type.crystal.name=кристалл 30 | type.dust.name=порошок 31 | type.boule.name=буль 32 | type.ingot.name=слиток 33 | type.nugget.name=самородок 34 | type.stick.name=стержень 35 | type.plate.name=листок 36 | type.ore.name=руда 37 | type.block.name=блок 38 | type.coil.name=моток 39 | type.fan.name=пропеллер 40 | type.sheet.name=лист 41 | type.gear.name=механизм -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/multiblock/BlockMultiMachineBattery.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block.multiblock; 2 | 3 | import zmaster587.libVulpes.LibVulpes; 4 | import net.minecraft.block.material.Material; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.tileentity.TileEntity; 7 | import net.minecraft.world.World; 8 | 9 | public class BlockMultiMachineBattery extends BlockMultiblockStructure { 10 | 11 | protected Class tileClass; 12 | protected int guiId; 13 | 14 | public BlockMultiMachineBattery(Material material, Class tileClass, int guiId) { 15 | super(material); 16 | this.tileClass = tileClass; 17 | this.guiId = guiId; 18 | } 19 | 20 | @Override 21 | public boolean hasTileEntity(int meta) { 22 | return true; 23 | } 24 | 25 | @Override 26 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float arg0, float arg1,float arg2) { 27 | 28 | if (!world.isRemote) 29 | player.openGui(LibVulpes.instance, guiId, world, x, y, z); 30 | return true; 31 | } 32 | 33 | @Override 34 | public TileEntity createTileEntity(World world, int meta) { 35 | try { 36 | return tileClass.newInstance(); 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | } 40 | return null; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/lang/es_ES.lang: -------------------------------------------------------------------------------- 1 | tile.hatch.0.name=Entrada 2 | tile.hatch.1.name=Salida 3 | tile.hatch.2.name=Entrada de líquidos 4 | tile.hatch.3.name=Salida de líquidos 5 | tile.rfBattery.name=Enchufe de flujo de redstone (RF) 6 | tile.IC2Plug.name=Enchufe de IC2 (EU) 7 | tile.structureMachine.name=Estructura de máquina 8 | tile.blockGenericMachine.name=Bloque de control de máquinas 9 | tile.coil.silicon.name=Bobina de silicio 10 | tile.coil.copper.name=Bobina de cobre 11 | tile.coil.tin.name=Bobina de estaño 12 | tile.coil.steel.name=Bobina de acero 13 | tile.coil=Bobina 14 | tile.Copper.name=Mena de cobre 15 | tile.Tin.name=Mena de estaño 16 | tile.Rutile.name=Mena de rutilo 17 | 18 | 19 | item.holoProjector.name=Proyector de hologramas 20 | 21 | material.Gold.name=Oro 22 | material.Iron.name=Hierro 23 | material.Silicon.name=Silicio 24 | material.Copper.name=Cobre 25 | material.Tin.name=Aluminio 26 | material.Steel.name=Acero 27 | material.Titanium.name=Titanio 28 | material.Rutile.name=Rutilo 29 | 30 | type.crystal.name=Cristal 31 | type.dust.name=Polvo 32 | type.boule.name=Boulé 33 | type.ingot.name=Lingote 34 | type.nugget.name=Pepita 35 | type.stick.name=Vara 36 | type.plate.name=Placa 37 | type.ore.name=Mena 38 | type.block.name=Bloque 39 | type.coil.name=Bobina 40 | type.fan.name=Ventilador 41 | type.sheet.name=Lámina 42 | type.gear.name=Engranaje -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileEntityItemFueledMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | 5 | public abstract class TileEntityItemFueledMachine extends TileEntityMachine { 6 | protected int fuelTime, maxFuelTime; 7 | 8 | @Override 9 | public void updateEntity() { 10 | if(fuelTime > 0) { 11 | fuelTime--; 12 | if(fuelTime == 0) { 13 | maxFuelTime = 0; 14 | 15 | //Run update to check for more fuel 16 | onInventoryUpdate(); 17 | if(fuelTime == 0) 18 | setRunning(false, worldObj); 19 | 20 | } 21 | } 22 | } 23 | 24 | public int getFuelTime() {return fuelTime;} 25 | 26 | public int getMaxFuelTime() { return maxFuelTime; } 27 | 28 | public void setFuelTime(int time) { fuelTime = time; } 29 | 30 | public void setMaxFuelTime(int time) { maxFuelTime = time; setFuelTime(time); } 31 | 32 | public boolean isBurningFuel() { return fuelTime > 0; } 33 | 34 | @Override 35 | public void writeToNBT(NBTTagCompound nbt) { 36 | super.writeToNBT(nbt); 37 | 38 | nbt.setInteger("fuelTime", fuelTime); 39 | nbt.setInteger("maxFuelTime", maxFuelTime); 40 | } 41 | 42 | @Override 43 | public void readFromNBT(NBTTagCompound nbt) { 44 | super.readFromNBT(nbt); 45 | 46 | fuelTime = nbt.getInteger("fuelTime"); 47 | maxFuelTime = nbt.getInteger("maxFuelTime"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/multiblock/BlockMultiBlockComponentVisible.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block.multiblock; 2 | 3 | import net.minecraft.block.material.Material; 4 | import net.minecraft.tileentity.TileEntity; 5 | import net.minecraft.world.IBlockAccess; 6 | import net.minecraft.world.World; 7 | import zmaster587.libVulpes.tile.TilePointer; 8 | 9 | public class BlockMultiBlockComponentVisible extends BlockMultiblockStructure { 10 | 11 | 12 | public BlockMultiBlockComponentVisible(Material material) { 13 | super(material); 14 | } 15 | 16 | @Override 17 | public boolean hasTileEntity(int metadata) { 18 | return metadata > 7; 19 | } 20 | 21 | public void completeStructure(World world, int x, int y, int z, int meta) { 22 | world.setBlockMetadataWithNotify(x, y, z, meta | 8, 3); 23 | } 24 | 25 | @Override 26 | public boolean isOpaqueCube() { 27 | return true; 28 | } 29 | 30 | @Override 31 | public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, 32 | int z, int side) { 33 | //Yes this is hacky... 34 | return side == 0 && this.minY > 0.0D ? true : (side == 1 && this.maxY < 1.0D ? true : (side == 2 && this.minZ > 0.0D ? true : (side == 3 && this.maxZ < 1.0D ? true : (side == 4 && this.minX > 0.0D ? true : (side == 5 && this.maxX < 1.0D ? true : !access.getBlock(x, y, z).isOpaqueCube()))))); 35 | } 36 | 37 | @Override 38 | public TileEntity createTileEntity(World world, int metadata) { 39 | return new TilePointer(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleSlotArray.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.List; 4 | 5 | import zmaster587.libVulpes.inventory.ContainerModular; 6 | import net.minecraft.inventory.Container; 7 | import net.minecraft.inventory.IInventory; 8 | import net.minecraft.inventory.Slot; 9 | 10 | public class ModuleSlotArray extends ModuleBase { 11 | 12 | int startSlot, endSlot; 13 | IInventory inventory; 14 | ContainerModular container; //TODO: fix this OOPs (Object Oriented Poops) 15 | 16 | public ModuleSlotArray(int offsetX, int offsetY, IInventory container, int startSlot, int endSlot) { 17 | super(offsetX, offsetY); 18 | this.startSlot = startSlot; 19 | this.endSlot = endSlot; 20 | this.inventory = container; 21 | } 22 | 23 | public void setSlotBounds(int a, int b) { 24 | 25 | for(int i = startSlot; i < endSlot; i++) { 26 | container.inventorySlots.remove(i); 27 | container.inventoryItemStacks.remove(i); 28 | } 29 | startSlot = a; 30 | endSlot = b; 31 | 32 | for(Slot slot : getSlots(container)) { 33 | container.addSlotToContainer(slot); 34 | } 35 | } 36 | 37 | @Override 38 | public List getSlots(Container container) { 39 | 40 | //Get the reference to the container 41 | this.container = (ContainerModular)container; 42 | 43 | for(int i = 0; i + startSlot < endSlot; i++) { 44 | Slot slot; 45 | slot = new Slot(inventory, i+startSlot, offsetX + 18* (i % 9), offsetY + 18*(i/9)); 46 | 47 | slotList.add(slot); 48 | } 49 | return slotList; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | itemGroup.multiBlock=Multi Block Machine Parts 2 | item.Linker.name=Linker 3 | 4 | tile.hatch.0.name=Input Hatch 5 | tile.hatch.1.name=Output Hatch 6 | tile.hatch.2.name=Fluid Input Hatch 7 | tile.hatch.3.name=Fluid Output Hatch 8 | 9 | tile.rfBattery.name=Redstone Flux(RF) Input Plug 10 | tile.IC2Plug.name=IC2 Plug(EU) 11 | tile.structureMachine.name=Machine Structure 12 | tile.advStructureMachine.name=Advanced Machine Structure 13 | tile.blockGenericMachine.name=Machine Controller Block 14 | tile.coil.silicon.name=Silicon Coil 15 | tile.coil.copper.name=Copper Coil 16 | tile.coil.tin.name=Tin Coil 17 | tile.coil.steel.name=Steel Coil 18 | tile.coil=Coil 19 | tile.Copper.name=Copper Ore 20 | tile.Tin.name=Tin Ore 21 | tile.Rutile.name=Rutile Ore 22 | tile.Aluminum.name=Aluminum Ore 23 | tile.coalGenerator.name=Coal Generator 24 | 25 | item.holoProjector.name=Holo-Projector 26 | 27 | type.crystal.name=Crystal 28 | type.dust.name=Dust 29 | type.boule.name=Boule 30 | type.ingot.name=Ingot 31 | type.nugget.name=Nugget 32 | type.stick.name=Rod 33 | type.plate.name=Plate 34 | type.ore.name=Ore 35 | type.block.name=Block 36 | type.coil.name=Coil 37 | type.fan.name=Fan 38 | type.sheet.name=Sheet 39 | type.gear.name=Gear 40 | 41 | material.Gold.name=Gold 42 | material.Iron.name=Iron 43 | material.Silicon.name=Silicon 44 | material.Copper.name=Copper 45 | material.Tin.name=Tin 46 | material.Steel.name=Steel 47 | material.Titanium.name=Titanium 48 | material.Rutile.name=Rutile 49 | material.Aluminum.name=Aluminum 50 | material.Iridium.name=Iridium -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/slot/SlotArmor.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.slot; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.inventory.IInventory; 5 | import net.minecraft.inventory.Slot; 6 | import net.minecraft.item.ItemArmor; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.IIcon; 9 | import cpw.mods.fml.relauncher.Side; 10 | import cpw.mods.fml.relauncher.SideOnly; 11 | 12 | public class SlotArmor extends Slot { 13 | 14 | EntityPlayer player; 15 | int armorType; 16 | public SlotArmor(IInventory inv, int slot, int x, int y, EntityPlayer player, int armorType) { 17 | super(inv, slot, x, y); 18 | this.player = player; 19 | this.armorType = armorType; 20 | // TODO Auto-generated constructor stub 21 | } 22 | 23 | /** 24 | * Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 25 | * in the case of armor slots) 26 | */ 27 | public int getSlotStackLimit() 28 | { 29 | return 1; 30 | } 31 | /** 32 | * Check if the stack is a valid item for this slot. Always true beside for the armor slots. 33 | */ 34 | public boolean isItemValid(ItemStack p_75214_1_) 35 | { 36 | if (p_75214_1_ == null) return false; 37 | return p_75214_1_.getItem().isValidArmor(p_75214_1_, armorType, player); 38 | } 39 | /** 40 | * Returns the icon index on items.png that is used as background image of the slot. 41 | */ 42 | @SideOnly(Side.CLIENT) 43 | public IIcon getBackgroundIconIndex() 44 | { 45 | return ItemArmor.func_94602_b(armorType); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/compat/InventoryCompat.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.compat; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.tileentity.TileEntity; 6 | import net.minecraft.world.World; 7 | import zmaster587.libVulpes.util.BlockPosition; 8 | import zmaster587.libVulpes.util.ZUtils; 9 | 10 | public class InventoryCompat { 11 | 12 | static boolean buildCraft_injectable; 13 | 14 | public static void initCompat() { 15 | try { 16 | Class.forName("buildcraft.api.transport.IInjectable"); 17 | buildCraft_injectable = true; 18 | } catch (ClassNotFoundException e) { 19 | buildCraft_injectable = false; 20 | } 21 | 22 | buildCraft_injectable = false; 23 | } 24 | 25 | public static boolean canInjectItems(TileEntity tile) { 26 | 27 | if(buildCraft_injectable) { 28 | return true; 29 | } 30 | return tile != null && tile instanceof IInventory && ZUtils.numEmptySlots((IInventory)tile) > 0; 31 | } 32 | 33 | public static boolean canInjectItems(TileEntity tile, ItemStack item) { 34 | 35 | if(buildCraft_injectable) { 36 | return true; 37 | } 38 | return tile != null && tile instanceof IInventory && (ZUtils.numEmptySlots((IInventory)tile) > 0 || ZUtils.doesInvHaveRoom(item, (IInventory)tile)); 39 | } 40 | 41 | public static boolean canInjectItems(IInventory tile, ItemStack item) { 42 | 43 | return (ZUtils.numEmptySlots((IInventory)tile) > 0 || ZUtils.doesInvHaveRoom(item, (IInventory)tile)); 44 | } 45 | 46 | public static void injectItem(IInventory tile, ItemStack item) { 47 | if(buildCraft_injectable) {} 48 | 49 | ZUtils.mergeInventory(item, (IInventory)tile); 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileMaterial.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import zmaster587.libVulpes.api.material.Material; 4 | import zmaster587.libVulpes.api.material.MaterialRegistry; 5 | import net.minecraft.nbt.NBTTagCompound; 6 | import net.minecraft.network.NetworkManager; 7 | import net.minecraft.network.Packet; 8 | import net.minecraft.network.play.server.S35PacketUpdateTileEntity; 9 | 10 | public class TileMaterial extends TilePointer { 11 | 12 | Material materialType; 13 | 14 | public TileMaterial() { 15 | super(); 16 | } 17 | 18 | @Override 19 | public boolean canUpdate() { 20 | return false; 21 | } 22 | 23 | public Material getMaterial() { 24 | return materialType; 25 | } 26 | 27 | public void setMaterial(Material material) { 28 | materialType = material; 29 | } 30 | 31 | @Override 32 | public Packet getDescriptionPacket() { 33 | NBTTagCompound nbt = new NBTTagCompound(); 34 | 35 | nbt.setString("material", materialType.getUnlocalizedName()); 36 | 37 | return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, worldObj.provider.dimensionId, nbt); 38 | } 39 | 40 | @Override 41 | public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { 42 | materialType = MaterialRegistry.getMaterialFromName(pkt.func_148857_g().getString("material")); 43 | } 44 | 45 | @Override 46 | public void writeToNBT(NBTTagCompound nbt) { 47 | super.writeToNBT(nbt); 48 | if(materialType != null) 49 | nbt.setString("material", materialType.getUnlocalizedName()); 50 | } 51 | 52 | @Override 53 | public void readFromNBT(NBTTagCompound nbt) { 54 | super.readFromNBT(nbt); 55 | if(nbt.hasKey("material")) 56 | materialType = MaterialRegistry.getMaterialFromName(nbt.getString("material")); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleSlider.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import zmaster587.libVulpes.client.util.ProgressBarImage; 4 | import zmaster587.libVulpes.inventory.GuiModular; 5 | import net.minecraft.client.gui.GuiScreen; 6 | import net.minecraft.util.MathHelper; 7 | 8 | public class ModuleSlider extends ModuleProgress { 9 | 10 | public ModuleSlider(int offsetX, int offsetY, int id, 11 | ProgressBarImage progressBar, ISliderBar progress) { 12 | super(offsetX, offsetY, id, progressBar, progress); 13 | } 14 | 15 | @Override 16 | public void onMouseClickedAndDragged(int x, int y, int button, 17 | long timeSineLastClick) { 18 | onMouseClicked(null,x, y, button); 19 | } 20 | 21 | @Override 22 | public void onMouseClicked(GuiModular gui, int x, int y, int button) { 23 | 24 | if(button == 0 && isEnabled()) { 25 | int localX = x - offsetX - progressBar.getInsetX(); 26 | int localY = y - offsetY - progressBar.getInsetY(); 27 | 28 | //If user is over the slider 29 | if(localX > 0 && localX < progressBar.getBackWidth() - progressBar.getInsetX() && localY > 0 && localY < progressBar.getBackHeight() - progressBar.getInsetY()) { 30 | 31 | float percent; 32 | if(progressBar.getDirection().offsetX != 0) { // horizontal 33 | percent = MathHelper.clamp_float((localX + progressBar.getInsetX())/ ((float)(progressBar.getBackWidth() - 2*progressBar.getInsetX())),0f,1f); 34 | } 35 | else if(progressBar.getDirection().offsetY == 1) 36 | percent = 1 - (localY / (float)(progressBar.getBackHeight() - progressBar.getInsetY())); 37 | else 38 | percent = localY / (float)(progressBar.getBackHeight() + progressBar.getInsetY()); 39 | 40 | 41 | ((ISliderBar)progress).setProgressByUser(id, (int) (percent*progress.getTotalProgress(id))); 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockOre.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import java.util.List; 4 | 5 | import zmaster587.libVulpes.api.material.AllowedProducts; 6 | import net.minecraft.block.Block; 7 | import net.minecraft.block.material.Material; 8 | import net.minecraft.client.renderer.texture.IIconRegister; 9 | import net.minecraft.creativetab.CreativeTabs; 10 | import net.minecraft.item.Item; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraft.util.IIcon; 13 | 14 | public class BlockOre extends Block implements INamedMetaBlock { 15 | 16 | public zmaster587.libVulpes.api.material.Material[] ores = new zmaster587.libVulpes.api.material.Material[16]; 17 | IIcon[] textures = new IIcon[16]; 18 | public byte numBlocks; 19 | public AllowedProducts product; 20 | 21 | public BlockOre(Material material) { 22 | super(material); 23 | } 24 | 25 | public AllowedProducts getProduct() { 26 | return product; 27 | } 28 | 29 | @Override 30 | public IIcon getIcon(int side, int meta) { 31 | return textures[meta]; 32 | } 33 | 34 | @Override 35 | public void getSubBlocks(Item item, CreativeTabs tab, 36 | List list) { 37 | for(int i = 0; i < numBlocks; i++) 38 | if(product.isOfType(ores[i].getAllowedProducts())) 39 | list.add(new ItemStack(item, 1, i)); 40 | } 41 | 42 | @Override 43 | public void registerBlockIcons(IIconRegister iconRegister) { 44 | for(int i = 0; i < numBlocks; i++) { 45 | if(product.isOfType(ores[i].getAllowedProducts()) ) 46 | textures[i] = iconRegister.registerIcon("libvulpes:" + textureName + ores[i].getUnlocalizedName()); 47 | } 48 | } 49 | 50 | @Override 51 | public int damageDropped(int meta) { 52 | return meta; 53 | } 54 | 55 | @Override 56 | public String getUnlocalizedName(int itemDamage) { 57 | return "material." + ores[itemDamage].getUnlocalizedName(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileEntityRFMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import zmaster587.libVulpes.api.IUniversalEnergy; 4 | import zmaster587.libVulpes.util.UniversalBattery; 5 | import net.minecraft.nbt.NBTTagCompound; 6 | import net.minecraftforge.common.util.ForgeDirection; 7 | import cofh.api.energy.IEnergyHandler; 8 | 9 | 10 | public abstract class TileEntityRFMachine extends TileEntityMachine implements IEnergyHandler, IUniversalEnergy { 11 | 12 | protected UniversalBattery energy; 13 | 14 | @Override 15 | public void writeToNBT(NBTTagCompound nbt) { 16 | super.writeToNBT(nbt); 17 | energy.writeToNBT(nbt); 18 | } 19 | 20 | @Override 21 | public void readFromNBT(NBTTagCompound nbt) { 22 | super.readFromNBT(nbt); 23 | energy.readFromNBT(nbt); 24 | } 25 | 26 | @Override 27 | public int receiveEnergy(ForgeDirection from, int maxReceive, 28 | boolean simulate) { 29 | return energy.receiveEnergy(maxReceive, simulate); 30 | } 31 | 32 | @Override 33 | public int extractEnergy(ForgeDirection from, int maxExtract, 34 | boolean simulate) { 35 | return 0; 36 | } 37 | 38 | @Override 39 | public int getEnergyStored(ForgeDirection from) { 40 | return energy.getEnergyStored(); 41 | } 42 | 43 | @Override 44 | public int getMaxEnergyStored(ForgeDirection from) { 45 | return energy.getMaxEnergyStored(); 46 | } 47 | 48 | public boolean hasEnergy() { return energy.getEnergyStored() > 0; } 49 | 50 | @Override 51 | public void setEnergyStored(int value) { 52 | energy.setEnergyStored(value); 53 | } 54 | 55 | 56 | public void removePower(int amt) { 57 | energy.extractEnergy(amt, false); 58 | } 59 | 60 | 61 | public int getPower() { 62 | return energy.getEnergyStored(); 63 | } 64 | 65 | @Override 66 | public boolean canConnectEnergy(ForgeDirection arg0) { 67 | return true; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/client/ResourceIcon.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.client; 2 | 3 | import net.minecraft.util.IIcon; 4 | import net.minecraft.util.ResourceLocation; 5 | 6 | public class ResourceIcon implements IIcon { 7 | 8 | ResourceLocation location; 9 | IIcon subIcon; 10 | 11 | public ResourceIcon(ResourceLocation location) { 12 | this.location = location; 13 | subIcon = null; 14 | } 15 | 16 | public ResourceIcon(ResourceLocation location, IIcon subIcon) { 17 | this.location = location; 18 | this.subIcon = subIcon; 19 | } 20 | 21 | public ResourceLocation getResourceLocation() { 22 | return location; 23 | } 24 | 25 | @Override 26 | public int getIconWidth() { 27 | return 0; 28 | } 29 | 30 | @Override 31 | public int getIconHeight() { 32 | return 0; 33 | } 34 | 35 | @Override 36 | public float getMinU() { 37 | if(subIcon == null) 38 | return 0; 39 | else 40 | return subIcon.getMinU(); 41 | } 42 | 43 | @Override 44 | public float getMaxU() { 45 | if(subIcon == null) 46 | return 1f; 47 | else 48 | return subIcon.getMaxU(); 49 | } 50 | 51 | @Override 52 | public float getInterpolatedU(double p_94214_1_) { 53 | if(subIcon == null) 54 | return 0; 55 | else 56 | return subIcon.getInterpolatedU(p_94214_1_); 57 | } 58 | 59 | @Override 60 | public float getMinV() { 61 | if(subIcon == null) 62 | return 0f; 63 | else 64 | return subIcon.getMinV(); 65 | } 66 | 67 | @Override 68 | public float getMaxV() { 69 | if(subIcon == null) 70 | return 1f; 71 | else 72 | return subIcon.getMaxV(); 73 | } 74 | 75 | @Override 76 | public float getInterpolatedV(double p_94207_1_) { 77 | if(subIcon == null) 78 | return 0f; 79 | else 80 | return subIcon.getInterpolatedV(p_94207_1_); 81 | } 82 | 83 | @Override 84 | public String getIconName() { 85 | return null; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileEntityPowerMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import cofh.api.energy.IEnergyHandler; 4 | import zmaster587.libVulpes.api.IUniversalEnergy; 5 | import zmaster587.libVulpes.util.UniversalBattery; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | import net.minecraft.util.EnumFacing; 8 | import net.minecraftforge.common.util.ForgeDirection; 9 | public abstract class TileEntityPowerMachine extends TileEntityMachine implements IEnergyHandler, IUniversalEnergy { 10 | 11 | protected UniversalBattery energy; 12 | 13 | @Override 14 | public void writeToNBT(NBTTagCompound nbt) { 15 | super.writeToNBT(nbt); 16 | energy.writeToNBT(nbt); 17 | } 18 | 19 | @Override 20 | public void readFromNBT(NBTTagCompound nbt) { 21 | super.readFromNBT(nbt); 22 | energy.readFromNBT(nbt); 23 | } 24 | 25 | @Override 26 | public int receiveEnergy(ForgeDirection from, int maxReceive, 27 | boolean simulate) { 28 | return energy.acceptEnergy(maxReceive, simulate); 29 | } 30 | 31 | @Override 32 | public int extractEnergy(ForgeDirection from, int maxExtract, 33 | boolean simulate) { 34 | return 0; 35 | } 36 | 37 | @Override 38 | public int getEnergyStored(ForgeDirection from) { 39 | return energy.getEnergyStored(); 40 | } 41 | 42 | @Override 43 | public int getMaxEnergyStored(ForgeDirection from) { 44 | return energy.getMaxEnergyStored(); 45 | } 46 | 47 | public boolean hasEnergy() { return energy.getEnergyStored() > 0; } 48 | 49 | @Override 50 | public void setEnergyStored(int value) { 51 | energy.setEnergyStored(value); 52 | } 53 | 54 | 55 | public void removePower(int amt) { 56 | energy.extractEnergy(amt, false); 57 | } 58 | 59 | 60 | public int getPower() { 61 | return energy.getEnergyStored(); 62 | } 63 | 64 | @Override 65 | public boolean canConnectEnergy(ForgeDirection arg0) { 66 | return true; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleSlotArmor.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.List; 4 | 5 | import zmaster587.libVulpes.inventory.ContainerModular; 6 | import zmaster587.libVulpes.inventory.slot.SlotArmor; 7 | import cpw.mods.fml.relauncher.Side; 8 | import cpw.mods.fml.relauncher.SideOnly; 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.inventory.Container; 11 | import net.minecraft.inventory.IInventory; 12 | import net.minecraft.inventory.Slot; 13 | import net.minecraft.item.ItemArmor; 14 | import net.minecraft.item.ItemStack; 15 | import net.minecraft.util.IIcon; 16 | 17 | public class ModuleSlotArmor extends ModuleBase { 18 | 19 | int startSlot, endSlot; 20 | EntityPlayer player; 21 | ContainerModular container; //TODO: fix this OOPs (Object Oriented Poops) 22 | 23 | public ModuleSlotArmor(int offsetX, int offsetY, EntityPlayer player) { 24 | super(offsetX, offsetY); 25 | this.player = player; 26 | startSlot = 36; 27 | endSlot = 40; 28 | } 29 | 30 | public void setSlotBounds(int a, int b) { 31 | 32 | for(int i = startSlot; i < endSlot; i++) { 33 | container.inventorySlots.remove(i); 34 | container.inventoryItemStacks.remove(i); 35 | } 36 | startSlot = a; 37 | endSlot = b; 38 | 39 | for(Slot slot : getSlots(container)) { 40 | container.addSlotToContainer(slot); 41 | } 42 | } 43 | 44 | @Override 45 | public List getSlots(Container container) { 46 | 47 | //Get the reference to the container 48 | this.container = (ContainerModular)container; 49 | 50 | for(int i = 0; i + startSlot < endSlot; i++) { 51 | 52 | Slot slot; 53 | final int k = (endSlot - startSlot) - i - 1; 54 | slot = new SlotArmor(player.inventory, k + startSlot, offsetX + 18 * (i / 9), offsetY + 18*(i%9), player, 3- k); 55 | 56 | 57 | slotList.add(slot); 58 | } 59 | return slotList; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockMulti.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import java.util.List; 4 | 5 | import cpw.mods.fml.relauncher.Side; 6 | import cpw.mods.fml.relauncher.SideOnly; 7 | import net.minecraft.block.Block; 8 | import net.minecraft.block.material.Material; 9 | import net.minecraft.client.renderer.texture.IIconRegister; 10 | import net.minecraft.creativetab.CreativeTabs; 11 | import net.minecraft.item.Item; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraft.util.IIcon; 14 | import net.minecraft.world.World; 15 | 16 | public class BlockMulti extends Block { 17 | 18 | public BlockMulti(Material mat) { 19 | super(mat); 20 | } 21 | 22 | protected String[] names; 23 | protected IIcon[] textures; 24 | 25 | 26 | /** 27 | * @param names Array of unlocalized names for this block, also used for the texture names and lang 28 | * @return self, for convenience 29 | */ 30 | public BlockMulti setNames(String[] names) { 31 | this.names = names; 32 | return this; 33 | } 34 | 35 | @Override 36 | public int damageDropped(int meta) { 37 | return meta; 38 | } 39 | 40 | @Override 41 | @SideOnly(Side.CLIENT) 42 | public IIcon getIcon(int side, int metadata) 43 | { 44 | return textures[metadata]; 45 | } 46 | 47 | @SideOnly(Side.CLIENT) 48 | @Override 49 | public void registerBlockIcons(IIconRegister reg) 50 | { 51 | textures = new IIcon[names.length]; 52 | for(int i = 0; i < names.length; i++) { 53 | textures[i] = reg.registerIcon(names[i]); 54 | } 55 | } 56 | 57 | @Override 58 | public int getDamageValue(World world, int x, int y, int z) 59 | { 60 | return world.getBlockMetadata(x, y, z); 61 | } 62 | 63 | @Override 64 | @SideOnly(Side.CLIENT) 65 | public void getSubBlocks(Item par1, CreativeTabs tab, List subItems) { 66 | for (int ix = 0; ix < names.length; ix++) { 67 | subItems.add(new ItemStack(this, 1, ix)); 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/assets/libvulpes/lang/fr_FR.lang: -------------------------------------------------------------------------------- 1 | itemGroup.multiBlock=Multi Block Machine Parts 2 | item.Linker.name=Connecteur 3 | 4 | tile.hatch.0.name=Écoutille d'entrée 5 | tile.hatch.1.name=Écoutille de sortie 6 | tile.hatch.2.name=Écoutille d'entrée de fluide 7 | tile.hatch.3.name=Écoutille de sortie de fluide 8 | 9 | tile.forgePowerInput.name=Power Input Plug 10 | tile.forgePowerOutput.name=Power Output Plug 11 | tile.creativePowerBattery.name=Creative Power Input Plug 12 | tile.rfBattery.name=Interface Redstone Flux(RF) 13 | tile.IC2Plug.name=Interface IC2(EU) 14 | tile.structureMachine.name=Structure de machine 15 | tile.advStructureMachine.name=Structure de machine avancé 16 | tile.blockGenericMachine.name=Machine Controller Block 17 | tile.coil.silicon.name=Bobine en silicone 18 | tile.coil.copper.name=Bobine en cuivre 19 | tile.coil.tin.name=Bobine en étain 20 | tile.coil.steel.name=Bobine en en acier 21 | tile.coil=Bobine 22 | tile.Copper.name=Minerai de cuivre 23 | tile.Tin.name=Minerai d'étain 24 | tile.Rutile.name=Minerai de rutile 25 | tile.Aluminum.name=Minerai d'aluminum 26 | tile.coalGenerator.name=Générateur à charbon 27 | tile.motor.name=Moteur 28 | tile.advancedMotor.name=Moteur avancé 29 | tile.enhancedMotor.name=Moteur amélioré 30 | tile.eliteMotor.name=Moteur élite 31 | 32 | item.holoProjector.name=Holo-projecteur 33 | 34 | type.crystal.name=Cristal 35 | type.dust.name=Poudre 36 | type.boule.name=Barreau 37 | type.ingot.name=Lingot 38 | type.nugget.name=Pépite 39 | type.stick.name=Barre 40 | type.plate.name=Plaque 41 | type.ore.name=Minerai 42 | type.block.name=Bloc 43 | type.coil.name=Bobine 44 | type.fan.name=Hélice 45 | type.sheet.name=Feuille 46 | type.gear.name=Roue dentée 47 | 48 | material.Gold.name=Or 49 | material.Iron.name=Fer 50 | material.Silicon.name=Silicone 51 | material.Copper.name=Cuivre 52 | material.Tin.name=Étain 53 | material.Steel.name=Acier 54 | material.Titanium.name=Titane 55 | material.Rutile.name=Rutile 56 | material.Aluminum.name=Aluminium 57 | material.Iridium.name=Iridium 58 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/UniversalBattery.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraftforge.common.util.ForgeDirection; 5 | import zmaster587.libVulpes.api.IUniversalEnergy; 6 | 7 | public class UniversalBattery implements IUniversalEnergy { 8 | 9 | private int energy; 10 | private int maxEnergy; 11 | 12 | public UniversalBattery() { 13 | maxEnergy = 0; 14 | } 15 | 16 | public UniversalBattery(int maxEnergy) { 17 | this.maxEnergy = maxEnergy; 18 | } 19 | 20 | @Override 21 | public int acceptEnergy(int maxReceive, 22 | boolean simulate) { 23 | 24 | if(maxReceive > maxEnergy - energy) { 25 | int returnAmt = maxEnergy - energy; 26 | if(!simulate) 27 | energy = maxEnergy; 28 | 29 | return returnAmt; 30 | } 31 | 32 | if(!simulate) 33 | energy += maxReceive; 34 | 35 | return maxReceive; 36 | } 37 | 38 | @Override 39 | public int extractEnergy(int maxExtract, 40 | boolean simulate) { 41 | if(maxExtract > energy) { 42 | int ret = energy; 43 | if(!simulate) 44 | energy = 0; 45 | return ret; 46 | } 47 | 48 | if(!simulate) 49 | energy -= maxExtract; 50 | 51 | return maxExtract; 52 | } 53 | 54 | @Override 55 | public int getEnergyStored() { 56 | return energy; 57 | } 58 | 59 | @Override 60 | public int getMaxEnergyStored() { 61 | return maxEnergy; 62 | } 63 | 64 | @Override 65 | public void setMaxEnergyStored(int max) { 66 | maxEnergy = max; 67 | } 68 | 69 | @Override 70 | public void setEnergyStored(int energy) { 71 | this.energy = energy; 72 | } 73 | 74 | public void writeToNBT(NBTTagCompound nbt) { 75 | nbt.setInteger("energy", this.energy); 76 | nbt.setInteger("maxEnergy", this.maxEnergy); 77 | } 78 | 79 | public void readFromNBT(NBTTagCompound nbt) { 80 | this.energy = nbt.getInteger("energy"); 81 | this.maxEnergy = nbt.getInteger("maxEnergy"); 82 | } 83 | 84 | public int receiveEnergy(int maxReceive, boolean simulate) { 85 | return acceptEnergy(maxReceive, simulate); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/cofh/api/energy/IEnergyHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.api.energy; 2 | 3 | import net.minecraftforge.common.util.ForgeDirection; 4 | 5 | /** 6 | * Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects. 7 | *

8 | * A reference implementation is provided {@link TileEnergyHandler}. 9 | * 10 | * @author King Lemming 11 | * 12 | */ 13 | public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { 14 | 15 | // merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things) 16 | 17 | /** 18 | * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. 19 | * 20 | * @param from 21 | * Orientation the energy is received from. 22 | * @param maxReceive 23 | * Maximum amount of energy to receive. 24 | * @param simulate 25 | * If TRUE, the charge will only be simulated. 26 | * @return Amount of energy that was (or would have been, if simulated) received. 27 | */ 28 | @Override 29 | int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); 30 | 31 | /** 32 | * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. 33 | * 34 | * @param from 35 | * Orientation the energy is extracted from. 36 | * @param maxExtract 37 | * Maximum amount of energy to extract. 38 | * @param simulate 39 | * If TRUE, the extraction will only be simulated. 40 | * @return Amount of energy that was (or would have been, if simulated) extracted. 41 | */ 42 | @Override 43 | int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); 44 | 45 | /** 46 | * Returns the amount of energy currently stored. 47 | */ 48 | @Override 49 | int getEnergyStored(ForgeDirection from); 50 | 51 | /** 52 | * Returns the maximum amount of energy that can be stored. 53 | */ 54 | @Override 55 | int getMaxEnergyStored(ForgeDirection from); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/energy/TilePlugOutputRF.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.energy; 2 | 3 | import net.minecraft.tileentity.TileEntity; 4 | import net.minecraftforge.common.util.ForgeDirection; 5 | import cofh.api.energy.IEnergyHandler; 6 | import cofh.api.energy.IEnergyReceiver; 7 | 8 | public class TilePlugOutputRF extends TilePlugBase implements IEnergyHandler { 9 | 10 | public TilePlugOutputRF() { 11 | super(1); 12 | } 13 | 14 | @Override 15 | public boolean canConnectEnergy(ForgeDirection arg0) { 16 | return true; 17 | } 18 | 19 | 20 | @Override 21 | public boolean canUpdate() { 22 | return true; 23 | } 24 | 25 | @Override 26 | public void updateEntity() { 27 | super.updateEntity(); 28 | 29 | if(!worldObj.isRemote) { 30 | for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { 31 | TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); 32 | 33 | if(tile instanceof IEnergyReceiver) { 34 | IEnergyReceiver handle = (IEnergyReceiver)tile; 35 | storage.getEnergyStored(); 36 | storage.extractEnergy(handle.receiveEnergy(dir.getOpposite(), storage.getEnergyStored(), false), false); 37 | } 38 | } 39 | } 40 | } 41 | 42 | @Override 43 | public String getModularInventoryName() { 44 | return "tile.rfOutput.name"; 45 | } 46 | 47 | @Override 48 | public String getInventoryName() { 49 | return ""; 50 | } 51 | 52 | @Override 53 | public int extractEnergy(ForgeDirection dir, int maxExtract, boolean simulate) { 54 | return storage.extractEnergy(maxExtract, simulate); 55 | } 56 | 57 | @Override 58 | public int getEnergyStored(ForgeDirection dir) { 59 | return storage.getEnergyStored(); 60 | } 61 | 62 | @Override 63 | public int getMaxEnergyStored(ForgeDirection arg0) { 64 | return storage.getMaxEnergyStored(); 65 | } 66 | 67 | @Override 68 | public int receiveEnergy(ForgeDirection dir, int amt, boolean simulate) { 69 | if(dir == ForgeDirection.UNKNOWN) 70 | return storage.acceptEnergy(amt, simulate); 71 | return 0; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /gradle/scripts/jars.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | maven { 5 | name = "sonatype" 6 | url = "https://oss.sonatype.org/content/repositories/snapshots/" 7 | } 8 | } 9 | dependencies { 10 | classpath 'org.ajoberstar:gradle-git:1.3.2' 11 | classpath 'org.ajoberstar:grgit:1.4.1' 12 | } 13 | } 14 | 15 | def currentJvm = org.gradle.internal.jvm.Jvm.current() 16 | println "Current Java version = " + currentJvm 17 | 18 | import org.ajoberstar.grgit.* 19 | 20 | def gitHash = 'unknown' 21 | if (new File(projectDir, '.git').exists()) { 22 | def repo = Grgit.open(project.file('.')) 23 | gitHash = repo.log().find().abbreviatedId 24 | } 25 | 26 | 27 | ext.sharedManifest = manifest { 28 | attributes("Built-By": System.getProperty('user.name'), 29 | "Created-By": currentJvm, 30 | "Implementation-Title": archivesBaseName, 31 | "Implementation-Version": project.version, 32 | "Git-Hash": gitHash) 33 | } 34 | 35 | task deobfJar(type: Jar) { 36 | from sourceSets.main.output 37 | //if project name is BBM-Dev it makes the deobf jar deobf-dev if not its just deobf 38 | if (project.hasProperty("bambooshortPlanName") && project.getProperty("bambooshortPlanName") == "BBM-Dev") classifier = "deobf-dev" 39 | else classifier = "deobf" 40 | //sets where the jars go to. 41 | destinationDir = file 'output' 42 | manifest = project.manifest { 43 | from sharedManifest 44 | } 45 | mustRunAfter "jar" 46 | } 47 | 48 | jar { 49 | //if project has the property BBM-Dev then it appends dev to indicate the dev branch 50 | if (project.hasProperty("bambooshortPlanName") && project.getProperty("bambooshortPlanName") == "BBM-Dev") classifier = "dev-universal" 51 | else classifier = "universal" 52 | //sets where the jars go to. 53 | destinationDir = file 'output' 54 | manifest = project.manifest { 55 | from sharedManifest 56 | 57 | } 58 | } 59 | 60 | tasks.build.dependsOn deobfJar -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileInventoriedRFConsumerTank.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | import net.minecraftforge.common.util.ForgeDirection; 5 | import net.minecraftforge.fluids.Fluid; 6 | import net.minecraftforge.fluids.FluidStack; 7 | import net.minecraftforge.fluids.FluidTank; 8 | import net.minecraftforge.fluids.FluidTankInfo; 9 | import net.minecraftforge.fluids.IFluidHandler; 10 | 11 | public abstract class TileInventoriedRFConsumerTank extends TileInventoriedRFConsumer implements IFluidHandler { 12 | 13 | protected FluidTank tank; 14 | 15 | protected TileInventoriedRFConsumerTank(int energy, int invSize, int tankSize) { 16 | super(energy,invSize); 17 | tank = new FluidTank(tankSize); 18 | } 19 | 20 | @Override 21 | public void writeToNBT(NBTTagCompound nbt) { 22 | super.writeToNBT(nbt); 23 | NBTTagCompound tanks = new NBTTagCompound(); 24 | tank.writeToNBT(tanks); 25 | 26 | nbt.setTag("tank", tanks); 27 | } 28 | 29 | @Override 30 | public void readFromNBT(NBTTagCompound nbt) { 31 | super.readFromNBT(nbt); 32 | 33 | tank.readFromNBT((NBTTagCompound)nbt.getTag("tank")); 34 | } 35 | 36 | @Override 37 | public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { 38 | return tank.fill(resource, doFill); 39 | } 40 | 41 | @Override 42 | public FluidStack drain(ForgeDirection from, FluidStack resource, 43 | boolean doDrain) { 44 | return tank.drain(resource.amount, doDrain); 45 | } 46 | 47 | @Override 48 | public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { 49 | return tank.drain(maxDrain, doDrain); 50 | } 51 | 52 | @Override 53 | public boolean canDrain(ForgeDirection from, Fluid fluid) { 54 | return tank.getCapacity() > 0; 55 | } 56 | 57 | @Override 58 | public FluidTankInfo[] getTankInfo(ForgeDirection from) { 59 | // TODO Auto-generated method stub 60 | return new FluidTankInfo[] {tank.getInfo()}; 61 | } 62 | 63 | @Override 64 | public boolean canFill(ForgeDirection from, Fluid fluid) { 65 | return tank.getCapacity() > 0; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleRedstoneOutputButton.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import zmaster587.libVulpes.inventory.TextureResources; 4 | import zmaster587.libVulpes.util.ZUtils.RedstoneState; 5 | import cpw.mods.fml.relauncher.Side; 6 | import cpw.mods.fml.relauncher.SideOnly; 7 | import net.minecraft.client.gui.FontRenderer; 8 | import net.minecraft.client.gui.GuiButton; 9 | import net.minecraft.client.gui.inventory.GuiContainer; 10 | import net.minecraft.util.ResourceLocation; 11 | 12 | public class ModuleRedstoneOutputButton extends ModuleButton { 13 | 14 | RedstoneState state; 15 | 16 | public ModuleRedstoneOutputButton(int offsetX, int offsetY, int buttonId, 17 | String text, IButtonInventory tile) { 18 | super(offsetX, offsetY, buttonId, text, tile, TextureResources.buttonRedstoneActive, 24 ,24); 19 | state = RedstoneState.ON; 20 | } 21 | 22 | public RedstoneState getState() { 23 | return state; 24 | } 25 | 26 | public void setRedstoneState(int i) { 27 | state = RedstoneState.values()[i]; 28 | } 29 | 30 | public void setRedstoneState(RedstoneState i) { 31 | state = i; 32 | } 33 | 34 | @SideOnly(Side.CLIENT) 35 | @Override 36 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, 37 | int mouseY, FontRenderer font) { 38 | if(state != null) 39 | 40 | switch(state) { 41 | case ON: 42 | button.setButtonTexture(TextureResources.buttonRedstoneActive); 43 | tooltipText = "Redstone control normal"; 44 | break; 45 | case OFF: 46 | button.setButtonTexture(TextureResources.buttonRedstoneDisabled); 47 | tooltipText = "Redstone control disabled"; 48 | break; 49 | case INVERTED: 50 | button.setButtonTexture(TextureResources.buttonRedstoneInverted); 51 | tooltipText = "Redstone control inverted"; 52 | } 53 | 54 | super.renderBackground(gui, x, y, mouseX, mouseY, font); 55 | } 56 | 57 | @SideOnly(Side.CLIENT) 58 | public void actionPerform(GuiButton button) { 59 | if(enabled && button == this.button) { 60 | if(state == null) 61 | state = RedstoneState.ON; 62 | state = state.getNext(); 63 | tile.onInventoryButtonPressed(buttonId); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/energy/TilePlugInputIC2.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.energy; 2 | 3 | import zmaster587.libVulpes.Configuration; 4 | import net.minecraft.tileentity.TileEntity; 5 | import net.minecraftforge.common.MinecraftForge; 6 | import net.minecraftforge.common.util.ForgeDirection; 7 | import ic2.api.energy.event.EnergyTileLoadEvent; 8 | import ic2.api.energy.event.EnergyTileUnloadEvent; 9 | import ic2.api.energy.tile.IEnergySink; 10 | 11 | public class TilePlugInputIC2 extends TilePlugOutputRF implements IEnergySink { 12 | 13 | public TilePlugInputIC2() { 14 | } 15 | boolean tickedOnce = false; 16 | @Override 17 | public String getModularInventoryName() { 18 | return "tile.IC2Plug.name"; 19 | } 20 | 21 | 22 | @Override 23 | public boolean canUpdate() { 24 | return true; 25 | } 26 | 27 | //TODO: find a way of doing this that doesn't tick all the time 28 | @Override 29 | public void updateEntity() { 30 | if(!worldObj.isRemote && !tickedOnce) { 31 | MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); 32 | tickedOnce = true; 33 | } 34 | super.updateEntity(); 35 | } 36 | 37 | @Override 38 | public void invalidate() { 39 | super.invalidate(); 40 | MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); 41 | } 42 | 43 | @Override 44 | public void onChunkUnload() { 45 | super.onChunkUnload(); 46 | MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); 47 | } 48 | 49 | @Override 50 | public String getInventoryName() { 51 | return null; 52 | } 53 | 54 | @Override 55 | public boolean acceptsEnergyFrom(TileEntity emitter, 56 | ForgeDirection direction) { 57 | return true; 58 | } 59 | 60 | @Override 61 | public double getDemandedEnergy() { 62 | return Math.min(getMaxEnergyStored() - getEnergyStored(), 128.0); 63 | } 64 | 65 | @Override 66 | public int getSinkTier() { 67 | return 2; 68 | } 69 | 70 | @Override 71 | public double injectEnergy(ForgeDirection directionFrom, double amount, 72 | double voltage) { 73 | storage.acceptEnergy((int)(amount*Configuration.EUMult), false); 74 | return 0; 75 | } 76 | 77 | @Override 78 | public int acceptEnergy(int amt, boolean simulate) { 79 | return 0; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleText.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.lwjgl.opengl.GL11; 7 | 8 | import net.minecraft.client.gui.FontRenderer; 9 | import net.minecraft.client.gui.inventory.GuiContainer; 10 | import net.minecraft.client.renderer.Tessellator; 11 | 12 | public class ModuleText extends ModuleBase { 13 | 14 | List text; 15 | int color; 16 | boolean centered; 17 | float scale; 18 | 19 | public ModuleText(int offsetX, int offsetY, String text, int color) { 20 | super(offsetX, offsetY); 21 | 22 | this.text = new ArrayList(); 23 | scale = 1f; 24 | setText(text); 25 | this.color = color; 26 | centered = false; 27 | } 28 | 29 | public ModuleText(int offsetX, int offsetY, String text, int color, boolean centered) { 30 | this(offsetX, offsetY, text, color); 31 | this.centered = centered; 32 | scale = 1f; 33 | } 34 | 35 | public ModuleText(int offsetX, int offsetY, String text, int color, float scale) { 36 | this(offsetX, offsetY, text, color); 37 | this.scale = scale; 38 | } 39 | 40 | public void setText(String text) { 41 | 42 | this.text.clear(); 43 | for(String str : text.split("\\n")) { 44 | this.text.add(str); 45 | } 46 | } 47 | 48 | public void setColor(int color) { 49 | this.color = color; 50 | } 51 | 52 | public String getText() { 53 | 54 | String str = ""; 55 | 56 | for(String str2 : this.text) { 57 | str += "\n" + str2; 58 | } 59 | 60 | return str.substring(1); 61 | } 62 | 63 | @Override 64 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, int mouseY, FontRenderer font) { 65 | 66 | GL11.glPushMatrix(); 67 | GL11.glScalef(scale, scale, scale); 68 | GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); 69 | for(int i = 0; i < text.size(); i++) { 70 | if(centered) 71 | font.drawString(text.get(i), (x + offsetX - (font.getStringWidth(text.get(i))/2)), y + offsetY + i*font.FONT_HEIGHT, color); 72 | else 73 | font.drawString(text.get(i),(int)((x + offsetX)/scale), (int)((y + offsetY + i*font.FONT_HEIGHT)/scale), color); 74 | } 75 | GL11.glPopAttrib(); 76 | GL11.glPopMatrix(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/items/ItemIngredient.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.items; 2 | 3 | import java.util.List; 4 | 5 | import cpw.mods.fml.common.registry.GameRegistry; 6 | import cpw.mods.fml.relauncher.Side; 7 | import cpw.mods.fml.relauncher.SideOnly; 8 | import net.minecraft.client.renderer.texture.IIconRegister; 9 | import net.minecraft.creativetab.CreativeTabs; 10 | import net.minecraft.item.Item; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraft.util.IIcon; 13 | 14 | public class ItemIngredient extends Item { 15 | 16 | private int numIngots; 17 | 18 | public ItemIngredient(int num) { 19 | super(); 20 | numIngots = num; 21 | setHasSubtypes(true); 22 | setMaxDamage(0); 23 | } 24 | 25 | private IIcon[] icons; 26 | 27 | @SuppressWarnings({"rawtypes", "unchecked"}) 28 | @Override 29 | @SideOnly(Side.CLIENT) 30 | public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) { 31 | for (int i = 0; i < numIngots; i++) { 32 | itemList.add(new ItemStack(this, 1, i)); 33 | } 34 | } 35 | 36 | @Override 37 | public String getUnlocalizedName() { 38 | return super.getUnlocalizedName().split(":")[1]; 39 | } 40 | 41 | @Override 42 | public String getUnlocalizedName(ItemStack itemstack) { 43 | return (new StringBuilder()).append("item." + super.getUnlocalizedName().split(":")[1]).append(".").append(itemstack.getItemDamage()).toString(); 44 | } 45 | 46 | @Override 47 | public IIcon getIconFromDamage(int i) { 48 | return i < icons.length ? icons[i] : null; 49 | } 50 | 51 | @Override 52 | @SideOnly(Side.CLIENT) 53 | public void registerIcons(IIconRegister par1IconRegister) { 54 | icons = new IIcon[numIngots]; 55 | String fullName = super.getUnlocalizedName().replaceFirst("item\\.", ""); 56 | String namespace = fullName.split(":")[0]; 57 | fullName = fullName.split(":")[1]; 58 | 59 | for (int i = 0; i < numIngots; i++) { 60 | icons[i] = par1IconRegister.registerIcon(namespace + ":" + fullName + i); 61 | } 62 | } 63 | 64 | public void registerItemStacks() { 65 | for(int i = 0; i < numIngots; i++) { 66 | ItemStack stack = new ItemStack(this, 1, i); 67 | GameRegistry.registerCustomItemStack(getUnlocalizedName(stack), stack); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/items/ItemMaterialBlock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.items; 2 | 3 | import cpw.mods.fml.relauncher.Side; 4 | import cpw.mods.fml.relauncher.SideOnly; 5 | import zmaster587.libVulpes.api.material.Material; 6 | import zmaster587.libVulpes.tile.TileMaterial; 7 | import net.minecraft.block.Block; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | import net.minecraft.item.ItemBlockWithMetadata; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.tileentity.TileEntity; 12 | import net.minecraft.util.StatCollector; 13 | import net.minecraft.world.World; 14 | 15 | public class ItemMaterialBlock extends ItemBlockWithMetadata { 16 | 17 | public ItemMaterialBlock(Block block) { 18 | super(block,block); 19 | } 20 | 21 | /*@Override 22 | public boolean placeBlockAt(ItemStack stack, EntityPlayer player, 23 | World world, int x, int y, int z, int side, float hitX, float hitY, 24 | float hitZ, int metadata) { 25 | boolean succeeded = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, 0); 26 | 27 | if(succeeded) { 28 | TileEntity tile = world.getTileEntity(x, y, z); 29 | if(tile instanceof TileMaterial) { 30 | ((TileMaterial)tile).setMaterial(Material.Materials.values()[stack.getItemDamage()]); 31 | } 32 | } 33 | 34 | return succeeded; 35 | } 36 | 37 | @Override 38 | public String getUnlocalizedName(ItemStack stack) { 39 | return this.getUnlocalizedName() + "." + getMaterial(stack).getUnlocalizedName(); 40 | } 41 | 42 | @Override 43 | public String getItemStackDisplayName(ItemStack itemstack) { 44 | return StatCollector.translateToLocal("material." + getMaterial(itemstack).getUnlocalizedName() + ".name") + " " + StatCollector.translateToLocal(this.getUnlocalizedName()); 45 | } 46 | 47 | public Material.Materials getMaterial(ItemStack stack) { 48 | if(stack.getItemDamage() < 0 || stack.getItemDamage() >= Material.Materials.values().length) 49 | return Material.Materials.values()[0]; 50 | 51 | return Material.Materials.values()[stack.getItemDamage()]; 52 | } 53 | 54 | @Override 55 | @SideOnly(Side.CLIENT) 56 | public int getColorFromItemStack(ItemStack stack, int p_82790_2_) { 57 | return getMaterial(stack).getColor(); 58 | }*/ 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleDualProgressBar.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | import zmaster587.libVulpes.client.util.ProgressBarImage; 7 | import cpw.mods.fml.relauncher.Side; 8 | import cpw.mods.fml.relauncher.SideOnly; 9 | import net.minecraft.client.gui.FontRenderer; 10 | import net.minecraft.client.gui.inventory.GuiContainer; 11 | import net.minecraft.util.MathHelper; 12 | 13 | public class ModuleDualProgressBar extends ModuleProgress { 14 | 15 | private float multiplier; 16 | 17 | public ModuleDualProgressBar(int offsetX, int offsetY, int id, 18 | ProgressBarImage progressBar, IProgressBar progress) { 19 | super(offsetX, offsetY, id, progressBar, progress); 20 | multiplier =1f; 21 | } 22 | 23 | public ModuleDualProgressBar(int offsetX, int offsetY, int id, 24 | ProgressBarImage progressBar, IProgressBar progress, String tooltip) { 25 | super(offsetX, offsetY, id, progressBar, progress, tooltip); 26 | multiplier =1f; 27 | } 28 | 29 | 30 | public void setTooltipValueMultiplier(float multiplier) { 31 | this.multiplier = multiplier; 32 | } 33 | 34 | @Override 35 | @SideOnly(Side.CLIENT) 36 | protected List getToolTip() { 37 | List modifiedList = new LinkedList(); 38 | 39 | for(String string : tooltip) { 40 | int centerPoint = progress.getTotalProgress(id); 41 | int variation = progress.getProgress(id); 42 | 43 | String newStr = string.replaceAll("%b", String.format("%.2f",multiplier*MathHelper.clamp_float(centerPoint - variation/2,0,100))); 44 | newStr = newStr.replaceAll("%a", String.format("%.2f",multiplier*MathHelper.clamp_float(centerPoint + variation/2,0,100))); 45 | modifiedList.add(newStr); 46 | } 47 | return modifiedList; 48 | } 49 | 50 | @Override 51 | @SideOnly(Side.CLIENT) 52 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, 53 | int mouseY, FontRenderer font) { 54 | 55 | float totalProgress = progress.getTotalProgress(id)/100f; 56 | float randomnessFactor = progress.getProgress(id)/100f; 57 | 58 | progressBar.renderProgressBarPartial(x + offsetX, y + offsetY, totalProgress , 0.5f*randomnessFactor, gui); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/items/ItemOreProduct.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.items; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map.Entry; 6 | 7 | import zmaster587.libVulpes.api.material.Material; 8 | import zmaster587.libVulpes.api.material.MaterialRegistry; 9 | import net.minecraft.creativetab.CreativeTabs; 10 | import net.minecraft.item.Item; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraft.util.StatCollector; 13 | import net.minecraftforge.oredict.OreDictionary; 14 | import cpw.mods.fml.relauncher.Side; 15 | import cpw.mods.fml.relauncher.SideOnly; 16 | 17 | public class ItemOreProduct extends Item { 18 | 19 | HashMap properties; 20 | String outputType; 21 | 22 | public ItemOreProduct(String outputType) { 23 | super(); 24 | 25 | setUnlocalizedName(outputType); 26 | setHasSubtypes(true); 27 | setMaxDamage(0); 28 | this.outputType = outputType; 29 | setTextureName("libvulpes:" + outputType); 30 | properties = new HashMap(); 31 | } 32 | 33 | public void registerItem(int meta, Material ore) { 34 | properties.put(meta, ore); 35 | for(String oreDictName : ore.getOreDictNames()) 36 | OreDictionary.registerOre(outputType + oreDictName, new ItemStack(this, 1, meta)); 37 | } 38 | 39 | @SuppressWarnings({"rawtypes", "unchecked"}) 40 | @Override 41 | @SideOnly(Side.CLIENT) 42 | public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) { 43 | 44 | for(Entry entry : properties.entrySet()) { 45 | itemList.add(new ItemStack(this, 1, entry.getKey())); 46 | } 47 | } 48 | 49 | @Override 50 | @SideOnly(Side.CLIENT) 51 | public int getColorFromItemStack(ItemStack stack, int int1) { 52 | int itemDamage = stack.getItemDamage(); 53 | //Sanity check if anyone somehow gets an invalid damage 54 | if(!properties.containsKey(itemDamage)) 55 | return 0xFFFFFFFF; 56 | return properties.get(itemDamage).getColor(); 57 | } 58 | 59 | 60 | @Override 61 | public String getItemStackDisplayName(ItemStack itemstack) { 62 | return StatCollector.translateToLocal("material." + properties.get(itemstack.getItemDamage()).getUnlocalizedName() + ".name") + " " + StatCollector.translateToLocal("type." + outputType + ".name"); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/IArmorComponent.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api; 2 | 3 | import java.util.List; 4 | 5 | import zmaster587.libVulpes.client.ResourceIcon; 6 | import cpw.mods.fml.relauncher.Side; 7 | import cpw.mods.fml.relauncher.SideOnly; 8 | import net.minecraft.client.gui.Gui; 9 | import net.minecraft.entity.EntityLivingBase; 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.inventory.IInventory; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraft.nbt.NBTTagCompound; 14 | import net.minecraft.util.DamageSource; 15 | import net.minecraft.util.IIcon; 16 | import net.minecraft.util.ResourceLocation; 17 | import net.minecraft.world.World; 18 | import net.minecraftforge.client.event.RenderGameOverlayEvent; 19 | 20 | public interface IArmorComponent { 21 | 22 | /** 23 | * Called on Armor tick for each IArmorComponent in IModularArmor 24 | * @param world the world 25 | * @param player the player wearing the armor 26 | * @param armorStack the ItemStack representing the piece of armor being worn 27 | * @param modules Inventory of the armorStack containing all modules inlcuding the current one 28 | * @param componentStack the ItemStack representing the current component being ticked 29 | */ 30 | public void onTick(World world, EntityPlayer player, ItemStack armorStack, IInventory modules, ItemStack componentStack); 31 | 32 | /** 33 | * Called right before adding a component to the armor 34 | * @param world 35 | * @param player 36 | * @param itemStack the armor itemStack to add the component to 37 | * @return true if it should be added false otherwise 38 | */ 39 | public boolean onComponentAdded(World world, ItemStack armorStack); 40 | 41 | public void onComponentRemoved(World world, ItemStack armorStack); 42 | 43 | public void onArmorDamaged(EntityLivingBase entity, ItemStack armorStack, ItemStack componentStack, DamageSource source, int damage); 44 | 45 | public boolean isAllowedInSlot(ItemStack componentStack, int targetSlot); 46 | 47 | @SideOnly(Side.CLIENT) 48 | public void renderScreen(ItemStack componentStack, List modules, 49 | RenderGameOverlayEvent event, Gui gui); 50 | 51 | /** 52 | * @param armorStack 53 | * @return The Icon for the HUD, null if none 54 | */ 55 | @SideOnly(Side.CLIENT) 56 | public ResourceIcon getComponentIcon(ItemStack armorStack); 57 | 58 | 59 | } -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/network/BasePacket.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.network; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.entity.player.EntityPlayerMP; 6 | import com.google.common.collect.BiMap; 7 | import com.google.common.collect.ImmutableBiMap; 8 | import cpw.mods.fml.relauncher.Side; 9 | import cpw.mods.fml.relauncher.SideOnly; 10 | 11 | public abstract class BasePacket { 12 | public static final String CHANNEL = "advancedRocketry"; 13 | private static final BiMap> idMap; 14 | 15 | static { 16 | ImmutableBiMap.Builder> builder = ImmutableBiMap.builder(); 17 | //builder.put(Integer.valueOf(0), PacketMachine.class); 18 | idMap = builder.build(); 19 | } 20 | 21 | public static BasePacket constructPacket(int packetId) throws ProtocolException, InstantiationException, IllegalAccessException { 22 | Class clazz = idMap.get(Integer.valueOf(packetId)); 23 | if(clazz == null){ 24 | throw new ProtocolException("Protocol Exception! Unknown Packet Id!"); 25 | } else { 26 | return clazz.newInstance(); 27 | } 28 | } 29 | 30 | 31 | 32 | 33 | public static class ProtocolException extends Exception { 34 | 35 | public ProtocolException() { 36 | } 37 | 38 | public ProtocolException(String message, Throwable cause) { 39 | super(message, cause); 40 | } 41 | 42 | public ProtocolException(String message) { 43 | super(message); 44 | } 45 | 46 | public ProtocolException(Throwable cause) { 47 | super(cause); 48 | } 49 | } 50 | 51 | public final int getPacketId() { 52 | if(idMap.inverse().containsKey(getClass())) { 53 | return idMap.inverse().get(getClass()).intValue(); 54 | } else { 55 | throw new RuntimeException("Packet " + getClass().getSimpleName() + " is a missing mapping!"); 56 | } 57 | } 58 | 59 | public abstract void write(ByteBuf out); 60 | 61 | public abstract void readClient(ByteBuf in); 62 | 63 | public abstract void read(ByteBuf in); 64 | 65 | @SideOnly(Side.CLIENT) 66 | public abstract void executeClient(EntityPlayer thePlayer); 67 | 68 | public abstract void executeServer(EntityPlayerMP player); 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/energy/TileCoalGenerator.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.energy; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.tileentity.TileEntityFurnace; 8 | import zmaster587.libVulpes.inventory.TextureResources; 9 | import zmaster587.libVulpes.inventory.modules.ModuleBase; 10 | import zmaster587.libVulpes.inventory.modules.ModuleProgress; 11 | import zmaster587.libVulpes.inventory.modules.ModuleSlotArray; 12 | import zmaster587.libVulpes.inventory.modules.ModuleText; 13 | import zmaster587.libVulpes.tile.TileInventoriedForgePowerMachine; 14 | 15 | public class TileCoalGenerator extends TileInventoriedForgePowerMachine { 16 | 17 | int powerPerTick; 18 | ModuleText textModule; 19 | private static final int INPUT_SLOT = 0; 20 | 21 | public TileCoalGenerator() { 22 | super(10000, 1); 23 | powerPerTick = 40; 24 | textModule = new ModuleText(40, 20, "Generating 0 RF/t", 0x2b2b2b); 25 | } 26 | 27 | @Override 28 | public List getModules(int ID, EntityPlayer player) { 29 | List modules = super.getModules(ID, player); 30 | 31 | modules.add(new ModuleSlotArray(40, 40, this, 0, 1)); 32 | modules.add(new ModuleProgress(80, 40, 1, TextureResources.progressGenerator, this)); 33 | modules.add(textModule); 34 | 35 | 36 | return modules; 37 | } 38 | 39 | @Override 40 | public void setInventorySlotContents(int slot, ItemStack stack) { 41 | super.setInventorySlotContents(slot, stack); 42 | 43 | if(!canGeneratePower()) 44 | setTimeAndAmounts(); 45 | } 46 | 47 | @Override 48 | public int getPowerPerOperation() { 49 | return powerPerTick; 50 | } 51 | 52 | @Override 53 | protected void onOperationFinish() { 54 | super.onOperationFinish(); 55 | setTimeAndAmounts(); 56 | } 57 | 58 | private void setTimeAndAmounts() { 59 | timeRemaining = TileEntityFurnace.getItemBurnTime(inventory.getStackInSlot(INPUT_SLOT)); 60 | if(timeRemaining > 0) 61 | inventory.decrStackSize(INPUT_SLOT, 1); 62 | } 63 | 64 | @Override 65 | public void updateEntity() { 66 | super.updateEntity(); 67 | if(worldObj.isRemote) 68 | textModule.setText("Generating " + getLastAmtGenerated() + " RF/t"); 69 | } 70 | 71 | @Override 72 | public String getModularInventoryName() { 73 | return "tile.coalGenerator.name"; 74 | } 75 | } -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/multiblock/TilePlaceholder.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile.multiblock; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | import net.minecraft.network.NetworkManager; 6 | import net.minecraft.network.Packet; 7 | import net.minecraft.network.play.server.S35PacketUpdateTileEntity; 8 | import net.minecraft.tileentity.TileEntity; 9 | import zmaster587.libVulpes.tile.TilePointer; 10 | 11 | //Used to store info about the block previously at the location 12 | public class TilePlaceholder extends TilePointer { 13 | 14 | Block replacedBlock; 15 | byte blockMeta; 16 | TileEntity replacedTile; 17 | 18 | public Block getReplacedBlock() { 19 | return replacedBlock; 20 | } 21 | 22 | public void setReplacedBlock(Block block) { 23 | replacedBlock = block; 24 | } 25 | 26 | public byte getReplacedBlockMeta() { 27 | return blockMeta; 28 | } 29 | 30 | public void setReplacedBlockMeta(byte meta) { 31 | blockMeta = meta; 32 | } 33 | 34 | public TileEntity getReplacedTileEntity() { 35 | return replacedTile; 36 | } 37 | 38 | public void setReplacedTileEntity(TileEntity tile) { 39 | replacedTile = tile; 40 | } 41 | 42 | @Override 43 | public Packet getDescriptionPacket() { 44 | NBTTagCompound nbt = new NBTTagCompound(); 45 | 46 | writeToNBT(nbt); 47 | return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbt); 48 | } 49 | 50 | @Override 51 | public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { 52 | NBTTagCompound nbt = pkt.func_148857_g(); 53 | readFromNBT(nbt); 54 | } 55 | 56 | @Override 57 | public void writeToNBT(NBTTagCompound nbt) { 58 | super.writeToNBT(nbt); 59 | 60 | nbt.setInteger("ID", Block.getIdFromBlock(replacedBlock)); 61 | nbt.setByte("damage", blockMeta); 62 | NBTTagCompound tag = new NBTTagCompound(); 63 | 64 | if(replacedTile != null) { 65 | replacedTile.writeToNBT(tag); 66 | nbt.setTag("tile", tag); 67 | } 68 | } 69 | 70 | @Override 71 | public void readFromNBT(NBTTagCompound nbt) { 72 | super.readFromNBT(nbt); 73 | 74 | //TODO: perform sanity check 75 | replacedBlock = Block.getBlockById(nbt.getInteger("ID")); 76 | 77 | blockMeta = nbt.getByte("damage"); 78 | 79 | if(nbt.hasKey("tile")) { 80 | NBTTagCompound tile = nbt.getCompoundTag("tile"); 81 | replacedTile = TileEntity.createAndLoadEntity(tile); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/gui/GuiToggleButtonImage.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.gui; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.gui.GuiButton; 5 | import net.minecraft.client.renderer.Tessellator; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | import org.lwjgl.opengl.GL11; 9 | 10 | public class GuiToggleButtonImage extends GuiButton { 11 | 12 | boolean state = false; 13 | protected ResourceLocation[] buttonTexture; 14 | /** 15 | * 16 | * @param id id of the button 17 | * @param x x position of the button 18 | * @param y y position of the button 19 | * @param width width of the button in pixels 20 | * @param height height of the button in pixels 21 | * @param location index 0: enabled, index 1: disabled 22 | */ 23 | public GuiToggleButtonImage(int id, int x, int y, int width, int height, ResourceLocation[] location) { 24 | super(id, x, y, width, height,""); 25 | buttonTexture = location; 26 | //TODO: add exception 27 | } 28 | 29 | 30 | public void setState(boolean state) { 31 | this.state = state; 32 | } 33 | 34 | @Override 35 | public void drawButton(Minecraft minecraft, int par2, int par3) 36 | { 37 | if (this.visible) 38 | { 39 | // 40 | this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; 41 | 42 | /*if(mousePressed(minecraft, par2, par3) && buttonTexture[2] != null) 43 | minecraft.getTextureManager().bindTexture(buttonTexture[2]);*/ 44 | if(state) 45 | minecraft.getTextureManager().bindTexture(buttonTexture[0]); 46 | else 47 | minecraft.getTextureManager().bindTexture(buttonTexture[1]); 48 | 49 | GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 50 | 51 | 52 | //Draw the button...each button should contain 3 images default state, hover, and pressed 53 | 54 | Tessellator tessellator = Tessellator.instance; 55 | tessellator.startDrawingQuads(); 56 | tessellator.addVertexWithUV(xPosition, yPosition + height, (double)this.zLevel, 0, 1); 57 | tessellator.addVertexWithUV(xPosition + width, yPosition + height, (double)this.zLevel, 1, 1); 58 | tessellator.addVertexWithUV(xPosition + width, yPosition, (double)this.zLevel, 1, 0); 59 | tessellator.addVertexWithUV(xPosition, yPosition, (double)this.zLevel, 0, 0); 60 | tessellator.draw(); 61 | 62 | this.mouseDragged(minecraft, par2, par3); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/multiblock/BlockMultiblockStructure.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block.multiblock; 2 | 3 | import zmaster587.libVulpes.tile.IMultiblock; 4 | import zmaster587.libVulpes.tile.multiblock.TileMultiBlock; 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.tileentity.TileEntity; 8 | import net.minecraft.world.IBlockAccess; 9 | import net.minecraft.world.World; 10 | import net.minecraftforge.common.util.ForgeDirection; 11 | 12 | /** 13 | * Block which is integrated into the multiblock structure. When a structure is formed the block 14 | * continues to render and when broken will alert the master block 15 | * most significant damage bit indicates if the block is fully formed 16 | */ 17 | public class BlockMultiblockStructure extends Block { 18 | 19 | protected BlockMultiblockStructure(Material material) { 20 | super(material); 21 | } 22 | 23 | /** 24 | * Turns the block invisible or in the case of BlockMultiBlockComponentVisible makes it create a tileEntity 25 | * @param world 26 | * @param x 27 | * @param y 28 | * @param z 29 | * @param meta 30 | */ 31 | public void hideBlock(World world, int x, int y, int z, int meta) { 32 | world.setBlockMetadataWithNotify(x, y, z, meta | 8, 3); 33 | } 34 | 35 | public void completeStructure(World world, int x, int y, int z, int meta) { 36 | 37 | } 38 | 39 | public void destroyStructure(World world, int x, int y, int z, int meta) { 40 | world.setBlockMetadataWithNotify(x, y, z, meta & 7, 3); 41 | } 42 | 43 | @Override 44 | public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side) { 45 | ForgeDirection direction = ForgeDirection.getOrientation(side); 46 | return super.shouldSideBeRendered(access, x, y, z, side) && access.getBlockMetadata(x - direction.offsetX, y- direction.offsetY, z - direction.offsetZ) < 8; 47 | } 48 | 49 | @Override 50 | public boolean isOpaqueCube() { 51 | return false; 52 | } 53 | 54 | @Override 55 | public void onBlockPreDestroy(World world, int x, 56 | int y, int z, int meta) { 57 | TileEntity tile = world.getTileEntity(x, y, z); 58 | if(tile instanceof IMultiblock) { 59 | IMultiblock tileMulti = (IMultiblock)tile; 60 | 61 | if(tileMulti.hasMaster()) { 62 | if(tileMulti.getMasterBlock() instanceof TileMultiBlock) 63 | ((TileMultiBlock)tileMulti.getMasterBlock()).deconstructMultiBlock(world,x,y,z,true); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockFullyRotatable.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import cpw.mods.fml.relauncher.Side; 4 | import cpw.mods.fml.relauncher.SideOnly; 5 | import net.minecraft.block.material.Material; 6 | import net.minecraft.entity.EntityLivingBase; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.IIcon; 9 | import net.minecraft.world.World; 10 | import net.minecraftforge.common.util.ForgeDirection; 11 | public class BlockFullyRotatable extends RotatableBlock { 12 | 13 | public BlockFullyRotatable(Material par2Material) { 14 | super(par2Material); 15 | } 16 | 17 | @Override 18 | public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { 19 | if(Math.abs(entity.rotationPitch) > 60) { 20 | world.setBlockMetadataWithNotify(x, y, z, entity.rotationPitch > 0 ? ForgeDirection.UP.ordinal() : ForgeDirection.DOWN.ordinal(), 2); 21 | } 22 | else 23 | super.onBlockPlacedBy(world, x, y, z, entity, stack); 24 | } 25 | 26 | public static ForgeDirection getRelativeSide(int side, int meta) { 27 | return getRelativeSide(ForgeDirection.getOrientation(side), meta & 7); 28 | } 29 | 30 | //North is defined as the front 31 | public static ForgeDirection getRelativeSide(ForgeDirection side, int meta) { 32 | 33 | ForgeDirection dir = ForgeDirection.getOrientation(meta & 7); 34 | 35 | if(dir == ForgeDirection.NORTH) 36 | return side; 37 | else if(dir == ForgeDirection.SOUTH) 38 | return side.getOpposite(); 39 | else if(dir == ForgeDirection.EAST) 40 | return side.getRotation(ForgeDirection.DOWN); 41 | else if(dir == ForgeDirection.WEST) 42 | return side.getRotation(ForgeDirection.UP); 43 | else if(dir == ForgeDirection.UP) 44 | return side.getRotation(ForgeDirection.EAST); 45 | else if (dir == ForgeDirection.DOWN) 46 | return side.getRotation(ForgeDirection.WEST); 47 | 48 | 49 | return side.getOpposite(); 50 | } 51 | 52 | @SideOnly(Side.CLIENT) 53 | @Override 54 | public IIcon getIcon(int dir, int meta) { 55 | 56 | ForgeDirection side = getRelativeSide(dir,meta); 57 | 58 | if(side == ForgeDirection.UP) 59 | return this.top; 60 | else if(side == ForgeDirection.DOWN) 61 | return this.bottom; 62 | else if(side == ForgeDirection.NORTH) 63 | return this.front; 64 | else if(side == ForgeDirection.EAST) 65 | return this.sides; 66 | else if(side == ForgeDirection.SOUTH) 67 | return this.rear; 68 | else if(side == ForgeDirection.WEST) 69 | return this.sides; 70 | 71 | return blockIcon; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/multiblock/BlockMultiblockMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block.multiblock; 2 | 3 | import zmaster587.libVulpes.LibVulpes; 4 | import zmaster587.libVulpes.block.BlockTile; 5 | import zmaster587.libVulpes.inventory.modules.IModularInventory; 6 | import zmaster587.libVulpes.tile.multiblock.TileMultiBlock; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.tileentity.TileEntity; 9 | import net.minecraft.world.IBlockAccess; 10 | import net.minecraft.world.World; 11 | import net.minecraftforge.common.util.ForgeDirection; 12 | 13 | /** 14 | * hosts a multiblock machine master tile 15 | * 16 | */ 17 | public class BlockMultiblockMachine extends BlockTile { 18 | 19 | public BlockMultiblockMachine(Class tileClass, 20 | int guiId) { 21 | super(tileClass, guiId); 22 | } 23 | 24 | @Override 25 | public void onBlockPreDestroy(World world, int x, 26 | int y, int z, int meta) { 27 | super.onBlockPreDestroy(world, x, y, z, meta); 28 | 29 | TileEntity tile = world.getTileEntity(x, y, z); 30 | if(tile instanceof TileMultiBlock) { 31 | TileMultiBlock tileMulti = (TileMultiBlock)tile; 32 | if(tileMulti.isComplete()) 33 | tileMulti.deconstructMultiBlock(world, x, y, z, false); 34 | } 35 | } 36 | 37 | @Override 38 | public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side) { 39 | 40 | ForgeDirection direction = ForgeDirection.getOrientation(side); 41 | 42 | TileEntity tile = access.getTileEntity(x - direction.offsetX, y- direction.offsetY, z - direction.offsetZ); 43 | if(tile instanceof TileMultiBlock) { 44 | return !((TileMultiBlock)tile).shouldHideBlock(tile.getWorldObj(), x - direction.offsetX, y- direction.offsetY, z - direction.offsetZ, access.getBlock(x - direction.offsetX, y- direction.offsetY, z - direction.offsetZ)) || !((TileMultiBlock)tile).canRender(); 45 | } 46 | return super.shouldSideBeRendered(access, x, y, z, side); 47 | } 48 | 49 | @Override 50 | public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) 51 | { 52 | TileEntity tile = world.getTileEntity(x, y, z); 53 | if(tile instanceof TileMultiBlock) { 54 | TileMultiBlock tileMulti = (TileMultiBlock)tile; 55 | if(tileMulti.isComplete() && !world.isRemote) { 56 | if(tile instanceof IModularInventory) 57 | player.openGui(LibVulpes.instance, guiId, world, x, y, z); 58 | } 59 | else 60 | return tileMulti.attemptCompleteStructure(); 61 | } 62 | return true; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/MultiBattery.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import java.util.LinkedList; 4 | 5 | import net.minecraftforge.common.util.ForgeDirection; 6 | import zmaster587.libVulpes.api.IUniversalEnergy; 7 | 8 | public class MultiBattery implements IUniversalEnergy { 9 | 10 | //Note: as of writing there should never be a need to save this 11 | 12 | protected LinkedList batteries = new LinkedList(); 13 | 14 | public void addBattery(IUniversalEnergy battery) { 15 | batteries.add(battery); 16 | } 17 | 18 | public boolean removeBattery(IUniversalEnergy battery) { 19 | return batteries.remove(battery); 20 | } 21 | 22 | public void clear() { 23 | batteries.clear(); 24 | } 25 | 26 | @Override 27 | public int extractEnergy(int amt, boolean simulate) { 28 | int amtExtracted = 0; 29 | 30 | for(IUniversalEnergy battery : batteries) 31 | amtExtracted += battery.extractEnergy(amt, simulate); 32 | 33 | return amtExtracted; 34 | } 35 | 36 | @Override 37 | public int getEnergyStored() { 38 | int energyStored = 0; 39 | for(IUniversalEnergy battery : batteries) 40 | energyStored += battery.getEnergyStored(); 41 | 42 | return energyStored; 43 | } 44 | 45 | @Override 46 | public int getMaxEnergyStored() { 47 | int energyStored = 0; 48 | for(IUniversalEnergy battery : batteries) 49 | energyStored += battery.getMaxEnergyStored(); 50 | 51 | return energyStored; 52 | } 53 | 54 | @Override 55 | public void setMaxEnergyStored(int max) { 56 | max /= batteries.size(); 57 | 58 | for(IUniversalEnergy battery : batteries) { 59 | battery.setMaxEnergyStored(max); 60 | } 61 | } 62 | 63 | @Override 64 | public int acceptEnergy(int amt, boolean simulate) { 65 | int energyRecieved = 0; 66 | for(IUniversalEnergy battery : batteries) 67 | energyRecieved += battery.acceptEnergy(amt - energyRecieved, simulate); 68 | return energyRecieved; 69 | } 70 | 71 | @Override 72 | public void setEnergyStored(int amt) { 73 | int difference = amt - getEnergyStored(); 74 | int amtAdded = 0; 75 | 76 | //Possible inf loop 77 | //TODO: fix distribution 78 | if(difference > 0) 79 | while(amtAdded < difference) { 80 | int recieved = acceptEnergy(difference, false); 81 | if(recieved == 0) 82 | break; 83 | amtAdded += recieved; 84 | } 85 | else if(difference < 0) 86 | while(amtAdded < -difference) { 87 | int recieved = extractEnergy(-difference, false); 88 | if(recieved == 0) 89 | break; 90 | amtAdded += recieved; 91 | } 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/RotatableBlock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import zmaster587.libVulpes.util.ZUtils; 4 | import cpw.mods.fml.relauncher.Side; 5 | import cpw.mods.fml.relauncher.SideOnly; 6 | import net.minecraft.block.Block; 7 | import net.minecraft.block.material.Material; 8 | import net.minecraft.entity.EntityLivingBase; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.util.IIcon; 11 | import net.minecraft.util.MathHelper; 12 | import net.minecraft.world.World; 13 | import net.minecraftforge.common.util.ForgeDirection; 14 | 15 | public class RotatableBlock extends Block { 16 | 17 | protected IIcon front, rear, sides, top, bottom; 18 | 19 | public RotatableBlock(Material par2Material) { 20 | super(par2Material); 21 | } 22 | 23 | 24 | @Override 25 | public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { 26 | 27 | world.setBlockMetadataWithNotify(x, y, z, ZUtils.getDirectionFacing(entity.rotationYaw), 2); 28 | } 29 | 30 | public static ForgeDirection getFront(int meta) { 31 | return ForgeDirection.getOrientation(meta & 7); 32 | } 33 | 34 | public static ForgeDirection getRelativeSide(int side, int meta) { 35 | return getRelativeSide(ForgeDirection.getOrientation(side), meta & 7); 36 | } 37 | 38 | //North is defined as the front 39 | public static ForgeDirection getRelativeSide(ForgeDirection side, int meta) { 40 | 41 | if(side == ForgeDirection.UP || side == ForgeDirection.DOWN) 42 | return side; 43 | 44 | ForgeDirection dir = ForgeDirection.getOrientation(meta & 7); 45 | 46 | if(dir == ForgeDirection.NORTH) 47 | return side; 48 | else if(dir == ForgeDirection.SOUTH) 49 | return side.getOpposite(); 50 | else if(dir == ForgeDirection.EAST) 51 | return side.getRotation(ForgeDirection.DOWN); 52 | else if(dir == ForgeDirection.WEST) 53 | return side.getRotation(ForgeDirection.UP); 54 | 55 | 56 | return side.getOpposite(); 57 | } 58 | 59 | @SideOnly(Side.CLIENT) 60 | @Override 61 | public IIcon getIcon(int dir, int meta) { 62 | 63 | ForgeDirection side = getRelativeSide(dir,meta); 64 | 65 | if(side == ForgeDirection.UP) 66 | return this.top; 67 | else if(side == ForgeDirection.DOWN) 68 | return this.bottom; 69 | else if(side == ForgeDirection.NORTH) 70 | return this.front; 71 | else if(side == ForgeDirection.EAST) 72 | return this.sides; 73 | else if(side == ForgeDirection.SOUTH) 74 | return this.rear; 75 | else if(side == ForgeDirection.WEST) 76 | return this.sides; 77 | 78 | return blockIcon; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/client/util/IndicatorBarImage.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.client.util; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.gui.Gui; 5 | import net.minecraft.util.ResourceLocation; 6 | import net.minecraftforge.common.util.ForgeDirection; 7 | /** 8 | * Used to display an arrow or some other image moving along a bar 9 | * 10 | */ 11 | public class IndicatorBarImage extends ProgressBarImage { 12 | 13 | public IndicatorBarImage(int backOffsetX, int backOffsetY, int backWidth, int backHeight, int foreOffsetX, int foreOffsetY, int foreWidth, int foreHeight, int insetX, int insetY, ForgeDirection direction, ResourceLocation image) { 14 | super(backOffsetX, backOffsetY, backWidth, backHeight, foreOffsetX, foreOffsetY, foreWidth, foreHeight, insetX, insetY, direction,image); 15 | } 16 | 17 | public IndicatorBarImage(int backOffsetX, int backOffsetY, int backWidth, int backHeight, int foreOffsetX, int foreOffsetY, int foreWidth, int foreHeight,ForgeDirection direction, ResourceLocation image) { 18 | super(backOffsetX, backOffsetY, backWidth, backHeight, foreOffsetX, foreOffsetY, foreWidth, foreHeight, 0, 0, direction, image); 19 | } 20 | 21 | public IndicatorBarImage(int backOffsetX, int backOffsetY, int backWidth, int backHeight, int foreOffsetX, int foreOffsetY, ForgeDirection direction, ResourceLocation image) { 22 | super(backOffsetX, backOffsetY, backWidth, backHeight, foreOffsetX, foreOffsetY, backWidth, backHeight, 0, 0, direction, image); 23 | } 24 | 25 | @Override 26 | public void renderProgressBar(int x, int y, float percent, Gui gui) { 27 | 28 | Minecraft.getMinecraft().getTextureManager().bindTexture(image); 29 | 30 | gui.drawTexturedModalRect(x, y, backOffsetX, backOffsetY, backWidth, backHeight); 31 | 32 | int xProgress = 0, yProgress = 0; 33 | 34 | if(direction == ForgeDirection.WEST) 35 | xProgress = (int) (backWidth - insetX - ( ( backWidth - ( insetX*2 ) )*percent)) - foreHeight/2; 36 | else if(direction == ForgeDirection.EAST) 37 | xProgress = (int) (insetX - foreWidth + ( ( backWidth - ( insetX*2 ) )*percent)); 38 | else 39 | xProgress = insetX; 40 | 41 | if(direction == ForgeDirection.UP) 42 | yProgress = (int) (backHeight - insetY - ( ( backHeight - ( insetY*2 ) )*percent)) - foreHeight/2; 43 | else if(direction == ForgeDirection.DOWN) 44 | yProgress = (int) (insetY + ( ( backHeight - ( insetY*2 ) )*percent)) + foreHeight/2; 45 | else 46 | yProgress = insetY; 47 | 48 | gui.drawTexturedModalRect(x + xProgress, y + yProgress, foreOffsetX, foreOffsetY, foreWidth, foreHeight); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileInventoriedRFConsumer.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import zmaster587.libVulpes.util.EmbeddedInventory; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.inventory.ISidedInventory; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.nbt.NBTTagCompound; 8 | import net.minecraft.nbt.NBTTagList; 9 | 10 | public abstract class TileInventoriedRFConsumer extends TileEntityRFConsumer implements ISidedInventory { 11 | 12 | protected EmbeddedInventory inventory; 13 | 14 | protected TileInventoriedRFConsumer(int energy,int invSize) { 15 | super(energy); 16 | inventory = new EmbeddedInventory(invSize); 17 | } 18 | 19 | @Override 20 | public void writeToNBT(NBTTagCompound nbt) { 21 | super.writeToNBT(nbt); 22 | 23 | inventory.writeToNBT(nbt); 24 | } 25 | 26 | @Override 27 | public void readFromNBT(NBTTagCompound nbt) { 28 | super.readFromNBT(nbt); 29 | 30 | inventory.readFromNBT(nbt); 31 | } 32 | 33 | 34 | public int getSizeInventory() { 35 | return inventory.getSizeInventory(); 36 | } 37 | 38 | @Override 39 | public ItemStack getStackInSlot(int slot) { 40 | return inventory.getStackInSlot(slot); 41 | } 42 | 43 | @Override 44 | public ItemStack decrStackSize(int slot, int amt) { 45 | return inventory.decrStackSize(slot, amt); 46 | } 47 | 48 | @Override 49 | public ItemStack getStackInSlotOnClosing(int slot) { 50 | return inventory.getStackInSlot(slot); 51 | } 52 | 53 | @Override 54 | public void setInventorySlotContents(int slot, ItemStack stack) { 55 | inventory.setInventorySlotContents(slot, stack); 56 | } 57 | 58 | @Override 59 | public boolean hasCustomInventoryName() { 60 | return false; 61 | } 62 | 63 | @Override 64 | public String getInventoryName() { 65 | return null; 66 | } 67 | 68 | @Override 69 | public int getInventoryStackLimit() { 70 | return 64; 71 | } 72 | 73 | @Override 74 | public boolean isUseableByPlayer(EntityPlayer player) { 75 | return player.getDistance(xCoord, yCoord, zCoord) < 64; 76 | } 77 | 78 | 79 | @Override 80 | public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, 81 | int p_102007_3_) { 82 | return true; 83 | } 84 | 85 | @Override 86 | public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, 87 | int p_102008_3_) { 88 | return true; 89 | } 90 | 91 | @Override 92 | public void openInventory() { 93 | 94 | } 95 | 96 | @Override 97 | public void closeInventory() { 98 | 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/entity/fx/FxErrorBlock.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.entity.fx; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import zmaster587.libVulpes.render.RenderHelper; 6 | import net.minecraft.client.Minecraft; 7 | import net.minecraft.client.particle.EntityFX; 8 | import net.minecraft.client.renderer.Tessellator; 9 | import net.minecraft.util.ResourceLocation; 10 | import net.minecraft.world.World; 11 | 12 | public class FxErrorBlock extends EntityFX { 13 | 14 | public static final ResourceLocation icon = new ResourceLocation("libvulpes:textures/fx/x.png"); 15 | 16 | public FxErrorBlock(World world, double x, 17 | double y, double z) { 18 | super(world, x, y, z); 19 | this.prevPosX = this.posX = this.lastTickPosX = x + 0.5; 20 | this.prevPosY = this.posY = this.lastTickPosY = y + 0.5; 21 | this.prevPosZ = this.posZ = this.lastTickPosZ = z + 0.5; 22 | 23 | this.particleMaxAge = 100; 24 | } 25 | 26 | @Override 27 | public void renderParticle(Tessellator tess, float x1, 28 | float y1, float z1, float x2, 29 | float y2, float z2) { 30 | 31 | 32 | Minecraft.getMinecraft().getTextureManager().bindTexture(icon); 33 | //Finish current draw, we need to kill depth test 34 | //tess.draw(); 35 | GL11.glDisable(GL11.GL_DEPTH_TEST); 36 | // Draw the box 37 | float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)x1 - interpPosX); 38 | float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)x1 - interpPosY); 39 | float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)x1 - interpPosZ); 40 | float f10 = 0.25F * this.particleScale; 41 | 42 | tess.startDrawingQuads(); 43 | tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1f); 44 | tess.addVertexWithUV((double)(f11 - y1 * f10 - y2 * f10), (double)(f12 - z1 * f10), (double)(f13 - x2 * f10 - z2 * f10), 1, 1); 45 | tess.addVertexWithUV((double)(f11 - y1 * f10 + y2 * f10), (double)(f12 + z1 * f10), (double)(f13 - x2 * f10 + z2 * f10), 1, 0); 46 | tess.addVertexWithUV((double)(f11 + y1 * f10 + y2 * f10), (double)(f12 + z1 * f10), (double)(f13 + x2 * f10 + z2 * f10), 0, 0); 47 | tess.addVertexWithUV((double)(f11 + y1 * f10 - y2 * f10), (double)(f12 - z1 * f10), (double)(f13 + x2 * f10 - z2 * f10), 0, 1); 48 | tess.draw(); 49 | 50 | GL11.glEnable(GL11.GL_DEPTH_TEST); 51 | 52 | //continue happily 53 | //tess.startDrawingQuads(); 54 | } 55 | 56 | @Override 57 | public int getFXLayer() { 58 | return 3; 59 | } 60 | 61 | @Override 62 | public void onUpdate() { 63 | if (this.particleAge++ >= this.particleMaxAge) 64 | { 65 | this.setDead(); 66 | } 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /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 Windows 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/zmaster587/libVulpes/inventory/modules/ModuleTextBox.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import org.lwjgl.input.Keyboard; 4 | 5 | import cpw.mods.fml.relauncher.Side; 6 | import cpw.mods.fml.relauncher.SideOnly; 7 | import zmaster587.libVulpes.inventory.GuiModular; 8 | import net.minecraft.client.Minecraft; 9 | import net.minecraft.client.gui.FontRenderer; 10 | import net.minecraft.client.gui.GuiTextField; 11 | import net.minecraft.client.gui.inventory.GuiContainer; 12 | 13 | public class ModuleTextBox extends ModuleBase { 14 | 15 | @SideOnly(Side.CLIENT) 16 | GuiTextField textBox; 17 | String currentText; 18 | IGuiCallback tile; 19 | 20 | @SideOnly(Side.CLIENT) 21 | public ModuleTextBox(IGuiCallback tile, int offsetX, int offsetY, int sizeX, int sizeY, int maxStrLen) { 22 | super(offsetX, offsetY); 23 | this.tile = tile; 24 | textBox = new GuiTextField(Minecraft.getMinecraft().fontRenderer ,offsetX, offsetY, sizeX, sizeY); 25 | textBox.setCanLoseFocus(true); 26 | textBox.setFocused(false); 27 | textBox.setEnabled(true); 28 | textBox.setMaxStringLength(maxStrLen); 29 | textBox.setEnableBackgroundDrawing(true); 30 | currentText = ""; 31 | } 32 | 33 | public ModuleTextBox(IGuiCallback tile, int offsetX, int offsetY, String initialString) { 34 | super(offsetX, offsetY); 35 | 36 | this.tile = tile; 37 | currentText = initialString; 38 | } 39 | 40 | 41 | @Override 42 | public boolean keyTyped(char chr, int t) { 43 | 44 | 45 | if(textBox.isFocused()) { 46 | 47 | if(Keyboard.KEY_ESCAPE == t) { 48 | textBox.setFocused(false); 49 | } 50 | else { 51 | textBox.textboxKeyTyped(chr, t); 52 | 53 | //Make callback to calling tile 54 | tile.onModuleUpdated(this); 55 | return false; 56 | } 57 | } 58 | 59 | return true; 60 | } 61 | 62 | 63 | @Override 64 | @SideOnly(Side.CLIENT) 65 | public void onMouseClicked(GuiModular gui, int x, int y, int button) { 66 | 67 | //Make sure we can focus the textboxes 68 | if(offsetX < x && offsetY < y && offsetX + textBox.width > x && offsetY + textBox.height > y ) 69 | textBox.setFocused(true); 70 | else 71 | textBox.setFocused(false); 72 | 73 | } 74 | 75 | @Override 76 | @SideOnly(Side.CLIENT) 77 | public void renderForeground(int guiOffsetX, int guiOffsetY, int mouseX, 78 | int mouseY, float zLevel, GuiContainer gui, FontRenderer font) { 79 | super.renderForeground(guiOffsetX, guiOffsetY, mouseX, mouseY, zLevel, gui, 80 | font); 81 | 82 | textBox.drawTextBox(); 83 | } 84 | 85 | public void setText(String str) { 86 | textBox.setText(str); 87 | } 88 | 89 | public String getText() { 90 | return textBox.getText(); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.world.World; 6 | import zmaster587.libVulpes.inventory.modules.IModularInventory; 7 | import cpw.mods.fml.common.network.IGuiHandler; 8 | 9 | public class GuiHandler implements IGuiHandler { 10 | 11 | public enum guiId { 12 | MODULAR, 13 | MODULARNOINV, 14 | MODULARFULLSCREEN 15 | } 16 | 17 | //X coord is entity ID num if entity 18 | @Override 19 | public Object getServerGuiElement(int ID, EntityPlayer player, World world, 20 | int x, int y, int z) { 21 | 22 | Object tile; 23 | 24 | if(y > -1) 25 | tile = world.getTileEntity(x, y, z); 26 | else if(x == -1) { 27 | ItemStack stack = player.getHeldItem(); 28 | 29 | //If there is latency or some desync odd things can happen so check for that 30 | if(stack == null || !(stack.getItem() instanceof IModularInventory)) { 31 | return null; 32 | } 33 | 34 | tile = player.getHeldItem().getItem(); 35 | } 36 | else 37 | tile = world.getEntityByID(x); 38 | 39 | if(ID == guiId.MODULAR.ordinal() || ID == guiId.MODULARNOINV.ordinal() || ID == guiId.MODULARFULLSCREEN.ordinal()) { 40 | return new ContainerModular(player, ((IModularInventory)tile).getModules(ID, player), ((IModularInventory)tile), ID == guiId.MODULAR.ordinal(), ID != guiId.MODULARFULLSCREEN.ordinal()); 41 | } 42 | return null; 43 | } 44 | 45 | @Override 46 | public Object getClientGuiElement(int ID, EntityPlayer player, World world, 47 | int x, int y, int z) { 48 | 49 | Object tile; 50 | 51 | if(y > -1) 52 | tile = world.getTileEntity(x, y, z); 53 | else if(x == -1) { 54 | ItemStack stack = player.getHeldItem(); 55 | 56 | //If there is latency or some desync odd things can happen so check for that 57 | if(stack == null || !(stack.getItem() instanceof IModularInventory)) { 58 | return null; 59 | } 60 | 61 | tile = player.getHeldItem().getItem(); 62 | } 63 | else 64 | tile = world.getEntityByID(x); 65 | 66 | if(ID == guiId.MODULAR.ordinal() || ID == guiId.MODULARNOINV.ordinal()) { 67 | IModularInventory modularTile = ((IModularInventory)tile); 68 | return new GuiModular(player, modularTile.getModules(ID, player), modularTile, ID == guiId.MODULAR.ordinal(), true, modularTile.getModularInventoryName()); 69 | } 70 | else if(ID == guiId.MODULARFULLSCREEN.ordinal()) { 71 | IModularInventory modularTile = ((IModularInventory)tile); 72 | return new GuiModularFullScreen(player,modularTile.getModules(ID, player), modularTile, ID == guiId.MODULAR.ordinal(), false, modularTile.getModularInventoryName()); 73 | } 74 | return null; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleTab.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import java.util.List; 4 | 5 | import cpw.mods.fml.relauncher.Side; 6 | import cpw.mods.fml.relauncher.SideOnly; 7 | import zmaster587.libVulpes.inventory.GuiModular; 8 | import net.minecraft.client.gui.FontRenderer; 9 | import net.minecraft.client.gui.GuiButton; 10 | import net.minecraft.client.gui.inventory.GuiContainer; 11 | import net.minecraft.util.ResourceLocation; 12 | 13 | public class ModuleTab extends ModuleBase implements IButtonInventory { 14 | 15 | private int tab; 16 | IGuiCallback gameObject; 17 | private ModuleButton buttons[]; 18 | 19 | public ModuleTab(int offsetX, int offsetY,int startingId, IGuiCallback object, int numTabs, String[] tabText, ResourceLocation[][] textures) { 20 | super(offsetX, offsetY); 21 | gameObject = object; 22 | 23 | buttons = new ModuleButton[numTabs]; 24 | 25 | for(int i = 0; i < numTabs; i++) { 26 | buttons[i] = new ModuleButton(offsetX + i*24, offsetY - 20, i, "", this, textures[i], tabText[i], 24,24); 27 | } 28 | 29 | } 30 | 31 | 32 | public void setTab(int tabNum) { tab = tabNum; } 33 | 34 | public int getTab() { return tab; } 35 | 36 | @Override 37 | public void onMouseClicked(GuiModular gui, int x, int y, int button) { 38 | super.onMouseClicked(gui, x, y, button); 39 | 40 | for(ModuleButton button2 : buttons) 41 | button2.onMouseClicked(gui, x, y, button); 42 | } 43 | 44 | @Override 45 | public List addButtons(int x, int y) { 46 | List list = super.addButtons(x, y); 47 | 48 | for(ModuleButton button2 : buttons) list.addAll(button2.addButtons(x, y)); 49 | 50 | return list; 51 | } 52 | 53 | @Override 54 | @SideOnly(Side.CLIENT) 55 | public void actionPerform(GuiButton button) { 56 | super.actionPerform(button); 57 | 58 | for(ModuleButton button2 : buttons) 59 | button2.actionPerform(button); 60 | } 61 | 62 | @Override 63 | public void renderForeground(int guiOffsetX, int guiOffsetY, int mouseX, 64 | int mouseY, float zLevel, GuiContainer gui, FontRenderer font) { 65 | // TODO Auto-generated method stub 66 | super.renderForeground(guiOffsetX, guiOffsetY, mouseX, mouseY, zLevel, gui, 67 | font); 68 | 69 | for(ModuleButton button2 : buttons) 70 | button2.renderForeground(guiOffsetX, guiOffsetY, mouseX, mouseY, zLevel, gui, 71 | font); 72 | 73 | } 74 | 75 | @Override 76 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, 77 | int mouseY, FontRenderer font) { 78 | super.renderBackground(gui, x, y, mouseX, mouseY, font); 79 | 80 | for(ModuleButton button2 : buttons) 81 | button2.renderBackground(gui, x, y, mouseX, mouseY, font); 82 | } 83 | 84 | 85 | @Override 86 | public void onInventoryButtonPressed(int buttonId) { 87 | tab = buttonId; 88 | gameObject.onModuleUpdated(this); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/modules/ModuleScaledImage.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory.modules; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.FontRenderer; 7 | import net.minecraft.client.gui.inventory.GuiContainer; 8 | import net.minecraft.client.renderer.Tessellator; 9 | import net.minecraft.util.ResourceLocation; 10 | import zmaster587.libVulpes.util.IconResource; 11 | import cpw.mods.fml.relauncher.Side; 12 | import cpw.mods.fml.relauncher.SideOnly; 13 | 14 | public class ModuleScaledImage extends ModuleBase { 15 | 16 | ResourceLocation icon; 17 | int sizeX, sizeY; 18 | float minX, maxX, minY, maxY; 19 | float alpha; 20 | 21 | public ModuleScaledImage(int locX, int locY, int sizeX, int sizeY, ResourceLocation icon) { 22 | super(locX, locY); 23 | this.icon = icon; 24 | 25 | if(sizeX < 0) { 26 | minX = 1f; 27 | maxX = 0f; 28 | sizeX = -sizeX; 29 | } 30 | else { 31 | minX = 0f; 32 | maxX = 1f; 33 | } 34 | 35 | if(sizeY < 0) { 36 | minY = 1f; 37 | maxY = 0f; 38 | sizeY = -sizeY; 39 | } 40 | else { 41 | minY = 0f; 42 | maxY = 1f; 43 | } 44 | 45 | this.sizeX = sizeX; 46 | this.sizeY = sizeY; 47 | alpha = 1f; 48 | } 49 | 50 | public ModuleScaledImage(int locX, int locY, int sizeX, int sizeY, float alpha, ResourceLocation icon) { 51 | this(locX, locY, sizeX, sizeY, icon); 52 | this.alpha = alpha; 53 | } 54 | 55 | public void setResourceLocation(ResourceLocation location ) { 56 | this.icon = location; 57 | } 58 | 59 | @Override 60 | @SideOnly(Side.CLIENT) 61 | public void renderBackground(GuiContainer gui, int x, int y, int mouseX, int mouseY, 62 | FontRenderer font) { 63 | super.renderBackground(gui, x, y, mouseX, mouseY, font); 64 | 65 | if(alpha < 1f) { 66 | GL11.glColor4d(alpha, alpha, alpha, alpha); 67 | GL11.glDisable(GL11.GL_ALPHA_TEST); 68 | GL11.glEnable(GL11.GL_BLEND); 69 | GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); 70 | } 71 | 72 | Minecraft.getMinecraft().getTextureManager().bindTexture(icon); 73 | Tessellator tessellator = Tessellator.instance; 74 | tessellator.startDrawingQuads(); 75 | tessellator.addVertexWithUV((double)(x + this.offsetX), (double)(y + this.offsetY + sizeY), (double)0, minX, maxY); 76 | tessellator.addVertexWithUV((double)(x + this.offsetX + sizeX), (double)(y + this.offsetY + sizeY), (double)0, maxX, maxY); 77 | tessellator.addVertexWithUV((double)(x + this.offsetX + sizeX), (double)(y + this.offsetY), (double)0, maxX, minY); 78 | tessellator.addVertexWithUV((double)(x + this.offsetX), (double)(y + this.offsetY), (double)0, minX, minY); 79 | tessellator.draw(); 80 | 81 | if(alpha < 1f) { 82 | GL11.glColor4d(1f, 1f, 1f, 1f); 83 | GL11.glDisable(GL11.GL_BLEND); 84 | GL11.glEnable(GL11.GL_ALPHA_TEST); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/MultiInventory.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.inventory.IInventory; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class MultiInventory implements IInventory { 10 | 11 | List inventories; 12 | 13 | public MultiInventory(List list) { 14 | inventories = list; 15 | } 16 | 17 | @Override 18 | public int getSizeInventory() { 19 | int i = 0; 20 | for(IInventory inv : inventories) { 21 | i += inv.getSizeInventory(); 22 | } 23 | return i; 24 | } 25 | 26 | @Override 27 | public ItemStack getStackInSlot(int i) { 28 | for(IInventory inv : inventories) { 29 | if(i >= inv.getSizeInventory()) { 30 | i -= inv.getSizeInventory(); 31 | continue; 32 | } 33 | return inv.getStackInSlot(i); 34 | } 35 | return null; 36 | } 37 | 38 | @Override 39 | public ItemStack decrStackSize(int i, int j) { 40 | 41 | for(IInventory inv : inventories) { 42 | if(i >= inv.getSizeInventory()) { 43 | i -= inv.getSizeInventory(); 44 | continue; 45 | } 46 | return inv.decrStackSize(i, j); 47 | } 48 | return null; 49 | } 50 | 51 | @Override 52 | public ItemStack getStackInSlotOnClosing(int i) { 53 | for(IInventory inv : inventories) { 54 | if(i >= inv.getSizeInventory()) { 55 | i -= inv.getSizeInventory(); 56 | continue; 57 | } 58 | return inv.getStackInSlotOnClosing(i); 59 | } 60 | return null; 61 | } 62 | 63 | @Override 64 | public void setInventorySlotContents(int i, ItemStack j) { 65 | for(IInventory inv : inventories) { 66 | if(i >= inv.getSizeInventory()) { 67 | i -= inv.getSizeInventory(); 68 | continue; 69 | } 70 | inv.setInventorySlotContents(i,j); 71 | return; 72 | } 73 | } 74 | 75 | @Override 76 | public String getInventoryName() { 77 | return null; 78 | } 79 | 80 | @Override 81 | public boolean hasCustomInventoryName() { 82 | return false; 83 | } 84 | 85 | @Override 86 | public int getInventoryStackLimit() { 87 | return 64; 88 | } 89 | 90 | @Override 91 | public void markDirty() { 92 | 93 | } 94 | 95 | @Override 96 | public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { 97 | return true; 98 | } 99 | 100 | @Override 101 | public void openInventory() { 102 | // TODO Auto-generated method stub 103 | 104 | } 105 | 106 | @Override 107 | public void closeInventory() { 108 | // TODO Auto-generated method stub 109 | 110 | } 111 | 112 | @Override 113 | public boolean isItemValidForSlot(int i, ItemStack j) { 114 | 115 | for(IInventory inv : inventories) { 116 | if(i >= inv.getSizeInventory()) { 117 | i -= inv.getSizeInventory(); 118 | continue; 119 | } 120 | return inv.isItemValidForSlot(i,j); 121 | 122 | } 123 | return false; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/api/material/AllowedProducts.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.api.material; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | 8 | import net.minecraft.block.Block; 9 | 10 | public class AllowedProducts { 11 | 12 | /** 13 | * Registers a product with the handler 14 | * The product is then registered with allowed materials using the name of the product as the prefix 15 | * The name of the product is also the name of the icon to use with the product (ie: "rod" uses "rod.png") 16 | * @param name name of the product 17 | */ 18 | public static void registerProduct(String name) { 19 | AllowedProducts product = new AllowedProducts(); 20 | product.flagValue = currentFlagValue; 21 | product.name = name; 22 | currentFlagValue++; 23 | map.put(name, product); 24 | list.add(product); 25 | } 26 | 27 | public static void registerProduct(String name, boolean isBlock) { 28 | AllowedProducts product = new AllowedProducts(isBlock); 29 | product.flagValue = currentFlagValue; 30 | product.name = name; 31 | currentFlagValue++; 32 | MaterialRegistry.productBlockListMapping.put(product, new ArrayList()); 33 | map.put(name, product); 34 | list.add(product); 35 | } 36 | 37 | public static AllowedProducts getProductByName(String name) { 38 | return map.get(name); 39 | } 40 | 41 | public static List getAllAllowedProducts() { 42 | return list; 43 | } 44 | 45 | private static short currentFlagValue = 1; 46 | private static HashMap map = new HashMap(); 47 | private static List list = new LinkedList(); 48 | /*DUST, 49 | INGOT, 50 | CRYSTAL, 51 | BOULE, 52 | NUGGET, 53 | COIL(true, AdvancedRocketryBlocks.blockCoil), 54 | PLATE, 55 | STICK, 56 | BLOCK(true, LibVulpesBlocks.blockMetal), 57 | ORE(true, LibVulpesBlocks.blockOre), 58 | FAN, 59 | SHEET, 60 | GEAR;*/ 61 | 62 | short flagValue = 0; 63 | String name; 64 | boolean isBlock; 65 | 66 | private AllowedProducts() { 67 | this.isBlock = false; 68 | } 69 | 70 | private AllowedProducts(boolean isBlock) { 71 | this.isBlock = isBlock; 72 | } 73 | 74 | public int getFlagValue() { 75 | return 1 << flagValue; 76 | } 77 | 78 | public int ordinal() { 79 | return flagValue-1; 80 | } 81 | 82 | /** 83 | * @param flag 84 | * @return true if the flag corresponds to this type of item 85 | */ 86 | public boolean isOfType(int flag) { 87 | return (getFlagValue() & flag) != 0; 88 | } 89 | 90 | public String getName() { 91 | return this.name.equalsIgnoreCase("stick") ? "rod" : this.name; 92 | } 93 | 94 | /** 95 | * @return true if the itemtype is a block, IE Ore, coils, etc 96 | */ 97 | public boolean isBlock() { 98 | return isBlock; 99 | } 100 | 101 | public String name() { return name; } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileInventoriedForgePowerMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import zmaster587.libVulpes.block.BlockTile; 4 | import zmaster587.libVulpes.inventory.modules.IProgressBar; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | 8 | public abstract class TileInventoriedForgePowerMachine extends TileInventoriedForgeProducer implements IProgressBar { 9 | 10 | protected int timeRemaining, currentTime, lastRFAmount; 11 | 12 | protected TileInventoriedForgePowerMachine(int energy, int invSize) { 13 | super(energy, invSize); 14 | } 15 | 16 | @Override 17 | public boolean canGeneratePower() { 18 | return timeRemaining > 0; 19 | } 20 | 21 | @Override 22 | public void onGeneratePower() { 23 | 24 | } 25 | 26 | protected void setState(boolean on) { 27 | if(on) 28 | worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord) | 8, 2); 29 | else 30 | worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord) & (~8), 2); 31 | 32 | } 33 | 34 | protected void onOperationFinish() { 35 | setState(false); 36 | }; 37 | 38 | public int getLastAmtGenerated() { 39 | return lastRFAmount; 40 | } 41 | 42 | @Override 43 | public void updateEntity() { 44 | lastRFAmount = 0; 45 | if(canGeneratePower()) { 46 | if(hasEnoughEnergyBuffer(getPowerPerOperation())) { 47 | lastRFAmount = getPowerPerOperation(); 48 | if(!worldObj.isRemote) this.energy.acceptEnergy(lastRFAmount, false); 49 | onGeneratePower(); 50 | setState(true); 51 | if(timeRemaining < currentTime++) { 52 | currentTime = 0; 53 | timeRemaining = -1; 54 | onOperationFinish(); 55 | } 56 | } 57 | else 58 | notEnoughBufferForFunction(); 59 | } 60 | transmitPower(); 61 | } 62 | 63 | @Override 64 | public void notEnoughBufferForFunction() { 65 | setState(false); 66 | } 67 | 68 | @Override 69 | public void writeToNBT(NBTTagCompound nbt) { 70 | super.writeToNBT(nbt); 71 | nbt.setInteger("timeRemaining", timeRemaining); 72 | nbt.setInteger("currentTime", currentTime); 73 | } 74 | 75 | @Override 76 | public void readFromNBT(NBTTagCompound nbt) { 77 | super.readFromNBT(nbt); 78 | 79 | timeRemaining = nbt.getInteger("timeRemaining"); 80 | currentTime= nbt.getInteger("currentTime"); 81 | 82 | } 83 | 84 | @Override 85 | public float getNormallizedProgress(int id) { 86 | return (timeRemaining-currentTime)/(float)timeRemaining; 87 | } 88 | 89 | @Override 90 | public void setProgress(int id, int progress) { 91 | currentTime = progress; 92 | } 93 | 94 | @Override 95 | public int getProgress(int id) { 96 | return currentTime; 97 | } 98 | 99 | @Override 100 | public int getTotalProgress(int id) { 101 | return timeRemaining; 102 | } 103 | 104 | @Override 105 | public void setTotalProgress(int id, int progress) { 106 | timeRemaining = progress; 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileEntityRFConsumer.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import zmaster587.libVulpes.api.IUniversalEnergy; 4 | import zmaster587.libVulpes.util.UniversalBattery; 5 | import net.minecraft.nbt.NBTTagCompound; 6 | import net.minecraft.tileentity.TileEntity; 7 | import net.minecraftforge.common.util.ForgeDirection; 8 | import cofh.api.energy.IEnergyHandler; 9 | 10 | public abstract class TileEntityRFConsumer extends TileEntity implements IEnergyHandler, IUniversalEnergy { 11 | protected UniversalBattery energy; 12 | 13 | protected TileEntityRFConsumer(int energy) { 14 | this.energy = new UniversalBattery(energy); 15 | } 16 | 17 | @Override 18 | public boolean canConnectEnergy(ForgeDirection arg0) { 19 | return true; 20 | } 21 | 22 | @Override 23 | public void writeToNBT(NBTTagCompound nbt) { 24 | super.writeToNBT(nbt); 25 | energy.writeToNBT(nbt); 26 | } 27 | 28 | @Override 29 | public void readFromNBT(NBTTagCompound nbt) { 30 | super.readFromNBT(nbt); 31 | energy.readFromNBT(nbt); 32 | } 33 | 34 | @Override 35 | public int receiveEnergy(ForgeDirection from, int maxReceive, 36 | boolean simulate) { 37 | return acceptEnergy(maxReceive, simulate); 38 | } 39 | 40 | @Override 41 | public int extractEnergy(ForgeDirection from, int maxExtract, 42 | boolean simulate) { 43 | return extractEnergy(maxExtract, simulate); 44 | } 45 | 46 | public boolean hasEnoughEnergy(int amt) { 47 | return getEnergyStored() >= amt; 48 | } 49 | 50 | public int getPowerPerOperation() { 51 | return 0; 52 | } 53 | 54 | public abstract boolean canPerformFunction(); 55 | 56 | 57 | @Override 58 | public void updateEntity() { 59 | super.updateEntity(); 60 | 61 | if(canPerformFunction()) { 62 | 63 | if(hasEnoughEnergy(getPowerPerOperation())) { 64 | if(!worldObj.isRemote) this.energy.extractEnergy(getPowerPerOperation(), false); 65 | performFunction(); 66 | } 67 | else 68 | notEnoughEnergyForFunction(); 69 | } 70 | } 71 | 72 | public abstract void performFunction(); 73 | 74 | public void notEnoughEnergyForFunction() { 75 | 76 | } 77 | 78 | @Override 79 | public int getEnergyStored(ForgeDirection from) { 80 | return energy.getEnergyStored(); 81 | } 82 | 83 | @Override 84 | public int getMaxEnergyStored(ForgeDirection from) { 85 | return energy.getMaxEnergyStored(); 86 | } 87 | 88 | public boolean hasEnergy() { return energy.getEnergyStored() > 0; } 89 | 90 | public void setEnergyStored(int value) { 91 | energy.setEnergyStored(value); 92 | } 93 | 94 | @Override 95 | public int extractEnergy(int amt, boolean simulate) { 96 | return energy.extractEnergy(amt, false); 97 | } 98 | 99 | @Override 100 | public int getEnergyStored() { 101 | return energy.getEnergyStored(); 102 | } 103 | 104 | @Override 105 | public int getMaxEnergyStored() { 106 | return energy.getMaxEnergyStored(); 107 | } 108 | 109 | public void setMaxEnergyStored(int max) { 110 | energy.setEnergyStored(max); 111 | } 112 | 113 | @Override 114 | public int acceptEnergy(int amt, boolean simulate) { 115 | return energy.acceptEnergy(amt, simulate); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileInventoriedForgeProducer.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.inventory.ISidedInventory; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | import net.minecraft.util.EnumFacing; 8 | import net.minecraftforge.common.util.ForgeDirection; 9 | import zmaster587.libVulpes.util.EmbeddedInventory; 10 | 11 | public abstract class TileInventoriedForgeProducer extends TileEntityForgeProducer implements ISidedInventory { 12 | 13 | protected EmbeddedInventory inventory; 14 | 15 | protected TileInventoriedForgeProducer(int energy,int invSize) { 16 | super(energy); 17 | inventory = new EmbeddedInventory(invSize); 18 | } 19 | 20 | @Override 21 | public void writeToNBT(NBTTagCompound nbt) { 22 | super.writeToNBT(nbt); 23 | 24 | inventory.writeToNBT(nbt); 25 | } 26 | 27 | @Override 28 | public int[] getAccessibleSlotsFromSide(int p_94128_1_) { 29 | int i[] = new int[inventory.getSizeInventory()]; 30 | 31 | for(int j = 0; j < i.length; j++) { i[j] = j;} 32 | 33 | return i; 34 | } 35 | 36 | @Override 37 | public boolean isItemValidForSlot(int index, ItemStack stack) { 38 | return false; 39 | } 40 | 41 | @Override 42 | public void readFromNBT(NBTTagCompound nbt) { 43 | super.readFromNBT(nbt); 44 | 45 | inventory.readFromNBT(nbt); 46 | } 47 | 48 | 49 | public int getSizeInventory() { 50 | return inventory.getSizeInventory(); 51 | } 52 | 53 | @Override 54 | public ItemStack getStackInSlot(int slot) { 55 | return inventory.getStackInSlot(slot); 56 | } 57 | 58 | @Override 59 | public ItemStack decrStackSize(int slot, int amt) { 60 | return inventory.decrStackSize(slot, amt); 61 | } 62 | 63 | 64 | @Override 65 | public void setInventorySlotContents(int slot, ItemStack stack) { 66 | inventory.setInventorySlotContents(slot, stack); 67 | } 68 | 69 | 70 | @Override 71 | public boolean hasCustomInventoryName() { 72 | return false; 73 | } 74 | 75 | 76 | @Override 77 | public String getInventoryName() { 78 | return null; 79 | } 80 | 81 | @Override 82 | public int getInventoryStackLimit() { 83 | return 64; 84 | } 85 | 86 | @Override 87 | public boolean isUseableByPlayer(EntityPlayer player) { 88 | return player.getDistanceSq(xCoord, yCoord, zCoord) < 64; 89 | } 90 | @Override 91 | public void openInventory() { 92 | inventory.openInventory(); 93 | } 94 | 95 | @Override 96 | public void closeInventory() { 97 | inventory.closeInventory(); 98 | } 99 | 100 | @Override 101 | public boolean canInsertItem(int index, ItemStack itemStackIn, 102 | int direction) { 103 | return inventory.canInsertItem(index, itemStackIn, direction); 104 | } 105 | 106 | @Override 107 | public boolean canExtractItem(int index, ItemStack stack, 108 | int direction) { 109 | return inventory.canExtractItem(index, stack, direction); 110 | } 111 | 112 | @Override 113 | public boolean canInteractWithContainer(EntityPlayer entity) { 114 | return true; 115 | } 116 | 117 | @Override 118 | public ItemStack getStackInSlotOnClosing(int slot) { 119 | return inventory.getStackInSlotOnClosing(slot); 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/inventory/TextureResources.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.inventory; 2 | 3 | import zmaster587.libVulpes.client.util.ProgressBarImage; 4 | import net.minecraft.util.EnumFacing; 5 | import net.minecraft.util.ResourceLocation; 6 | import net.minecraftforge.common.util.ForgeDirection; 7 | 8 | public class TextureResources { 9 | 10 | public static final ResourceLocation starryBG = new ResourceLocation("libvulpes", "textures/gui/starryBg.png"); 11 | public static final ResourceLocation buttonNull[] = {new ResourceLocation("libvulpes","textures/gui/null.png" )}; 12 | public static final ResourceLocation buttonScan[] = {new ResourceLocation("libvulpes", "textures/gui/GuiScan.png"), new ResourceLocation("libvulpes", "textures/gui/GuiScan_hover.png"), new ResourceLocation("libvulpes", "textures/gui/GuiScan_pressed.png"), null}; 13 | public static final ResourceLocation buttonBuild[] = {new ResourceLocation("libvulpes", "textures/gui/GuiButtonRed.png"), new ResourceLocation("libvulpes", "textures/gui/GuiButtonRed_hover.png"), new ResourceLocation("libvulpes", "textures/gui/GuiButtonRed_pressed.png"), new ResourceLocation("libvulpes", "textures/gui/GuiButtonRed_disabled.png")}; 14 | public static final ResourceLocation buttonDown[] = {new ResourceLocation("libvulpes", "textures/gui/GuiArrowDown.png"), new ResourceLocation("libvulpes", "textures/gui/GuiArrowDown_hover.png"), new ResourceLocation("libvulpes", "textures/gui/GuiArrowDown_pressed.png"), null}; 15 | public static final ResourceLocation buttonLeft[] = {new ResourceLocation("libvulpes", "textures/gui/GuiArrowLeft.png"), new ResourceLocation("libvulpes", "textures/gui/GuiArrowLeft_hover.png"), new ResourceLocation("libvulpes", "textures/gui/GuiArrowLeft_pressed.png"), null}; 16 | public static final ResourceLocation buttonRight[] = {new ResourceLocation("libvulpes", "textures/gui/GuiArrowRight.png"), new ResourceLocation("libvulpes", "textures/gui/GuiArrowRight_hover.png"), new ResourceLocation("libvulpes", "textures/gui/GuiArrowRight_pressed.png"), null}; 17 | public static final ResourceLocation buttonToggleImage[] = new ResourceLocation[] {new ResourceLocation("libvulpes:textures/gui/buttons/switchOn.png"), new ResourceLocation("libvulpes:textures/gui/buttons/switchOff.png")}; 18 | public static final ResourceLocation buttonRedstoneActive[] = new ResourceLocation[] {new ResourceLocation("libvulpes:textures/gui/buttons/buttonRedstoneAllowed.png"), new ResourceLocation("libvulpes:textures/gui/buttons/buttonRedstoneAllowed_hover.png")}; 19 | public static final ResourceLocation buttonRedstoneInverted[] = new ResourceLocation[] {new ResourceLocation("libvulpes:textures/gui/buttons/buttonRedstoneInverted.png"), new ResourceLocation("libvulpes:textures/gui/buttons/buttonRedstoneInverted_hover.png")}; 20 | public static final ResourceLocation buttonRedstoneDisabled[] = new ResourceLocation[] {new ResourceLocation("libvulpes:textures/gui/buttons/buttonRedstoneNotAllowed.png"), new ResourceLocation("libvulpes:textures/gui/buttons/buttonRedstoneNotAllowed_hover.png")}; 21 | 22 | public static final ResourceLocation coalGeneratorBarImg = new ResourceLocation("libvulpes", "textures/gui/coalGenerator.png"); 23 | 24 | public static final ProgressBarImage progressGenerator = new ProgressBarImage(16, 0, 16, 16, 0, 0, 16, 16, ForgeDirection.UP, coalGeneratorBarImg); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/tile/TileSchematic.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.tile; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.commons.lang3.ArrayUtils; 7 | 8 | import net.minecraft.block.Block; 9 | import net.minecraft.init.Blocks; 10 | import net.minecraft.nbt.NBTTagCompound; 11 | import zmaster587.libVulpes.block.BlockMeta; 12 | import zmaster587.libVulpes.tile.multiblock.TilePlaceholder; 13 | 14 | public class TileSchematic extends TilePlaceholder { 15 | 16 | private final int ttl = 6000; 17 | private int timeAlive = 0; 18 | List possibleBlocks; 19 | 20 | public TileSchematic() { 21 | possibleBlocks = new ArrayList(); 22 | } 23 | 24 | @Override 25 | public boolean canUpdate() { 26 | return true; 27 | } 28 | 29 | public void setReplacedBlock(List block) { 30 | possibleBlocks = block; 31 | } 32 | 33 | @Override 34 | public void setReplacedBlock(Block block) { 35 | super.setReplacedBlock(block); 36 | possibleBlocks.clear(); 37 | } 38 | 39 | @Override 40 | public void setReplacedBlockMeta(byte meta) { 41 | super.setReplacedBlockMeta(meta); 42 | possibleBlocks.clear(); 43 | } 44 | 45 | @Override 46 | public Block getReplacedBlock() { 47 | if(possibleBlocks.isEmpty()) 48 | return super.getReplacedBlock(); 49 | else { 50 | return possibleBlocks.get((timeAlive/20) % possibleBlocks.size()).getBlock(); 51 | } 52 | } 53 | 54 | @Override 55 | public byte getReplacedBlockMeta() { 56 | if(possibleBlocks.isEmpty()) 57 | return super.getReplacedBlockMeta(); 58 | else 59 | return possibleBlocks.get((timeAlive/20) % possibleBlocks.size()).getMeta(); 60 | } 61 | 62 | @Override 63 | public void updateEntity() { 64 | super.updateEntity(); 65 | 66 | if(!worldObj.isRemote) { 67 | if(timeAlive == ttl) { 68 | worldObj.setBlockToAir(xCoord, yCoord, zCoord); 69 | } 70 | } 71 | timeAlive++; 72 | } 73 | 74 | @Override 75 | public void writeToNBT(NBTTagCompound nbt) { 76 | super.writeToNBT(nbt); 77 | nbt.setInteger("timeAlive", timeAlive); 78 | 79 | List blockIds = new ArrayList(); 80 | List blockMetas = new ArrayList(); 81 | for(int i = 0; i < possibleBlocks.size();i++) { 82 | blockIds.add(Block.getIdFromBlock(possibleBlocks.get(i).getBlock())); 83 | blockMetas.add((int)possibleBlocks.get(i).getMeta()); 84 | } 85 | 86 | if(!blockIds.isEmpty()) { 87 | Integer[] bufferSpace1 = new Integer[blockIds.size()]; 88 | Integer[] bufferSpace2 = new Integer[blockIds.size()]; 89 | nbt.setIntArray("blockIds", ArrayUtils.toPrimitive(blockIds.toArray(bufferSpace1))); 90 | nbt.setIntArray("blockMetas", ArrayUtils.toPrimitive(blockMetas.toArray(bufferSpace2))); 91 | } 92 | } 93 | 94 | @Override 95 | public void readFromNBT(NBTTagCompound nbt) { 96 | super.readFromNBT(nbt); 97 | timeAlive = nbt.getInteger("timeAlive"); 98 | 99 | if(nbt.hasKey("blockIds")) { 100 | int[] block = nbt.getIntArray("blockIds"); 101 | int[] metas = nbt.getIntArray("blockMetas"); 102 | possibleBlocks.clear(); 103 | 104 | for(int i = 0; i < block.length; i++) { 105 | if(Block.getBlockById(block[i]) != Blocks.air) 106 | possibleBlocks.add(new BlockMeta(Block.getBlockById(block[i]), metas[i])); 107 | } 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/util/InputSyncHandler.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.util; 2 | 3 | import java.util.HashMap; 4 | 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.inventory.IInventory; 7 | import net.minecraft.item.ItemStack; 8 | 9 | import org.lwjgl.input.Keyboard; 10 | 11 | import zmaster587.libVulpes.api.IJetPack; 12 | import zmaster587.libVulpes.api.IModularArmor; 13 | import zmaster587.libVulpes.network.PacketChangeKeyState; 14 | import zmaster587.libVulpes.network.PacketHandler; 15 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 16 | import cpw.mods.fml.common.gameevent.InputEvent; 17 | import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; 18 | import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent; 19 | 20 | public class InputSyncHandler { 21 | 22 | public static HashMap spaceDown = new HashMap(); 23 | 24 | 25 | public static boolean isSpaceDown(EntityPlayer player) { 26 | Boolean bool = spaceDown.get(player); 27 | 28 | return bool != null && bool; 29 | } 30 | 31 | //Called on server 32 | public static void updateKeyPress(EntityPlayer player, int key, boolean state) { 33 | ItemStack stack; 34 | switch(key) { 35 | case 0: 36 | stack = player.getEquipmentInSlot(3); 37 | if(stack != null) { 38 | IJetPack pack; 39 | if(stack.getItem() instanceof IJetPack) { 40 | pack = ((IJetPack)stack.getItem()); 41 | pack.setEnabledState(stack, !pack.isEnabled(stack)); 42 | } 43 | else if(stack.getItem() instanceof IModularArmor) { 44 | IInventory inv = ((IModularArmor)stack.getItem()).loadModuleInventory(stack); 45 | 46 | for(int i = 0; i < inv.getSizeInventory(); i++) { 47 | if(inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof IJetPack) { 48 | pack = ((IJetPack)inv.getStackInSlot(i).getItem()); 49 | pack.setEnabledState(inv.getStackInSlot(i), !pack.isEnabled(inv.getStackInSlot(i))); 50 | } 51 | } 52 | ((IModularArmor)stack.getItem()).saveModuleInventory(stack, inv); 53 | 54 | } 55 | } 56 | break; 57 | 58 | case 1: 59 | stack = player.getEquipmentInSlot(3); 60 | if(stack != null) { 61 | IJetPack pack; 62 | if(stack.getItem() instanceof IJetPack) { 63 | pack = ((IJetPack)stack.getItem()); 64 | pack.setEnabledState(stack, !pack.isEnabled(stack)); 65 | } 66 | else if(stack.getItem() instanceof IModularArmor) { 67 | IInventory inv = ((IModularArmor)stack.getItem()).loadModuleInventory(stack); 68 | 69 | for(int i = 0; i < inv.getSizeInventory(); i++) { 70 | if(inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof IJetPack) { 71 | pack = ((IJetPack)inv.getStackInSlot(i).getItem()); 72 | pack.changeMode(inv.getStackInSlot(i), inv, player); 73 | } 74 | } 75 | ((IModularArmor)stack.getItem()).saveModuleInventory(stack, inv); 76 | 77 | } 78 | } 79 | break; 80 | case 57: //SPACE 81 | spaceDown.put(player, state); 82 | break; 83 | 84 | default: 85 | 86 | } 87 | } 88 | 89 | @SubscribeEvent 90 | public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { 91 | spaceDown.remove(evt.player); 92 | } 93 | 94 | @SubscribeEvent 95 | public void onDimChanged(PlayerChangedDimensionEvent evt) { 96 | spaceDown.remove(evt.player); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/network/PacketMachine.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.network; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import zmaster587.libVulpes.util.INetworkMachine; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.entity.player.EntityPlayerMP; 8 | import net.minecraft.nbt.NBTTagCompound; 9 | import net.minecraft.tileentity.TileEntity; 10 | import net.minecraft.world.World; 11 | import net.minecraft.world.chunk.Chunk; 12 | import net.minecraftforge.common.DimensionManager; 13 | import cpw.mods.fml.relauncher.Side; 14 | import cpw.mods.fml.relauncher.SideOnly; 15 | 16 | public class PacketMachine extends BasePacket { 17 | 18 | INetworkMachine machine; 19 | 20 | NBTTagCompound nbt; 21 | 22 | byte packetId; 23 | 24 | public PacketMachine() { 25 | nbt = new NBTTagCompound(); 26 | }; 27 | 28 | public PacketMachine(INetworkMachine machine, byte packetId) { 29 | this(); 30 | this.machine = machine; 31 | this.packetId = packetId; 32 | } 33 | 34 | 35 | @Override 36 | public void write(ByteBuf outline) { 37 | outline.writeInt(((TileEntity)machine).getWorldObj().provider.dimensionId); 38 | outline.writeInt(((TileEntity)machine).xCoord); 39 | outline.writeInt(((TileEntity)machine).yCoord); 40 | outline.writeInt(((TileEntity)machine).zCoord); 41 | 42 | outline.writeByte(packetId); 43 | 44 | machine.writeDataToNetwork(outline, packetId); 45 | //ByteBuf buffer 46 | //outline.writeBytes(out.toByteArray()); 47 | //outline. 48 | //outline. = (ByteBuf)out.toByteArray(); 49 | } 50 | 51 | @Override 52 | @SideOnly(Side.CLIENT) 53 | public void readClient(ByteBuf in) { 54 | //DEBUG: 55 | in.readInt(); 56 | World world = Minecraft.getMinecraft().theWorld; 57 | int x = in.readInt(); 58 | int y = in.readInt(); 59 | int z = in.readInt(); 60 | packetId = in.readByte(); 61 | 62 | TileEntity ent = world.getTileEntity(x, y, z); 63 | 64 | if(ent != null && ent instanceof INetworkMachine) { 65 | machine = (INetworkMachine)ent; 66 | machine.readDataFromNetwork(in, packetId, nbt); 67 | } 68 | else { 69 | //Error 70 | } 71 | } 72 | 73 | @Override 74 | public void read(ByteBuf in) { 75 | //DEBUG: 76 | int temp = in.readInt(); 77 | World world = DimensionManager.getWorld(temp); 78 | 79 | int x = in.readInt(); 80 | int y = in.readInt(); 81 | int z = in.readInt(); 82 | packetId = in.readByte(); 83 | 84 | Chunk chunk = world.getChunkFromBlockCoords(x, z); 85 | 86 | if(chunk != null && chunk.isChunkLoaded) { 87 | TileEntity ent = world.getTileEntity(x, y, z); 88 | 89 | if(ent != null && ent instanceof INetworkMachine) { 90 | machine = (INetworkMachine)ent; 91 | machine.readDataFromNetwork(in, packetId, nbt); 92 | } 93 | else { 94 | //Error 95 | } 96 | } 97 | } 98 | 99 | public void executeClient(EntityPlayer player) { 100 | //Machine can be null if not all chunks are loaded 101 | if(machine != null) 102 | machine.useNetworkData(player, Side.CLIENT, packetId, nbt); 103 | } 104 | 105 | public void executeServer(EntityPlayerMP player) { 106 | if(machine != null) 107 | machine.useNetworkData(player, Side.SERVER, packetId, nbt); 108 | } 109 | 110 | public void execute(EntityPlayer player, Side side) { 111 | if(machine != null) 112 | machine.useNetworkData(player, side, packetId, nbt); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/zmaster587/libVulpes/block/BlockPhantom.java: -------------------------------------------------------------------------------- 1 | package zmaster587.libVulpes.block; 2 | 3 | import java.util.ArrayList; 4 | 5 | import zmaster587.libVulpes.tile.TileSchematic; 6 | import zmaster587.libVulpes.tile.multiblock.TilePlaceholder; 7 | import net.minecraft.block.Block; 8 | import net.minecraft.block.material.Material; 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.tileentity.TileEntity; 12 | import net.minecraft.util.AxisAlignedBB; 13 | import net.minecraft.util.IIcon; 14 | import net.minecraft.util.MovingObjectPosition; 15 | import net.minecraft.world.IBlockAccess; 16 | import net.minecraft.world.World; 17 | 18 | public class BlockPhantom extends Block { 19 | 20 | public BlockPhantom(Material mat) { 21 | super(mat); 22 | } 23 | 24 | @Override 25 | public boolean hasTileEntity(int metadata) { 26 | return true; 27 | } 28 | 29 | @Override 30 | protected boolean canSilkHarvest() { 31 | return false; 32 | } 33 | 34 | @Override 35 | public ArrayList getDrops(World world, int x, int y, int z, 36 | int metadata, int fortune) { 37 | return new ArrayList(); 38 | } 39 | 40 | 41 | @Override 42 | public TileEntity createTileEntity(World world, int metadata) { 43 | return new TileSchematic(); 44 | } 45 | 46 | @Override 47 | public IIcon getIcon(IBlockAccess access, int x, 48 | int y, int z, int side) { 49 | 50 | TileEntity tile = access.getTileEntity(x, y, z); 51 | 52 | if(tile instanceof TilePlaceholder) { 53 | TilePlaceholder placeHolder = (TilePlaceholder)tile; 54 | 55 | if(placeHolder.getReplacedBlock() != null) 56 | return placeHolder.getReplacedBlock().getIcon(side, placeHolder.getReplacedBlockMeta()); 57 | } 58 | 59 | return super.getIcon(access, x, y, z, 60 | side); 61 | } 62 | 63 | 64 | @Override 65 | public ItemStack getPickBlock(MovingObjectPosition target, World world, 66 | int x, int y, int z, EntityPlayer player) { 67 | TileEntity tile = world.getTileEntity(x, y, z); 68 | 69 | if(tile != null && tile instanceof TilePlaceholder && ((TilePlaceholder)tile).getReplacedBlock() != null) { 70 | Block block = ((TilePlaceholder)tile).getReplacedBlock(); 71 | ItemStack stack = ((TilePlaceholder)tile).getReplacedBlock().getPickBlock(target, world, x, y, z, player); 72 | if(stack != null) { 73 | stack.setItemDamage(block.damageDropped(((TilePlaceholder)tile).getReplacedBlockMeta())); 74 | return stack; 75 | } 76 | } 77 | return super.getPickBlock(target, world, x, y, z, player); 78 | } 79 | 80 | @Override 81 | public int getDamageValue(World world, int x, 82 | int y, int z) { 83 | 84 | TileEntity tile = world.getTileEntity(x, y, z); 85 | if(tile instanceof TilePlaceholder) 86 | return ((TilePlaceholder)tile).getReplacedBlockMeta(); 87 | return super.getDamageValue(world, x, y, z); 88 | } 89 | 90 | @Override 91 | public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, 92 | int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { 93 | return false; 94 | } 95 | 96 | @Override 97 | public boolean isOpaqueCube() { 98 | return false; 99 | } 100 | 101 | @Override 102 | public boolean isReplaceable(IBlockAccess world, int x, int y, int z) { 103 | return true; 104 | } 105 | 106 | @Override 107 | public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, 108 | int p_149668_2_, int p_149668_3_, int p_149668_4_) { 109 | return null; 110 | } 111 | } 112 | --------------------------------------------------------------------------------